diff --git a/.gitignore b/.gitignore index 5489f4321..4bcbe901a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ obj/ *.user *.cache *.trx -Scripts/ packages/ +Tests/*/Scripts TestResults/ diff --git a/History.txt b/History.txt deleted file mode 100644 index d93d10faa..000000000 --- a/History.txt +++ /dev/null @@ -1,209 +0,0 @@ -Changelog -=============================================================================== - -v0.7.6 - - Removed script loading APIs from Script class in mscorlib - (moved them to Loader class in Script.Web) - - Removed script startup functionality from mscorlib.js ... all script - loading is now in ssloader.js (and included into the Runtime nuget - package) - - Removed Script.Alert/Confirm/Prompt from mscorlib and moved them to - Window in Script.Web - - Moved SetTimeout, SetInterval and ClearTimeout, ClearInterval from - Window object to Script object in mscorlib. - - Removed some methods from Type as part of cleanup (AddHandler, - GetProperty, RemoveHandler, SetProperty, IsEnum, IsFlags, IsNamespace, - GetInterfaces, Parse) - - Removed window dependency in mscorlib.js - - Debug class now maps directly to console - - Moved GetField, HasField, DeleteField, HasMethod, InvokeMethod, - CreateInstance, GetScriptType off Type and onto Script while - HasProperty, GetProperty, SetProperty, AddHandler, RemoveHandler are gone - - Optimize generation of static ctors to use a function scope only when - static ctors have a local variable reference. - Should help optimize generation of jQuery scripts, by reducing one extra - function scope. - - Removed Aggregate method from Array, ArrayList and List. Use Reduce instead. - Removed the corresponding custom implementation from mscorlib.js. - - [git #131] Correctly detect member references within array initializers - - [git #161] Add Slice, Splice, Shift, Unshift, Reduce, ReduceRight to - Array, ArrayList and List. - - [git #228] Restore ability to generate public resource classes - (Change Custom Tool property of resx file to - ResxPublicScriptGenerator) - - [git #230] Add String.IsNullOrWhitespace - - [git #234] Knockout API update - added CompareResult status enum - -v0.7.5.0 - - DOM metadata update (readyState property on Document, - plugins on Navigator) - - jQuery API update (on/off methods) - - Knockout API updates for missing APIs - - Addition of support for jQuery validation plugin - - jQueryUI added! - - [git #130] ReadyState property on Document - - [git #132] DOM metadata for plugins - - [git #139] jQuery on/off APIs - - [git #141] Bing maps metadata missing APIs - - [git #145] Knockout additions - - [git #152] Knockout additions - - [git #155] ReadyState property on Document - - [git #156] Changed projects (incl. templates) to target .net framework v2.0 - - [git #166] Fix generic Deffered API on jQuery - - [git #169] Missing jQuery API overload added - - [git #170] Fix bing maps metadata bug - - [git #173] Fix StringBuilder and appending empty string/isEmpty interaction - - [git #178] Issues with string extensions - - [git #180] Added workaround: Better error message for namespace-qualified name gotcha - - [git #183] Various DOM metadata additions (eg. ClassList) - - [git #187] Support for writing 'new Image()' - - [git #189] Fixed jQuery.when metadata - - [git #201] Strongly typed some Knockout API (KnockoutMapping) - - Nuget packages for compiler, and individual import libraries - - VSIX-based approach for getting script# and associated templates - - Breaking changes: - - In a csproj, the TemplateFile property has been changed to ScriptTemplate - - When creating a project there is no prompt to setup a DeploymentPath - ... but for now, msbuild support continues to exist (via manual edit) - ... will potentially be replaced eventually. - - No more support for WebAppParitioning. If you were compiling multiple script - files out of a single c# project, this feature is gone. You can switch your - msbuild scripts to use the ScriptCompilerExecTask, instead of ScriptCompilerTask - and invoke the compiler multiple times for each script file, passing in exactly - the right set of sources for each script file to be generated. - - Removed Script.Windows.dll and gadget project - -v0.7.4.0 - - Fix/update bing maps metadata bug - - Fix observable bug where access to an observed property without an observer - registration would drop existing observers. - - Remove /copyRefs flag from ssc.exe (script references are no longer copied to output folder) - Same applies to ScriptCompilerExec task. The normal ScriptCompilerTask continues to provide - this capability. - - Added Sharpen.dom.js - a minimal set of helper APIs on top of HTML5 DOM APIs. - - Some enum related changes: - ToString/Enum parsing support removed (it didn't work for internal enums anyway) - ToString on named enums (and on strings) skipped as it is redundant - Inline enum values in generated script - Skip generating internal enum types - - [git #25] Importing multi-dimensional arrays - - [git #56] Switch statement when used with more then 6 cases will generate a compile error - - [git #62] Compile error due to assembly name sort order (with generic types being - imported, assembly load order starts to matter) - - [git #66] Support Nullable.GetValueOrDefault which is needed for ?? operator on - nullables. - - [git #67] BREAKING CHANGE: DateTime -> Date. Date is also no longer a value type. - (partially fixes #67, and also makes Date more representative of script semantics - which are not that of a value type) - - [git #84] Raise error for code which calls Type.CreateInstance with the results of a method - call/property access directly. - - [git #92] Don't generate internal consts since their values have been inlined - even in debug builds (for symmetry with release builds) - Also, at the same type skip generating types for internal enums marked - as Named/NumericValues, since their values have been inlined as well. - Also fixes [git #42] indirectly. - - [git #93] Error compiling cross-referenced projects in 0.7.3 - Fix by requiring explicit references, and reporting failure on not doing so - instead of silent failure (this is temporary ... there must be a better - msbuild way of including transitive closure of assemblies, but even - referencing indirect references in the targets file raises an error to - include explicit references). - - [git #94] Raise error for code which calls Type.CreateInstance with the results of a method - call/property access directly. - - [git #96] Handle '+' unary operator - - [git #97] Unable to generate code for projects that don't reference Script.Web.dll. - - [git #103] Fix generation of custom delegates to use "Function" as generated script name - - [git #107] ScriptAlias is not respected on types defined in the current assembly - - [git #114] Window.ApplicationCache.Status.ToString() generates invalid JavaScript - -v0.7.3.0 [8/14/2011] - - [git #71] Fix formatting of GMT dates - - [git #70] Support for const decimal - - [git #69] Fix LocaleFormat typo - - [git #76] Compiler crash in 0.7.2 defining decimal type with non-integer value - - [git #75] Defining a local variable 'ss' hides the Script# ss global - - [git #60] List constructor with params for creating literal array - - [git #74] Fix date formatting to make it more in sync with .net - - [git #63] Fix internal partial class generation - - [git #65] Calling ToString() on a constant breaks minified script - - [git #73] Creating Record objects from another library - - [git #80] The decimal type is missing the Parse method - - [git #84] if( is ) not compiled properly when is a delegate. - - Enable creating derived jQueryEvent objects - - Knockout API updates (ability to create binding handlers for example) - - Propagate ScriptNamespace to generic instance class - - DOM API metadata updates - - Separate out msbuild tasks into ScriptSharp.Build.dll and Visual Studio generators - into ScriptSharp.VisualStudio.dll - -v0.7.2.0 [5/22/2011] - - Revert null equality check to non-falsey check - - Switch String.empty references to in generated script to string literal - - Fix delegate optimization bug involving Type.InvokeMember with first parameter being null - - Remove hack in metadata importer to try import generic types first - (instead design imported apis carefully so type don't have instance of generic type - as return type of a member) - - To fix above bug: - - jQueryXmlHttpRequest replaced with jQueryDataHttpRequest - and jQueryXmlHttpRequest is now non-generic - - Added non-generic versions of various jQuery ajax callbacks - - Improve jQuery deferred APIs - - jQuery 1.6.1 APIs and other missing APIs added - - [git #36] Misc jQuery apis added - - [git #50] Fix GeoLocation API: WatchCurrentPosition -> WatchPosition - - Added AudioElement - - Added Tuple, Callback, various component model interfaces - - FxCop rules for CSS Selector validation, Script.Literal usage and public fields - - [git #45] Apply [PreserveName] semantics in debug builds as well - - [git #52] DocumentFragment related API updates - - [git #54] DateTime metadata update - -v0.7.1.0 [5/2/2011] - - [git #19] Add CssFloat to Style - - [git #22] Fix issue with importing generic delegates - generic types were getting - created before their members were being imported. - - [git #20] If/While/For statements can have an no body statement when compiling in release - mode, and the only statement in source code is a debug-conditional statement. - - [git #27] Optimize generated script for checking equality against null, 0, true/false, empty - string by generating a check that works against false-y values - - [git #28] Fix jQueryAjaxOptions metadata - - [git #29] Add Select() to InputElement - - Added Observable and mscorlib infrastructure for observables, and change notification - - Added ObservableCollection and ObservableCollection along with mscorlib implementation - - Added Script.IsValue (equivalent of !Script.IsNullOrUndefined) - - Added Nullable and T? syntax support; .HasValue -> Script.IsValue, .Value is a no-op at runtime - - Added ElementQuery, ElementListQuery, and ElementReference helper classes for emitting script - expressions when using AddScriptlet - -v0.7.0.2 - - [git #7] Add missing jQueryObject.Html overload - - Add Document.ElementFromPoint - - DOM events API added - - [git #3] Fixed anonymous delegation creation by detecting use of 'this' context for - variable declaration - - [git #9] String literal optimization - - [git #11] Added SCRIPTSHARP to the defines list in the project template - - Remove Script.Windows.js and move the functionality into gadget project template. - - Add ss.init/ss.ready to mscorlib.js as well, in case page is not using ssloader.js. - -v0.7.0.1 - - [git #4] Fixed typo in mscorlib.js - - Fix typo in web.config in nuget package - - Fix bug with jQuery.InArray signature - -v0.7.0.0 [4/13/2011] - - Added basic generic support - ability to consume some generic types such as List, Dictionary, - Action, Func etc. - - Fix bug with NamedValues enum not working with [ScriptName] - - New script loader - - New asp.net mvc integration - - Updates to project templates to match new script loader - - Various metadata updates - eg. Canvas, Image, Document etc. - - Replace ContextualCallback with Action - - Replace CancelEventHandler with EventHandler - - Replace Delegate.Null -> Delegate.Empty - - ScriptCompilerTask msbuild task removes "DEBUG" define for release build even when building - in Debug mode from an msbuild perspective. - - Some namespace changes (eg. System.Globalization) - - Nuget package - - Replace XmlDocumentParser class with parseXml method diff --git a/Readme.md b/Readme.md index 3140c065d..72f0fcfd5 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # Script# Project # -Script# is a development tool that generates JavaScript by compiling C# source code. It is especially interesting for scripting-in-the-large scenarios that is commonplace in the current generation of HTML5 and script-based Web applications. +Script# is a development tool that generates JavaScript by compiling C# source code. It is especially interesting for scripting-in-the-large scenarios that is commonplace in the current generation of HTML5, node.js and script-based Web applications. The driving principle behind Script# is that JavaScript is the "assembly language of the Web" ... the idea isn't to dislike JavaScript, but rather appreciate it for its flexibility and ubiquity, while bringing the productivity and familiarity of C# when building large scale (large codebase, large team or project over a longer period) application where stronger tools, more maintainable codebases are of utmost importance. You might have heard of this described as "application scale". @@ -23,8 +23,9 @@ The [Script# Wiki](https://github.com/nikhilk/scriptsharp/wiki/Wiki) contains th * [Repository Contents](https://github.com/nikhilk/scriptsharp/wiki/Repository) * [Status](https://github.com/nikhilk/scriptsharp/wiki/Status), including roadmap and some thoughts about areas of contribution -* [Building and testing](https://github.com/nikhilk/scriptsharp/wiki/Building-and-Testing) the sources, and information on using private as well as incremental pre-release builds +* [Building, installing and testing](https://github.com/nikhilk/scriptsharp/wiki/Building,-Installing-and-Testing) the sources, and information on using private as well as incremental pre-release builds * [Coding guidelines](https://github.com/nikhilk/scriptsharp/wiki/Coding-Guidelines) +* [Release notes](https://github.com/nikhilk/scriptsharp/wiki/Release-Notes) for a changelog and any version to version migration details. ### Credits ### diff --git a/fx/Sharpen/Core/Application.Behaviors.cs b/fx/Sharpen/Core/Application.Behaviors.cs new file mode 100644 index 000000000..1e5445a6c --- /dev/null +++ b/fx/Sharpen/Core/Application.Behaviors.cs @@ -0,0 +1,98 @@ +// Application.Behaviors.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; +using System.Runtime.CompilerServices; + +namespace Sharpen { + + public sealed partial class Application { + + /// + /// Creates and attaches behaviors specified on the element declaratively. + /// + /// The element whose behaviors should be created and attached. + private void AttachBehaviors(Element element) { + string[] behaviorNames = ((string)element.GetAttribute(Application.BehaviorsAttribute)).Split(","); + int behaviorCount = behaviorNames.Length; + + for (int i = 0; i < behaviorCount; i++) { + string name = behaviorNames[i].Trim(); + + BehaviorRegistration registration = _registeredBehaviors[name]; + Debug.Assert(registration != null, "Unknown behavior '" + name + "'"); + + if (registration != null) { + Dictionary options = OptionsParser.GetOptions(element, name); + + // Use the Application's IoC capabilities to create behaviors. + // This allows satisfying dependencies behaviors have to other services, + // and also allows behaviors to provide or register services into the container. + + Behavior behavior = (Behavior)GetObject(registration.BehaviorType); + behavior.Initialize(element, options); + + if (registration.ServiceType != null) { + // Special-case the common case where a behavior represents a single + // service type, and auto-register it. + // In the case where a behavior is registering multiple service types + // (not so common), it can do so manually in its Initialize method. + + RegisterObject(registration.ServiceType, behavior); + } + } + } + } + + /// + /// Detaches all behaviors associated with the specified element. + /// + /// The element whose behaviors are to be detached. + private void DetachBehaviors(Element element) { + // Detach all behaviors by enumerating the key/value pair list of + // behaviors being maintained on the element, and disposing them + // individually. + + Dictionary behaviors = Script.GetField>(element, Application.BehaviorsKey); + if (behaviors != null) { + IEnumerable names = behaviors.Keys; + foreach (string name in names) { + Behavior behavior = behaviors[name]; + behavior.Dispose(); + } + } + } + + /// + /// Registers a behavior so it can be used declaratively in markup. + /// + /// The unique name of the behavior. + /// The type of the behavior. + public extern void RegisterBehavior(string name, Type behaviorType); + + /// + /// Registers a behavior so it can be used declaratively in markup. + /// + /// The unique name of the behavior. + /// The type of the behavior. + /// An option service type associated with the behavior for auto-registration with the application container. + public void RegisterBehavior(string name, Type behaviorType, Type serviceType) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(behaviorType != null); + Debug.Assert(typeof(Behavior).IsAssignableFrom(behaviorType)); + Debug.Assert(_registeredBehaviors.ContainsKey(name) == false, "A behavior with name '" + name + "' was already registered."); + + BehaviorRegistration registration = new BehaviorRegistration(); + registration.BehaviorType = behaviorType; + registration.ServiceType = serviceType; + + _registeredBehaviors[name] = registration; + Script.SetField(behaviorType, Application.BehaviorNameKey, name); + } + } +} diff --git a/fx/Sharpen/Core/Application.Bindings.cs b/fx/Sharpen/Core/Application.Bindings.cs new file mode 100644 index 000000000..a5719b4dc --- /dev/null +++ b/fx/Sharpen/Core/Application.Bindings.cs @@ -0,0 +1,206 @@ +// Application.Bindings.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; +using Sharpen.Bindings; + +namespace Sharpen { + + public sealed partial class Application { + + private static Binder BindContent(Element element, string property, Expression expression) { + property = (property == "text") ? "textContent" : "innerHTML"; + return new ContentBinder(element, property, expression); + } + + private static Binder BindValue(Element element, string property, Expression expression) { + Debug.Assert((element.TagName.ToLowerCase() == "input") || + (element.TagName.ToLowerCase() == "textarea") || + (element.TagName.ToLowerCase() == "select"), + "Value can only be bound on user input elements."); + + return new ValueBinder((InputElement)element, expression); + } + + private static Binder BindVisibility(Element element, string property, Expression expression) { + return new VisibilityBinder(element, property, expression); + } + + private static Expression ProcessModelExpression(object model, string expressionType, string value) { + Debug.Assert(Script.GetField(model, value) != null, "The model does not have a member named '" + value + '"'); + + if (expressionType == "exec") { + // TODO: Support scenarios where value is parent.method, or root.method (for invoking + // a method on the parent model or root model... useful in templating scenarios + // where items are not bound to view model but an object retrieved from the + // view model. + + // When the expression is exec, the value is interpreted as a reference to a method + // on the model. An invoker function is created that when called invokes the referenced + // method in context of the model instance. The expression itself contains a delegate + // to this dynamically created invoker function. + + // function _(e) { + // var result = this.modelMethod(e, this); + // if (result) { e.preventDefault(); } + // } + + // TODO: If bound to parent/root, generated this instead: + // function _(e) { + // var model = Application.Current.GetModel(element.parentElement); + // var result = this.modelMethod(e, model); + // if (result) { e.preventDefault(); } + // } + + string invokerCode = "var result = this." + value + "(e, this); if (result) { e.preventDefault(); }"; + return new Expression(Delegate.Create(new Function(invokerCode, "e", "model"), model), /* canChange */ false); + } + + // TODO: Eventually stop with the () business if we can switch over to true properties + // with getter/setter accessors in javascript. + + // Check if the value is something like A.B.C, where A, B and C are identifiers. + bool propertyPathExpression = PropertyPathRegex.Test(value); + + // The value represents a string that contains a script expression for properties off + // the model. + string getterCode; + if (propertyPathExpression) { + // If its a simple property path, then we parenthesize since in script, the + // properties are represented as functions. + value = value.Replace(".", "()."); + getterCode = "return model." + value + "();"; + } + else { + // If its not a simple property path, we're going to assume that the developer + // has referenced the property functions themselves, and we use as-is. + getterCode = "with(model) { return " + value + "; }"; + } + + Func getter = (Func)(object)new Function(getterCode, "model"); + + if (expressionType == "init") { + // Read-only, one-time binder... so execute the getter, and create + // an expression with the current value. + return new Expression(getter(model), /* canChange */ false); + } + else if (expressionType == "link") { + // Read-only, bound binder... create a BindExpression that tracks the + // value by observing any observables representing the property. + return new BindExpression(model, getter, null); + } + else { + // Read-write, bound binder ... must be a simple property path. + + if (propertyPathExpression == false) { + Debug.Fail("A bind expression's value must be a property path. The expression '" + value + "' is invalid."); + } + + string setterCode = "model." + value + "(value);"; + Action setter = (Action)(object)new Function(setterCode, "model", "value"); + + return new BindExpression(model, getter, setter); + } + } + + /// + /// Registers a binder factory. The supplied name prefixed with "data-" is used + /// as the attribute name in markup to create a binder. + /// + /// The name of the expression handler. + /// The factory being registered. + public void RegisterBinder(string name, BinderFactory factory) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(factory != null); + Debug.Assert(_registeredBinders.ContainsKey(name) == false, "A binder with name '" + name + "' was already registered."); + + _registeredBinders[name] = factory; + } + + /// + /// Registers an expression factory. The supplied name is used in markup to represent + /// an instance of the associated expression. + /// + /// The name of expression. + /// The factory to be used to handle the supplied name. + public void RegisterExpression(string name, ExpressionFactory factory) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(factory != null); + Debug.Assert(_registeredExpressions.ContainsKey(name) == false, "An expression factory with name '" + name + "' was already registered."); + + _registeredExpressions[name] = factory; + } + + private void SetupBindings(Element element, object model) { + Debug.Assert(element != null); + + string bindings = (string)element.GetAttribute(Application.BindingsAttribute); + bindings.ReplaceRegex(Application.BindingsRegex, delegate(string match /*, string binderType, string expressionType, string expressionValue */) { + string binderType = (string)Arguments.GetArgument(1); + string expressionType = (string)Arguments.GetArgument(2); + string expressionValue = (string)Arguments.GetArgument(3); + + ExpressionFactory expressionFactory = _registeredExpressions[expressionType]; + Debug.Assert(expressionFactory != null, "Unknown expression of type '" + expressionType + "' found."); + + if (expressionFactory != null) { + Expression expression = expressionFactory(model, expressionType, expressionValue); + Binder binder = null; + + // TODO: Add support for binding attributes - @xxx + + if (binderType.StartsWith("on.")) { + Debug.Assert(expression.CanChange == false, "Events cannot be bound to dynamic expressions."); + Debug.Assert(expression.GetValue() is Action); + + binder = new EventBinder(element, binderType.Substr(3), (ElementEventListener)expression.GetValue()); + } + else if (binderType.StartsWith("style.")) { + object style = element.Style; + binder = new PropertyBinder(style, binderType.Substr(6), expression); + } + else { + BinderFactory binderFactory = _registeredBinders[binderType]; + if (binderFactory == null) { + binder = new PropertyBinder(element, binderType, expression); + } + else { + binder = binderFactory(element, binderType, expression); + } + } + + if (binder != null) { + binder.Update(); + if (expression.CanChange == false) { + // Since the expression value cannot change, there isn't a whole lot of need + // to keep the binder alive and manage it. + binder = null; + } + } + + if (binder != null) { + // The binder is managed using a behavior that is attached to the element. + // This allows stashing the model for later retrieval, as well as a way to + // dispose bindings (the behavior disposes all binders it is managing). + + BinderManager binderManager = (BinderManager)Behavior.GetBehavior(element, typeof(BinderManager)); + if (binderManager == null) { + binderManager = new BinderManager(); + binderManager.Initialize(element, null); + binderManager.Model = model; + } + + binderManager.AddBinder(binder); + } + } + + return String.Empty; + }); + } + } +} diff --git a/fx/Sharpen/Core/Application.Services.cs b/fx/Sharpen/Core/Application.Services.cs new file mode 100644 index 000000000..8a5027ec7 --- /dev/null +++ b/fx/Sharpen/Core/Application.Services.cs @@ -0,0 +1,67 @@ +// Application.Services.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Html; + +namespace Sharpen { + + public sealed partial class Application { + + /// + /// Registers a service type. + /// + /// The name of the service. + /// The type providing the implementation of the service. + /// The type of the service. + public void RegisterService(string name, Type serviceImplementationType, Type serviceType) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(serviceImplementationType != null); + Debug.Assert(serviceType != null); + Debug.Assert(_registeredServices.ContainsKey(name) == false, "A service with name '" + name + "' was already registered."); + + ServiceRegistration registration = new ServiceRegistration(); + registration.ServiceImplementationType = serviceImplementationType; + registration.ServiceType = serviceType; + + _registeredServices[name] = registration; + } + + private void SetupServices() { + string servicesAttribute = (string)Document.Body.GetAttribute(ServicesAttribute); + if (String.IsNullOrEmpty(servicesAttribute)) { + return; + } + + string[] serviceNames = servicesAttribute.Split(","); + int serviceCount = serviceNames.Length; + + for (int i = 0; i < serviceCount; i++) { + string name = serviceNames[i]; + + ServiceRegistration registration = _registeredServices[name]; + Debug.Assert(registration != null, "Unknown service '" + name + "'"); + + // TODO: Add support for deferred loading of service implementation, where + // the service gets included later, even though it is declared at the + // page level. + + object service = GetObject(registration.ServiceImplementationType); + + IInitializable initializableService = service as IInitializable; + if (initializableService != null) { + Dictionary options = OptionsParser.GetOptions(Document.Body, name); + initializableService.BeginInitialization(options); + initializableService.EndInitialization(); + } + + RegisterObject(registration.ServiceType, service); + } + } + } +} diff --git a/fx/Sharpen/Core/Application.Templates.cs b/fx/Sharpen/Core/Application.Templates.cs new file mode 100644 index 000000000..317b0db25 --- /dev/null +++ b/fx/Sharpen/Core/Application.Templates.cs @@ -0,0 +1,102 @@ +// Application.Templates.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; + +namespace Sharpen { + + public sealed partial class Application { + + /// + /// Compiles a template instance from the specified template type and content. + /// + /// The template engine to use to compile the template. + /// The template content. + /// Any options to be passed to the template engine. + /// The newly compiled template instance. + public Template CompileTemplate(string type, string content, Dictionary options) { + Debug.Assert(String.IsNullOrEmpty(type) == false); + Debug.Assert(String.IsNullOrEmpty(content) == false); + + TemplateEngine templateEngine = _registeredTemplateEngines[type]; + Debug.Assert(templateEngine != null, "No template engine was found to be able to process the template typed '" + type + "'."); + + if (templateEngine == null) { + return null; + } + + return templateEngine(content, options); + } + + /// + /// Gets a template instance from the specified template name. The specified name + /// is used to lookup a script element with a matching id. + /// + /// The name to lookup a template. + /// The template instance if the associated element could be found and successfully parsed. + public Template GetTemplate(string name) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + + // TODO: Should we allow plugging in a template selector callback? + // We would need to have a value parameter to pass in the data value into GetTemplate. + + // Check if there is a previously parsed or registered template + Template template = _registeredTemplates[name]; + if (template != null) { + return template; + } + + Element templateElement = Document.GetElementById(name); + Debug.Assert(templateElement != null, "Could not find a template element with the id '" + name + "'."); + if (templateElement == null) { + return null; + } + + // Parse the template using the associated template engine + string templateType = (string)templateElement.GetAttribute(TemplateTypeAttribute); + Debug.Assert(String.IsNullOrEmpty(templateType) == false, "A template must have a valid data-template attribute set."); + + template = CompileTemplate(templateType, + templateElement.TextContent, + OptionsParser.GetOptions(templateElement, TemplateOptionsAttribute)); + + // Cache the newly parsed template for future use + _registeredTemplates[name] = template; + + return template; + } + + /// + /// Registers a template with the specified name. + /// + /// The name of template. + /// The template to be used. + public void RegisterTemplate(string name, Template template) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(template != null); + Debug.Assert(_registeredTemplates.ContainsKey(name) == false, "A template with name '" + name + "' was already registered."); + + _registeredTemplates[name] = template; + } + + /// + /// Registers a template engine. The supplied name is used to match against the + /// mime type attribute on a template script element. + /// + /// The name of template engine. + /// The engine to be used to handle the supplied name. + public void RegisterTemplateEngine(string name, TemplateEngine engine) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert(engine != null); + Debug.Assert(_registeredTemplateEngines.ContainsKey(name) == false, + "A template engine with name '" + name + "' was already registered."); + + _registeredTemplateEngines[name] = engine; + } + } +} diff --git a/fx/Sharpen/Core/Application.cs b/fx/Sharpen/Core/Application.cs new file mode 100644 index 000000000..5660497c7 --- /dev/null +++ b/fx/Sharpen/Core/Application.cs @@ -0,0 +1,357 @@ +// Application.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Html; +using System.Runtime.CompilerServices; + +namespace Sharpen { + + /// + /// A page-level singleton representing the current application. It provides core + /// services like settings, IoC, and pub/sub events-based messaging for decoupled + /// components. + /// + public sealed partial class Application : IApplication, IContainer, IEventManager { + + internal const string ServicesAttribute = "data-services"; + + internal const string BehaviorNameKey = "behaviorName"; + internal const string BehaviorsKey = "behaviors"; + internal const string BehaviorsAttribute = "data-behavior"; + internal const string BehaviorsSelector = "*[data-behavior]"; + + internal const string ModelTypeAttribute = "data-model-type"; + + internal const string BindingsAttribute = "data-bindings"; + internal const string BindingsSelector = "*[data-bindings]"; + internal static readonly RegExp BindingsRegex = + new RegExp(@"([a-z\.\-]+)\s*:\s*([a-z]+)\s+([^;]*)\s*\;", "gi"); + internal static readonly RegExp PropertyPathRegex = + new RegExp(@"[a-z0-9\.]+", "gi"); + + internal const string TemplateTypeAttribute = "data-template"; + internal const string TemplateOptionsAttribute = "template-options"; + + /// + /// The current Application instance. + /// + public static readonly Application Current = new Application(); + + private readonly Dictionary _registeredServices; + private readonly Dictionary _registeredBehaviors; + private readonly Dictionary _registeredExpressions; + private readonly Dictionary _registeredBinders; + private readonly Dictionary _registeredTemplateEngines; + private readonly Dictionary _registeredTemplates; + + private Dictionary _catalog; + private Dictionary> _subscriptions; + private int _subscriptionCount; + + private object _model; + + static Application() { + Script.SetTimeout(delegate() { + Application.Current.ActivateFragment(Document.Body, /* contentOnly */ false); + }, 0); + } + + private Application() { + _catalog = new Dictionary(); + _subscriptions = new Dictionary>(); + + _registeredServices = new Dictionary(); + _registeredBehaviors = new Dictionary(); + _registeredExpressions = new Dictionary(); + _registeredBinders = new Dictionary(); + _registeredTemplateEngines = new Dictionary(); + _registeredTemplates = new Dictionary(); + + RegisterObject(typeof(IApplication), this); + RegisterObject(typeof(IContainer), this); + RegisterObject(typeof(IEventManager), this); + + RegisterBehavior(BinderManager.BehaviorName, typeof(BinderManager)); + RegisterExpression("bind", ProcessModelExpression); + RegisterExpression("init", ProcessModelExpression); + RegisterExpression("link", ProcessModelExpression); + RegisterExpression("exec", ProcessModelExpression); + RegisterBinder("text", BindContent); + RegisterBinder("html", BindContent); + RegisterBinder("value", BindValue); + RegisterBinder("visibility", BindVisibility); + } + + /// + /// The model object associated with the application. + /// + public object Model { + get { + return _model; + } + } + + /// + /// Activates a specified element and its children by instantiating any + /// declaratively specified behaviors or bindings within the markup. + /// + /// The element to activate. + /// Whether the element should be activated, or only its contained content. + public extern void ActivateFragment(Element element, bool contentOnly); + + /// + /// Activates a specified element and its children by instantiating any + /// declaratively specified behaviors or bindings within the markup. + /// + /// The element to activate. + /// Whether the element should be activated, or only its contained content. + /// The model to bind to. + public void ActivateFragment(Element element, bool contentOnly, object model) { + Debug.Assert(element != null); + + if (element == Document.Body) { + // Perform app-level activation (tied to body initialization) + + // Setup top-level services specified declaratively. + SetupServices(); + + // Create the model declaratively associated with the application. + if (model == null) { + string modelTypeName = (string)Document.Body.GetAttribute(ModelTypeAttribute); + if (String.IsNullOrEmpty(modelTypeName) == false) { + Type modelType = Type.GetType(modelTypeName); + Debug.Assert(modelType != null, "Could not resolve model '" + modelTypeName + "'"); + + model = GetObject(modelType); + + IInitializable initializableModel = model as IInitializable; + if (initializableModel != null) { + Dictionary modelData = OptionsParser.GetOptions(element, "model"); + initializableModel.BeginInitialization(modelData); + initializableModel.EndInitialization(); + } + } + } + + _model = model; + } + + // Create expressions and bindings associated with the specified elements and + // the contained elements. Do this first, as this allows behaviors to look at + // values set as a result of bindings when they are attached. + if ((contentOnly == false) && element.HasAttribute(Application.BindingsAttribute)) { + SetupBindings(element, model); + } + + ElementCollection boundElements = element.QuerySelectorAll(Application.BindingsSelector); + for (int i = 0, boundElementCount = boundElements.Length; i < boundElementCount; i++) { + SetupBindings(boundElements[i], model); + } + + // Attach behaviors associated declaratively with the specified element and the + // contained elements. + if ((contentOnly == false) && element.HasAttribute(Application.BehaviorsAttribute)) { + AttachBehaviors(element); + } + + ElementCollection extendedElements = element.QuerySelectorAll(Application.BehaviorsSelector); + for (int i = 0, extendedElementCount = extendedElements.Length; i < extendedElementCount; i++) { + AttachBehaviors(extendedElements[i]); + } + } + + /// + /// Deactivates the specified element and its children by disposing any + /// behaviors or binding instances attached to the elements. + /// + /// The element to deactivate. + /// Whether the element should be deactivated, or only its contained content. + public void DeactivateFragment(Element element, bool contentOnly) { + Debug.Assert(element != null); + + // Detach behaviors associated with the element and the contained elements. + if ((contentOnly == false) && element.HasAttribute(Application.BehaviorsAttribute)) { + DetachBehaviors(element); + } + + ElementCollection elements = element.QuerySelectorAll(Application.BehaviorsSelector); + int matchingElements = elements.Length; + + if (matchingElements != 0) { + for (int i = 0; i < matchingElements; i++) { + DetachBehaviors(elements[i]); + } + } + } + + private string GetTypeKey(Type type) { + string key = Script.GetField(type, "$key"); + if (key == null) { + key = Date.Now.GetTime().ToString(); + Script.SetField(type, "$key", key); + } + + return key; + } + + #region Implementation of IApplication + + /// + /// Gets the value of the specified setting. + /// + /// The name of the setting. + /// The value of the specified setting. + public string GetSetting(string name) { + // TODO: Implement access to query string settings as well as maybe + // a few other things like JSON data written out as page-level + // metadata, or maybe a JSON block in an embedded script element. + return null; + } + + #endregion + + #region Implementation of IContainer + + /// + /// Gets an instance of the specified object type. An instance is created + /// if one has not been registered with the container. A factory method is + /// called if a factory has been registered or implemented on the object type. + /// + /// The type of object to retrieve. + /// The object instance. + public object GetObject(Type objectType) { + Debug.Assert(objectType != null, "Expected an object type when creating objects."); + + string catalogKey = GetTypeKey(objectType); + object catalogItem = _catalog[catalogKey]; + + if (catalogItem == null) { + Function objectFactory = Script.GetField(objectType, "factory") as Function; + if (objectFactory != null) { + catalogItem = objectFactory; + } + else { + return Script.CreateInstance(objectType); + } + } + + if (catalogItem is Function) { + return ((Function)catalogItem).Call(null, (IContainer)this, objectType); + } + + return catalogItem; + } + + /// + /// Registers an object factory with the container. The factory is called + /// when the particular object type is requested. The factory can decide whether to + /// cache object instances it returns or not, based on its policy. + /// + /// + /// + public void RegisterFactory(Type objectType, Func objectFactory) { + Debug.Assert(objectType != null, "Expected an object type when registering object factories."); + Debug.Assert(objectFactory != null, "Expected an object factory when registering object factories."); + + _catalog[GetTypeKey(objectType)] = objectFactory; + } + + /// + /// Registers an object instance for the specified object type. + /// + /// The type that can be used to lookup the specified object instance. + /// The object instance to use. + public void RegisterObject(Type objectType, object objectInstance) { + Debug.Assert(objectType != null, "Expected an object type when registering objects."); + Debug.Assert(objectInstance != null, "Expected an object instance when registering objects."); + + _catalog[GetTypeKey(objectType)] = objectInstance; + } + + #endregion + + #region Implementation of IEventManager + + /// + /// Raises the specified event. The type of the event arguments is used to determine + /// which subscribers the event is routed to. + /// + /// The event arguments containing event-specific data. + public void PublishEvent(EventArgs eventArgs) { + Debug.Assert(eventArgs != null, "Must specify an eventArgs when raising an event."); + + string eventTypeKey = GetTypeKey(eventArgs.GetType()); + + Dictionary eventHandlerMap = _subscriptions[eventTypeKey]; + if (eventHandlerMap != null) { + // TODO: Handle the case where a subscriber unsubscribes while we're iterating + // Should we do it here by copying/cloning the list, or should we handle it + // by completing unsubscribe asynchronously? + foreach (KeyValuePair eventHandlerEntry in eventHandlerMap) { + eventHandlerEntry.Value(eventArgs); + } + } + } + + /// + /// Subscribes to the specified type of events. The resulting cookie can be used for + /// unsubscribing. + /// + /// The type of the event. + /// The event handler to invoke when the specified event type is raised. + /// + public object SubscribeEvent(Type eventType, Callback eventHandler) { + Debug.Assert(eventType != null, "Must specify an event type when subscribing to events."); + Debug.Assert(eventHandler != null, "Must specify an event handler when subscribing to events."); + + string eventTypeKey = GetTypeKey(eventType); + + Dictionary eventHandlerMap = _subscriptions[eventTypeKey]; + if (eventHandlerMap == null) { + eventHandlerMap = new Dictionary(); + _subscriptions[eventTypeKey] = eventHandlerMap; + } + + string eventHandlerKey = (++_subscriptionCount).ToString(); + eventHandlerMap[eventHandlerKey] = eventHandler; + + // The subscription cookie we use is an object with the two strings + // identifying the event handler uniquely - the event type key used to index + // into the top-level event handlers key/value pair list, and the handler key + // (as generated above) to index into the event-type-specific key/value pair list. + // Keep these in sync with Unsubscribe... + + return new Dictionary("type", eventTypeKey, "handler", eventHandlerKey); + } + + /// + /// Unsubcribes from a previously subscribed-to event type. + /// + /// The subscription cookie. + public void UnsubscribeEvent(object subscriptionCookie) { + Debug.Assert(subscriptionCookie != null, "Must specify the subscription cookie when unsubscribing to events."); + Debug.Assert(Script.HasField(subscriptionCookie, "type") && Script.HasField(subscriptionCookie, "handler"), + "A valid subscription cookie is an object with 'type' and 'handler' fields."); + + Dictionary keys = (Dictionary)subscriptionCookie; + + Dictionary eventHandlerMap = _subscriptions[keys["type"]]; + Debug.Assert(eventHandlerMap != null, "Invalid subscription cookie."); + Debug.Assert(eventHandlerMap.ContainsKey(keys["handler"]), "Invalid subscription cookie."); + + eventHandlerMap.Remove(keys["handler"]); + + if (eventHandlerMap.Count == 0) { + _subscriptions.Remove(keys["type"]); + } + } + + #endregion + } +} diff --git a/fx/Sharpen/Core/Behavior.cs b/fx/Sharpen/Core/Behavior.cs new file mode 100644 index 000000000..ca8296542 --- /dev/null +++ b/fx/Sharpen/Core/Behavior.cs @@ -0,0 +1,119 @@ +// Behavior.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; + +namespace Sharpen { + + /// + /// Represents a script objects that can be attached to an Element to + /// extend its standard functionality. + /// + public abstract class Behavior : IDisposable { + + private Element _element; + + /// + /// Gets the element that this behavior is attached to. + /// + protected Element Element { + get { + Debug.Assert(_element != null, "Element is being accessed after this behavior has been disposed."); + return _element; + } + } + + /// + /// Disposes a behavior by detaching itself from its associated element. + /// When overriding this, be sure to call the base functionality at the after the implementation + /// in the derived class. + /// + public virtual void Dispose() { + Debug.Assert(_element != null, "Behavior has already been disposed."); + + // First remove the expando corresponding to this behavior on the element. + + string name = Script.GetField(this.GetType(), Application.BehaviorNameKey); + Script.DeleteField(_element, name); + + // Next remove this behavior from the key/value pair list of all behaviors + // being maintained on the element. + + Dictionary behaviors = Script.GetField>(_element, Application.BehaviorsKey); + Debug.Assert(behaviors != null); + + behaviors.Remove(name); + + _element = null; + } + + /// + /// Gets a behavior instance attached to the specified element if one exists. + /// + /// The element to lookup. + /// The type of the behavior to lookup. + /// + public static Behavior GetBehavior(Element element, Type behaviorType) { + Debug.Assert(element != null, "Must specify the element to inspect for a behavior instance."); + Debug.Assert(behaviorType != null, "Must specify a behavior type to lookup."); + + // Find the first matching behavior by enumerating the key/value pair + // list of behaviors on the element. + + Dictionary behaviors = Script.GetField>(element, Application.BehaviorsKey); + if (behaviors != null) { + foreach (KeyValuePair behaviorEntry in behaviors) { + if (behaviorType.IsInstanceOfType(behaviorEntry.Value)) { + return behaviorEntry.Value; + } + } + } + + return null; + } + + /// + /// Initializes a behavior by attaching it to the specified element. + /// When overriding this, be sure to call the base functionality before the implementation + /// in the derived class. + /// + /// The element to attach the behavior to. + /// Any initialization options that the behavior should consume. + public virtual void Initialize(Element element, Dictionary options) { + Debug.Assert(_element == null, "A behavior should be initialized only once."); + Debug.Assert(element != null, "Expected a valid element to initialize a behavior."); + + _element = element; + + // Automatically expose the behavior on the DOM element as an expando using + // the name of the behavior as the key. + + string name = Script.GetField(this.GetType(), Application.BehaviorNameKey); + Script.SetField(element, name, this); + + // Add a 'behaviors' expando on the element which is a key/value pair + // list of behavior name -> behavior instance mapping. + + Dictionary behaviors = Script.GetField>(element, Application.BehaviorsKey); + if (behaviors == null) { + behaviors = new Dictionary(); + Script.SetField(element, Application.BehaviorsKey, behaviors); + } + + behaviors[name] = this; + + // Set data-behavior on the element if it is not already set (i.e. if the behavior + // is being programmatically constructed), so that if DisposeBehaviors is called, + // then this element is picked up via the CSS query used to find elements that have + // behaviors. + if (element.HasAttribute(Application.BehaviorsAttribute) == false) { + element.SetAttribute(Application.BehaviorsAttribute, String.Empty); + } + } + } +} diff --git a/fx/Sharpen/Core/BehaviorRegistration.cs b/fx/Sharpen/Core/BehaviorRegistration.cs new file mode 100644 index 000000000..9028f70de --- /dev/null +++ b/fx/Sharpen/Core/BehaviorRegistration.cs @@ -0,0 +1,19 @@ +// BehaviorRegistration.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace Sharpen { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + internal sealed class BehaviorRegistration { + + public Type BehaviorType = null; + public Type ServiceType = null; + } +} diff --git a/fx/Sharpen/Core/Binder.cs b/fx/Sharpen/Core/Binder.cs new file mode 100644 index 000000000..9f88dc82e --- /dev/null +++ b/fx/Sharpen/Core/Binder.cs @@ -0,0 +1,21 @@ +// Binder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; + +namespace Sharpen { + + /// + /// A binder is an object that performs the work of binding an expression value + /// with the associated DOM element. + /// + public abstract class Binder : IDisposable { + + public abstract void Dispose(); + + internal virtual void Update() { + } + } +} diff --git a/fx/Sharpen/Core/BinderFactory.cs b/fx/Sharpen/Core/BinderFactory.cs new file mode 100644 index 000000000..d41f5c670 --- /dev/null +++ b/fx/Sharpen/Core/BinderFactory.cs @@ -0,0 +1,20 @@ +// BinderFactory.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Html; + +namespace Sharpen { + + /// + /// Creates an expression binder given an element, the bound property and + /// the expression to bind to. + /// + /// The element that is bound. + /// The property on the element that is bound. + /// The expression to bind to. + /// The binder that was created. If no binder needs to be created, the return value is null. + public delegate Binder BinderFactory(Element element, string property, Expression expression); +} diff --git a/fx/Sharpen/Core/BinderManager.cs b/fx/Sharpen/Core/BinderManager.cs new file mode 100644 index 000000000..e48667852 --- /dev/null +++ b/fx/Sharpen/Core/BinderManager.cs @@ -0,0 +1,49 @@ +// BinderManager.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; + +namespace Sharpen { + + internal sealed class BinderManager : Behavior { + + internal const string BehaviorName = "binderManager"; + + private object _model; + private List _binders; + + public BinderManager() { + _binders = new List(); + } + + public object Model { + get { + return _model; + } + set { + _model = value; + } + } + + public void AddBinder(Binder binder) { + Debug.Assert(_binders != null); + Debug.Assert(binder != null); + + _binders.Add(binder); + } + + public override void Dispose() { + foreach (Binder binder in _binders) { + binder.Dispose(); + } + _binders = null; + + base.Dispose(); + } + } +} diff --git a/fx/Sharpen/Core/Bindings/BindExpression.cs b/fx/Sharpen/Core/Bindings/BindExpression.cs new file mode 100644 index 000000000..bd67e2b86 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/BindExpression.cs @@ -0,0 +1,61 @@ +// BindExpression.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.ComponentModel; + +namespace Sharpen.Bindings { + + /// + /// Implementation of an expression that binds to a value off the model and + /// tracks changes by virtue of being an observer. + /// + internal sealed class BindExpression : Expression, IObserver { + + private object _model; + private Func _getter; + private Action _setter; + + public BindExpression(object model, Func getter, Action setter) + : base(null, /* canChange */ true) { + _model = model; + _getter = getter; + _setter = setter; + + RetrieveValue(/* notify */ false); + } + + public void InvalidateObserver() { + RetrieveValue(/* notify */ true); + } + + private void RetrieveValue(bool notify) { + object value; + + IDisposable observation = ObserverManager.RegisterObserver(this); + try { + value = _getter(_model); + UpdateValue(value, notify); + } + catch { + // TODO: Error handling (logging + breakpoint if debugger attached) + } + finally { + observation.Dispose(); + } + } + + public override void SetValue(object value) { + if (_setter != null) { + try { + _setter(_model, value); + } + catch { + // TODO: Error handling (logging + breakpoint if debugger attached) + } + } + } + } +} diff --git a/fx/Sharpen/Core/Bindings/ContentBinder.cs b/fx/Sharpen/Core/Bindings/ContentBinder.cs new file mode 100644 index 000000000..2867b0a13 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/ContentBinder.cs @@ -0,0 +1,71 @@ +// ContentBinder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Html; + +namespace Sharpen.Bindings { + + /// + /// Binds the content (textContent/innerHTML) of element to an expression. + /// + internal sealed class ContentBinder : PropertyBinder { + + public ContentBinder(Element target, string property, Expression expression) + : base(target, property, expression) { + } + + protected override void UpdateTarget(object target, string propertyName, object value) { + Element targetElement = (Element)target; + + // Convert the value into a string if it isn't already... do this with a template + // if one is specified, or resort to ToString as a fallback. + string content = null; + if (value is string) { + content = (string)value; + } + else { + string templateName = (string)targetElement.GetAttribute("data-template"); + if (String.IsNullOrEmpty(templateName) == false) { + Template template = Application.Current.GetTemplate(templateName); + if (template != null) { + content = template(value, /* index */ 0, /* context */ null); + } + } + else { + content = value.ToString(); + } + } + + // Raise contentUpdating event, so it allows any behaviors attached to this + // element to be notified + MutableEvent updatingEvent = Document.CreateEvent("Custom"); + updatingEvent.InitCustomEvent("contentUpdating", /* canBubble */ false, /* canCancel */ false, null); + targetElement.DispatchEvent(updatingEvent); + + // Deactivate the content, in case current content has attached behaviors or bindings. + Application.Current.DeactivateFragment(targetElement, /* contentOnly */ true); + + // Update the element with the new value. + base.UpdateTarget(targetElement, propertyName, content); + + // If the property that was updated was the innerHTML, then activate any + // binding expressions or behaviors that might have been specified within the + // new markup. + if ((String.IsNullOrEmpty(content) == false) && (propertyName == "innerHTML")) { + BinderManager binderManager = (BinderManager)Behavior.GetBehavior(targetElement, typeof(BinderManager)); + if (binderManager != null) { + Application.Current.ActivateFragment(targetElement, /* contentOnly */ true, binderManager.Model); + } + } + + // Raise contentUpdated event, so it allows any behaviors attached to this + // element to be notified + MutableEvent updatedEvent = Document.CreateEvent("Custom"); + updatedEvent.InitCustomEvent("contentUpdated", /* canBubble */ false, /* canCancel */ false, null); + targetElement.DispatchEvent(updatedEvent); + } + } +} diff --git a/fx/Sharpen/Core/Bindings/EventBinder.cs b/fx/Sharpen/Core/Bindings/EventBinder.cs new file mode 100644 index 000000000..c8de9b7e6 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/EventBinder.cs @@ -0,0 +1,35 @@ +// EventBinder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Html; + +namespace Sharpen.Bindings { + + /// + /// Binds an event of an element to the value of an expression. + /// + internal sealed class EventBinder : Binder { + + private Element _source; + private string _eventName; + + private ElementEventListener _eventHandler; + + public EventBinder(Element source, string eventName, ElementEventListener eventHandler) { + _source = source; + _eventName = eventName; + _eventHandler = eventHandler; + } + + public override void Dispose() { + _source.RemoveEventListener(_eventName, _eventHandler, false); + } + + internal override void Update() { + _source.AddEventListener(_eventName, _eventHandler, false); + } + } +} diff --git a/fx/Sharpen/Core/Bindings/PropertyBinder.cs b/fx/Sharpen/Core/Bindings/PropertyBinder.cs new file mode 100644 index 000000000..c11c5c461 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/PropertyBinder.cs @@ -0,0 +1,49 @@ +// PropertyBinder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Html; + +namespace Sharpen.Bindings { + + /// + /// This binds the property of an object to the value of an expression, and + /// updates the object as the expression's value changes. + /// + internal class PropertyBinder : Binder { + + private object _target; + private string _propertyName; + private Expression _expression; + + internal PropertyBinder(object target, string propertyName, Expression expression) { + _target = target; + _propertyName = propertyName; + _expression = expression; + + if (_expression.CanChange) { + _expression.Subscribe(Update); + } + } + + public override void Dispose() { + _target = null; + } + + internal override void Update() { + if (_target != null) { + UpdateTarget(_target, _propertyName, _expression.GetValue()); + } + } + + protected void UpdateSource(object value) { + _expression.SetValue(value); + } + + protected virtual void UpdateTarget(object target, string propertyName, object value) { + Script.SetField(target, propertyName, value); + } + } +} diff --git a/fx/Sharpen/Core/Bindings/ValueBinder.cs b/fx/Sharpen/Core/Bindings/ValueBinder.cs new file mode 100644 index 000000000..339296a73 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/ValueBinder.cs @@ -0,0 +1,38 @@ +// ValueBinder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Html; + +namespace Sharpen.Bindings { + + /// + /// Binds the value property of an input element to an expression. + /// This binder supports two-way binding. + /// + internal sealed class ValueBinder : PropertyBinder { + + private InputElement _target; + private ElementEventListener _changeListener; + + public ValueBinder(InputElement target, Expression expression) + : base(target, "value", expression) { + _target = target; + _changeListener = OnChanged; + target.AddEventListener("change", _changeListener, false); + } + + public override void Dispose() { + if (_target != null) { + _target.RemoveEventListener("change", _changeListener, false); + _target = null; + } + } + + private void OnChanged(ElementEvent e) { + UpdateSource(_target.Value); + } + } +} diff --git a/fx/Sharpen/Core/Bindings/VisibilityBinder.cs b/fx/Sharpen/Core/Bindings/VisibilityBinder.cs new file mode 100644 index 000000000..6b22cee77 --- /dev/null +++ b/fx/Sharpen/Core/Bindings/VisibilityBinder.cs @@ -0,0 +1,37 @@ +// VisibilityBinder.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Diagnostics; +using System.Html; + +namespace Sharpen.Bindings { + + /// + /// Binds the visibility of an element to an expression. + /// + internal sealed class VisibilityBinder : PropertyBinder { + + private string _visibleDisplay; + private bool _useDisplay; + + public VisibilityBinder(Element target, string property, Expression expression) + : base(target, property, expression) { + _visibleDisplay = target.Style.Display; + _useDisplay = String.IsNullOrEmpty(_visibleDisplay) == false; + } + + protected override void UpdateTarget(object target, string propertyName, object value) { + if (_useDisplay) { + string displayValue = (bool)value ? _visibleDisplay : "none"; + base.UpdateTarget(((Element)target).Style, "display", displayValue); + } + else { + string visibilityValue = (bool)value ? "visible" : "hidden"; + base.UpdateTarget(((Element)target).Style, "visibility", visibilityValue); + } + } + } +} diff --git a/fx/Sharpen/Core/Core.csproj b/fx/Sharpen/Core/Core.csproj new file mode 100644 index 000000000..f3a597658 --- /dev/null +++ b/fx/Sharpen/Core/Core.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4} + Library + Properties + Sharpen + Sharpen + Properties\FxCop.ruleset + True + True + True + True + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684, 0626 + bin\Debug\Sharpen.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684, 0626 + bin\Release\Sharpen.xml + + + + + + + + Application.cs + + + Application.cs + + + Application.cs + + + Application.cs + + + + + + + + + + + + + + + + + + + + + + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll + + + + + + + + + \ No newline at end of file diff --git a/fx/Sharpen/Core/Expression.cs b/fx/Sharpen/Core/Expression.cs new file mode 100644 index 000000000..3dbae039e --- /dev/null +++ b/fx/Sharpen/Core/Expression.cs @@ -0,0 +1,80 @@ +// Expression.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; + +namespace Sharpen { + + /// + /// Represents the base class for all expressions. Expressions represent + /// a value, and optionally a value that can change after being read (in which + /// case, it provides a mechanism to subscribe for changes) + /// + public class Expression { + + private bool _canChange; + private Action _changeCallback; + private object _value; + + /// + /// Initializes and instance of an Expression. + /// + /// The initial value of the expression. + /// Whether the expression represents a value that can change. + public Expression(object value, bool canChange) { + _value = value; + _canChange = canChange; + } + + /// + /// Gets whether the expression represents a value that can change. + /// + public bool CanChange { + get { + return _canChange; + } + } + + /// + /// Gets the current value of the expression. + /// + /// The current value. + public object GetValue() { + return _value; + } + + /// + /// Sets the value of the expression. Most expressions are read-only and ignore + /// this call, but some expressions do support the ability to write back. + /// + /// The new value of the expression. + public virtual void SetValue(object value) { + // By default expressions are read-only, so they ignore SetValue calls + // TODO: Should there be a IsReadOnly property? + } + + /// + /// Allows a consumer of the expression to subscribe to change notifications. + /// + /// The callback to be invoked. + public void Subscribe(Action changeCallback) { + if (_canChange) { + _changeCallback = changeCallback; + } + } + + /// + /// Updates the value represented by the expression. + /// + /// The new value of the expression. + /// Whether to notify the subscriber of the change. + protected void UpdateValue(object value, bool notify) { + _value = value; + if (notify && (_changeCallback != null)) { + _changeCallback(); + } + } + } +} diff --git a/fx/Sharpen/Core/ExpressionFactory.cs b/fx/Sharpen/Core/ExpressionFactory.cs new file mode 100644 index 000000000..e7e6b3bc4 --- /dev/null +++ b/fx/Sharpen/Core/ExpressionFactory.cs @@ -0,0 +1,19 @@ +// ExpressionFactory.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; + +namespace Sharpen { + + /// + /// Creates an expression given a model object and a string representation of the + /// expression. + /// + /// The model object to be used for binding purposes. + /// The type of expression. + /// The string representation of the expression. + /// An expression object. + public delegate Expression ExpressionFactory(object model, string expressionType, string value); +} diff --git a/fx/Sharpen/Core/OptionsParser.cs b/fx/Sharpen/Core/OptionsParser.cs new file mode 100644 index 000000000..54d454748 --- /dev/null +++ b/fx/Sharpen/Core/OptionsParser.cs @@ -0,0 +1,105 @@ +// OptionsParser.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Html; +using System.Serialization; + +namespace Sharpen { + + internal static class OptionsParser { + + // Find the following types of string sequences: + // Literals (true, false, null, numbers + // Strings (either single-quoted, or double-quoted) + // (note, we don't handle nested quotes) + // Element references (either #id, or .class) + // Syntax (comma for name/value separators, square brackets + // for arrays, curly braces for nested objects) + // Names (sequence of alphanumerics followed by a ':') + private static readonly RegExp _optionsParserRegex = + new RegExp("(true|false|null|-?[0-9.]+)|('[^']*'|\\\"[^\"]*\\\")|([#\\.][a-z][a-z0-9]*)|(\\,|\\[|\\]|\\{|\\})|([a-z][a-z0-9]*\\:)", "gi"); + + public static Dictionary GetOptions(Element element, string name) { + // Options can be specified using a pseudo-JSON/css-esque syntax + // as the value of a data- attribute on the element. + + string optionsText = (string)element.GetAttribute("data-" + name); + if (String.IsNullOrEmpty(optionsText) == false) { + if (optionsText.StartsWith("{")) { + // Vanilla JSON object + return Json.ParseData>(optionsText); + } + + // Treat it as our pseudo-JSON/CSS-esque syntax which requires a bit of rewriting + // before it can be parsed as JSON. + return Parse(optionsText); + } + else { + // Create an empty object if no options were declaratively specified. + return new Dictionary(); + } + } + + private static Dictionary Parse(string optionsText) { + Debug.Assert(String.IsNullOrEmpty(optionsText) == false); + + bool resolveElements = false; + optionsText = optionsText.ReplaceRegex(_optionsParserRegex, + delegate(string match /*, string simpleValue, string stringValue, string elementReference, string separator, string name */) { + string stringValue = (string)Arguments.GetArgument(2); + string elementReference = (string)Arguments.GetArgument(3); + string nameValue = (string)Arguments.GetArgument(5); + if (Script.IsValue(stringValue)) { + // Matches single and double quoted strings + // JSON strings are always double quoted, and additionally + // escape any double quotes within. + + return '"' + stringValue.Substr(1, stringValue.Length - 2).Replace("\"", "\\\"") + '"'; + } + else if (Script.IsValue(elementReference)) { + // ID references require resolution at JSON parse time + // Convert them to strings, so they can be parsed as valid JSON first. + + resolveElements = true; + return '"' + elementReference + '"'; + } + else if (Script.IsValue(nameValue)) { + // Matches a name followed by ":" + // In JSON, names must be double quoted + + return '"' + nameValue.Substr(0, nameValue.Length - 1) + "\":"; + } + return match; + }); + + // Finally turn this into a JSON object, by wrapping with curly braces + + string optionsJson = "{" + optionsText + "}"; + + JsonParseCallback parseCallback = null; + if (resolveElements) { + parseCallback = ResolveElementReferences; + } + + return Json.ParseData>(optionsJson, parseCallback); + } + + private static object ResolveElementReferences(string name, object value) { + if (value is String) { + if (((string)value).CharAt(0) == '#') { + return Document.QuerySelector((string)value); + } + else if (((string)value).CharAt(0) == '.') { + return Document.QuerySelectorAll((string)value); + } + } + return value; + } + } +} diff --git a/fx/Sharpen/Core/Properties/AssemblyInfo.cs b/fx/Sharpen/Core/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..bdcf2cfff --- /dev/null +++ b/fx/Sharpen/Core/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// AssemblyInfo.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Sharpen")] +[assembly: AssemblyDescription("Sharpen Framework for HTML5 Single Page Apps")] +[assembly: AssemblyConfiguration("http://www.scriptsharp.com")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Sharpen Framework")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("sharpen")] + +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +define('{name}', [{requires}], function({dependencies}) { + var $global = this; + + {script} + +{include:Properties\TemplateEngine.js} + + return $exports; +}); +")] diff --git a/samples/Photos/Photos/Properties/FxCop.ruleset b/fx/Sharpen/Core/Properties/FxCop.ruleset similarity index 100% rename from samples/Photos/Photos/Properties/FxCop.ruleset rename to fx/Sharpen/Core/Properties/FxCop.ruleset diff --git a/fx/Sharpen/Core/Properties/TemplateEngine.js b/fx/Sharpen/Core/Properties/TemplateEngine.js new file mode 100644 index 000000000..a57980d24 --- /dev/null +++ b/fx/Sharpen/Core/Properties/TemplateEngine.js @@ -0,0 +1,183 @@ +(function() { + var startTagRegex = /^<([^>\s\/]+)((\s+[^=>\s]+(\s*=\s*((\"[^"]*\")|(\'[^']*\')|[^>\s]+))?)*\s*\/?\s*)>/m, + endTagRegex = /^<\/([^>\s]+)[^>]*>/m, + attrsRegex = /([^=\s]+)(\s*=\s*((\"([^"]*)\")|(\'([^']*)\')|[^>\s]+))?/gm; + + function sharpenTemplate(content) { + var _code = []; + var _buffer = []; + var _stack = []; + + function writeCode(s) { + if (_buffer.length) { + var text = _buffer.join(''); + text.length && _code.push('_text("' + _buffer.join('').replace(/"/g, '\\"') + '");'); + _buffer = []; + } + _code.push(s); + } + + function writeText(s) { + _buffer.push(s); + } + + function writeValue(value) { + if (value && value.length) { + for (var i = 0; i < value.length; ) { + var beginIndex = value.indexOf("{{", i); + if (beginIndex < 0) { + break; + } + var endIndex = value.indexOf("}}", beginIndex + 2); + if (endIndex < 0) { + break; + } + writeText(value.substring(i, beginIndex)); + + var expr = value.substring(beginIndex + 2, endIndex).trim(); + writeCode('_text(' + ((expr != '.') ? expr : 'i') + ');'); + i = endIndex + 2; + } + writeText(value.substr(i).trim()); + } + } + + function handleStartElement(tag, attrs, closed) { + var frame = {}; + _stack.push(frame); + + if (attrs.loop) { + frame.loop = attrs.loop; + delete attrs.loop; + } + else if (attrs['if']) { + writeCode('if (' + attrs['if'] + ') {'); + frame.conditional = true; + delete attrs['if']; + } + else if (attrs['elseif']) { + writeCode('else if (' + attrs['elseif'] + ') {'); + frame.conditional = true; + delete attrs['elseif']; + } + else if (typeof attrs['else'] !== 'undefined') { + writeCode('else {'); + frame.conditional = true; + delete attrs['else']; + } + + writeText('<' + tag); + for (var attr in attrs) { + var value = attrs[attr]; + + if (!value) { + writeText(' ' + attr); + } + else if (value.startsWith('?{{') && value.endsWith('}}')) { + value = value.substr(3, value.length - 5); + writeCode('if (_t = (' + value + ')) {'); + writeText(' ' + attr + '="'); + writeCode('_text(_t);'); + writeText('"'); + writeCode('}'); + } + else { + writeText(' ' + attr + '="'); + writeValue(value); + writeText('"'); + } + } + if (closed) { + writeText(' />', true); + handleEndElement(tag, closed); + } + else { + writeText('>'); + frame.loop && writeCode('_loop(' + frame.loop + ', function(i) { with(i) {'); + } + } + function handleEndElement(tag, closed) { + var frame = _stack.pop(); + + frame.loop && writeCode('}});'); + !closed && writeText(''); + frame.conditional && writeCode('}'); + } + function handleText(s) { + writeValue(s); + } + + function parseContent(content) { + var treatAsText = true; + while (content.length) { + if (content.substring(0, 4) == ''); + if (index != -1) { + content = content.substring(index + 3); + treatAsText = false; + } + } + else if (content.substring(0, 2) == ' + /// Creates an instance of the markup represented by this template. + /// + /// The data that is associated with the template instance. + /// The index of the template if the template is being instantiated in a repeated fashion. + /// Any additional contextual information that should be passed into the template. + /// The markup instance. + public delegate string Template(object data, int index, object context); +} diff --git a/fx/Sharpen/Core/TemplateEngine.cs b/fx/Sharpen/Core/TemplateEngine.cs new file mode 100644 index 000000000..a8c6baa68 --- /dev/null +++ b/fx/Sharpen/Core/TemplateEngine.cs @@ -0,0 +1,19 @@ +// TemplateEngine.cs +// Script#/FX/Sharpen/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Html; + +namespace Sharpen { + + /// + /// Creates an instance of a template from the specified content. + /// + /// The content representing the template. + /// Any options associated with the template. + /// The template instance. + public delegate Template TemplateEngine(string content, Dictionary options); +} diff --git a/fx/Sharpen/Core/packages.config b/fx/Sharpen/Core/packages.config new file mode 100644 index 000000000..059657ee7 --- /dev/null +++ b/fx/Sharpen/Core/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/fx/Sharpen/Sharpen.sln b/fx/Sharpen/Sharpen.sln new file mode 100644 index 000000000..9d87f560d --- /dev/null +++ b/fx/Sharpen/Sharpen.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C05D1B5-AF50-4CFB-8A8D-5558D4CE3FC4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/fx/Sharpen/packages/nuget.exe b/fx/Sharpen/packages/nuget.exe new file mode 100644 index 000000000..e313ff958 Binary files /dev/null and b/fx/Sharpen/packages/nuget.exe differ diff --git a/fx/Sharpen/packages/nuget.targets b/fx/Sharpen/packages/nuget.targets new file mode 100644 index 000000000..51fc72bd2 --- /dev/null +++ b/fx/Sharpen/packages/nuget.targets @@ -0,0 +1,16 @@ + + + + false + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory))) + $(MSBuildThisFileDirectory)nuget.exe install "$(MSBuildProjectDirectory)\packages.config" -o "$(PackagesDir)" + + RestorePackages; + $(BuildDependsOn); + + + + + + + \ No newline at end of file diff --git a/fx/Sharpen/packages/repositories.config b/fx/Sharpen/packages/repositories.config new file mode 100644 index 000000000..e33122ffa --- /dev/null +++ b/fx/Sharpen/packages/repositories.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/.gitignore b/samples/.gitignore new file mode 100644 index 000000000..195e81e30 --- /dev/null +++ b/samples/.gitignore @@ -0,0 +1 @@ +Scripts/ diff --git a/samples/AroundMe/AroundMe.sln b/samples/AroundMe/AroundMe.sln index c69f9e195..c23a1ab99 100644 --- a/samples/AroundMe/AroundMe.sln +++ b/samples/AroundMe/AroundMe.sln @@ -14,28 +14,34 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution AroundMeTests.testsettings = AroundMeTests.testsettings EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMeWeb", "AroundMeWeb\AroundMeWeb.csproj", "{7AC62D04-57DD-433D-89D9-34E5C240E353}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.Build.0 = Release|Any CPU - {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.Build.0 = Release|Any CPU {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Release|Any CPU.ActiveCfg = Release|Any CPU {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Release|Any CPU.Build.0 = Release|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.Build.0 = Release|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.Build.0 = Release|Any CPU {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Debug|Any CPU.Build.0 = Debug|Any CPU {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Release|Any CPU.ActiveCfg = Release|Any CPU {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Release|Any CPU.Build.0 = Release|Any CPU + {7AC62D04-57DD-433D-89D9-34E5C240E353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AC62D04-57DD-433D-89D9-34E5C240E353}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AC62D04-57DD-433D-89D9-34E5C240E353}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AC62D04-57DD-433D-89D9-34E5C240E353}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/AroundMe/AroundMe/AroundMe.csproj b/samples/AroundMe/AroundMe/AroundMe.csproj index ef7bf43cb..2566f91a7 100644 --- a/samples/AroundMe/AroundMe/AroundMe.csproj +++ b/samples/AroundMe/AroundMe/AroundMe.csproj @@ -15,6 +15,7 @@ True True true + True bin\Debug\ @@ -45,7 +46,6 @@ - @@ -56,63 +56,21 @@ - - - ..\packages\ScriptSharp.Lib.BingMaps.0.7.5.0\lib\Script.Microsoft.BingMaps.dll - - - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll - - {476312f9-5403-4c3a-848a-0f31213fc72e} Twitter - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - + + ..\packages\ScriptSharp.Lib.BingMaps.0.8\lib\Script.Microsoft.BingMaps.dll + + + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll + - + \ No newline at end of file diff --git a/samples/AroundMe/AroundMe/DataModel/Photo.cs b/samples/AroundMe/AroundMe/DataModel/Photo.cs index b9cbcdecd..767e579c0 100644 --- a/samples/AroundMe/AroundMe/DataModel/Photo.cs +++ b/samples/AroundMe/AroundMe/DataModel/Photo.cs @@ -8,7 +8,8 @@ namespace AroundMe.DataModel { /// /// Represents a geo-tagged photo along with various bits of metadata. /// - internal sealed class Photo : Record { + [ScriptObject] + internal sealed class Photo { /// /// The ID of the photo. diff --git a/samples/AroundMe/AroundMe/Page.cs b/samples/AroundMe/AroundMe/Page.cs index 47192e0f3..75ef00051 100644 --- a/samples/AroundMe/AroundMe/Page.cs +++ b/samples/AroundMe/AroundMe/Page.cs @@ -107,13 +107,13 @@ static Page() { }); Utility.SubscribeKey("searchBox", delegate(ElementEvent e) { - Window.SetTimeout(delegate() { + Script.SetTimeout(delegate() { Document.GetElementById("searchButton").ClassName = String.IsNullOrEmpty(Utility.GetElement("searchBox").As().Value) ? "reset" : ""; }, 0); }); Utility.SubscribeBlur("searchBox", delegate(ElementEvent e) { - Window.SetTimeout(delegate() { + Script.SetTimeout(delegate() { Document.GetElementById("searchButton").ClassName = ""; }, 0); }); @@ -157,7 +157,7 @@ private static string CreateTileUrl(MapTile tile) { private static void FavoritePhoto() { Debug.Assert(_model.SelectedPhoto != null); _model.AddFavorite(); - Script.Alert("This photo has been saved to your favorites."); + Window.Alert("This photo has been saved to your favorites."); } private static void HidePhoto() { @@ -193,7 +193,7 @@ private static void SharePhoto() { TweetBoxOptions options = new TweetBoxOptions(); options.Callback = delegate(string tweet, string htmlTweet) { Utility.GetElement("photoTweet").InnerHTML = String.Empty; - Script.Alert("This photo has been shared with your followers on Twitter."); + Window.Alert("This photo has been shared with your followers on Twitter."); }; options.Data = new TweetBoxData(); options.Data.Latitude = photo.latitude; @@ -239,7 +239,7 @@ private static void ShowLocation() { if (_currentPushpin == null) { MapPushpinOptions pushpinOptions = new MapPushpinOptions(); - pushpinOptions.Icon = "Pushpin.png"; + pushpinOptions.Icon = "/Content/Pushpin.png"; pushpinOptions.Anchor = new MapPoint(12, 14); pushpinOptions.Width = 25; pushpinOptions.Height = 28; @@ -309,7 +309,7 @@ private static void UpdateLayout() { }); if (continueLayout) { - Window.SetTimeout(UpdateLayout, 30); + Script.SetTimeout(UpdateLayout, 30); } } @@ -351,11 +351,11 @@ private static void UpdatePhotos(bool newPhotos) { calloutOptions.Offset = new MapPoint(-25, -25); calloutOptions.HtmlContent = "
"; + " title=\"" + photo.title + "\">"; calloutOptions.Visible = true; MapPushpinOptions pushpinOptions = new MapPushpinOptions(); - pushpinOptions.Icon = "Dot.png"; + pushpinOptions.Icon = "/Content/Dot.png"; pushpinOptions.Width = 10; pushpinOptions.Height = 10; pushpinOptions.Anchor = new MapPoint(5, 5); @@ -397,7 +397,7 @@ private static void UpdatePhotos(bool newPhotos) { _graph.AddEdge(connectorEdge); }); - Window.SetTimeout(UpdateLayout, 30); + Script.SetTimeout(UpdateLayout, 30); } } } diff --git a/samples/AroundMe/AroundMe/PhotoView.cs b/samples/AroundMe/AroundMe/PhotoView.cs index 0ef0a8680..f61961f45 100644 --- a/samples/AroundMe/AroundMe/PhotoView.cs +++ b/samples/AroundMe/AroundMe/PhotoView.cs @@ -8,7 +8,8 @@ namespace AroundMe.DataModel { - internal sealed class PhotoView : Record { + [ScriptObject] + internal sealed class PhotoView { public GraphNode pushpinNode; public GraphNode calloutNode; diff --git a/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs b/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs index 0840f80f9..fc22b866a 100644 --- a/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs +++ b/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs @@ -3,7 +3,6 @@ using System; using System.Reflection; -using System.Runtime.CompilerServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -20,4 +19,3 @@ [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ScriptAssembly("AroundMe")] -[assembly: ScriptNamespace("app")] diff --git a/samples/AroundMe/AroundMe/Properties/Script.template b/samples/AroundMe/AroundMe/Properties/Script.template deleted file mode 100644 index d0fad56de..000000000 --- a/samples/AroundMe/AroundMe/Properties/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function() { -#include[as-is] "%code%" -})(); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/AroundMe/AroundMe/Services/FlickrService.cs b/samples/AroundMe/AroundMe/Services/FlickrService.cs index 0c57adb1b..480cfe42d 100644 --- a/samples/AroundMe/AroundMe/Services/FlickrService.cs +++ b/samples/AroundMe/AroundMe/Services/FlickrService.cs @@ -8,21 +8,21 @@ namespace AroundMe.Services { - [Imported] + [ScriptImport] public sealed class SearchResponse { [ScriptName("photos")] public PhotosSearchResponse PhotoResponse; } - [Imported] + [ScriptImport] public sealed class PhotosSearchResponse { [ScriptName("photo")] public List PhotoList; } - [Imported] + [ScriptImport] public sealed class PhotoResult { public string ID; @@ -73,7 +73,7 @@ private static void Search(string url, Action> searchCa photos.ForEach(delegate(PhotoResult photo) { string[] tagsArray = photo.tags.Split(' '); if (tagsArray.Length > 10) { - tagsArray = (string[])tagsArray.Extract(0, 10); + tagsArray = (string[])tagsArray.GetRange(0, 10); } photo.tags = tagsArray.Join(","); @@ -83,8 +83,8 @@ private static void Search(string url, Action> searchCa searchCallback(photos); }; - string jsonCallbackName = Delegate.CreateExport(jsonCallback); - string scriptSource = url + "&jsoncallback=" + jsonCallbackName; + Export jsonpCallback = Delegate.Export(jsonCallback); + string scriptSource = url + "&jsoncallback=" + jsonpCallback.Name; ScriptElement scriptElement = Document.CreateElement("script").As(); scriptElement.Type = "text/javascript"; diff --git a/samples/AroundMe/AroundMe/Tests/PageModelTests.cs b/samples/AroundMe/AroundMe/Tests/PageModelTests.cs index ab9035297..66c92e0be 100644 --- a/samples/AroundMe/AroundMe/Tests/PageModelTests.cs +++ b/samples/AroundMe/AroundMe/Tests/PageModelTests.cs @@ -22,7 +22,7 @@ public void TestSearchLocationTogglesSearchingStatus() { pageModel.SearchLocation("xyz", 0, 0); Assert.IsTrue(pageModel.Searching, "Expected model to report true for Searching."); - Window.SetTimeout(delegate() { + Script.SetTimeout(delegate() { PhotoResult[] dummyResults = new PhotoResult[0]; flickrService.InvokeCallback(dummyResults); diff --git a/samples/AroundMe/AroundMe/packages.config b/samples/AroundMe/AroundMe/packages.config index a7a59cc42..b032fdf58 100644 --- a/samples/AroundMe/AroundMe/packages.config +++ b/samples/AroundMe/AroundMe/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMeTests.testsettings b/samples/AroundMe/AroundMeTests.testsettings index d78647c9b..89de284bf 100644 --- a/samples/AroundMe/AroundMeTests.testsettings +++ b/samples/AroundMe/AroundMeTests.testsettings @@ -1,6 +1,8 @@  These are default test settings for a local test run. + + diff --git a/samples/AroundMe/AroundMeTests/AroundMeTests.csproj b/samples/AroundMe/AroundMeTests/AroundMeTests.csproj index ea073b83b..11c306fcb 100644 --- a/samples/AroundMe/AroundMeTests/AroundMeTests.csproj +++ b/samples/AroundMe/AroundMeTests/AroundMeTests.csproj @@ -34,7 +34,7 @@ - ..\packages\ScriptSharp.Testing.0.7.5.0\lib\ScriptSharp.Testing.dll + ..\packages\ScriptSharp.Testing.0.8\lib\ScriptSharp.Testing.dll @@ -42,6 +42,7 @@ + diff --git a/samples/AroundMe/AroundMeTests/DefaultTests.cs b/samples/AroundMe/AroundMeTests/DefaultTests.cs index d03768991..13c58a907 100644 --- a/samples/AroundMe/AroundMeTests/DefaultTests.cs +++ b/samples/AroundMe/AroundMeTests/DefaultTests.cs @@ -10,11 +10,10 @@ namespace AroundMeTests { [TestClass] - [DeploymentItem("AroundMeTests\\Web", "Web")] - [DeploymentItem("AroundMe\\bin\\Debug\\mscorlib.debug.js", "Web")] - [DeploymentItem("AroundMe\\bin\\Debug\\AroundMe.test.js", "Web")] public class DefaultTests { + private const int Port = 3976; + private static WebTest _webTest; public TestContext TestContext { @@ -27,11 +26,11 @@ public static void OnInitialize(TestContext testContext) { // This starts the web server rooted at the specified directory // on http://localhost: - string webRoot = Path.Combine(testContext.DeploymentDirectory, "Web"); - int port = 3976; + string testContentRoot = Path.GetFullPath(Path.Combine(testContext.TestRunDirectory, "..\\..\\AroundMeTests\\Web")); + string scriptsRoot = Path.GetFullPath(Path.Combine(testContext.TestRunDirectory, "..\\..\\AroundMe\\bin\\Debug")); _webTest = new WebTest(); - _webTest.StartWebServer(webRoot, port); + _webTest.StartWebServer(Port, testContentRoot, scriptsRoot); } [ClassCleanup()] @@ -41,12 +40,7 @@ public static void OnCleanup() { [TestMethod] public void TestMethod1() { - WebTestPageBuilder pageBuilder = new WebTestPageBuilder("DefaultTests"); - string html = - pageBuilder.AddScripts("mscorlib.debug.js", "AroundMe.test.js") - .ToHtml(); - - Uri pageUri = _webTest.CreateContent("/DefaultTests.htm", html, "text/html"); + Uri pageUri = _webTest.GetTestUri("/DefaultTests.htm"); WebTestResult chromeResult = _webTest.RunTest(pageUri, WebBrowser.Chrome); Assert.IsTrue(chromeResult.Succeeded, "Chrome:\r\n" + chromeResult.Log); diff --git a/samples/AroundMe/AroundMeTests/Web/DefaultTests.htm b/samples/AroundMe/AroundMeTests/Web/DefaultTests.htm new file mode 100644 index 000000000..d04ddf98d --- /dev/null +++ b/samples/AroundMe/AroundMeTests/Web/DefaultTests.htm @@ -0,0 +1,28 @@ + + + + DefaultTests + + + +
+

Default Tests

+

+

+
    +
    + +
    + + + + + + + + + + diff --git a/samples/AroundMe/AroundMeTests/packages.config b/samples/AroundMe/AroundMeTests/packages.config index 753b9e2a5..60e777c09 100644 --- a/samples/AroundMe/AroundMeTests/packages.config +++ b/samples/AroundMe/AroundMeTests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj b/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj new file mode 100644 index 000000000..eba29ac4d --- /dev/null +++ b/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj @@ -0,0 +1,140 @@ + + + + + Debug + AnyCPU + + + 2.0 + {7AC62D04-57DD-433D-89D9-34E5C240E353} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + AroundMeWeb + AroundMeWeb + v4.0 + true + + + + + true + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + {c1aff814-2c3a-4d04-88a4-5cf10d07aa56} + AroundMe + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 10065 + / + http://localhost:10056/ + False + False + + + False + + + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMe/Content/CloseButton.png b/samples/AroundMe/AroundMeWeb/Content/CloseButton.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/CloseButton.png rename to samples/AroundMe/AroundMeWeb/Content/CloseButton.png diff --git a/samples/AroundMe/AroundMe/Content/Dot.png b/samples/AroundMe/AroundMeWeb/Content/Dot.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Dot.png rename to samples/AroundMe/AroundMeWeb/Content/Dot.png diff --git a/samples/AroundMe/AroundMe/Content/Flickr.png b/samples/AroundMe/AroundMeWeb/Content/Flickr.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Flickr.png rename to samples/AroundMe/AroundMeWeb/Content/Flickr.png diff --git a/samples/AroundMe/AroundMe/Content/Heart.png b/samples/AroundMe/AroundMeWeb/Content/Heart.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Heart.png rename to samples/AroundMe/AroundMeWeb/Content/Heart.png diff --git a/samples/AroundMe/AroundMe/Content/Location.png b/samples/AroundMe/AroundMeWeb/Content/Location.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Location.png rename to samples/AroundMe/AroundMeWeb/Content/Location.png diff --git a/samples/AroundMe/AroundMe/Content/PlaceHolder.png b/samples/AroundMe/AroundMeWeb/Content/PlaceHolder.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/PlaceHolder.png rename to samples/AroundMe/AroundMeWeb/Content/PlaceHolder.png diff --git a/samples/AroundMe/AroundMe/Content/ProgressBar.gif b/samples/AroundMe/AroundMeWeb/Content/ProgressBar.gif similarity index 100% rename from samples/AroundMe/AroundMe/Content/ProgressBar.gif rename to samples/AroundMe/AroundMeWeb/Content/ProgressBar.gif diff --git a/samples/AroundMe/AroundMe/Content/Pushpin.png b/samples/AroundMe/AroundMeWeb/Content/Pushpin.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Pushpin.png rename to samples/AroundMe/AroundMeWeb/Content/Pushpin.png diff --git a/samples/AroundMe/AroundMe/Content/Reset.png b/samples/AroundMe/AroundMeWeb/Content/Reset.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Reset.png rename to samples/AroundMe/AroundMeWeb/Content/Reset.png diff --git a/samples/AroundMe/AroundMe/Content/Search.png b/samples/AroundMe/AroundMeWeb/Content/Search.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Search.png rename to samples/AroundMe/AroundMeWeb/Content/Search.png diff --git a/samples/AroundMe/AroundMe/Content/Site.css b/samples/AroundMe/AroundMeWeb/Content/Site.css similarity index 100% rename from samples/AroundMe/AroundMe/Content/Site.css rename to samples/AroundMe/AroundMeWeb/Content/Site.css diff --git a/samples/AroundMe/AroundMe/Content/Twitter.png b/samples/AroundMe/AroundMeWeb/Content/Twitter.png similarity index 100% rename from samples/AroundMe/AroundMe/Content/Twitter.png rename to samples/AroundMe/AroundMeWeb/Content/Twitter.png diff --git a/samples/AroundMe/AroundMe/Content/AroundMe.htm b/samples/AroundMe/AroundMeWeb/Default.htm similarity index 69% rename from samples/AroundMe/AroundMe/Content/AroundMe.htm rename to samples/AroundMe/AroundMeWeb/Default.htm index d5846da06..808a07fea 100644 --- a/samples/AroundMe/AroundMe/Content/AroundMe.htm +++ b/samples/AroundMe/AroundMeWeb/Default.htm @@ -3,7 +3,7 @@ Photos Around Me - + - - - - + + + + + + + diff --git a/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs b/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ed92f5b9e --- /dev/null +++ b/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("AroundMeWeb")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/AroundMe/AroundMeWeb/packages.config b/samples/AroundMe/AroundMeWeb/packages.config new file mode 100644 index 000000000..7eae9ad2f --- /dev/null +++ b/samples/AroundMe/AroundMeWeb/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/AroundMe/MapDemo/Map.htm b/samples/AroundMe/MapDemo/Map.htm index bb66498bb..98e2c81c4 100644 --- a/samples/AroundMe/MapDemo/Map.htm +++ b/samples/AroundMe/MapDemo/Map.htm @@ -12,8 +12,11 @@ - - - + + + + + diff --git a/samples/AroundMe/MapDemo/MapDemo.csproj b/samples/AroundMe/MapDemo/MapDemo.csproj index 8e7e73c4a..2b356c948 100644 --- a/samples/AroundMe/MapDemo/MapDemo.csproj +++ b/samples/AroundMe/MapDemo/MapDemo.csproj @@ -33,27 +33,28 @@ bin\Release\MapDemo.xml - + + Designer + - + + + PreserveNewest + + - ..\packages\ScriptSharp.Lib.BingMaps.0.7.5.0\lib\Script.Microsoft.BingMaps.dll + ..\packages\ScriptSharp.Lib.BingMaps.0.8\lib\Script.Microsoft.BingMaps.dll - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll - - - PreserveNewest - - - + \ No newline at end of file diff --git a/samples/AroundMe/MapDemo/MapPage.cs b/samples/AroundMe/MapDemo/MapPage.cs index 843dac4e9..947350292 100644 --- a/samples/AroundMe/MapDemo/MapPage.cs +++ b/samples/AroundMe/MapDemo/MapPage.cs @@ -75,7 +75,7 @@ public void Run() { venueOptions.SuccessCallback = delegate(VenueMap venueMap, VenueMapOptions options) { venueMap.Show(); - if (Script.Confirm("Zoom to " + venueMap.Name + "?")) { + if (Window.Confirm("Zoom to " + venueMap.Name + "?")) { _map.SetView(venueMap.BestMapView); } }; diff --git a/samples/AroundMe/MapDemo/Properties/Script.template b/samples/AroundMe/MapDemo/Properties/Script.template deleted file mode 100644 index d0fad56de..000000000 --- a/samples/AroundMe/MapDemo/Properties/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function() { -#include[as-is] "%code%" -})(); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/AroundMe/MapDemo/packages.config b/samples/AroundMe/MapDemo/packages.config index a7a59cc42..b032fdf58 100644 --- a/samples/AroundMe/MapDemo/packages.config +++ b/samples/AroundMe/MapDemo/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs b/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs index 80fc9acb6..aeffd12c5 100644 --- a/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs +++ b/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs @@ -19,4 +19,4 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("Twitter")] +[assembly: ScriptAssembly("twttr")] diff --git a/samples/AroundMe/Twitter/Twitter.cs b/samples/AroundMe/Twitter/Twitter.cs index 291e1b475..664bced9c 100644 --- a/samples/AroundMe/Twitter/Twitter.cs +++ b/samples/AroundMe/Twitter/Twitter.cs @@ -10,8 +10,8 @@ namespace TwitterApi { public delegate void TwitterCallback(TwitterObject twitterObject); - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("twttr")] public static class Twitter { @@ -19,8 +19,8 @@ public static void Anywhere(TwitterCallback callback) { } } - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TweetBoxOptions { @@ -30,52 +30,52 @@ public TweetBoxOptions() { public TweetBoxOptions(params object[] nameValuePairs) { } - [IntrinsicProperty] + [ScriptField] public bool Counter { get; set; } - [IntrinsicProperty] + [ScriptField] public TweetBoxData Data { get; set; } - [IntrinsicProperty] + [ScriptField] public string DefaultContent { get; set; } - [IntrinsicProperty] + [ScriptField] public int Height { get; set; } - [IntrinsicProperty] + [ScriptField] public string Label { get; set; } [ScriptName("onTweet")] - [IntrinsicProperty] + [ScriptField] public TweetCallback Callback { get; set; } - [IntrinsicProperty] + [ScriptField] public int Width { get; set; } } - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TweetBoxData { @@ -86,14 +86,14 @@ public TweetBoxData(params object[] nameValuePairs) { } [ScriptName("lat")] - [IntrinsicProperty] + [ScriptField] public double Latitude { get; set; } [ScriptName("lon")] - [IntrinsicProperty] + [ScriptField] public double Longitude { get; set; @@ -103,8 +103,8 @@ public double Longitude { public delegate void TweetCallback(string text, string htmlText); - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class TwitterObject { private TwitterObject() { diff --git a/samples/AroundMe/Twitter/Twitter.csproj b/samples/AroundMe/Twitter/Twitter.csproj index 171fb0894..897e5ee2d 100644 --- a/samples/AroundMe/Twitter/Twitter.csproj +++ b/samples/AroundMe/Twitter/Twitter.csproj @@ -40,13 +40,13 @@
    - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll - + \ No newline at end of file diff --git a/samples/AroundMe/Twitter/packages.config b/samples/AroundMe/Twitter/packages.config index 794c9675d..059657ee7 100644 --- a/samples/AroundMe/Twitter/packages.config +++ b/samples/AroundMe/Twitter/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/samples/AroundMe/packages/repositories.config b/samples/AroundMe/packages/repositories.config index e003ad5ea..172820c43 100644 --- a/samples/AroundMe/packages/repositories.config +++ b/samples/AroundMe/packages/repositories.config @@ -2,6 +2,7 @@ + \ No newline at end of file diff --git a/samples/Cellar/Cellar.sln b/samples/Cellar/Cellar.sln new file mode 100644 index 000000000..b29f739b5 --- /dev/null +++ b/samples/Cellar/Cellar.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CellarServer", "CellarServer\CellarServer.csproj", "{C58080FF-3DFB-4EBC-A05F-B35EEB686E33}" + ProjectSection(ProjectDependencies) = postProject + {E32153A0-364C-418F-B409-287B764E2875} = {E32153A0-364C-418F-B409-287B764E2875} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CellarClient", "CellarClient\CellarClient.csproj", "{E32153A0-364C-418F-B409-287B764E2875}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C58080FF-3DFB-4EBC-A05F-B35EEB686E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C58080FF-3DFB-4EBC-A05F-B35EEB686E33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C58080FF-3DFB-4EBC-A05F-B35EEB686E33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C58080FF-3DFB-4EBC-A05F-B35EEB686E33}.Release|Any CPU.Build.0 = Release|Any CPU + {E32153A0-364C-418F-B409-287B764E2875}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E32153A0-364C-418F-B409-287B764E2875}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E32153A0-364C-418F-B409-287B764E2875}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E32153A0-364C-418F-B409-287B764E2875}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/Cellar/CellarClient/CellarApplication.cs b/samples/Cellar/CellarClient/CellarApplication.cs new file mode 100644 index 000000000..976e5f76f --- /dev/null +++ b/samples/Cellar/CellarClient/CellarApplication.cs @@ -0,0 +1,106 @@ +// CellarApplication.cs +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Serialization; +using Cellar.DataModels; +using KnockoutApi; + +namespace Cellar { + + public sealed class CellarApplication { + + private const int WinesPerPage = 8; + + private readonly Observable _pageIndex; + private readonly Observable _pages; + + public readonly ComputedObservable CanGoPrevious; + public readonly ComputedObservable CanGoNext; + public readonly Observable> Wines; + public readonly Observable SelectedWine; + public readonly ComputedObservable ShowSelection; + + public readonly Action Next; + public readonly Action Previous; + public readonly Action Select; + + public CellarApplication() { + _pages = Knockout.Observable(0); + _pageIndex = Knockout.Observable(0); + + Wines = Knockout.Observable>(); + SelectedWine = Knockout.Observable(); + CanGoPrevious = Knockout.Computed(ComputeCanGoPrevious); + CanGoNext = Knockout.Computed(ComputeCanGoNext); + ShowSelection = Knockout.Computed(ComputeShowSelection); + + Next = delegate() { + NextCommand(); + }; + Previous = delegate() { + PreviousCommand(); + }; + Select = delegate(Wine wine) { + SelectCommand(wine); + }; + + LoadWines(); + } + + private bool ComputeCanGoNext() { + return _pageIndex.GetValue() < (_pages.GetValue() - 1); + } + + private bool ComputeCanGoPrevious() { + return _pageIndex.GetValue() > 0; + } + + private bool ComputeShowSelection() { + return SelectedWine.GetValue() != null; + } + + private void LoadWines() { + int skip = _pageIndex.GetValue() * WinesPerPage; + + XmlHttpRequest xhr = new XmlHttpRequest(); + xhr.OnReadyStateChange = delegate() { + if ((xhr.ReadyState == ReadyState.Loaded) && + (xhr.Status == 200)) { + WineResults results = Json.ParseData(xhr.ResponseText); + + if (results.Count != 0) { + _pages.SetValue(Math.Ceil(results.Count / WinesPerPage)); + } + + Wines.SetValue(results.Wines); + + Wine selectedWine = null; + if ((results.Wines != null) && (results.Wines.Length != 0)) { + selectedWine = results.Wines[0]; + } + SelectedWine.SetValue(selectedWine); + } + }; + + xhr.Open(HttpVerb.Get, "/wines/?skip=" + skip + "&count=" + WinesPerPage, true); + xhr.Send(); + } + + private void PreviousCommand() { + _pageIndex.SetValue(_pageIndex.GetValue() - 1); + LoadWines(); + } + + private void NextCommand() { + _pageIndex.SetValue(_pageIndex.GetValue() + 1); + LoadWines(); + } + + private void SelectCommand(Wine wine) { + SelectedWine.SetValue(wine); + } + } +} diff --git a/samples/Cellar/CellarClient/CellarClient.csproj b/samples/Cellar/CellarClient/CellarClient.csproj new file mode 100644 index 000000000..6fe72fa2a --- /dev/null +++ b/samples/Cellar/CellarClient/CellarClient.csproj @@ -0,0 +1,56 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {E32153A0-364C-418F-B409-287B764E2875} + Library + Properties + Cellar + cellar + Properties\FxCop.ruleset + True + True + True + True + true + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\cellar.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\cellar.xml + + + + + + + + + + + + + ..\packages\ScriptSharp.Lib.Knockout.0.8\lib\Script.Knockout.dll + + + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll + + + + + + \ No newline at end of file diff --git a/samples/Cellar/CellarClient/DataModels/Wine.cs b/samples/Cellar/CellarClient/DataModels/Wine.cs new file mode 100644 index 000000000..623259fd8 --- /dev/null +++ b/samples/Cellar/CellarClient/DataModels/Wine.cs @@ -0,0 +1,22 @@ +// Wine.cs +// + +using System; +using System.Collections.Generic; + +namespace Cellar.DataModels { + + [ScriptObject] + public sealed class Wine { + + [ScriptName("_id")] + public int ID; + public string Name; + public int Year; + public string Grapes; + public string Country; + public string Region; + public string Description; + public string Image; + } +} diff --git a/samples/Cellar/CellarClient/DataModels/WineResults.cs b/samples/Cellar/CellarClient/DataModels/WineResults.cs new file mode 100644 index 000000000..7298c5eb3 --- /dev/null +++ b/samples/Cellar/CellarClient/DataModels/WineResults.cs @@ -0,0 +1,16 @@ +// WineResults.cs +// + +using System; +using System.Runtime.CompilerServices; + +namespace Cellar.DataModels { + + [ScriptImport] + [ScriptObject] + public sealed class WineResults { + + public int Count; + public Wine[] Wines; + } +} diff --git a/samples/Cellar/CellarClient/Page.cs b/samples/Cellar/CellarClient/Page.cs new file mode 100644 index 000000000..9ec277527 --- /dev/null +++ b/samples/Cellar/CellarClient/Page.cs @@ -0,0 +1,14 @@ +// Page.cs +// + +using System; +using KnockoutApi; +using Cellar; + +[ScriptModule] +internal static class Page { + + static Page() { + Knockout.ApplyBindings(new CellarApplication()); + } +} diff --git a/samples/Cellar/CellarClient/Properties/AssemblyInfo.cs b/samples/Cellar/CellarClient/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d4db5084b --- /dev/null +++ b/samples/Cellar/CellarClient/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Cellar")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Cellar Sample for Script#")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("cellar")] +[assembly: ScriptReference("knockout", Path="knockout-2.1.0")] + +// A script template using an AMD pattern for declaring dependencies consumed +// by the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/FxCop.ruleset b/samples/Cellar/CellarClient/Properties/FxCop.ruleset similarity index 100% rename from src/ZipX/ProjectTemplates/ClassLibrary/FxCop.ruleset rename to samples/Cellar/CellarClient/Properties/FxCop.ruleset diff --git a/samples/Cellar/CellarClient/packages.config b/samples/Cellar/CellarClient/packages.config new file mode 100644 index 000000000..cf5db3f97 --- /dev/null +++ b/samples/Cellar/CellarClient/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/Cellar/CellarServer/CellarApplication.cs b/samples/Cellar/CellarServer/CellarApplication.cs new file mode 100644 index 000000000..cd31db2d2 --- /dev/null +++ b/samples/Cellar/CellarServer/CellarApplication.cs @@ -0,0 +1,67 @@ +// CellarApplication.cs +// + +using System; +using System.Diagnostics; +using System.Serialization; +using System.Threading; +using NodeApi.IO; +using NodeApi.Network; +using Cellar.Controllers; +using Cellar.DataModels; +using Cellar.Services; +using Cellar.Services.MongoLab; + +namespace Cellar { + + internal sealed class CellarApplication { + + private IWineRepository _repository; + + public WinesController CreateWinesController() { + return new WinesController(_repository); + } + + public void Initialize(string dbUrl, Action callback) { + UrlData urlData = Url.Parse(dbUrl); + string[] credentials = urlData.Auth.Split(':'); + + MongoWineRepository.Create(urlData.HostName, Number.ParseInt(urlData.Port, 10), + urlData.Path.Substr(1), + credentials[0], credentials[1]) + .Done(delegate(MongoWineRepository repository) { + _repository = repository; + _repository.CountWines() + .ContinueWith(delegate(Task countTask) { + if ((countTask.Error != null) || + (countTask.Result == 0)) { + PopulateRepository(callback); + } + else { + Debug.WriteLine("Repository initialized (and already populated)."); + callback(null); + } + }); + }) + .Fail(delegate(Exception error) { + callback(new Exception("Unable to create repository.")); + }); + } + + private void PopulateRepository(Action callback) { + Debug.WriteLine("Populating repository..."); + + string data = FileSystem.ReadFileTextSync("data.json", Encoding.UTF8); + Wine[] wines = Json.ParseData(data); + + _repository.InsertWines(wines) + .Done(delegate() { + Debug.WriteLine("Repository populated."); + callback(null); + }) + .Fail(delegate(Exception error) { + callback(new Exception("Could not populate repository.")); + }); + } + } +} diff --git a/samples/Cellar/CellarServer/CellarServer.csproj b/samples/Cellar/CellarServer/CellarServer.csproj new file mode 100644 index 000000000..fa484946a --- /dev/null +++ b/samples/Cellar/CellarServer/CellarServer.csproj @@ -0,0 +1,189 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {C58080FF-3DFB-4EBC-A05F-B35EEB686E33} + Library + Properties + Cellar + Cellar.Server + cellar + Properties\FxCop.ruleset + True + True + False + True + node_modules + true + Content\Scripts + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + + + + + + + + + Content\scripts\cellar.js + Always + + + Content\scripts\cellar.min.js + Always + + + Content\scripts\ss.js + Always + + + Content\scripts\ss.min.js + Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + PreserveNewest + + + + + ..\packages\ScriptSharp.Lib.Node.0.8\lib\Script.Node.dll + + + False + ..\packages\ScriptSharp.Lib.Node.Express.0.8\lib\Script.Node.Express.dll + + + False + ..\packages\ScriptSharp.Lib.Node.Mongo.0.8\lib\Script.Node.Mongo.dll + + + + + + + \ No newline at end of file diff --git a/samples/Cellar/CellarServer/Content/cellar.html b/samples/Cellar/CellarServer/Content/cellar.html new file mode 100644 index 000000000..bf0e18844 --- /dev/null +++ b/samples/Cellar/CellarServer/Content/cellar.html @@ -0,0 +1,43 @@ + + + + Wines in the Cellar + + + + +
    +
    +

    Cellar

    +
    +
    +
    + +
    +

    + +

    +

    +

    +

    + × +
    +
    +
    + + +
    + + + + + diff --git a/samples/Cellar/CellarServer/Content/images/bg.jpg b/samples/Cellar/CellarServer/Content/images/bg.jpg new file mode 100644 index 000000000..5ba169b08 Binary files /dev/null and b/samples/Cellar/CellarServer/Content/images/bg.jpg differ diff --git a/samples/Cellar/CellarServer/Content/images/github.png b/samples/Cellar/CellarServer/Content/images/github.png new file mode 100644 index 000000000..9194d80c4 Binary files /dev/null and b/samples/Cellar/CellarServer/Content/images/github.png differ diff --git a/samples/Cellar/CellarServer/Content/images/wine.png b/samples/Cellar/CellarServer/Content/images/wine.png new file mode 100644 index 000000000..d0ab24783 Binary files /dev/null and b/samples/Cellar/CellarServer/Content/images/wine.png differ diff --git a/samples/Cellar/CellarServer/Content/index.html b/samples/Cellar/CellarServer/Content/index.html new file mode 100644 index 000000000..fb04c6d87 --- /dev/null +++ b/samples/Cellar/CellarServer/Content/index.html @@ -0,0 +1,18 @@ + + + + Cellar + + + + + + + + diff --git a/samples/Cellar/CellarServer/Content/scripts/jquery-1.4.4.min.js b/samples/Cellar/CellarServer/Content/scripts/jquery-1.4.4.min.js new file mode 100644 index 000000000..2bd4cbb8a --- /dev/null +++ b/samples/Cellar/CellarServer/Content/scripts/jquery-1.4.4.min.js @@ -0,0 +1,167 @@ +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
    a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
    ";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
    t
    ";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

    ";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
    ").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); \ No newline at end of file diff --git a/samples/Cellar/CellarServer/Content/scripts/jquery.reveal.js b/samples/Cellar/CellarServer/Content/scripts/jquery.reveal.js new file mode 100644 index 000000000..9140d48b4 --- /dev/null +++ b/samples/Cellar/CellarServer/Content/scripts/jquery.reveal.js @@ -0,0 +1,160 @@ +/* + * jQuery Reveal Plugin 1.0 + * www.ZURB.com + * Copyright 2010, ZURB + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php +*/ + + +(function($) { + +/*--------------------------- + Defaults for Reveal +----------------------------*/ + +/*--------------------------- + Listener for data-reveal-id attributes +----------------------------*/ + + $('a[data-reveal-id]').live('click', function(e) { + e.preventDefault(); + var modalLocation = $(this).attr('data-reveal-id'); + $('#'+modalLocation).reveal($(this).data()); + }); + +/*--------------------------- + Extend and Execute +----------------------------*/ + + $.fn.reveal = function(options) { + + + var defaults = { + animation: 'fadeAndPop', //fade, fadeAndPop, none + animationspeed: 300, //how fast animtions are + closeonbackgroundclick: true, //if you click background will modal close? + dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal + }; + + //Extend dem' options + var options = $.extend({}, defaults, options); + + return this.each(function() { + +/*--------------------------- + Global Variables +----------------------------*/ + var modal = $(this), + topMeasure = parseInt(modal.css('top')), + topOffset = modal.height() + topMeasure, + locked = false, + modalBG = $('.reveal-modal-bg'); + +/*--------------------------- + Create Modal BG +----------------------------*/ + if(modalBG.length == 0) { + modalBG = $('
    ').insertAfter(modal); + } + +/*--------------------------- + Open & Close Animations +----------------------------*/ + //Entrance Animations + modal.bind('reveal:open', function () { + modalBG.unbind('click.modalEvent'); + $('.' + options.dismissmodalclass).unbind('click.modalEvent'); + if(!locked) { + lockModal(); + if(options.animation == "fadeAndPop") { + modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible'}); + modalBG.fadeIn(options.animationspeed/2); + modal.delay(options.animationspeed/2).animate({ + "top": $(document).scrollTop()+topMeasure + 'px', + "opacity" : 1 + }, options.animationspeed,unlockModal()); + } + if(options.animation == "fade") { + modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure}); + modalBG.fadeIn(options.animationspeed/2); + modal.delay(options.animationspeed/2).animate({ + "opacity" : 1 + }, options.animationspeed,unlockModal()); + } + if(options.animation == "none") { + modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure}); + modalBG.css({"display":"block"}); + unlockModal() + } + } + modal.unbind('reveal:open'); + }); + + //Closing Animation + modal.bind('reveal:close', function () { + if(!locked) { + lockModal(); + if(options.animation == "fadeAndPop") { + modalBG.delay(options.animationspeed).fadeOut(options.animationspeed); + modal.animate({ + "top": $(document).scrollTop()-topOffset + 'px', + "opacity" : 0 + }, options.animationspeed/2, function() { + modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'}); + unlockModal(); + }); + } + if(options.animation == "fade") { + modalBG.delay(options.animationspeed).fadeOut(options.animationspeed); + modal.animate({ + "opacity" : 0 + }, options.animationspeed, function() { + modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure}); + unlockModal(); + }); + } + if(options.animation == "none") { + modal.css({'visibility' : 'hidden', 'top' : topMeasure}); + modalBG.css({'display' : 'none'}); + } + } + modal.unbind('reveal:close'); + }); + +/*--------------------------- + Open and add Closing Listeners +----------------------------*/ + //Open Modal Immediately + modal.trigger('reveal:open') + + //Close Modal Listeners + var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () { + modal.trigger('reveal:close') + }); + + if(options.closeonbackgroundclick) { + modalBG.css({"cursor":"pointer"}) + modalBG.bind('click.modalEvent', function () { + modal.trigger('reveal:close') + }); + } + $('body').keyup(function(e) { + if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key + }); + + +/*--------------------------- + Animations Locks +----------------------------*/ + function unlockModal() { + locked = false; + } + function lockModal() { + locked = true; + } + + });//each call + }//orbit plugin call +})(jQuery); + diff --git a/samples/Cellar/CellarServer/Content/scripts/knockout-2.1.0.js b/samples/Cellar/CellarServer/Content/scripts/knockout-2.1.0.js new file mode 100644 index 000000000..107026da1 --- /dev/null +++ b/samples/Cellar/CellarServer/Content/scripts/knockout-2.1.0.js @@ -0,0 +1,86 @@ +// Knockout JavaScript library v2.1.0 +// (c) Steven Sanderson - http://knockoutjs.com/ +// License: MIT (http://www.opensource.org/licenses/mit-license.php) + +(function(window,document,navigator,undefined){ +function m(w){throw w;}var n=void 0,p=!0,s=null,t=!1;function A(w){return function(){return w}};function E(w){function B(b,c,d){d&&c!==a.k.r(b)&&a.k.S(b,c);c!==a.k.r(b)&&a.a.va(b,"change")}var a="undefined"!==typeof w?w:{};a.b=function(b,c){for(var d=b.split("."),f=a,g=0;g",c[0];);return 4a.a.j(c,b[e])&&c.push(b[e]);return c},T:function(a,b){for(var a=a||[],c=[], +e=0,f=a.length;ea.length?t:a.substring(0,b.length)===b},eb:function(a,b){for(var c="return ("+a+")",e=0;e","
    "]||!d.indexOf("",""]||(!d.indexOf("",""]||[0,"",""];b="ignored
    "+d[1]+b+d[2]+"
    ";for("function"==typeof window.innerShiv?c.appendChild(window.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.L(c.lastChild.childNodes)}return c}; +a.a.Y=function(b,c){a.a.ga(b);if(c!==s&&c!==n)if("string"!=typeof c&&(c=c.toString()),"undefined"!=typeof jQuery)jQuery(b).html(c);else for(var d=a.a.pa(c),f=0;f"},Va:function(a,b){var c=d[a];c===n&&m(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));try{return c.apply(s,b||[]),p}finally{delete d[a]}},Wa:function(b,d){var e=[];c(b,e);for(var h=0,j=e.length;hc;c++)b=b();return b})};a.toJSON=function(b,c,e){b=a.Ta(b);return a.a.sa(b,c,e)}})();a.b("toJS",a.Ta);a.b("toJSON",a.toJSON);(function(){a.k={r:function(b){switch(a.a.o(b)){case "option":return b.__ko__hasDomDataOptionValue__===p?a.a.f.get(b,a.c.options.oa):b.getAttribute("value");case "select":return 0<=b.selectedIndex?a.k.r(b.options[b.selectedIndex]):n;default:return b.value}},S:function(b,c){switch(a.a.o(b)){case "option":switch(typeof c){case "string":a.a.f.set(b,a.c.options.oa, +n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.f.set(b,a.c.options.oa,c),b.__ko__hasDomDataOptionValue__=p,b.value="number"===typeof c?c:""}break;case "select":for(var d=b.options.length-1;0<=d;d--)if(a.k.r(b.options[d])==c){b.selectedIndex=d;break}break;default:if(c===s||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.k);a.b("selectExtensions.readValue",a.k.r);a.b("selectExtensions.writeValue",a.k.S);a.g=function(){function b(a,b){for(var d= +s;a!=d;)d=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,f=["true","false"];return{D:[],W:function(c){var e=a.a.w(c);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var c=[],d=s,f,k=0;k$/: +/^\s*ko\s+(.*\:.*)\s*$/,h=g?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,j={ul:p,ol:p};a.e={C:{},childNodes:function(a){return b(a)?d(a):a.childNodes},ha:function(c){if(b(c))for(var c=a.e.childNodes(c),e=0,d=c.length;e"),t))}};a.c.uniqueName.gb=0;a.c.checked={init:function(b,c,d){a.a.n(b,"click",function(){var f;if("checkbox"==b.type)f=b.checked;else if("radio"==b.type&&b.checked)f=b.value;else return;var g=c();"checkbox"==b.type&&a.a.d(g)instanceof Array?(f=a.a.j(a.a.d(g),b.value), +b.checked&&0>f?g.push(b.value):!b.checked&&0<=f&&g.splice(f,1)):a.g.$(g,d,"checked",f,p)});"radio"==b.type&&!b.name&&a.c.uniqueName.init(b,A(p))},update:function(b,c){var d=a.a.d(c());"checkbox"==b.type?b.checked=d instanceof Array?0<=a.a.j(d,b.value):d:"radio"==b.type&&(b.checked=b.value==d)}};var F={"class":"className","for":"htmlFor"};a.c.attr={update:function(b,c){var d=a.a.d(c())||{},f;for(f in d)if("string"==typeof f){var g=a.a.d(d[f]),e=g===t||g===s||g===n;e&&b.removeAttribute(f);8>=a.a.ja&& +f in F?(f=F[f],e?b.removeAttribute(f):b[f]=g):e||b.setAttribute(f,g.toString())}}};a.c.hasfocus={init:function(b,c,d){function f(b){var e=c();a.g.$(e,d,"hasfocus",b,p)}a.a.n(b,"focus",function(){f(p)});a.a.n(b,"focusin",function(){f(p)});a.a.n(b,"blur",function(){f(t)});a.a.n(b,"focusout",function(){f(t)})},update:function(b,c){var d=a.a.d(c());d?b.focus():b.blur();a.a.va(b,d?"focusin":"focusout")}};a.c["with"]={p:function(b){return function(){var c=b();return{"if":c,data:c,templateEngine:a.q.K}}}, +init:function(b,c){return a.c.template.init(b,a.c["with"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["with"].p(c),d,f,g)}};a.g.D["with"]=t;a.e.C["with"]=p;a.c["if"]={p:function(b){return function(){return{"if":b(),templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c["if"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["if"].p(c),d,f,g)}};a.g.D["if"]=t;a.e.C["if"]=p;a.c.ifnot={p:function(b){return function(){return{ifnot:b(),templateEngine:a.q.K}}}, +init:function(b,c){return a.c.template.init(b,a.c.ifnot.p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c.ifnot.p(c),d,f,g)}};a.g.D.ifnot=t;a.e.C.ifnot=p;a.c.foreach={p:function(b){return function(){var c=a.a.d(b());return!c||"number"==typeof c.length?{foreach:c,templateEngine:a.q.K}:{foreach:c.data,includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.p(c))}, +update:function(b,c,d,f,g){return a.c.template.update(b,a.c.foreach.p(c),d,f,g)}};a.g.D.foreach=t;a.e.C.foreach=p;a.t=function(){};a.t.prototype.renderTemplateSource=function(){m(Error("Override renderTemplateSource"))};a.t.prototype.createJavaScriptEvaluatorBlock=function(){m(Error("Override createJavaScriptEvaluatorBlock"))};a.t.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){var c=c||document,d=c.getElementById(b);d||m(Error("Cannot find template with ID "+b));return new a.l.i(d)}if(1== +b.nodeType||8==b.nodeType)return new a.l.M(b);m(Error("Unknown template type: "+b))};a.t.prototype.renderTemplate=function(a,c,d,f){return this.renderTemplateSource(this.makeTemplateSource(a,f),c,d)};a.t.prototype.isTemplateRewritten=function(a,c){return this.allowTemplateRewriting===t||!(c&&c!=document)&&this.V&&this.V[a]?p:this.makeTemplateSource(a,c).data("isRewritten")};a.t.prototype.rewriteTemplate=function(a,c,d){var f=this.makeTemplateSource(a,d),c=c(f.text());f.text(c);f.data("isRewritten", +p);!(d&&d!=document)&&"string"==typeof a&&(this.V=this.V||{},this.V[a]=p)};a.b("templateEngine",a.t);a.Z=function(){function b(b,c,e){for(var b=a.g.W(b),d=a.g.D,j=0;j/g;return{mb:function(b,c,e){c.isTemplateRewritten(b,e)||c.rewriteTemplate(b,function(b){return a.Z.zb(b,c)},e)},zb:function(a,g){return a.replace(c,function(a,c,d,f,i,l,q){return b(q,c,g)}).replace(d,function(a,c){return b(c,"<\!-- ko --\>",g)})},Za:function(b){return a.s.na(function(c, +e){c.nextSibling&&a.ya(c.nextSibling,b,e)})}}}();a.b("templateRewriting",a.Z);a.b("templateRewriting.applyMemoizedBindingsToNextSibling",a.Z.Za);(function(){a.l={};a.l.i=function(a){this.i=a};a.l.i.prototype.text=function(){var b=a.a.o(this.i),b="script"===b?"text":"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.i[b];var c=arguments[0];"innerHTML"===b?a.a.Y(this.i,c):this.i[b]=c};a.l.i.prototype.data=function(b){if(1===arguments.length)return a.a.f.get(this.i,"templateSourceData_"+ +b);a.a.f.set(this.i,"templateSourceData_"+b,arguments[1])};a.l.M=function(a){this.i=a};a.l.M.prototype=new a.l.i;a.l.M.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.i,"__ko_anon_template__")||{};b.ua===n&&b.da&&(b.ua=b.da.innerHTML);return b.ua}a.a.f.set(this.i,"__ko_anon_template__",{ua:arguments[0]})};a.l.i.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.i,"__ko_anon_template__")||{}).da;a.a.f.set(this.i,"__ko_anon_template__",{da:arguments[0]})}; +a.b("templateSources",a.l);a.b("templateSources.domElement",a.l.i);a.b("templateSources.anonymousTemplate",a.l.M)})();(function(){function b(b,c,d){for(var f,c=a.e.nextSibling(c);b&&(f=b)!==c;)b=a.e.nextSibling(f),(1===f.nodeType||8===f.nodeType)&&d(f)}function c(c,d){if(c.length){var f=c[0],g=c[c.length-1];b(f,g,function(b){a.xa(d,b)});b(f,g,function(b){a.s.Wa(b,[d])})}}function d(a){return a.nodeType?a:0a.a.ja)&&b.nodes?b.nodes():s; +if(c)return a.a.L(c.cloneNode(p).childNodes);b=b.text();return a.a.pa(b)};a.q.K=new a.q;a.ra(a.q.K);a.b("nativeTemplateEngine",a.q);(function(){a.ma=function(){var a=this.vb=function(){if("undefined"==typeof jQuery||!jQuery.tmpl)return 0;try{if(0<=jQuery.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,f,g){g=g||{};2>a&&m(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var e=b.data("precompiled"); +e||(e=b.text()||"",e=jQuery.template(s,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),b.data("precompiled",e));b=[f.$data];f=jQuery.extend({koBindingContext:f},g.templateOptions);f=jQuery.tmpl(e,b,f);f.appendTo(document.createElement("div"));jQuery.fragments={};return f};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){document.write(" - + + diff --git a/samples/FishTank/FishTankApplication.cs b/samples/FishTank/FishTankApplication.cs index 28d97accb..261549a0a 100644 --- a/samples/FishTank/FishTankApplication.cs +++ b/samples/FishTank/FishTankApplication.cs @@ -4,18 +4,15 @@ using System; using System.Collections; using System.Html; -using System.Runtime.CompilerServices; +using FishTankApp; -namespace FishTankApp { +[ScriptModule] +internal static class FishTankApplication { - [GlobalMethods] - internal static class FishTankApplication { - - static FishTankApplication() { - Window.AddEventListener("load", delegate(ElementEvent e) { - FishTank fishtank = new FishTank(); - fishtank.Run(); - }, /* useCapture */ false); - } + static FishTankApplication() { + Window.AddEventListener("load", delegate(ElementEvent e) { + FishTank fishtank = new FishTank(); + fishtank.Run(); + }, /* useCapture */ false); } } diff --git a/samples/FishTank/Properties/AssemblyInfo.cs b/samples/FishTank/Properties/AssemblyInfo.cs index 3da5e17cf..01b2bcf79 100644 --- a/samples/FishTank/Properties/AssemblyInfo.cs +++ b/samples/FishTank/Properties/AssemblyInfo.cs @@ -19,5 +19,13 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("FishTank")] -[assembly: ScriptNamespace("ft")] +[assembly: ScriptAssembly("ft")] +[assembly: ScriptTemplate(@" +// {name}.js +// + +'use strict'; +(function($global) { + {script} +})(this); +")] diff --git a/samples/FishTank/Properties/FxCop.ruleset b/samples/FishTank/Properties/FxCop.ruleset index eedb32ead..3fb02631d 100644 --- a/samples/FishTank/Properties/FxCop.ruleset +++ b/samples/FishTank/Properties/FxCop.ruleset @@ -1,7 +1,7 @@  - ..\packages\ScriptSharp.FxCop.0.7.5.0\tools + ..\packages\ScriptSharp.FxCop.0.8\tools @@ -103,5 +103,11 @@ + + + + + + \ No newline at end of file diff --git a/samples/FishTank/Properties/Script.template b/samples/FishTank/Properties/Script.template deleted file mode 100644 index d0fad56de..000000000 --- a/samples/FishTank/Properties/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function() { -#include[as-is] "%code%" -})(); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/FishTank/packages.config b/samples/FishTank/packages.config index 7025b00f8..fc57940f5 100644 --- a/samples/FishTank/packages.config +++ b/samples/FishTank/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/samples/KOWorld/App/App.csproj b/samples/KOWorld/App/App.csproj new file mode 100644 index 000000000..4045fe7a7 --- /dev/null +++ b/samples/KOWorld/App/App.csproj @@ -0,0 +1,55 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {6BFE535A-668C-447E-BAF9-AC84B120F9BF} + Library + Properties + App + App + Properties\FxCop.ruleset + True + True + False + True + True + true + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\App.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\App.xml + + + + + + + + + + + ..\packages\ScriptSharp.Lib.Knockout.0.8\lib\Script.Knockout.dll + + + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/App/AppModel.cs b/samples/KOWorld/App/AppModel.cs new file mode 100644 index 000000000..6edd5e959 --- /dev/null +++ b/samples/KOWorld/App/AppModel.cs @@ -0,0 +1,28 @@ +// Class1.cs +// + +using System; +using System.Collections.Generic; +using KnockoutApi; + +namespace App { + + public sealed class AppModel { + + public readonly Observable FirstName; + public readonly Observable LastName; + + public readonly ComputedObservable FullName; + + public AppModel() { + FirstName = Knockout.Observable(String.Empty); + LastName = Knockout.Observable(String.Empty); + + FullName = Knockout.Computed(ComputeFullName); + } + + private string ComputeFullName() { + return FirstName.GetValue() + " " + LastName.GetValue(); + } + } +} diff --git a/samples/KOWorld/App/HelloPage.cs b/samples/KOWorld/App/HelloPage.cs new file mode 100644 index 000000000..ab194c32e --- /dev/null +++ b/samples/KOWorld/App/HelloPage.cs @@ -0,0 +1,16 @@ +// HelloPage.cs +// + +using System; +using System.Collections.Generic; +using System.Html; +using KnockoutApi; +using App; + +[ScriptModule] +internal static class HelloPage { + + static HelloPage() { + Knockout.ApplyBindings(new AppModel()); + } +} diff --git a/samples/KOWorld/App/Properties/AssemblyInfo.cs b/samples/KOWorld/App/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..8a950eba1 --- /dev/null +++ b/samples/KOWorld/App/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("App")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("app")] +[assembly: ScriptReference("knockout", Path = "knockout-2.1.0")] + +// A script template allows customization of the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + * {copyright} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); + +// Generated with Script# {compiler} +")] diff --git a/samples/KOWorld/App/Properties/FxCop.ruleset b/samples/KOWorld/App/Properties/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/samples/KOWorld/App/Properties/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/App/packages.config b/samples/KOWorld/App/packages.config new file mode 100644 index 000000000..cf5db3f97 --- /dev/null +++ b/samples/KOWorld/App/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/KOWorld.sln b/samples/KOWorld/KOWorld.sln new file mode 100644 index 000000000..2db21065e --- /dev/null +++ b/samples/KOWorld/KOWorld.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Web\Web.csproj", "{05C1CE5C-8F5E-4739-81C6-498F734A5EC6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "App\App.csproj", "{6BFE535A-668C-447E-BAF9-AC84B120F9BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05C1CE5C-8F5E-4739-81C6-498F734A5EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05C1CE5C-8F5E-4739-81C6-498F734A5EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05C1CE5C-8F5E-4739-81C6-498F734A5EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05C1CE5C-8F5E-4739-81C6-498F734A5EC6}.Release|Any CPU.Build.0 = Release|Any CPU + {6BFE535A-668C-447E-BAF9-AC84B120F9BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6BFE535A-668C-447E-BAF9-AC84B120F9BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6BFE535A-668C-447E-BAF9-AC84B120F9BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6BFE535A-668C-447E-BAF9-AC84B120F9BF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/KOWorld/Web/Hello.html b/samples/KOWorld/Web/Hello.html new file mode 100644 index 000000000..800f683f3 --- /dev/null +++ b/samples/KOWorld/Web/Hello.html @@ -0,0 +1,17 @@ + + + + Hello World + + +

    Hello World

    +

    This page demonstrates a simple Knockout-based script generated with Script# and loaded with Require.js.

    +
    +
    +

    First name:

    +

    Last name:

    +

    Hello, !

    +
    + + + diff --git a/samples/KOWorld/Web/Properties/AssemblyInfo.cs b/samples/KOWorld/Web/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..a823916d8 --- /dev/null +++ b/samples/KOWorld/Web/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Web")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/KOWorld/Web/Web.csproj b/samples/KOWorld/Web/Web.csproj new file mode 100644 index 000000000..7057513a3 --- /dev/null +++ b/samples/KOWorld/Web/Web.csproj @@ -0,0 +1,109 @@ + + + + + Debug + AnyCPU + + + 2.0 + {05C1CE5C-8F5E-4739-81C6-498F734A5EC6} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Web + Web + v4.0 + true + + + + + true + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {6bfe535a-668c-447e-baf9-ac84b120f9bf} + App + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + True + True + 0 + / + http://localhost:1809/ + False + False + + + False + + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/Web/packages.config b/samples/KOWorld/Web/packages.config new file mode 100644 index 000000000..7a0ab739f --- /dev/null +++ b/samples/KOWorld/Web/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/packages/nuget.exe b/samples/KOWorld/packages/nuget.exe new file mode 100644 index 000000000..e313ff958 Binary files /dev/null and b/samples/KOWorld/packages/nuget.exe differ diff --git a/samples/KOWorld/packages/nuget.targets b/samples/KOWorld/packages/nuget.targets new file mode 100644 index 000000000..51fc72bd2 --- /dev/null +++ b/samples/KOWorld/packages/nuget.targets @@ -0,0 +1,16 @@ + + + + false + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory))) + $(MSBuildThisFileDirectory)nuget.exe install "$(MSBuildProjectDirectory)\packages.config" -o "$(PackagesDir)" + + RestorePackages; + $(BuildDependsOn); + + + + + + + \ No newline at end of file diff --git a/samples/KOWorld/packages/repositories.config b/samples/KOWorld/packages/repositories.config new file mode 100644 index 000000000..8b84ad906 --- /dev/null +++ b/samples/KOWorld/packages/repositories.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/samples/Photos/Photos/Photos.csproj b/samples/Photos/Flickr/Flickr.csproj similarity index 74% rename from samples/Photos/Photos/Photos.csproj rename to samples/Photos/Flickr/Flickr.csproj index b67740215..58bbe45de 100644 --- a/samples/Photos/Photos/Photos.csproj +++ b/samples/Photos/Flickr/Flickr.csproj @@ -8,13 +8,13 @@ {336CC726-E62D-484B-A15E-3E70A676D989} Library Properties - Photos - Photos - Properties\Script.template + Flickr + Flickr Properties\FxCop.ruleset True True true + True bin\Debug\ @@ -22,7 +22,7 @@ prompt 4 0028, 1591, 1684 - bin\Debug\Photos.xml + bin\Debug\Flickr.xml bin\Release\ @@ -30,12 +30,13 @@ prompt 4 0028, 1591, 1684 - bin\Release\Photos.xml + bin\Release\Flickr.xml - + + Designer + - @@ -45,14 +46,14 @@ - ..\packages\ScriptSharp.Lib.jQuery.0.7.5.0\lib\Script.jQuery.dll + ..\packages\ScriptSharp.Lib.jQuery.0.8\lib\Script.jQuery.dll - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll - + \ No newline at end of file diff --git a/samples/Photos/Photos/FlickrClient/Flickr.cs b/samples/Photos/Flickr/FlickrClient/Flickr.cs similarity index 87% rename from samples/Photos/Photos/FlickrClient/Flickr.cs rename to samples/Photos/Flickr/FlickrClient/Flickr.cs index 80d7bc7ba..6d70bd84c 100644 --- a/samples/Photos/Photos/FlickrClient/Flickr.cs +++ b/samples/Photos/Flickr/FlickrClient/Flickr.cs @@ -4,9 +4,8 @@ using System; using System.Collections.Generic; using System.Html; -using System.Runtime.CompilerServices; -namespace Photos.FlickrClient { +namespace Flickr.FlickrClient { public interface IFlickrService { @@ -22,9 +21,10 @@ public void SearchPhotos(string tags, int count, FlickrSearchCallback callback) FlickrCallback requestCallback = delegate(PhotoSearchResponse response) { callback(response.Photos.Results); }; - string callbackName = Delegate.CreateExport(requestCallback); - string url = String.Format(FlickrSearchURLFormat, tags.EncodeUriComponent(), count, callbackName); + Export exportedDelegate = Delegate.Export(requestCallback); + + string url = String.Format(FlickrSearchURLFormat, tags.EncodeUriComponent(), count, exportedDelegate.Name); ScriptElement script = (ScriptElement)Document.CreateElement("script"); script.Type = "text/javascript"; script.Src = url; diff --git a/samples/Photos/Photos/FlickrClient/Json.cs b/samples/Photos/Flickr/FlickrClient/Json.cs similarity index 88% rename from samples/Photos/Photos/FlickrClient/Json.cs rename to samples/Photos/Flickr/FlickrClient/Json.cs index 0d4e5736a..63dbdc1a8 100644 --- a/samples/Photos/Photos/FlickrClient/Json.cs +++ b/samples/Photos/Flickr/FlickrClient/Json.cs @@ -6,23 +6,23 @@ using System.Runtime.CompilerServices; using jQueryApi; -namespace Photos.FlickrClient { +namespace Flickr.FlickrClient { - [Imported] + [ScriptImport] public sealed class PhotoSearchResponse { [ScriptName("photos")] public PhotoCollection Photos; } - [Imported] + [ScriptImport] public sealed class PhotoCollection { [ScriptName("photo")] public List Results; } - [Imported] + [ScriptImport] public sealed class PhotoResult { public string ID; diff --git a/samples/Photos/Photos/FlickrPhotoService.cs b/samples/Photos/Flickr/FlickrPhotoService.cs similarity index 98% rename from samples/Photos/Photos/FlickrPhotoService.cs rename to samples/Photos/Flickr/FlickrPhotoService.cs index 5a929a3dd..4eb262b6e 100644 --- a/samples/Photos/Photos/FlickrPhotoService.cs +++ b/samples/Photos/Flickr/FlickrPhotoService.cs @@ -5,9 +5,9 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using jQueryApi; -using Photos.FlickrClient; +using Flickr.FlickrClient; -namespace Photos { +namespace Flickr { public sealed class FlickrPhotoService : IPhotoService { diff --git a/samples/Photos/Photos/IPhotoService.cs b/samples/Photos/Flickr/IPhotoService.cs similarity index 91% rename from samples/Photos/Photos/IPhotoService.cs rename to samples/Photos/Flickr/IPhotoService.cs index 860a14682..6d213c831 100644 --- a/samples/Photos/Photos/IPhotoService.cs +++ b/samples/Photos/Flickr/IPhotoService.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using jQueryApi; -namespace Photos { +namespace Flickr { public interface IPhotoService { diff --git a/samples/Photos/Photos/Photo.cs b/samples/Photos/Flickr/Photo.cs similarity index 93% rename from samples/Photos/Photos/Photo.cs rename to samples/Photos/Flickr/Photo.cs index 18875f0ed..9d51c40b0 100644 --- a/samples/Photos/Photos/Photo.cs +++ b/samples/Photos/Flickr/Photo.cs @@ -3,12 +3,13 @@ using System; -namespace Photos { +namespace Flickr { /// /// Represents a geo-tagged photo along with various bits of metadata. /// - public sealed class Photo : Record { + [ScriptObject] + public sealed class Photo { public string id; diff --git a/samples/Photos/Photos/Properties/AssemblyInfo.cs b/samples/Photos/Flickr/Properties/AssemblyInfo.cs similarity index 94% rename from samples/Photos/Photos/Properties/AssemblyInfo.cs rename to samples/Photos/Flickr/Properties/AssemblyInfo.cs index b22746978..192f0e8ee 100644 --- a/samples/Photos/Photos/Properties/AssemblyInfo.cs +++ b/samples/Photos/Flickr/Properties/AssemblyInfo.cs @@ -19,4 +19,4 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("Flickr")] +[assembly: ScriptAssembly("flickr")] diff --git a/samples/Photos/Flickr/Properties/FxCop.ruleset b/samples/Photos/Flickr/Properties/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/samples/Photos/Flickr/Properties/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Photos/Flickr/packages.config b/samples/Photos/Flickr/packages.config new file mode 100644 index 000000000..e8686f25f --- /dev/null +++ b/samples/Photos/Flickr/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/Photos/PhotoGrid/PhotoGrid.csproj b/samples/Photos/PhotoGrid/PhotoGrid.csproj index 0e4c98d22..10c5708ec 100644 --- a/samples/Photos/PhotoGrid/PhotoGrid.csproj +++ b/samples/Photos/PhotoGrid/PhotoGrid.csproj @@ -10,12 +10,11 @@ Properties PhotoGrid PhotoGrid - Properties\Script.template Properties\FxCop.ruleset True True - ..\PhotosWeb\Scripts true + True bin\Debug\ @@ -36,25 +35,24 @@ - - ..\packages\ScriptSharp.Lib.jQuery.0.7.5.0\lib\Script.jQuery.dll + ..\packages\ScriptSharp.Lib.jQuery.0.8\lib\Script.jQuery.dll - ..\packages\ScriptSharp.Lib.jQuery.Templating.0.7.5.0\lib\Script.jQuery.Templating.dll + ..\packages\ScriptSharp.Lib.jQuery.Templating.0.8\lib\Script.jQuery.Templating.dll - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll - + {336cc726-e62d-484b-a15e-3e70a676d989} - Photos + Flickr {a441a116-8f91-4fbc-8420-d21c98283bd3} @@ -62,6 +60,6 @@ - + \ No newline at end of file diff --git a/samples/Photos/PhotoGrid/PhotoGridPage.cs b/samples/Photos/PhotoGrid/PhotoGridPage.cs index 8396ec038..fe28a5509 100644 --- a/samples/Photos/PhotoGrid/PhotoGridPage.cs +++ b/samples/Photos/PhotoGrid/PhotoGridPage.cs @@ -4,57 +4,53 @@ using System; using System.Collections.Generic; using System.Html; -using System.Runtime.CompilerServices; using jQueryApi; using jQueryApi.Templating; using jQueryApi.Isotope; using jQueryApi.LightBox; -using Photos; +using Flickr; -namespace PhotoGrid { - - [GlobalMethods] - internal static class PhotoGridPage { +[ScriptModule] +internal static class PhotoGridPage { - static PhotoGridPage() { - jQuery.OnDocumentReady(delegate() { - string apiKey = (string)jQuery.FromElement(Document.Body).GetDataValue("flickrKey"); - IPhotoService flickrService = new FlickrPhotoService(); - - jQuery.Select("#searchButton").Click(delegate(jQueryEvent e) { - string tags = jQuery.Select("#tagsTextBox").GetValue(); - - flickrService.SearchPhotos(tags, 20).Done( - delegate(IEnumerable photos) { - jQueryObject thumbnailList = jQuery.Select("#thumbsList"); - thumbnailList.Empty(); - - if (photos == null) { - return; - } - - jQuery.Select("#thumbnailTemplate").Plugin(). - RenderTemplate(photos). - AppendTo(thumbnailList); - - thumbnailList. - Plugin().Isotope(new IsotopeOptions("layoutMode", IsotopeLayout.Masonry)). - Find("a"). - Plugin().LightBox(); - - thumbnailList.Find("li"). - MouseOver(delegate(jQueryEvent e2) { - jQuery.This.CSS("box-shadow", "0 0 15px #888"); - }). - MouseOut(delegate(jQueryEvent e2) { - jQuery.This.CSS("box-shadow", ""); - }); - }); - - jQuery.FromElement(Document.Body).Focus(); - e.PreventDefault(); - }); + static PhotoGridPage() { + jQuery.OnDocumentReady(delegate() { + string apiKey = (string)jQuery.FromElement(Document.Body).GetDataValue("flickrKey"); + IPhotoService flickrService = new FlickrPhotoService(); + + jQuery.Select("#searchButton").Click(delegate(jQueryEvent e) { + string tags = jQuery.Select("#tagsTextBox").GetValue(); + + flickrService.SearchPhotos(tags, 20).Done( + delegate(IEnumerable photos) { + jQueryObject thumbnailList = jQuery.Select("#thumbsList"); + thumbnailList.Empty(); + + if (photos == null) { + return; + } + + jQuery.Select("#thumbnailTemplate").Plugin(). + RenderTemplate(photos). + AppendTo(thumbnailList); + + thumbnailList. + Plugin().Isotope(new IsotopeOptions("layoutMode", IsotopeLayout.Masonry)). + Find("a"). + Plugin().LightBox(); + + thumbnailList.Find("li"). + MouseOver(delegate(jQueryEvent e2) { + jQuery.This.CSS("box-shadow", "0 0 15px #888"); + }). + MouseOut(delegate(jQueryEvent e2) { + jQuery.This.CSS("box-shadow", ""); + }); + }); + + jQuery.FromElement(Document.Body).Focus(); + e.PreventDefault(); }); - } + }); } } diff --git a/samples/Photos/PhotoGrid/Properties/AssemblyInfo.cs b/samples/Photos/PhotoGrid/Properties/AssemblyInfo.cs index 9ce779606..057bc7f3d 100644 --- a/samples/Photos/PhotoGrid/Properties/AssemblyInfo.cs +++ b/samples/Photos/PhotoGrid/Properties/AssemblyInfo.cs @@ -19,4 +19,20 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("PhotoGrid")] +[assembly: ScriptAssembly("photoGrid")] + +// A script template using an AMD pattern for declaring dependencies consumed +// by the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/samples/Photos/PhotoGrid/Properties/Script.template b/samples/Photos/PhotoGrid/Properties/Script.template deleted file mode 100644 index 8fcd90176..000000000 --- a/samples/Photos/PhotoGrid/Properties/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function($) { -#include[as-is] "%code%" -})(jQuery); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/Photos/PhotoGrid/packages.config b/samples/Photos/PhotoGrid/packages.config index 6f6f76839..3cc67ebab 100644 --- a/samples/Photos/PhotoGrid/packages.config +++ b/samples/Photos/PhotoGrid/packages.config @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff --git a/samples/Photos/PhotoList/GalleryPlugin.cs b/samples/Photos/PhotoList/GalleryPlugin.cs index 1f27586cb..4c5997fd5 100644 --- a/samples/Photos/PhotoList/GalleryPlugin.cs +++ b/samples/Photos/PhotoList/GalleryPlugin.cs @@ -7,9 +7,9 @@ using System.Runtime.CompilerServices; using jQueryApi; using jQueryApi.Templating; -using Photos.FlickrClient; +using Flickr.FlickrClient; -[Mixin("$.fn")] +[ScriptExtension("$.fn")] public static class GalleryPlugin { public static jQueryObject Gallery(GalleryPluginOptions customOptions) { @@ -61,7 +61,7 @@ public static jQueryObject Gallery(GalleryPluginOptions customOptions) { } } -[Imported] +[ScriptImport] [ScriptName("Object")] public sealed class GalleryPluginOptions { public string tags; @@ -79,7 +79,7 @@ public GalleryPluginOptions(params object[] nameValuePairs) { } } -[Imported] +[ScriptImport] public sealed class GalleryObject : jQueryObject { public jQueryObject Gallery() { diff --git a/samples/Photos/PhotoList/ListPage.cs b/samples/Photos/PhotoList/ListPage.cs index 46364bb14..2ba94ab8e 100644 --- a/samples/Photos/PhotoList/ListPage.cs +++ b/samples/Photos/PhotoList/ListPage.cs @@ -21,6 +21,7 @@ public static void Main(Dictionary args) { }); jQuery.Select("#searchButton").Bind("click", delegate(jQueryEvent e) { + e.PreventDefault(); string tags = jQuery.Select("#tagsTextBox").GetValue(); ShowPhotos(tags); }); diff --git a/samples/Photos/PhotoList/PhotoList.csproj b/samples/Photos/PhotoList/PhotoList.csproj index 542433705..e438a4f34 100644 --- a/samples/Photos/PhotoList/PhotoList.csproj +++ b/samples/Photos/PhotoList/PhotoList.csproj @@ -10,12 +10,11 @@ Properties PhotoList PhotoList - Properties\Script.template Properties\FxCop.ruleset True True - ..\PhotosWeb\Scripts true + True bin\Debug\ @@ -40,30 +39,29 @@ - - ..\packages\ScriptSharp.Lib.jQuery.0.7.5.0\lib\Script.jQuery.dll + ..\packages\ScriptSharp.Lib.jQuery.0.8\lib\Script.jQuery.dll - ..\packages\ScriptSharp.Lib.jQuery.History.0.7.5.0\lib\Script.jQuery.History.dll + ..\packages\ScriptSharp.Lib.jQuery.History.0.8\lib\Script.jQuery.History.dll - ..\packages\ScriptSharp.Lib.jQuery.Templating.0.7.5.0\lib\Script.jQuery.Templating.dll + ..\packages\ScriptSharp.Lib.jQuery.Templating.0.8\lib\Script.jQuery.Templating.dll - ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + ..\packages\ScriptSharp.Lib.HTML.0.8\lib\Script.Web.dll - + {336cc726-e62d-484b-a15e-3e70a676d989} Flickr - + \ No newline at end of file diff --git a/samples/Photos/PhotoList/Properties/AssemblyInfo.cs b/samples/Photos/PhotoList/Properties/AssemblyInfo.cs index bc8ed6482..1cb444620 100644 --- a/samples/Photos/PhotoList/Properties/AssemblyInfo.cs +++ b/samples/Photos/PhotoList/Properties/AssemblyInfo.cs @@ -19,4 +19,20 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("Gallery")] +[assembly: ScriptAssembly("photoList")] + +// A script template using an AMD pattern for declaring dependencies consumed +// by the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/samples/Photos/PhotoList/Properties/Script.template b/samples/Photos/PhotoList/Properties/Script.template deleted file mode 100644 index 8fcd90176..000000000 --- a/samples/Photos/PhotoList/Properties/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function($) { -#include[as-is] "%code%" -})(jQuery); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/Photos/PhotoList/Tests/GalleryPluginTests.cs b/samples/Photos/PhotoList/Tests/GalleryPluginTests.cs index 0f34bf4c8..674185572 100644 --- a/samples/Photos/PhotoList/Tests/GalleryPluginTests.cs +++ b/samples/Photos/PhotoList/Tests/GalleryPluginTests.cs @@ -7,7 +7,7 @@ using System.Html; using System.Testing; using jQueryApi; -using Photos.FlickrClient; +using Flickr.FlickrClient; using Gallery; namespace Gallery.Tests { diff --git a/samples/Photos/PhotoList/Tests/MockFlickrService.cs b/samples/Photos/PhotoList/Tests/MockFlickrService.cs index d4512f671..d83fd6cdd 100644 --- a/samples/Photos/PhotoList/Tests/MockFlickrService.cs +++ b/samples/Photos/PhotoList/Tests/MockFlickrService.cs @@ -6,7 +6,7 @@ using System.Diagnostics.CodeAnalysis; using System.Html; using System.Testing; -using Photos.FlickrClient; +using Flickr.FlickrClient; namespace Gallery.Tests { @@ -19,7 +19,7 @@ public MockFlickrService(List photos) { } public void SearchPhotos(string tags, int count, FlickrSearchCallback callback) { - Window.SetTimeout(delegate() { + Script.SetTimeout(delegate() { callback(_photos); }, 0); } diff --git a/samples/Photos/PhotoList/packages.config b/samples/Photos/PhotoList/packages.config index a887b8310..b0cc5aa3d 100644 --- a/samples/Photos/PhotoList/packages.config +++ b/samples/Photos/PhotoList/packages.config @@ -1,8 +1,7 @@  - - - - - + + + + \ No newline at end of file diff --git a/samples/Photos/PhotoListTests.testsettings b/samples/Photos/PhotoListTests.testsettings index 6047fa016..11485e1b7 100644 --- a/samples/Photos/PhotoListTests.testsettings +++ b/samples/Photos/PhotoListTests.testsettings @@ -1,6 +1,8 @@  These are default test settings for a local test run. + + diff --git a/samples/Photos/PhotoListTests/GalleryPluginTests.cs b/samples/Photos/PhotoListTests/GalleryPluginTests.cs index 5d3013404..56c14adc9 100644 --- a/samples/Photos/PhotoListTests/GalleryPluginTests.cs +++ b/samples/Photos/PhotoListTests/GalleryPluginTests.cs @@ -10,12 +10,10 @@ namespace PhotoListTests { [TestClass] - [DeploymentItem("PhotoListTests\\Web", "Web")] - [DeploymentItem("PhotoList\\bin\\debug\\mscorlib.js", "Web")] - [DeploymentItem("PhotoList\\bin\\debug\\Photos.debug.js", "Web")] - [DeploymentItem("PhotoList\\bin\\debug\\PhotoList.test.js", "Web")] public class GalleryPluginTests { + private const int Port = 3976; + private static WebTest _webTest; public TestContext TestContext { @@ -28,11 +26,11 @@ public static void OnInitialize(TestContext testContext) { // This starts the web server rooted at the specified directory // on http://localhost: - string webRoot = Path.Combine(testContext.DeploymentDirectory, "Web"); - int port = 3976; + string testContentRoot = Path.GetFullPath(Path.Combine(testContext.TestRunDirectory, "..\\..\\PhotoListTests\\Web")); + string scriptsRoot = Path.GetFullPath(Path.Combine(testContext.TestRunDirectory, "..\\..\\PhotoList\\bin\\Debug")); _webTest = new WebTest(); - _webTest.StartWebServer(webRoot, port); + _webTest.StartWebServer(Port, testContentRoot, scriptsRoot); } [ClassCleanup()] diff --git a/samples/Photos/PhotoListTests/PhotoListTests.csproj b/samples/Photos/PhotoListTests/PhotoListTests.csproj index 6c1972bb6..947889e75 100644 --- a/samples/Photos/PhotoListTests/PhotoListTests.csproj +++ b/samples/Photos/PhotoListTests/PhotoListTests.csproj @@ -12,6 +12,7 @@ PhotoListTests v4.0 512 + true {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -33,7 +34,7 @@ - ..\packages\ScriptSharp.Testing.0.7.5.0\lib\ScriptSharp.Testing.dll + ..\packages\ScriptSharp.Testing.0.8\lib\ScriptSharp.Testing.dll @@ -51,6 +52,7 @@ + @@ -12,6 +12,7 @@ Copyright (C) 2012. Script# Project. All rights reserved. + true true pdbonly false @@ -25,26 +26,24 @@ Copyright (C) 2012. Script# Project. All rights reserved. - + $(MSBuildThisFileDirectory)mscorlib.dll - + diff --git a/src/Core/Build/Tasks/ScriptCompilerExecTask.cs b/src/Core/Build/Tasks/ScriptCompilerExecTask.cs index 17f094a05..5a26ec9a7 100644 --- a/src/Core/Build/Tasks/ScriptCompilerExecTask.cs +++ b/src/Core/Build/Tasks/ScriptCompilerExecTask.cs @@ -19,16 +19,13 @@ namespace ScriptSharp.Tasks { /// The Script# MSBuild task corresponding exactly to functionality exposed /// by the command-line tool. ///
    - public sealed class ScriptCompilerExecTask : Task, IErrorHandler { + public sealed class ScriptCompilerExecTask : Task, IErrorHandler, IStreamSourceResolver { private string _projectPath; private ITaskItem[] _references; private ITaskItem[] _sources; private ITaskItem[] _resources; - private ITaskItem _template; - private ITaskItem _docCommentFile; - private bool _debug; private bool _minimize; private bool _tests; private string _defines; @@ -39,15 +36,6 @@ public sealed class ScriptCompilerExecTask : Task, IErrorHandler { private bool _hasErrors; - public bool DebugFlavor { - get { - return _debug; - } - set { - _debug = value; - } - } - public string Defines { get { if (_defines == null) { @@ -60,15 +48,6 @@ public string Defines { } } - public ITaskItem DocumentationFile { - get { - return _docCommentFile; - } - set { - _docCommentFile = value; - } - } - public bool IncludeTests { get { return _tests; @@ -157,34 +136,15 @@ public ITaskItem[] Sources { } } - public ITaskItem Template { - get { - return _template; - } - set { - _template = value; - } - } - private bool Compile() { CompilerOptions options = new CompilerOptions(); - options.DebugFlavor = DebugFlavor; - if (DebugFlavor) { - options.IncludeTests = IncludeTests; - } - else { - options.Minimize = Minimize; - } + options.IncludeTests = IncludeTests; + options.Minimize = Minimize; options.Defines = GetDefines(); options.References = GetReferences(); options.Sources = GetSources(_sources); options.Resources = GetResources(_resources); - if (_template != null) { - options.TemplateFile = new TaskItemInputStreamSource(_template, "Template"); - } - if (_docCommentFile != null) { - options.DocCommentFile = new TaskItemInputStreamSource(_docCommentFile, "DocComment"); - } + options.IncludeResolver = this; ITaskItem scriptTaskItem = new TaskItem(OutputPath); options.ScriptFile = new TaskItemOutputStreamSource(scriptTaskItem); @@ -325,6 +285,21 @@ void IErrorHandler.ReportError(string errorMessage, string location) { } #endregion + #region Implementation of IStreamSourceResolver + + IStreamSource IStreamSourceResolver.Resolve(string name) { + if (_projectPath != null) { + string path = Path.Combine(Path.GetDirectoryName(_projectPath), name); + if (File.Exists(path)) { + return new FileInputStreamSource(path, name); + } + } + + return null; + } + + #endregion + private sealed class TaskItemInputStreamSource : FileInputStreamSource { diff --git a/src/Core/Build/Tasks/ScriptCompilerTask.cs b/src/Core/Build/Tasks/ScriptCompilerTask.cs index b15015889..ae7634a09 100644 --- a/src/Core/Build/Tasks/ScriptCompilerTask.cs +++ b/src/Core/Build/Tasks/ScriptCompilerTask.cs @@ -9,33 +9,34 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; +using System.Linq; using Microsoft.Build; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +using ScriptCruncher = Microsoft.Ajax.Utilities.Minifier; +using ScriptCruncherSettings = Microsoft.Ajax.Utilities.CodeSettings; +using ScriptSourceMap = Microsoft.Ajax.Utilities.ScriptSharpSourceMap; + namespace ScriptSharp.Tasks { /// /// The Script# MSBuild task. /// - public sealed class ScriptCompilerTask : Task, IErrorHandler { + public sealed class ScriptCompilerTask : Task, IErrorHandler, IStreamSourceResolver { private string _projectPath; private ITaskItem[] _references; private ITaskItem[] _sources; private ITaskItem[] _resources; - private ITaskItem _template; - private ITaskItem _docCommentFile; - private ITaskItem _csharpAssembly; - + private ITaskItem _assembly; private string _defines; - private bool _copyReferences; - private bool _suppressDocumentation; + private bool _minimize; + private bool _copyReferences; + private string _copyReferencesPath; private string _outputPath; - private string _deploymentPath; - private bool _localeSubFolders; - private bool _configSubFolders; + private string _scriptName; private List _scripts; private bool _hasErrors; @@ -44,82 +45,55 @@ public ScriptCompilerTask() { _copyReferences = true; } - public bool CopyReferences { + [Required] + public ITaskItem Assembly { get { - return _copyReferences; + return _assembly; } set { - _copyReferences = value; + _assembly = value; } } - [Required] - public ITaskItem CSharpAssembly { + public bool CopyReferences { get { - return _csharpAssembly; + return _copyReferences; } set { - _csharpAssembly = value; + _copyReferences = value; } } - public string Defines { + public string CopyReferencesPath { get { - if (_defines == null) { + if (_copyReferencesPath == null) { return String.Empty; } - return _defines; + return _copyReferencesPath; } set { - _defines = value; + _copyReferencesPath = value; } } - public string DeploymentPath { + public string Defines { get { - if (_deploymentPath == null) { + if (_defines == null) { return String.Empty; } - return _deploymentPath; - } - set { - _deploymentPath = value; - } - } - - public bool LocaleSubFolders { - get { - return _localeSubFolders; - } - set { - _localeSubFolders = value; - } - } - - public bool ConfigSubFolders { - get { - return _configSubFolders; - } - set { - _configSubFolders = value; - } - } - - public ITaskItem Template { - get { - return _template; + return _defines; } set { - _template = value; + _defines = value; } } - public ITaskItem DocumentationFile { + public bool Minimize { get { - return _docCommentFile; + return _minimize; } set { - _docCommentFile = value; + _minimize = value; } } @@ -136,6 +110,7 @@ public string OutputPath { } } + [Required] public string ProjectPath { get { return _projectPath; @@ -164,6 +139,15 @@ public ITaskItem[] Resources { } } + public string ScriptName { + get { + return _scriptName; + } + set { + _scriptName = value; + } + } + [Output] public ITaskItem[] Scripts { get { @@ -184,36 +168,27 @@ public ITaskItem[] Sources { } } - public bool SuppressDocumentation { - get { - return _suppressDocumentation; - } - set { - _suppressDocumentation = value; - } - } - - private bool Compile(string name, IEnumerable sourceItems, IEnumerable resourceItems, string locale) { + private bool Compile(IEnumerable sourceItems, IEnumerable resourceItems, string locale) { ITaskItem scriptTaskItem; - CompilerOptions debugOptions = - CreateOptions(name, sourceItems, resourceItems, locale, - /* debug */ true, /* includeTests */ false, /* minimize */ false, + CompilerOptions options = + CreateOptions(sourceItems, resourceItems, locale, + /* includeTests */ false, /* minimize */ false, out scriptTaskItem); string errorMessage = String.Empty; - if (debugOptions.Validate(out errorMessage) == false) { + if (options.Validate(out errorMessage) == false) { Log.LogError(errorMessage); return false; } - ScriptCompiler debugCompiler = new ScriptCompiler(this); - debugCompiler.Compile(debugOptions); + ScriptCompiler compiler = new ScriptCompiler(this); + compiler.Compile(options); if (_hasErrors == false) { // Only copy references once (when building language neutral scripts) bool copyReferences = String.IsNullOrEmpty(locale) && CopyReferences; - OnScriptFileGenerated(scriptTaskItem, debugOptions, copyReferences); + OnScriptFileGenerated(scriptTaskItem, options, copyReferences); if (_hasErrors) { return false; } @@ -222,10 +197,10 @@ private bool Compile(string name, IEnumerable sourceItems, IEnumerabl return false; } - if (debugOptions.HasTestTypes) { + if (options.HasTestTypes) { CompilerOptions testOptions = - CreateOptions(name, sourceItems, resourceItems, locale, - /* debug */ true, /* includeTests */ true, /* minimize */ false, + CreateOptions(sourceItems, resourceItems, locale, + /* includeTests */ true, /* minimize */ false, out scriptTaskItem); ScriptCompiler testCompiler = new ScriptCompiler(this); testCompiler.Compile(testOptions); @@ -237,43 +212,38 @@ private bool Compile(string name, IEnumerable sourceItems, IEnumerabl } } - CompilerOptions releaseOptions = - CreateOptions(name, sourceItems, resourceItems, locale, - /* debug */ false, /* includeTests */ false, /* minimize */ true, - out scriptTaskItem); - ScriptCompiler releaseCompiler = new ScriptCompiler(this); - releaseCompiler.Compile(releaseOptions); - if (_hasErrors == false) { - OnScriptFileGenerated(scriptTaskItem, releaseOptions, /* copyReferences */ false); - } - else { - return false; + if (_minimize) { + CompilerOptions minimizeOptions = + CreateOptions(sourceItems, resourceItems, locale, + /* includeTests */ false, /* minimize */ true, + out scriptTaskItem); + ScriptCompiler minimizingCompiler = new ScriptCompiler(this); + minimizingCompiler.Compile(minimizeOptions); + if (_hasErrors == false) { + ExecuteCruncher(scriptTaskItem); + OnScriptFileGenerated(scriptTaskItem, minimizeOptions, /* copyReferences */ false); + } + else { + return false; + } } return true; } - private CompilerOptions CreateOptions(string name, IEnumerable sourceItems, IEnumerable resourceItems, - string locale, - bool debug, bool includeTests, bool minimize, + private CompilerOptions CreateOptions(IEnumerable sourceItems, IEnumerable resourceItems, + string locale, bool includeTests, bool minimize, out ITaskItem outputScriptItem) { CompilerOptions options = new CompilerOptions(); - options.DebugFlavor = debug; options.IncludeTests = includeTests; options.Minimize = minimize; - options.ScriptNameSuffix = name; - options.Defines = GetDefines(name, !debug); + options.Defines = GetDefines(); options.References = GetReferences(); options.Sources = GetSources(sourceItems); options.Resources = GetResources(resourceItems, locale); - if (_template != null) { - options.TemplateFile = new TaskItemInputStreamSource(_template, "Template"); - } - if ((_docCommentFile != null) && (_suppressDocumentation == false)) { - options.DocCommentFile = new TaskItemInputStreamSource(_docCommentFile, "DocComment"); - } + options.IncludeResolver = this; - string scriptFilePath = GetScriptFilePath(name, locale, debug, includeTests); + string scriptFilePath = GetScriptFilePath(locale, minimize, includeTests); outputScriptItem = new TaskItem(scriptFilePath); options.ScriptFile = new TaskItemOutputStreamSource(outputScriptItem); @@ -283,107 +253,80 @@ private CompilerOptions CreateOptions(string name, IEnumerable source public override bool Execute() { _scripts = new List(); -#if PARTITIONING - if (_webAppPartitioning == false) { -#endif - return ExecuteCore(String.Empty, _sources, _resources); -#if PARTITIONING + bool success; + try { + success = ExecuteCore(_sources, _resources); + } + catch (Exception) { + success = false; } - else { - CompilationGroup sharedGroup = new CompilationGroup(); - Dictionary compilationGroups = - new Dictionary(StringComparer.OrdinalIgnoreCase); - - if (_sources != null) { - foreach (ITaskItem sourceItem in _sources) { - string groupName = CompilationGroup.GetGroupName(sourceItem); - - CompilationGroup group; - if (groupName == CompilationGroup.SharedGroupName) { - group = sharedGroup; - } - else if (compilationGroups.TryGetValue(groupName, out group) == false) { - group = new CompilationGroup(); - compilationGroups[groupName] = group; - } - - group.Sources.Add(sourceItem); - } - } - if (_resources != null) { - foreach (ITaskItem resourceItem in _resources) { - string groupName = CompilationGroup.GetGroupName(resourceItem); + return success; + } - CompilationGroup group; - if (groupName == CompilationGroup.SharedGroupName) { - group = sharedGroup; - } - else if (compilationGroups.TryGetValue(groupName, out group) == false) { - group = new CompilationGroup(); - compilationGroups[groupName] = group; - } + private bool ExecuteCore(IEnumerable sources, IEnumerable resources) { + // Create the neutral culture scripts first, and if that + // succeeds, compile any localized variants that are supposed + // to be generated. - group.Resources.Add(resourceItem); - } - } - - foreach (KeyValuePair group in compilationGroups) { - group.Value.Sources.AddRange(sharedGroup.Sources); - group.Value.Resources.AddRange(sharedGroup.Resources); + if (Compile(sources, resources, /* locale */ String.Empty)) { + ICollection locales = GetLocales(resources); - bool success = ExecuteCore(group.Key, group.Value.Sources, group.Value.Resources); - if (success == false) { + foreach (string locale in locales) { + if (Compile(sources, resources, locale) == false) { return false; } } + GenerateDeploymentFile(); return true; } -#endif // PARTITIONING + + return false; } - private bool ExecuteCore(string name, IEnumerable sources, IEnumerable resources) { - bool success = false; + private void ExecuteCruncher(ITaskItem scriptItem) { + string script = File.ReadAllText(scriptItem.ItemSpec); - try { - // Create the neutral culture scripts first - success = Compile(name, sources, resources, /* locale */ String.Empty); - - if (success) { - ICollection locales = GetLocales(resources); - foreach (string locale in locales) { - success = Compile(name, sources, resources, locale); - if (success == false) { - break; - } - } - } - } - catch { - success = false; - } + ScriptCruncher cruncher = new ScriptCruncher(); + ScriptCruncherSettings cruncherSettings = new ScriptCruncherSettings() { + StripDebugStatements = false, + OutputMode = Microsoft.Ajax.Utilities.OutputMode.SingleLine, + IgnorePreprocessorDefines = true, + IgnoreConditionalCompilation = true + }; + cruncherSettings.AddNoAutoRename("$"); + cruncherSettings.SetDebugNamespaces(null); - return success; + string crunchedScript = cruncher.MinifyJavaScript(script, cruncherSettings); + + File.WriteAllText(scriptItem.ItemSpec, crunchedScript); } - private ICollection GetDefines(string name, bool removeDebug) { - if ((Defines.Length == 0) && String.IsNullOrEmpty(name)) { - return new string[0]; + private void GenerateDeploymentFile() { + try { + string assemblyFile = Path.GetFileName(_assembly.ItemSpec); + string scriptsFilePath = Path.Combine(OutputPath, Path.ChangeExtension(assemblyFile, "scripts")); + + Uri scriptsUri = new Uri(Path.GetFullPath(scriptsFilePath), UriKind.Absolute); + IEnumerable scripts = + _scripts.Select(s => { + Uri fileUri = new Uri(s.ItemSpec, UriKind.Absolute); + return Uri.UnescapeDataString(scriptsUri.MakeRelativeUri(fileUri).ToString()); + }); + File.WriteAllLines(scriptsFilePath, scripts); } - string[] defines = Defines.Split(';'); - if (String.IsNullOrEmpty(name) && (removeDebug == false)) { - return defines; + catch (Exception e) { + Log.LogError(e.ToString()); } + } - List definesList = new List(defines); - definesList.Add(name); - - if (removeDebug) { - definesList.Remove("DEBUG"); + private ICollection GetDefines() { + if (Defines.Length == 0) { + return new string[0]; } - return definesList; + return Defines.Split(';'); } private ICollection GetLocales(IEnumerable resourceItems) { @@ -446,48 +389,22 @@ private ICollection GetResources(IEnumerable allResour return resources; } - private string GetScriptFilePath(string name, string locale, bool debug, bool includeTests) { - if ((_csharpAssembly != null) && (OutputPath.Length != 0)) { - string assemblyPath = _csharpAssembly.ItemSpec; - string assemblyFile = Path.GetFileName(assemblyPath); - string outputPath = OutputPath; - string extension = "js"; - - if ((assemblyFile.Length > 7) && assemblyFile.StartsWith("Script.", StringComparison.OrdinalIgnoreCase)) { - // Resulting script files don't need a "Script." prefix, since that - // is mostly a naming convention used to separate out script# managed binaries. - - assemblyFile = assemblyFile.Substring(7); - } - - if (_configSubFolders == false) { - extension = includeTests ? "test.js" : (debug ? "debug.js" : "js"); - } - else { - outputPath = Path.Combine(outputPath, includeTests ? "test" : (debug ? "debug" : "release")); - } - - if (String.IsNullOrEmpty(locale) == false) { - if (_localeSubFolders == false) { - extension = locale + "." + extension; - } - else { - outputPath = Path.Combine(outputPath, locale); - } - } - - if (String.IsNullOrEmpty(name) == false) { - extension = name + "." + extension; - } + private string GetScriptFilePath(string locale, bool minimize, bool includeTests) { + string scriptName = ScriptName; + if (String.IsNullOrEmpty(scriptName)) { + scriptName = Path.GetFileName(_assembly.ItemSpec); + } - if (Directory.Exists(outputPath) == false) { - Directory.CreateDirectory(outputPath); - } + string extension = includeTests ? "test.js" : (minimize ? "min.js" : "js"); + if (String.IsNullOrEmpty(locale) == false) { + extension = locale + "." + extension; + } - return Path.Combine(outputPath, Path.ChangeExtension(assemblyFile, extension)); + if (Directory.Exists(OutputPath) == false) { + Directory.CreateDirectory(OutputPath); } - return null; + return Path.GetFullPath(Path.Combine(OutputPath, Path.ChangeExtension(scriptName, extension))); } private ICollection GetSources(IEnumerable sourceItems) { @@ -512,15 +429,20 @@ private ICollection GetSources(IEnumerable sourceItems } private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options, bool copyReferences) { - _scripts.Add(scriptItem); + Func getScriptFile = delegate(string reference, bool minimized) { + string scriptFile = Path.ChangeExtension(reference, minimized ? ".min.js" : ".js"); + + string fileName = Path.GetFileNameWithoutExtension(scriptFile); + if (fileName.StartsWith("mscorlib", StringComparison.OrdinalIgnoreCase)) { + fileName = (minimized ? "ss.min" : "ss") + Path.GetExtension(scriptFile); + scriptFile = Path.Combine(Path.GetDirectoryName(scriptFile), fileName); + } - Func getScriptFile = delegate(string reference, bool debug) { - string scriptFile = Path.ChangeExtension(reference, debug ? ".debug.js" : ".js"); if (File.Exists(scriptFile)) { return scriptFile; } - string fileName = Path.GetFileName(scriptFile); + fileName = Path.GetFileName(scriptFile); if ((fileName.Length > 7) && fileName.StartsWith("Script.", StringComparison.OrdinalIgnoreCase)) { fileName = fileName.Substring(7); scriptFile = Path.Combine(Path.GetDirectoryName(scriptFile), fileName); @@ -535,6 +457,11 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options Action safeCopyFile = delegate(string sourceFilePath, string targetFilePath) { try { + string directory = Path.GetDirectoryName(targetFilePath); + if (Directory.Exists(directory) == false) { + Directory.CreateDirectory(directory); + } + if (File.Exists(targetFilePath)) { // If the file already exists, make sure it is not read-only, so // it can be overrwritten. @@ -546,6 +473,8 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options // Copy the file, and then make sure it is not read-only (for example, if the // source file for a referenced script is read-only). File.SetAttributes(targetFilePath, FileAttributes.Normal); + + _scripts.Add(new TaskItem(targetFilePath)); } catch (Exception e) { Log.LogError("Unable to copy referenced script '" + sourceFilePath + "' as '" + targetFilePath + "' (" + e.Message + ")"); @@ -553,7 +482,7 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options } }; - string projectName = (_projectPath != null) ? Path.GetFileNameWithoutExtension(_projectPath) : String.Empty; + string projectName = Path.GetFileNameWithoutExtension(_projectPath); string scriptFileName = Path.GetFileName(scriptItem.ItemSpec); string scriptPath = Path.GetFullPath(scriptItem.ItemSpec); string scriptFolder = Path.GetDirectoryName(scriptItem.ItemSpec); @@ -562,41 +491,21 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options if (copyReferences) { foreach (string reference in options.References) { - string releaseScriptFile = getScriptFile(reference, /* debug */ false); - if (releaseScriptFile != null) { - string path = Path.Combine(scriptFolder, Path.GetFileName(releaseScriptFile)); - safeCopyFile(releaseScriptFile, path); + string scriptFile = getScriptFile(reference, /* minimized */ false); + if (scriptFile != null) { + string path = Path.Combine(scriptFolder, CopyReferencesPath, Path.GetFileName(scriptFile)); + safeCopyFile(scriptFile, path); } - string debugScriptFile = getScriptFile(reference, /* debug */ true); - if (debugScriptFile != null) { - string path = Path.Combine(scriptFolder, Path.GetFileName(debugScriptFile)); - safeCopyFile(debugScriptFile, path); + string minScriptFile = getScriptFile(reference, /* minimized */ true); + if (minScriptFile != null) { + string path = Path.Combine(scriptFolder, CopyReferencesPath, Path.GetFileName(minScriptFile)); + safeCopyFile(minScriptFile, path); } } } - string deploymentPath = DeploymentPath; - if (DeploymentPath.Length != 0) { - string deployedScriptPath = Path.Combine(deploymentPath, scriptFileName); - safeCopyFile(scriptPath, deployedScriptPath); - - if (copyReferences) { - foreach (string reference in options.References) { - string releaseScriptFile = getScriptFile(reference, /* debug */ false); - if (releaseScriptFile != null) { - string path = Path.Combine(deploymentPath, Path.GetFileName(releaseScriptFile)); - safeCopyFile(releaseScriptFile, path); - } - - string debugScriptFile = getScriptFile(reference, /* debug */ true); - if (debugScriptFile != null) { - string path = Path.Combine(deploymentPath, Path.GetFileName(debugScriptFile)); - safeCopyFile(debugScriptFile, path); - } - } - } - } + _scripts.Add(scriptItem); } #region Implementation of IErrorHandler @@ -626,46 +535,19 @@ void IErrorHandler.ReportError(string errorMessage, string location) { } #endregion + #region Implementation of IStreamSourceResolver - private sealed class CompilationGroup { - - public static readonly string SharedGroupName = "Shared"; - - public List Sources; - public List Resources; - - public CompilationGroup() { - Sources = new List(); - Resources = new List(); + IStreamSource IStreamSourceResolver.Resolve(string name) { + string path = Path.Combine(Path.GetDirectoryName(_projectPath), name); + if (File.Exists(path)) { + return new FileInputStreamSource(path, name); } - public static string GetGroupName(ITaskItem taskItem) { - string groupName = null; - - string itemPath = taskItem.GetMetadata("Link"); - if (String.IsNullOrEmpty(itemPath)) { - itemPath = taskItem.ItemSpec; - } - - if (Path.IsPathRooted(itemPath) || - (itemPath.IndexOf(Path.DirectorySeparatorChar) < 0)) { - groupName = SharedGroupName; - } - else { - string path = itemPath; - while (String.IsNullOrEmpty(path) == false) { - groupName = path; - path = Path.GetDirectoryName(path); - } - } + return null; + } - if (groupName.Equals("Properties", StringComparison.Ordinal)) { - groupName = CompilationGroup.SharedGroupName; - } + #endregion - return groupName; - } - } private sealed class TaskItemInputStreamSource : FileInputStreamSource { diff --git a/src/Core/Build/Tasks/ScriptPreprocessorTask.cs b/src/Core/Build/Tasks/ScriptPreprocessorTask.cs deleted file mode 100644 index 7c6c36618..000000000 --- a/src/Core/Build/Tasks/ScriptPreprocessorTask.cs +++ /dev/null @@ -1,292 +0,0 @@ -// ScriptPreprocessorTask.cs -// Script#/Core/Build -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using Microsoft.Build; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace ScriptSharp.Tasks { - - public sealed class ScriptPreprocessorTask : Task, IErrorHandler, IStreamResolver { - - private bool _debug; - private bool _minimize; - private bool _stripCommentsOnly; - private bool _windowsLineBreaks; - private string _defines; - private string _outputDirectory; - - private string[] _preprocessorVariables; - - private ITaskItem[] _sources; - private ITaskItem[] _scripts; - - private bool _hasErrors; - - public ScriptPreprocessorTask() { - _minimize = true; - } - - public bool Debug { - get { - return _debug; - } - set { - _debug = value; - } - } - - public string Defines { - get { - return _defines; - } - set { - _defines = value; - } - } - - public bool Minimize { - get { - return _minimize; - } - set { - _minimize = value; - } - } - - [Required] - public string OutputDirectory { - get { - return _outputDirectory; - } - set { - _outputDirectory = value; - } - } - - [Output] - public ITaskItem[] Scripts { - get { - return _scripts; - } - set { - _scripts = value; - } - } - - public ITaskItem[] Sources { - get { - return _sources; - } - set { - _sources = value; - } - } - - public bool StripCommentsOnly { - get { - return _stripCommentsOnly; - } - set { - _stripCommentsOnly = value; - } - } - - public bool WindowsLineBreaks { - get { - return _windowsLineBreaks; - } - set { - _windowsLineBreaks = value; - } - } - - private string ConvertScriptFile(BuildType type, string inputPath) { - string result = null; - string outputPath = null; - try { - outputPath = Path.Combine(OutputDirectory, Path.ChangeExtension(Path.GetFileName(inputPath), ".js")); - - PreprocessorOptions options = new PreprocessorOptions(); - options.SourceFile = new FileInputStreamSource(inputPath); - options.TargetFile = new FileOutputStreamSource(outputPath); - options.DebugFlavor = Debug; - options.Minimize = Minimize; - options.StripCommentsOnly = StripCommentsOnly; - options.UseWindowsLineBreaks = WindowsLineBreaks; - options.PreprocessorVariables = _preprocessorVariables; - - ScriptPreprocessor preprocessor; - if (type == BuildType.ScriptAssembly) { - preprocessor = new ScriptPreprocessor(this, this); - } - else { - preprocessor = new ScriptPreprocessor(); - } - - preprocessor.Preprocess(options); - result = outputPath; - } - catch (Exception e) { -#if DEBUG - Log.LogErrorFromException(e, /* showStackTrace */ true); -#else - Log.LogErrorFromException(e, /* showStackTrace */ false); -#endif // DEBUG - } - - if ((result == null) && File.Exists(outputPath)) { - try { - File.Delete(outputPath); - } - catch { - } - } - return result; - } - - private string CopyStandardScriptFile(string inputPath) { - string result = null; - string outputPath = null; - - try { - outputPath = Path.Combine(OutputDirectory, Path.GetFileName(inputPath)); - - File.Copy(inputPath, outputPath, /* overwrite */ true); - File.SetAttributes(outputPath, FileAttributes.Normal); - result = outputPath; - } - catch { - Log.LogError("'" + outputPath + "' could not be opened for writing."); - } - - return result; - } - - public override bool Execute() { - if ((_sources == null) || (_sources.Length == 0)) { - Log.LogError("No source files were specified"); - return false; - } - - for (int i = 0; i < _sources.Length; i++) { - ITaskItem source = _sources[i]; - if (File.Exists(source.ItemSpec) == false) { - Log.LogError("'" + source.ItemSpec + "' was not found."); - _hasErrors = true; - } - } - - if (_hasErrors) { - return false; - } - - if (String.IsNullOrEmpty(Defines) == false) { - _preprocessorVariables = Defines.Split(',', ';', ' '); - } - - Log.LogMessage(MessageImportance.Low, - String.Format("Parameters: Debug={0}, Minimize={1}, StripCommentsOnly={2}, WindowsLineBreaks={3}\r\n Defines={4}", - Debug, Minimize, StripCommentsOnly, WindowsLineBreaks, Defines)); - - ArrayList scripts = new ArrayList(_sources.Length); - for (int i = 0; i < _sources.Length; i++) { - ITaskItem source = _sources[i]; - - string sourcePath = source.ItemSpec; - string outputPath = null; - BuildType type = BuildType.Unknown; - - string extension = Path.GetExtension(sourcePath); - if (String.Compare(extension, ".jsa", StringComparison.OrdinalIgnoreCase) == 0) { - type = BuildType.ScriptAssembly; - } - else if (String.Compare(extension, ".jsx", StringComparison.OrdinalIgnoreCase) == 0) { - type = BuildType.ExtendedScript; - } - else if (String.Compare(extension, ".js", StringComparison.OrdinalIgnoreCase) == 0) { - type = BuildType.StandardScript; - } - else { - Log.LogError("'" + sourcePath + "' is an unknown file type."); - _hasErrors = true; - } - - if (type != BuildType.Unknown) { - Log.LogMessage(MessageImportance.Low, "Building '" + sourcePath + "'"); - if (type == BuildType.StandardScript) { - outputPath = CopyStandardScriptFile(sourcePath); - } - else { - outputPath = ConvertScriptFile(type, sourcePath); - } - - if (String.IsNullOrEmpty(outputPath) == false) { - scripts.Add(new TaskItem(outputPath)); - } - else { - _hasErrors = true; - } - } - } - - if (_hasErrors == false) { - _scripts = (ITaskItem[])scripts.ToArray(typeof(ITaskItem)); - return true; - } - return false; - } - - #region Implementation of IErrorHandler - void IErrorHandler.ReportError(string errorMessage, string location) { - _hasErrors = true; - - int line = 0; - int column = 0; - - if (String.IsNullOrEmpty(location) == false) { - if (location.EndsWith(")", StringComparison.Ordinal)) { - int index = location.LastIndexOf("(", StringComparison.Ordinal); - System.Diagnostics.Debug.Assert(index > 0); - - string position = location.Substring(index + 1, location.Length - index - 2); - string[] positionParts = position.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); - System.Diagnostics.Debug.Assert(positionParts.Length == 2); - - Int32.TryParse(positionParts[0], out line); - Int32.TryParse(positionParts[1], out column); - - location = location.Substring(0, index); - } - } - - Log.LogError(String.Empty, String.Empty, String.Empty, location, line, column, 0, 0, errorMessage); - } - #endregion - - #region Implementation of IStreamResolver - IStreamSource IStreamResolver.ResolveInclude(IStreamSource baseStream, string includePath) { - string resolvedPath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(baseStream.FullName)), includePath); - return new FileInputStreamSource(resolvedPath); - } - #endregion - - private enum BuildType { - - Unknown = 0, - - StandardScript = 1, - - ExtendedScript = 2, - - ScriptAssembly = 3 - } - } -} diff --git a/src/Core/Compiler/Compiler.csproj b/src/Core/Compiler/Compiler.csproj index 7f14af864..70475588b 100644 --- a/src/Core/Compiler/Compiler.csproj +++ b/src/Core/Compiler/Compiler.csproj @@ -50,6 +50,9 @@ ResXParser.cs + + + @@ -172,7 +175,6 @@ - @@ -180,18 +182,11 @@ - - Properties\ScriptSharp.cs
    - - - - - @@ -359,6 +354,7 @@ + @@ -465,13 +461,11 @@ - - diff --git a/src/Core/Compiler/Compiler/CodeBuilder.cs b/src/Core/Compiler/Compiler/CodeBuilder.cs index b1860caa8..4c42e4181 100644 --- a/src/Core/Compiler/Compiler/CodeBuilder.cs +++ b/src/Core/Compiler/Compiler/CodeBuilder.cs @@ -115,9 +115,12 @@ private void BuildCode(EventSymbol eventSymbol) { private void BuildCode(FieldSymbol fieldSymbol) { ImplementationBuilder implBuilder = new ImplementationBuilder(_options, _errorHandler); - fieldSymbol.AddImplementation(implBuilder.BuildField(fieldSymbol)); + SymbolImplementation implementation = implBuilder.BuildField(fieldSymbol); - _implementations.Add(fieldSymbol.Implementation); + if (implementation != null) { + fieldSymbol.AddImplementation(implementation); + _implementations.Add(fieldSymbol.Implementation); + } } private void BuildCode(IndexerSymbol indexerSymbol) { diff --git a/src/Core/Compiler/Compiler/ExpressionBuilder.cs b/src/Core/Compiler/Compiler/ExpressionBuilder.cs index 8fbca4d99..7faed834a 100644 --- a/src/Core/Compiler/Compiler/ExpressionBuilder.cs +++ b/src/Core/Compiler/Compiler/ExpressionBuilder.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using ScriptSharp; using ScriptSharp.CodeModel; @@ -317,13 +318,27 @@ private Expression ProcessBinaryExpressionNode(BinaryExpressionNode node) { if (leftExpression.Type == ExpressionType.Member) { leftExpression = TransformMemberExpression((MemberExpression)leftExpression, - /* getOrAdd */ (node.Operator != TokenType.Equal)); + /* getOrAdd */ (node.Operator != TokenType.Equal)); } if (rightExpression.Type == ExpressionType.Member) { rightExpression = TransformMemberExpression((MemberExpression)rightExpression); } + if (node.Operator == TokenType.Coalesce) { + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + MethodSymbol valueMethod = (MethodSymbol)scriptType.GetMember("Value"); + + TypeExpression scriptExpression = new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers); + MethodExpression valueExpression = new MethodExpression(scriptExpression, valueMethod); + + valueExpression.AddParameterValue(leftExpression); + valueExpression.AddParameterValue(rightExpression); + valueExpression.Reevaluate(rightExpression.EvaluatedType); + + return valueExpression; + } + TypeSymbol resultType = null; Operator operatorType = OperatorConverter.OperatorFromToken(node.Operator); @@ -418,6 +433,29 @@ private Expression ProcessBinaryExpressionNode(BinaryExpressionNode node) { } } } + + if ((leftExpression.EvaluatedType == rightExpression.EvaluatedType) && + (leftExpression.EvaluatedType == _symbolSet.ResolveIntrinsicType(IntrinsicType.Date))) { + // Map equality comparison between Date objects to a call to + // Script.CompareDates + + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + Debug.Assert(scriptType != null); + + MethodSymbol compareMethod = (MethodSymbol)scriptType.GetMember("CompareDates"); + Debug.Assert(compareMethod != null); + + MethodExpression compareExpression = + new MethodExpression(new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers), + compareMethod); + compareExpression.AddParameterValue(leftExpression); + compareExpression.AddParameterValue(rightExpression); + + if (operatorType == Operator.NotEqualEqual) { + return new UnaryExpression(Operator.LogicalNot, compareExpression); + } + return compareExpression; + } } if ((operatorType == Operator.ShiftRight) || @@ -517,12 +555,7 @@ private Expression ProcessDotExpressionNode(BinaryExpressionNode node, SymbolFil } if (objectExpression is LiteralExpression) { - object literalValue = ((LiteralExpression)objectExpression).Value; - if (!((literalValue is Boolean) || (literalValue is String))) { - // Numeric literals need to be paranthesized in script when followed by a - // dot member access. - objectExpression.AddParenthesisHint(); - } + objectExpression.AddParenthesisHint(); } Debug.Assert(objectExpression.EvaluatedType is ISymbolTable); @@ -582,6 +615,7 @@ private Expression ProcessDotExpressionNode(BinaryExpressionNode node) { TypeSymbol dictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Dictionary); TypeSymbol genericDictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.GenericDictionary); TypeSymbol nullableType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Nullable); + TypeSymbol typeType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Type); if (memberSymbol.Type == SymbolType.Property) { if ((memberSymbol.Parent == dictionaryType) || @@ -625,6 +659,21 @@ MethodExpression methodExpression isValueMethod); methodExpression.AddParameterValue(objectExpression); + return methodExpression; + } + } + else if (memberSymbol.Parent == typeType) { + if (String.CompareOrdinal(memberSymbol.Name, "Name") == 0) { + // type.Name becomes ss.typeName(type) + + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + MethodSymbol typeNameMethod = (MethodSymbol)scriptType.GetMember("GetTypeName"); + + MethodExpression methodExpression + = new MethodExpression(new TypeExpression(memberSymbol.AssociatedType, SymbolFilter.Public | SymbolFilter.StaticMembers), + typeNameMethod); + methodExpression.AddParameterValue(objectExpression); + return methodExpression; } } @@ -653,9 +702,9 @@ MethodExpression methodExpression } } - string dependency = ((TypeSymbol)memberSymbol.Parent).DependencyName; - if (String.IsNullOrEmpty(dependency) == false) { - _options.AddExecutionDependency(dependency); + ScriptReference dependency = ((TypeSymbol)memberSymbol.Parent).Dependency; + if (dependency != null) { + _symbolSet.AddDependency(dependency); } MemberExpression expression = new MemberExpression(objectExpression, memberSymbol); @@ -807,7 +856,23 @@ private Expression ProcessNewNode(NewNode node) { Debug.Assert(node.Arguments is ExpressionListNode); Debug.Assert(((ExpressionListNode)node.Arguments).Expressions.Count == 1); - return BuildExpression(((ExpressionListNode)node.Arguments).Expressions[0]); + Expression subExpression = BuildExpression(((ExpressionListNode)node.Arguments).Expressions[0]); + + // We need parenthesis if we are declaring an inline function, ie + // Callback c = new Callback(delegate {}); --> var c = (function () {}); + // But not for: + // Callback c = new Callback(this.callback); --> var c = this._callback; + bool needsParenthesis = subExpression.Type == ExpressionType.Delegate; + + if (subExpression is MemberExpression) { + subExpression = TransformMemberExpression((MemberExpression)subExpression); + } + + NewDelegateExpression expr = new NewDelegateExpression(subExpression, type); + if (needsParenthesis) { + expr.AddParenthesisHint(); + } + return expr; } NewExpression newExpression = new NewExpression(type); @@ -852,8 +917,8 @@ private Expression ProcessNewNode(NewNode node) { } } - if (String.IsNullOrEmpty(type.DependencyName) == false) { - _options.AddExecutionDependency(type.DependencyName); + if (type.Dependency != null) { + _symbolSet.AddDependency(type.Dependency); } return newExpression; @@ -895,7 +960,7 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { bool isDelegateInvoke = false; Expression leftExpression = BuildExpression(node.LeftChild); - if (leftExpression is LocalExpression) { + if (leftExpression is LocalExpression || leftExpression is NewDelegateExpression) { Debug.Assert(leftExpression.EvaluatedType.Type == SymbolType.Delegate); // Handle the implicit delegate invoke scenario by turning the expression @@ -926,6 +991,19 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { args = BuildExpressionList(argNodes); } + // REVIEW: Uggh... this has become too complex over time with all the transformations + // added over time. Refactoring needed... + + TypeSymbol objectType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Object); + TypeSymbol typeType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Type); + TypeSymbol dictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Dictionary); + TypeSymbol genericDictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.GenericDictionary); + TypeSymbol intType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Integer); + TypeSymbol stringType = _symbolSet.ResolveIntrinsicType(IntrinsicType.String); + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + TypeSymbol argsType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Arguments); + TypeSymbol voidType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Void); + MethodExpression methodExpression = null; if (memberExpression.Member.Type != SymbolType.Method) { @@ -944,178 +1022,302 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { else { // The member being accessed is a method... - // REVIEW: Uggh... this has become too complex over time with all the transformations - // added over time. Refactoring needed... - MethodSymbol method = (MethodSymbol)memberExpression.Member; - TypeSymbol objectType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Object); - TypeSymbol typeType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Type); - TypeSymbol dictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Dictionary); - TypeSymbol genericDictionaryType = _symbolSet.ResolveIntrinsicType(IntrinsicType.GenericDictionary); - TypeSymbol numberType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Number); - TypeSymbol stringType = _symbolSet.ResolveIntrinsicType(IntrinsicType.String); - TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); - TypeSymbol argsType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Arguments); - - if ((method.Parent == objectType) && - method.Name.Equals("GetType", StringComparison.Ordinal)) { - // Since we can't extend object's prototype, we need to transform the - // natural c# syntax into a static method. - // Object.GetType instance method becomes Type.GetInstanceType static method + if (!method.MatchesConditions(_options.Defines)) { + return null; + } - TypeSymbol typeSymbol = typeType; + if (method.Name.Equals("GetEnumerator", StringComparison.Ordinal)) { + // This is a bit dangerous - GetEnumerator on any type gets mapped to + // Script.Enumerate. This actually somewhat matches c# semantics, where you + // can perform a foreach on any type that has a GetEnumerator method, rather + // than only types that implement IEnumerable. - method = (MethodSymbol)typeSymbol.GetMember("GetInstanceType"); - Debug.Assert(method != null); + MethodSymbol enumerateMethod = (MethodSymbol)scriptType.GetMember("Enumerate"); + Debug.Assert(enumerateMethod != null); - methodExpression = new MethodExpression(new TypeExpression(typeSymbol, SymbolFilter.Public | SymbolFilter.StaticMembers), - method); + methodExpression = new MethodExpression(new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers), + enumerateMethod); methodExpression.AddParameterValue(memberExpression.ObjectReference); + methodExpression.Reevaluate(memberExpression.EvaluatedType); + return methodExpression; } - else if ((method.Parent == objectType) && - (method.Name.Equals("ToString", StringComparison.Ordinal) || - method.Name.Equals("ToLocaleString", StringComparison.Ordinal)) && - (memberExpression.ObjectReference.EvaluatedType == stringType)) { - // No-op ToString calls on strings (this happens when performing a ToString - // on a named enum value. - return memberExpression.ObjectReference; - } - else if ((method.Parent == objectType) && - (method.Name.Equals("ToString", StringComparison.Ordinal) || - method.Name.Equals("ToLocaleString", StringComparison.Ordinal)) && - (memberExpression.ObjectReference.EvaluatedType is EnumerationSymbol)) { - EnumerationSymbol enumSymbol = (EnumerationSymbol)memberExpression.ObjectReference.EvaluatedType; - - if (enumSymbol.UseNamedValues) { - // If the enum value is a named enum, then it is already a string. + + if ((method.Parent == objectType) && + (method.Name.Equals("ToString", StringComparison.Ordinal) || + method.Name.Equals("ToLocaleString", StringComparison.Ordinal))) { + if (memberExpression.ObjectReference.EvaluatedType == stringType) { + // No-op ToString calls on strings (this happens when performing a ToString + // on a named enum value. return memberExpression.ObjectReference; } + if (memberExpression.ObjectReference.EvaluatedType.Type == SymbolType.Enumeration) { + EnumerationSymbol enumSymbol = (EnumerationSymbol)memberExpression.ObjectReference.EvaluatedType; - return new MethodExpression(memberExpression.ObjectReference, method); - } - else if (((method.Parent == dictionaryType) || (method.Parent == genericDictionaryType)) && - method.Name.Equals("ContainsKey", StringComparison.Ordinal)) { - // Switch the instance ContainsKey method on Dictionary to - // calls to the static KeyExists method. - Debug.Assert(args.Count == 1); + if (enumSymbol.UseNamedValues) { + // If the enum value is a named enum, then it is already a string. + return memberExpression.ObjectReference; + } - MethodSymbol keyExistsMethod = (MethodSymbol)dictionaryType.GetMember("KeyExists"); - Debug.Assert(keyExistsMethod != null); + return new MethodExpression(memberExpression.ObjectReference, method); + } + } + else if ((method.Parent == dictionaryType) || (method.Parent == genericDictionaryType)) { + if (method.Name.Equals("Remove", StringComparison.Ordinal)) { + // Switch the instance Remove method on Dictionary to + // calls to the delete operator. + Debug.Assert(args.Count == 1); - methodExpression = new MethodExpression(new TypeExpression(dictionaryType, SymbolFilter.Public | SymbolFilter.StaticMembers), - keyExistsMethod); - methodExpression.AddParameterValue(memberExpression.ObjectReference); - methodExpression.AddParameterValue(args[0]); + return new LateBoundExpression(memberExpression.ObjectReference, + args[0], LateBoundOperation.DeleteField, + objectType); + } + else if (method.Name.Equals("GetDictionary", StringComparison.Ordinal)) { + // Dictionary.GetDictionary is a no-op method; we're just interested + // in the object being passed in. + // However we'll re-evaluate the argument to be of dictionary type + // so that subsequent use of this expression sees it as a dictionary. + Debug.Assert(args.Count == 1); + args[0].Reevaluate((TypeSymbol)method.Parent); - return methodExpression; - } - else if (((method.Parent == dictionaryType) || (method.Parent == genericDictionaryType)) && - method.Name.Equals("Remove", StringComparison.Ordinal)) { - // Switch the instance Remove method on Dictionary to - // calls to the static DeleteKey method. - Debug.Assert(args.Count == 1); - - return new LateBoundExpression(memberExpression.ObjectReference, - args[0], LateBoundOperation.DeleteField, - objectType); - } - else if (((method.Parent == dictionaryType) || (method.Parent == genericDictionaryType)) && - method.Name.Equals("Clear")) { - // Switch the instance Clear method on Dictionary to - // calls to the static ClearKeys method. - MethodSymbol clearKeysMethod = (MethodSymbol)dictionaryType.GetMember("ClearKeys"); - Debug.Assert(clearKeysMethod != null); - - methodExpression = new MethodExpression(new TypeExpression(dictionaryType, SymbolFilter.Public | SymbolFilter.StaticMembers), - clearKeysMethod); - methodExpression.AddParameterValue(memberExpression.ObjectReference); - return methodExpression; - } - else if (((method.Parent == dictionaryType) || (((TypeSymbol)method.Parent).GenericType == genericDictionaryType)) && - ((method.Visibility & MemberVisibility.Static) != 0) && - method.Name.Equals("GetDictionary", StringComparison.Ordinal)) { - // Dictionary.GetDictionary is a no-op method; we're just interested - // in the object being passed in. - // However we'll re-evaluate the argument to be of dictionary type - // so that subsequent use of this expression sees it as a dictionary. - Debug.Assert(args.Count == 1); - args[0].Reevaluate((TypeSymbol)method.Parent); - - return args[0]; + return args[0]; + } } - else if ((method.Parent == stringType) && - (method.Name.Equals("Escape", StringComparison.Ordinal) || - method.Name.Equals("Unescape", StringComparison.Ordinal) || - method.Name.Equals("EncodeUri", StringComparison.Ordinal) || - method.Name.Equals("DecodeUri", StringComparison.Ordinal) || - method.Name.Equals("EncodeUriComponent", StringComparison.Ordinal) || - method.Name.Equals("DecodeUriComponent", StringComparison.Ordinal))) { - // String. becomes Script., as its a global method in script - MethodSymbol scriptMethod = (MethodSymbol)scriptType.GetMember(method.Name); + else if (method.Parent == scriptType) { + if (method.Name.Equals("Literal", StringComparison.Ordinal)) { + // Convert a call to Script.Literal into a literal expression - methodExpression = new MethodExpression(new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers), - scriptMethod); - methodExpression.AddParameterValue(memberExpression.ObjectReference); - return methodExpression; - } - else if ((method.Parent == scriptType) && - method.Name.Equals("Literal", StringComparison.Ordinal)) { - // Convert a call to Script.Literal into a literal expression + Debug.Assert(args.Count >= 1); + string script = null; - Debug.Assert(args.Count >= 1); - string script = null; + if (args[0].Type == ExpressionType.Field) { + Debug.Assert(args[0].EvaluatedType == stringType); - if (args[0].Type == ExpressionType.Field) { - Debug.Assert(args[0].EvaluatedType == stringType); + FieldSymbol field = ((FieldExpression)args[0]).Field; + if (field.IsConstant) { + Debug.Assert(field.Value is string); + script = (string)field.Value; + } + } + else if (args[0].Type == ExpressionType.Literal) { + Debug.Assert(((LiteralExpression)args[0]).Value is string); + script = (string)((LiteralExpression)args[0]).Value; + } + + if (script == null) { + // TODO: When we start raising errors at the expression level instead of the statement + // level, we should return an ErrorExpression instead of a dummy expression. + Token argToken = argNodes.Expressions[0].Token; + + _errorHandler.ReportError("The argument to Script.Literal must be a constant string.", + argToken.Location); + return new InlineScriptExpression("", objectType); + } - FieldSymbol field = ((FieldExpression)args[0]).Field; - if (field.IsConstant) { - Debug.Assert(field.Value is string); - script = (string)field.Value; + if (args.Count > 1) { + // Check whether the script is a valid string format string + try { + object[] argValues = new object[args.Count - 1]; + String.Format(CultureInfo.InvariantCulture, script, argValues); + } + catch { + _errorHandler.ReportError("The argument to Script.Literal must be a valid String.Format string.", + argNodes.Expressions[0].Token.Location); + return new InlineScriptExpression("", objectType); + } } + + InlineScriptExpression scriptExpression = new InlineScriptExpression(script, objectType); + for (int i = 1; i < args.Count; i++) { + scriptExpression.AddParameterValue(args[i]); + } + + return scriptExpression; } - else if (args[0].Type == ExpressionType.Literal) { - Debug.Assert(((LiteralExpression)args[0]).Value is string); - script = (string)((LiteralExpression)args[0]).Value; + else if (method.Name.Equals("Boolean", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); + + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); } + else if (method.Name.Equals("IsTruthy", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - if (script == null) { - // TODO: When we start raising errors at the expression level instead of the statement - // level, we should return an ErrorExpression instead of a dummy expression. - Token argToken = argNodes.Expressions[0].Token; + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); + } + else if (method.Name.Equals("IsFalsey", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - _errorHandler.ReportError("The argument to Script.Literal must be a constant string.", - argToken.Location); - return new InlineScriptExpression("", objectType); + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, args[0]); } + else if (method.Name.Equals("Or", StringComparison.Ordinal)) { + Debug.Assert(args.Count >= 2); + + Expression expr = args[0]; + for (int i = 1; i < args.Count; i++) { + expr = new BinaryExpression(Operator.LogicalOr, expr, args[i]); + } + + expr.Reevaluate(args[0].EvaluatedType); + expr.AddParenthesisHint(); - InlineScriptExpression scriptExpression = new InlineScriptExpression(script, objectType); - for (int i = 1; i < args.Count; i++) { - scriptExpression.AddParameterValue(args[i]); + return expr; } + else if (method.Name.Equals("IsNull", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - return scriptExpression; - } - else if ((method.Parent == scriptType) && - method.Name.Equals("Boolean", StringComparison.Ordinal)) { - Debug.Assert(args.Count == 1); + Expression expr = new BinaryExpression(Operator.EqualEqualEqual, args[0], + new LiteralExpression(objectType, null)); + expr.AddParenthesisHint(); - return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); - } - else if ((method.Parent == scriptType) && - method.Name.Equals("Value", StringComparison.Ordinal)) { - Debug.Assert(args.Count >= 2); + return expr; + } + else if (method.Name.Equals("IsUndefined", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - Expression expr = args[0]; - for (int i = 1; i < args.Count; i++) { - expr = new BinaryExpression(Operator.LogicalOr, expr, args[i]); + MemberSymbol undefinedMember = scriptType.GetMember("Undefined"); + Debug.Assert(undefinedMember != null); + + MemberExpression undefinedExpression = + new MemberExpression(new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers), + undefinedMember); + + Expression expr = new BinaryExpression(Operator.EqualEqualEqual, args[0], TransformMemberExpression(undefinedExpression)); + expr.AddParenthesisHint(); + + return expr; } + else if (method.Name.Equals("IsNullOrUndefined", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - expr.Reevaluate(args[0].EvaluatedType); - expr.AddParenthesisHint(); + MethodSymbol isValueMethod = (MethodSymbol)scriptType.GetMember("IsValue"); + Debug.Assert(isValueMethod != null); - return expr; + methodExpression = new MethodExpression(new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers), + isValueMethod); + methodExpression.AddParameterValue(args[0]); + + return new UnaryExpression(Operator.LogicalNot, methodExpression); + } + else if (method.Name.Equals("CreateInstance", StringComparison.Ordinal)) { + Debug.Assert(args.Count >= 1); + + if ((args[0].Type == ExpressionType.MethodInvoke) || + (args[0].Type == ExpressionType.PropertyGet)) { + // When using the result of a method call/property access directly + // with Type.CreateInstance, the following script would be generated: + // + // new method()() + // which is invalid. Instead we need to generate the following: + // var type = method(); + // new type() + + _errorHandler.ReportError("You must store the type returned from a method or property into a local variable to use with Type.CreateInstance.", + node.Token.Location); + } + + NewExpression newExpression = new NewExpression(args[0], objectType); + if (args.Count > 1) { + bool first = true; + foreach (Expression paramExpr in args) { + if (first) { + first = false; + continue; + } + newExpression.AddParameterValue(paramExpr); + } + } + return newExpression; + } + + bool lateBound = false; + LateBoundOperation lateBoundOperation = LateBoundOperation.InvokeMethod; + + if (method.Name.Equals("InvokeMethod", StringComparison.Ordinal)) { + lateBound = true; + } + else if (method.Name.Equals("DeleteField", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.DeleteField; + } + else if (method.Name.Equals("GetField", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.GetField; + } + else if (method.Name.Equals("SetField", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.SetField; + } + else if (method.Name.Equals("GetScriptType", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.GetScriptType; + } + else if (method.Name.Equals("HasField", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.HasField; + } + else if (method.Name.Equals("HasMethod", StringComparison.Ordinal)) { + lateBound = true; + lateBoundOperation = LateBoundOperation.HasMethod; + } + + if (lateBound) { + // Switch explicit late-bound calls into implicit late-bound expressions + // in script + Debug.Assert((args != null) && + (((lateBoundOperation == LateBoundOperation.GetScriptType) && (args.Count == 1)) || + (args.Count >= 2))); + + LateBoundExpression lateBoundExpression = null; + Expression instanceExpression = null; + Expression nameExpression = null; + + foreach (Expression paramExpr in args) { + if (instanceExpression == null) { + instanceExpression = paramExpr; + + if (lateBoundOperation == LateBoundOperation.GetScriptType) { + // GetScriptType only takes an instance + return new LateBoundExpression(instanceExpression, null, + lateBoundOperation, objectType); + } + continue; + } + if (nameExpression == null) { + nameExpression = paramExpr; + + Expression objectExpression = instanceExpression; + if (lateBoundOperation == LateBoundOperation.InvokeMethod) { + if ((instanceExpression.Type == ExpressionType.Literal) && + (((LiteralExpression)instanceExpression).Value == null)) { + objectExpression = null; + + LiteralExpression literalExpression = nameExpression as LiteralExpression; + if (literalExpression == null) { + _errorHandler.ReportError("The name of a global method must be a constant string known at compile time.", + argNodes.Expressions[0].Token.Location); + } + else if (!Utility.IsValidIdentifier((string)literalExpression.Value)) { + _errorHandler.ReportError("The name of a global method must be a valid identifer.", + argNodes.Expressions[0].Token.Location); + } + } + } + + lateBoundExpression = new LateBoundExpression(objectExpression, nameExpression, + lateBoundOperation, objectType); + continue; + } + + lateBoundExpression.AddParameterValue(paramExpr); + } + + Debug.Assert(lateBoundExpression != null); + return lateBoundExpression; + } } else if (method.Parent == argsType) { if (method.Name.Equals("GetArgument", StringComparison.Ordinal)) { @@ -1145,144 +1347,130 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { return toArrayExpression; } } - else { - bool lateBound = false; + else if ((method.Parent.Type == SymbolType.Class) && ((ClassSymbol)method.Parent).IsArray) { + ClassSymbol arraySymbol = (ClassSymbol)method.Parent; - if (method.Parent == scriptType) { - LateBoundOperation lateBoundOperation = LateBoundOperation.InvokeMethod; + if (method.Name.Equals("Clear", StringComparison.Ordinal)) { + // array.Clear() becomes array.length = 0 in generated code - if (method.Name.Equals("InvokeMethod", StringComparison.Ordinal)) { - lateBound = true; - } - else if (method.Name.Equals("DeleteField", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.DeleteField; - } - else if (method.Name.Equals("GetField", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.GetField; - } - else if (method.Name.Equals("SetField", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.SetField; - } - else if (method.Name.Equals("GetScriptType", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.GetScriptType; + MemberSymbol lengthMember = arraySymbol.GetMember("Length"); + if (lengthMember == null) { + lengthMember = arraySymbol.GetMember("Count"); } - else if (method.Name.Equals("HasField", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.HasField; - } - else if (method.Name.Equals("HasMethod", StringComparison.Ordinal)) { - lateBound = true; - lateBoundOperation = LateBoundOperation.HasMethod; - } - else if (method.Name.Equals("CreateInstance", StringComparison.Ordinal)) { - Debug.Assert(args.Count >= 1); - - if ((args[0].Type == ExpressionType.MethodInvoke) || - (args[0].Type == ExpressionType.PropertyGet)) { - // When using the result of a method call/property access directly - // with Type.CreateInstance, the following script would be generated: - // - // new method()() - // which is invalid. Instead we need to generate the following: - // var type = method(); - // new type() - - _errorHandler.ReportError("You must store the type returned from a method or property into a local variable to use with Type.CreateInstance.", - node.Token.Location); - } + Debug.Assert((lengthMember != null) && (lengthMember.Type == SymbolType.Field)); - NewExpression newExpression = new NewExpression(args[0], objectType); - if (args.Count > 1) { - bool first = true; - foreach (Expression paramExpr in args) { - if (first) { - first = false; - continue; - } - newExpression.AddParameterValue(paramExpr); - } - } - return newExpression; - } + MemberExpression lengthExpression = + new MemberExpression(memberExpression.ObjectReference, lengthMember); + return new BinaryExpression(Operator.Equals, TransformMemberExpression(lengthExpression), + new LiteralExpression(intType, 0)); + } + if (method.Name.Equals("Contains", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); - if (lateBound) { - // Switch explicit late-bound calls into implicit late-bound expressions - // in script - Debug.Assert((args != null) && - (((lateBoundOperation == LateBoundOperation.GetScriptType) && (args.Count == 1)) || - (args.Count >= 2))); + // array.Contains(item) becomes array.indexOf(item) >= 0 - LateBoundExpression lateBoundExpression = null; - Expression instanceExpression = null; - Expression nameExpression = null; + MemberSymbol indexOfSymbol = arraySymbol.GetMember("IndexOf"); + Debug.Assert((indexOfSymbol != null) && (indexOfSymbol.Type == SymbolType.Method)); - foreach (Expression paramExpr in args) { - if (instanceExpression == null) { - instanceExpression = paramExpr; + MethodExpression indexOfExpression = + new MethodExpression(memberExpression.ObjectReference, (MethodSymbol)indexOfSymbol); + indexOfExpression.AddParameterValue(args[0]); - if (lateBoundOperation == LateBoundOperation.GetScriptType) { - // GetScriptType only takes an instance - return new LateBoundExpression(instanceExpression, null, - lateBoundOperation, objectType); - } - continue; - } - if (nameExpression == null) { - nameExpression = paramExpr; - - Expression objectExpression = instanceExpression; - if (lateBoundOperation == LateBoundOperation.InvokeMethod) { - if ((instanceExpression.Type == ExpressionType.Literal) && - (((LiteralExpression)instanceExpression).Value == null)) { - objectExpression = null; - - LiteralExpression literalExpression = nameExpression as LiteralExpression; - if (literalExpression == null) { - _errorHandler.ReportError("The name of a global method must be a constant string known at compile time.", - argNodes.Expressions[0].Token.Location); - } - else if (!Utility.IsValidIdentifier((string)literalExpression.Value)) { - _errorHandler.ReportError("The name of a global method must be a valid identifer.", - argNodes.Expressions[0].Token.Location); - } - } - } + BinaryExpression compareExpression = + new BinaryExpression(Operator.GreaterEqual, indexOfExpression, new LiteralExpression(intType, 0)); + compareExpression.AddParenthesisHint(); - lateBoundExpression = new LateBoundExpression(objectExpression, nameExpression, - lateBoundOperation, objectType); - continue; - } + return compareExpression; + } + if (method.Name.Equals("Insert", StringComparison.Ordinal) || + method.Name.Equals("InsertRange", StringComparison.Ordinal)) { + Debug.Assert(args.Count >= 1); - lateBoundExpression.AddParameterValue(paramExpr); - } + // array.Insert(index, item) becomes array.splice(index, 0, item); + + MemberSymbol spliceSymbol = arraySymbol.GetMember("Splice"); + Debug.Assert((spliceSymbol != null) && (spliceSymbol.Type == SymbolType.Method)); - Debug.Assert(lateBoundExpression != null); - return lateBoundExpression; + MethodExpression spliceExpression = + new MethodExpression(memberExpression.ObjectReference, (MethodSymbol)spliceSymbol); + spliceExpression.AddParameterValue(args[0]); + spliceExpression.AddParameterValue(new LiteralExpression(intType, 0)); + + for (int i = 1; i < args.Count; i++) { + spliceExpression.AddParameterValue(args[i]); } + + return spliceExpression; } + if (method.Name.Equals("RemoveAt", StringComparison.Ordinal) || + method.Name.Equals("RemoveRange", StringComparison.Ordinal)) { + Debug.Assert((args.Count >= 1) && (args.Count <= 2)); - if (!method.MatchesConditions(_options.Defines)) { - return null; + // array.RemoveAt(index) becomes array.splice(index, 1) + // array.RemoveRange(index, count) becomes array.splice(index, count) + + MemberSymbol spliceSymbol = arraySymbol.GetMember("Splice"); + Debug.Assert((spliceSymbol != null) && (spliceSymbol.Type == SymbolType.Method)); + + MethodExpression spliceExpression = + new MethodExpression(memberExpression.ObjectReference, (MethodSymbol)spliceSymbol); + spliceExpression.AddParameterValue(args[0]); + if (args.Count == 1) { + spliceExpression.AddParameterValue(new LiteralExpression(intType, 1)); + } + else { + spliceExpression.AddParameterValue(args[1]); + } + + return spliceExpression; } + if (method.Name.Equals("GetRange", StringComparison.Ordinal)) { + Debug.Assert((args.Count == 2)); + + // array.GetRange(index, count) becomes array.slice(index, index + count) + + MemberSymbol sliceSymbol = arraySymbol.GetMember("Slice"); + Debug.Assert((sliceSymbol != null) && (sliceSymbol.Type == SymbolType.Method)); + + MethodExpression sliceExpression = + new MethodExpression(memberExpression.ObjectReference, (MethodSymbol)sliceSymbol); + sliceExpression.AddParameterValue(args[0]); + + if ((args[0].Type == ExpressionType.Literal) && + (args[1].Type == ExpressionType.Literal)) { + int endValue = (int)((LiteralExpression)args[0]).Value + + (int)((LiteralExpression)args[1]).Value; + sliceExpression.AddParameterValue(new LiteralExpression(intType, endValue)); + } + else { + sliceExpression.AddParameterValue(new BinaryExpression(Operator.Plus, args[0], args[1])); + } - methodExpression = new MethodExpression(memberExpression.ObjectReference, - method); + return sliceExpression; + } } + + methodExpression = new MethodExpression(memberExpression.ObjectReference, method); } - if (args != null) { - foreach (Expression paramExpr in args) { - methodExpression.AddParameterValue(paramExpr); + if (methodExpression != null) { + if (methodExpression.Method.HasSelector) { + LiteralExpression selectorExpression = + new LiteralExpression(stringType, methodExpression.Method.Selector); + methodExpression.AddParameterValue(selectorExpression); } - } - if (isDelegateInvoke) { - return new DelegateInvokeExpression(methodExpression); + if (args != null) { + foreach (Expression paramExpr in args) { + methodExpression.AddParameterValue(paramExpr); + } + } + + if (isDelegateInvoke) { + return new DelegateInvokeExpression(methodExpression); + } } + return methodExpression; } @@ -1294,8 +1482,8 @@ private Expression ProcessTypeofNode(TypeofNode node) { TypeSymbol referencedType = _symbolSet.ResolveType(node.TypeReference, _symbolTable, _symbolContext); Debug.Assert(referencedType != null); - if (String.IsNullOrEmpty(referencedType.DependencyName) == false) { - _options.AddExecutionDependency(referencedType.DependencyName); + if (referencedType.Dependency != null) { + _symbolSet.AddDependency(referencedType.Dependency); } TypeSymbol typeSymbol = _symbolSet.ResolveIntrinsicType(IntrinsicType.Type); diff --git a/src/Core/Compiler/Compiler/ImplementationBuilder.cs b/src/Core/Compiler/Compiler/ImplementationBuilder.cs index 6840b5ce9..6324e65ba 100644 --- a/src/Core/Compiler/Compiler/ImplementationBuilder.cs +++ b/src/Core/Compiler/Compiler/ImplementationBuilder.cs @@ -81,7 +81,12 @@ private SymbolImplementation BuildImplementation(ISymbolTable symbolTable, CodeM } } - return new SymbolImplementation(statements, _rootScope); + string thisIdentifier = "this"; + if (symbolContext.Type == SymbolType.AnonymousMethod) { + thisIdentifier = "$this"; + } + + return new SymbolImplementation(statements, _rootScope, thisIdentifier); } public SymbolImplementation BuildEventAdd(EventSymbol eventSymbol) { @@ -104,7 +109,7 @@ public SymbolImplementation BuildField(FieldSymbol fieldSymbol) { _rootScope = new SymbolScope((ISymbolTable)fieldSymbol.Parent); _currentScope = _rootScope; - Expression initializerExpression; + Expression initializerExpression = null; FieldDeclarationNode fieldDeclarationNode = (FieldDeclarationNode)fieldSymbol.ParseContext; Debug.Assert(fieldDeclarationNode != null); @@ -150,15 +155,22 @@ public SymbolImplementation BuildField(FieldSymbol fieldSymbol) { defaultValue = false; } - initializerExpression = - new LiteralExpression(symbolSet.ResolveIntrinsicType(IntrinsicType.Object), - defaultValue); + if (defaultValue != null) { + initializerExpression = + new LiteralExpression(symbolSet.ResolveIntrinsicType(IntrinsicType.Object), + defaultValue); + fieldSymbol.SetImplementationState(/* hasInitializer */ true); + } } - List statements = new List(); - statements.Add(new ExpressionStatement(initializerExpression, /* isFragment */ true)); + if (initializerExpression != null) { + List statements = new List(); + statements.Add(new ExpressionStatement(initializerExpression, /* isFragment */ true)); + + return new SymbolImplementation(statements, null, "this"); + } - return new SymbolImplementation(statements, null); + return null; } public SymbolImplementation BuildMethod(MethodSymbol methodSymbol) { diff --git a/src/Core/Compiler/Compiler/MetadataBuilder.cs b/src/Core/Compiler/Compiler/MetadataBuilder.cs index 17f9447f4..d846598f0 100644 --- a/src/Core/Compiler/Compiler/MetadataBuilder.cs +++ b/src/Core/Compiler/Compiler/MetadataBuilder.cs @@ -29,6 +29,87 @@ public MetadataBuilder(IErrorHandler errorHandler) { _errorHandler = errorHandler; } + private void BuildAssembly(ParseNodeList compilationUnits) { + string scriptName = GetAssemblyScriptName(compilationUnits); + if (String.IsNullOrEmpty(scriptName)) { + _errorHandler.ReportError("You must declare a ScriptAssembly attribute.", String.Empty); + } + else if (Utility.IsValidScriptName(scriptName) == false) { + string errorMessage = "The ScriptAssembly attribute referenced an invalid name '{0}'. Script names must only contain letters, numbers, dots or underscores."; + _errorHandler.ReportError(String.Format(errorMessage, scriptName), String.Empty); + } + + _symbols.ScriptName = scriptName; + + List referenceAttributes = GetAttributes(compilationUnits, "ScriptReference"); + foreach (AttributeNode attribNode in referenceAttributes) { + string name = null; + string identifier = null; + string path = null; + bool delayLoad = false; + + Debug.Assert((attribNode.Arguments.Count != 0) && (attribNode.Arguments[0].NodeType == ParseNodeType.Literal)); + Debug.Assert(((LiteralNode)attribNode.Arguments[0]).Value is string); + name = (string)((LiteralNode)attribNode.Arguments[0]).Value; + + if (attribNode.Arguments.Count > 1) { + for (int i = 1; i < attribNode.Arguments.Count; i++) { + Debug.Assert(attribNode.Arguments[1] is BinaryExpressionNode); + + BinaryExpressionNode propExpression = (BinaryExpressionNode)attribNode.Arguments[1]; + Debug.Assert((propExpression.LeftChild.NodeType == ParseNodeType.Name)); + + string propName = ((NameNode)propExpression.LeftChild).Name; + if (String.CompareOrdinal(propName, "Identifier") == 0) { + Debug.Assert(propExpression.RightChild.NodeType == ParseNodeType.Literal); + Debug.Assert(((LiteralNode)propExpression.RightChild).Value is string); + + identifier = (string)((LiteralNode)propExpression.RightChild).Value; + } + if (String.CompareOrdinal(propName, "Path") == 0) { + Debug.Assert(propExpression.RightChild.NodeType == ParseNodeType.Literal); + Debug.Assert(((LiteralNode)propExpression.RightChild).Value is string); + + path = (string)((LiteralNode)propExpression.RightChild).Value; + } + else if (String.CompareOrdinal(propName, "DelayLoad") == 0) { + Debug.Assert(propExpression.RightChild.NodeType == ParseNodeType.Literal); + Debug.Assert(((LiteralNode)propExpression.RightChild).Value is bool); + + delayLoad = (bool)((LiteralNode)propExpression.RightChild).Value; + } + } + } + + bool newReference; + ScriptReference reference = _symbols.GetDependency(name, out newReference); + reference.Path = path; + reference.DelayLoaded = delayLoad; + if (newReference) { + reference.Identifier = identifier; + } + } + + string template; + if (GetScriptTemplate(compilationUnits, out template)) { + _options.ScriptInfo.Template = template; + } + + string description; + string copyright; + string version; + GetAssemblyMetadata(compilationUnits, out description, out copyright, out version); + if (description != null) { + _options.ScriptInfo.Description = description; + } + if (copyright != null) { + _options.ScriptInfo.Copyright = copyright; + } + if (version != null) { + _options.ScriptInfo.Version = version; + } + } + private EnumerationFieldSymbol BuildEnumField(EnumerationFieldNode fieldNode, TypeSymbol typeSymbol) { Debug.Assert(typeSymbol is EnumerationSymbol); EnumerationSymbol enumSymbol = (EnumerationSymbol)typeSymbol; @@ -67,6 +148,16 @@ private EventSymbol BuildEvent(EventDeclarationNode eventNode, TypeSymbol typeSy } } + if (typeSymbol.IsApplicationType == false) { + AttributeNode eventAttribute = AttributeNode.FindAttribute(eventNode.Attributes, "ScriptEvent"); + if ((eventAttribute != null) && (eventAttribute.Arguments != null) && (eventAttribute.Arguments.Count == 2)) { + string addAccessor = (string)((LiteralNode)eventAttribute.Arguments[0]).Value; + string removeAccessor = (string)((LiteralNode)eventAttribute.Arguments[1]).Value; + + eventSymbol.SetAccessors(addAccessor, removeAccessor); + } + } + return eventSymbol; } @@ -84,7 +175,7 @@ private FieldSymbol BuildField(FieldDeclarationNode fieldNode, TypeSymbol typeSy if (fieldNode.Initializers.Count != 0) { VariableInitializerNode initializer = (VariableInitializerNode)fieldNode.Initializers[0]; - if ((initializer.Value != null) && (initializer.Value.NodeType != ParseNodeType.Literal)) { + if (initializer.Value != null) { symbol.SetImplementationState(/* hasInitializer */ true); } } @@ -116,8 +207,8 @@ private IndexerSymbol BuildIndexer(IndexerDeclarationNode indexerNode, TypeSymbo IndexerSymbol indexer = new IndexerSymbol(typeSymbol, indexerType); BuildMemberDetails(indexer, typeSymbol, indexerNode, indexerNode.Attributes); - if (AttributeNode.FindAttribute(indexerNode.Attributes, "IntrinsicProperty") != null) { - indexer.SetIntrinsic(); + if (AttributeNode.FindAttribute(indexerNode.Attributes, "ScriptField") != null) { + indexer.SetScriptIndexer(); } SymbolImplementationFlags implFlags = SymbolImplementationFlags.Regular; @@ -174,15 +265,48 @@ private void BuildMemberDetails(MemberSymbol memberSymbol, TypeSymbol typeSymbol memberSymbol.SetVisibility(GetVisibility(memberNode, typeSymbol)); } - bool preserveCase = (AttributeNode.FindAttribute(attributes, "PreserveCase") != null); - memberSymbol.SetNameCasing(preserveCase); + AttributeNode nameAttribute = AttributeNode.FindAttribute(attributes, "ScriptName"); + if ((nameAttribute != null) && (nameAttribute.Arguments != null) && + (nameAttribute.Arguments.Count != 0)) { + string name = null; + bool preserveCase = false; + bool preserveName = false; + + foreach (ParseNode argNode in nameAttribute.Arguments) { + Debug.Assert((argNode.NodeType == ParseNodeType.Literal) || + (argNode.NodeType == ParseNodeType.BinaryExpression)); + + if (argNode.NodeType == ParseNodeType.Literal) { + Debug.Assert(((LiteralNode)argNode).Value is string); + name = (string)((LiteralNode)argNode).Value; + preserveName = preserveCase = true; + break; + } + else { + BinaryExpressionNode propSetNode = (BinaryExpressionNode)argNode; - string scriptName = GetAttributeValue(attributes, "ScriptName"); - if (scriptName != null) { - memberSymbol.SetTransformedName(scriptName); - } - else if (AttributeNode.FindAttribute(attributes, "PreserveName") != null) { - memberSymbol.DisableNameTransformation(); + if (String.CompareOrdinal(((NameNode)propSetNode.LeftChild).Name, "PreserveName") == 0) { + preserveName = (bool)((LiteralNode)propSetNode.RightChild).Value; + } + else { + preserveCase = (bool)((LiteralNode)propSetNode.RightChild).Value; + if (preserveCase) { + preserveName = true; + break; + } + } + } + } + + if (String.IsNullOrEmpty(name) == false) { + memberSymbol.SetTransformedName(name); + } + else { + memberSymbol.SetNameCasing(preserveCase); + if (preserveName) { + memberSymbol.DisableNameTransformation(); + } + } } } @@ -286,30 +410,8 @@ public ICollection BuildMetadata(ParseNodeList compilationUnits, Sym _symbols = symbols; _symbolTable = symbols; _options = options; + BuildAssembly(compilationUnits); - string scriptName = GetAssemblyScriptName(compilationUnits); - if (String.IsNullOrEmpty(scriptName)) { - _errorHandler.ReportError("You must declare a ScriptAssembly attribute.", String.Empty); - } - else if (Utility.IsValidScriptName(scriptName) == false) { - string errorMessage = "The ScriptAssembly attribute referenced an invalid name '{0}'. Script names must only contain letters, numbers, dots or underscores."; - _errorHandler.ReportError(String.Format(errorMessage, scriptName), String.Empty); - } - symbols.ScriptName = scriptName; - - string scriptPrefix = GetAssemblyScriptPrefix(compilationUnits); - if (String.IsNullOrEmpty(scriptPrefix) == false) { - if (Utility.IsValidIdentifier(scriptPrefix) == false) { - string errorMessage = "The ScriptQualifier attribute referenced an invalid prefix '{0}'. Script prefix must be valid identifiers."; - _errorHandler.ReportError(String.Format(errorMessage, scriptPrefix), String.Empty); - } - } - else { - scriptPrefix = scriptName.Replace(".", String.Empty); - } - symbols.ScriptPrefix = scriptPrefix; - - string assemblyScriptNamespace = GetAssemblyScriptNamespace(compilationUnits); List types = new List(); // Build all the types first. @@ -376,12 +478,6 @@ public ICollection BuildMetadata(ParseNodeList compilationUnits, Sym continue; } - // Check if we have overriding script namespace for this type. - string typeScriptNamespace = GetScriptNamespace(userTypeNode.Attributes); - if (String.IsNullOrEmpty(typeScriptNamespace)) { - typeScriptNamespace = assemblyScriptNamespace; - } - ClassSymbol partialTypeSymbol = null; bool isPartial = false; @@ -400,10 +496,6 @@ public ICollection BuildMetadata(ParseNodeList compilationUnits, Sym // Merge interesting bits of information onto the primary type symbol as well // representing this partial class BuildType(partialTypeSymbol, userTypeNode); - - if (String.IsNullOrEmpty(typeScriptNamespace) == false) { - partialTypeSymbol.ScriptNamespace = typeScriptNamespace; - } } } @@ -418,10 +510,6 @@ public ICollection BuildMetadata(ParseNodeList compilationUnits, Sym typeSymbol.SetAliases(aliases); } - if (String.IsNullOrEmpty(typeScriptNamespace) == false) { - typeSymbol.ScriptNamespace = typeScriptNamespace; - } - if (isPartial == false) { namespaceSymbol.AddType(typeSymbol); } @@ -525,6 +613,18 @@ private MethodSymbol BuildMethod(MethodDeclarationNode methodNode, TypeSymbol ty if (conditions != null) { method.SetConditions(conditions); } + + if (typeSymbol.IsApplicationType == false) { + foreach (AttributeNode attrNode in methodNode.Attributes) { + if (attrNode.TypeName.Equals("ScriptMethod", StringComparison.Ordinal)) { + Debug.Assert(attrNode.Arguments[0] is LiteralNode); + Debug.Assert(((LiteralNode)attrNode.Arguments[0]).Value is string); + + method.SetSelector((string)((LiteralNode)attrNode.Arguments[0]).Value); + break; + } + } + } } } @@ -546,11 +646,9 @@ private MethodSymbol BuildMethod(MethodDeclarationNode methodNode, TypeSymbol ty } } - if ((method.Visibility & MemberVisibility.Static) != 0) { - string scriptAlias = GetAttributeValue(methodNode.Attributes, "ScriptAlias"); - if (scriptAlias != null) { - method.SetAlias(scriptAlias); - } + string scriptAlias = GetAttributeValue(methodNode.Attributes, "ScriptAlias"); + if (scriptAlias != null) { + method.SetAlias(scriptAlias); } } @@ -618,8 +716,8 @@ private PropertySymbol BuildProperty(PropertyDeclarationNode propertyNode, TypeS } private FieldSymbol BuildPropertyAsField(PropertyDeclarationNode propertyNode, TypeSymbol typeSymbol) { - AttributeNode intrinsicPropertyAttribute = AttributeNode.FindAttribute(propertyNode.Attributes, "IntrinsicProperty"); - if (intrinsicPropertyAttribute == null) { + AttributeNode scriptFieldAttribute = AttributeNode.FindAttribute(propertyNode.Attributes, "ScriptField"); + if (scriptFieldAttribute == null) { return null; } @@ -667,26 +765,23 @@ private TypeSymbol BuildType(UserTypeNode typeNode, NamespaceSymbol namespaceSym CustomTypeNode customTypeNode = (CustomTypeNode)typeNode; Debug.Assert(customTypeNode != null); - NameNode baseTypeNameNode = null; - if (customTypeNode.BaseTypes.Count != 0) { - baseTypeNameNode = customTypeNode.BaseTypes[0] as NameNode; - } - - if ((baseTypeNameNode != null) && (String.CompareOrdinal(baseTypeNameNode.Name, "Record") == 0)) { + if (AttributeNode.FindAttribute(attributes, "ScriptObject") != null) { typeSymbol = new RecordSymbol(typeNode.Name, namespaceSymbol); } + else if (AttributeNode.FindAttribute(attributes, "ScriptResources") != null) { + typeSymbol = new ResourcesSymbol(typeNode.Name, namespaceSymbol); + } else { - AttributeNode resourcesAttribute = AttributeNode.FindAttribute(attributes, "Resources"); - if (resourcesAttribute != null) { - typeSymbol = new ResourcesSymbol(typeNode.Name, namespaceSymbol); + typeSymbol = new ClassSymbol(typeNode.Name, namespaceSymbol); + + NameNode baseTypeNameNode = null; + if (customTypeNode.BaseTypes.Count != 0) { + baseTypeNameNode = customTypeNode.BaseTypes[0] as NameNode; } - else { - typeSymbol = new ClassSymbol(typeNode.Name, namespaceSymbol); - if ((baseTypeNameNode != null) && - (String.CompareOrdinal(baseTypeNameNode.Name, "TestClass") == 0)) { - ((ClassSymbol)typeSymbol).SetTestClass(); - } + if ((baseTypeNameNode != null) && + (String.CompareOrdinal(baseTypeNameNode.Name, "TestClass") == 0)) { + ((ClassSymbol)typeSymbol).SetTestClass(); } } } @@ -717,7 +812,8 @@ private TypeSymbol BuildType(UserTypeNode typeNode, NamespaceSymbol namespaceSym BuildType(typeSymbol, typeNode); - if (namespaceSymbol.Name.EndsWith(_options.TestsSubnamespace, StringComparison.Ordinal)) { + if (namespaceSymbol.Name.EndsWith(".Tests", StringComparison.Ordinal) || + (namespaceSymbol.Name.IndexOf(".Tests.", StringComparison.Ordinal) > 0)) { typeSymbol.SetTestType(); } } @@ -731,12 +827,42 @@ private void BuildType(TypeSymbol typeSymbol, UserTypeNode typeNode) { ParseNodeList attributes = typeNode.Attributes; - if (AttributeNode.FindAttribute(attributes, "Imported") != null) { - typeSymbol.SetImported(/* dependencyName */ null); - } + if (AttributeNode.FindAttribute(attributes, "ScriptImport") != null) { + ScriptReference dependency = null; - if (AttributeNode.FindAttribute(attributes, "IgnoreNamespace") != null) { - typeSymbol.SetIgnoreNamespace(); + AttributeNode dependencyAttribute = AttributeNode.FindAttribute(attributes, "ScriptDependency"); + if (dependencyAttribute != null) { + string dependencyIdentifier = null; + + Debug.Assert((dependencyAttribute.Arguments.Count != 0) && (dependencyAttribute.Arguments[0].NodeType == ParseNodeType.Literal)); + Debug.Assert(((LiteralNode)dependencyAttribute.Arguments[0]).Value is string); + string dependencyName = (string)((LiteralNode)dependencyAttribute.Arguments[0]).Value; + + if (dependencyAttribute.Arguments.Count > 1) { + Debug.Assert(dependencyAttribute.Arguments[1] is BinaryExpressionNode); + + BinaryExpressionNode propExpression = (BinaryExpressionNode)dependencyAttribute.Arguments[1]; + Debug.Assert((propExpression.LeftChild.NodeType == ParseNodeType.Name) && + (String.CompareOrdinal(((NameNode)propExpression.LeftChild).Name, "Identifier") == 0)); + + Debug.Assert(propExpression.RightChild.NodeType == ParseNodeType.Literal); + Debug.Assert(((LiteralNode)propExpression.RightChild).Value is string); + + dependencyIdentifier = (string)((LiteralNode)propExpression.RightChild).Value; + } + + dependency = new ScriptReference(dependencyName, dependencyIdentifier); + } + + typeSymbol.SetImported(dependency); + + if ((AttributeNode.FindAttribute(attributes, "ScriptIgnoreNamespace") != null) || + (dependency == null)) { + typeSymbol.SetIgnoreNamespace(); + } + else { + typeSymbol.ScriptNamespace = dependency.Identifier; + } } if (AttributeNode.FindAttribute(attributes, "PreserveName") != null) { @@ -749,35 +875,51 @@ private void BuildType(TypeSymbol typeSymbol, UserTypeNode typeNode) { } if (typeNode.Type == TokenType.Class) { - bool globalizeMembers = false; - string mixinRoot = null; + AttributeNode extensionAttribute = AttributeNode.FindAttribute(attributes, "ScriptExtension"); + if (extensionAttribute != null) { + Debug.Assert(extensionAttribute.Arguments[0] is LiteralNode); + Debug.Assert(((LiteralNode)extensionAttribute.Arguments[0]).Value is string); - AttributeNode globalMethodsAttribute = AttributeNode.FindAttribute(attributes, "GlobalMethods"); - if (globalMethodsAttribute != null) { - globalizeMembers = true; + string extendee = (string)((LiteralNode)extensionAttribute.Arguments[0]).Value; + Debug.Assert(String.IsNullOrEmpty(extendee) == false); + + ((ClassSymbol)typeSymbol).SetExtenderClass(extendee); } - else { - AttributeNode mixinAttribute = AttributeNode.FindAttribute(attributes, "Mixin"); - if (mixinAttribute != null) { - Debug.Assert(mixinAttribute.Arguments[0] is LiteralNode); - Debug.Assert(((LiteralNode)mixinAttribute.Arguments[0]).Value is string); - mixinRoot = (string)((LiteralNode)mixinAttribute.Arguments[0]).Value; - globalizeMembers = true; - } + AttributeNode moduleAttribute = AttributeNode.FindAttribute(attributes, "ScriptModule"); + if (moduleAttribute != null) { + ((ClassSymbol)typeSymbol).SetModuleClass(); } - if (globalizeMembers) { - ((ClassSymbol)typeSymbol).SetGlobalMethods(mixinRoot); + if ((typeNode.Modifiers & Modifiers.Static) != 0) { + ((ClassSymbol)typeSymbol).SetStaticClass(); } } if (typeNode.Type == TokenType.Enum) { - if (AttributeNode.FindAttribute(attributes, "NamedValues") != null) { - ((EnumerationSymbol)typeSymbol).SetNamedValues(); - } - else if (AttributeNode.FindAttribute(attributes, "NumericValues") != null) { - ((EnumerationSymbol)typeSymbol).SetNumericValues(); + AttributeNode constantsAttribute = AttributeNode.FindAttribute(attributes, "ScriptConstants"); + if (constantsAttribute != null) { + bool useNames = false; + + if ((constantsAttribute.Arguments != null) && (constantsAttribute.Arguments.Count != 0)) { + Debug.Assert(constantsAttribute.Arguments[0] is BinaryExpressionNode); + + BinaryExpressionNode propExpression = (BinaryExpressionNode)constantsAttribute.Arguments[0]; + Debug.Assert((propExpression.LeftChild.NodeType == ParseNodeType.Name) && + (String.CompareOrdinal(((NameNode)propExpression.LeftChild).Name, "UseNames") == 0)); + + Debug.Assert(propExpression.RightChild.NodeType == ParseNodeType.Literal); + Debug.Assert(((LiteralNode)propExpression.RightChild).Value is bool); + + useNames = (bool)((LiteralNode)propExpression.RightChild).Value; + } + + if (useNames) { + ((EnumerationSymbol)typeSymbol).SetNamedValues(); + } + else { + ((EnumerationSymbol)typeSymbol).SetNumericValues(); + } } } } @@ -818,47 +960,59 @@ private void BuildTypeInheritance(ClassSymbol classSymbol) { } } - private string GetAssemblyScriptName(ParseNodeList compilationUnits) { + private void GetAssemblyMetadata(ParseNodeList compilationUnits, out string description, out string copyright, out string version) { + description = null; + copyright = null; + version = null; + foreach (CompilationUnitNode compilationUnit in compilationUnits) { foreach (AttributeBlockNode attribBlock in compilationUnit.Attributes) { - string scriptName = GetAttributeValue(attribBlock.Attributes, "ScriptAssembly"); - if (scriptName != null) { - return scriptName; + if (description == null) { + description = GetAttributeValue(attribBlock.Attributes, "AssemblyDescription"); + } + if (copyright == null) { + copyright = GetAttributeValue(attribBlock.Attributes, "AssemblyCopyright"); + } + if (version == null) { + version = GetAttributeValue(attribBlock.Attributes, "AssemblyFileVersion"); } } } - return null; } - private string GetAssemblyScriptNamespace(ParseNodeList compilationUnits) { + private string GetAssemblyScriptName(ParseNodeList compilationUnits) { foreach (CompilationUnitNode compilationUnit in compilationUnits) { foreach (AttributeBlockNode attribBlock in compilationUnit.Attributes) { - string scriptNamespace = GetScriptNamespace(attribBlock.Attributes); - if (scriptNamespace != null) { - return scriptNamespace; + string scriptName = GetAttributeValue(attribBlock.Attributes, "ScriptAssembly"); + if (scriptName != null) { + return scriptName; } } } return null; } - private string GetAssemblyScriptPrefix(ParseNodeList compilationUnits) { + private List GetAttributes(ParseNodeList compilationUnits, string attributeName) { + List attributes = new List(); + foreach (CompilationUnitNode compilationUnit in compilationUnits) { foreach (AttributeBlockNode attribBlock in compilationUnit.Attributes) { - string scriptPrefix = GetAttributeValue(attribBlock.Attributes, "ScriptQualifier"); - if (scriptPrefix != null) { - return scriptPrefix; + foreach (AttributeNode attribNode in attribBlock.Attributes) { + if (attribNode.TypeName.Equals(attributeName, StringComparison.Ordinal)) { + attributes.Add(attribNode); + } } } } - return null; + + return attributes; } private string GetAttributeValue(ParseNodeList attributes, string attributeName) { AttributeNode node = AttributeNode.FindAttribute(attributes, attributeName); - if (node != null) { - Debug.Assert(node.Arguments[0] is LiteralNode); + if ((node != null) && + (node.Arguments.Count != 0) && (node.Arguments[0].NodeType == ParseNodeType.Literal)) { Debug.Assert(((LiteralNode)node.Arguments[0]).Value is string); return (string)((LiteralNode)node.Arguments[0]).Value; @@ -866,8 +1020,19 @@ private string GetAttributeValue(ParseNodeList attributes, string attributeName) return null; } - private string GetScriptNamespace(ParseNodeList attributes) { - return GetAttributeValue(attributes, "ScriptNamespace"); + private bool GetScriptTemplate(ParseNodeList compilationUnits, out string template) { + template = null; + + foreach (CompilationUnitNode compilationUnit in compilationUnits) { + foreach (AttributeBlockNode attribBlock in compilationUnit.Attributes) { + template = GetAttributeValue(attribBlock.Attributes, "ScriptTemplate"); + if (template != null) { + return true; + } + } + } + + return false; } private MemberVisibility GetVisibility(MemberNode node, TypeSymbol typeSymbol) { diff --git a/src/Core/Compiler/Compiler/StatementBuilder.cs b/src/Core/Compiler/Compiler/StatementBuilder.cs index a55c19043..392d7591e 100644 --- a/src/Core/Compiler/Compiler/StatementBuilder.cs +++ b/src/Core/Compiler/Compiler/StatementBuilder.cs @@ -202,9 +202,13 @@ private Statement ProcessForeachStatement(ForeachNode node) { ForInStatement statement; if (dictionaryContainer) { - string dictionaryVariableName = _symbolTable.CreateSymbolName("dict"); - VariableSymbol dictionaryVariable = new VariableSymbol(dictionaryVariableName, _memberContext, - collectionExpression.EvaluatedType); + VariableSymbol dictionaryVariable = null; + + if (collectionExpression.Type != ExpressionType.Local) { + string dictionaryVariableName = _symbolTable.CreateSymbolName("dict"); + dictionaryVariable = new VariableSymbol(dictionaryVariableName, _memberContext, + collectionExpression.EvaluatedType); + } statement = new ForInStatement(collectionExpression, dictionaryVariable); diff --git a/src/Core/Compiler/CompilerOptions.cs b/src/Core/Compiler/CompilerOptions.cs index f309fbb76..382301d7c 100644 --- a/src/Core/Compiler/CompilerOptions.cs +++ b/src/Core/Compiler/CompilerOptions.cs @@ -20,18 +20,12 @@ public sealed class CompilerOptions { private ICollection _defines; private ICollection _sources; private ICollection _resources; - private IStreamSource _templateFile; private IStreamSource _scriptFile; private IStreamSource _docCommentFile; - private string _scriptNameSuffix; - private bool _debugFlavor; + private IStreamSourceResolver _includeResolver; private bool _includeTests; private bool _minimize; - - private string _testsSubnamespace; - - private List _executionDependencies; - private List _referencedDependencies; + private ScriptInfo _scriptInfo; private bool _hasTestTypes; @@ -40,16 +34,7 @@ public sealed class CompilerOptions { private string _internalTestType; public CompilerOptions() { - _testsSubnamespace = ".Tests"; - } - - public bool DebugFlavor { - get { - return _debugFlavor; - } - set { - _debugFlavor = value; - } + _scriptInfo = new ScriptInfo(); } public ICollection Defines { @@ -72,25 +57,25 @@ public IStreamSource DocCommentFile { public bool EnableDocComments { get { - if (DebugFlavor) { - return (_docCommentFile != null); - } - return false; + return (_docCommentFile != null); } } - public IEnumerable ExecutionDependencies { + public bool HasTestTypes { get { - return _executionDependencies; + return _hasTestTypes; + } + set { + _hasTestTypes = value; } } - public bool HasTestTypes { + public IStreamSourceResolver IncludeResolver { get { - return _hasTestTypes; + return _includeResolver; } set { - _hasTestTypes = value; + _includeResolver = value; } } @@ -123,10 +108,7 @@ public string InternalTestType { public bool Minimize { get { - if (!DebugFlavor) { - return _minimize; - } - return false; + return _minimize; } set { _minimize = value; @@ -139,7 +121,6 @@ public ICollection References { } set { _references = value; - _referencedDependencies = null; } } @@ -152,21 +133,18 @@ public ICollection Resources { } } - public IStreamSource ScriptFile { + public ScriptInfo ScriptInfo { get { - return _scriptFile; - } - set { - _scriptFile = value; + return _scriptInfo; } } - public string ScriptNameSuffix { + public IStreamSource ScriptFile { get { - return _scriptNameSuffix ?? String.Empty; + return _scriptFile; } set { - _scriptNameSuffix = value; + _scriptFile = value; } } @@ -179,40 +157,6 @@ public ICollection Sources { } } - public IStreamSource TemplateFile { - get { - return _templateFile; - } - set { - _templateFile = value; - } - } - - public string TestsSubnamespace { - get { - return _testsSubnamespace; - } - set { - _testsSubnamespace = value; - } - } - - public void AddExecutionDependency(string scriptName) { - if (_executionDependencies == null) { - _executionDependencies = new List(); - } - if (_executionDependencies.Contains(scriptName) == false) { - _executionDependencies.Add(scriptName); - } - } - - public void AddReferencedDependency(string scriptName) { - if (_referencedDependencies == null) { - _referencedDependencies = new List(); - } - _referencedDependencies.Add(scriptName); - } - public bool Validate(out string errorMessage) { errorMessage = String.Empty; diff --git a/src/Core/Compiler/Generator/CodeGenerator.cs b/src/Core/Compiler/Generator/CodeGenerator.cs index f237dc2f4..b12792592 100644 --- a/src/Core/Compiler/Generator/CodeGenerator.cs +++ b/src/Core/Compiler/Generator/CodeGenerator.cs @@ -15,8 +15,35 @@ namespace ScriptSharp.Generator { internal static class CodeGenerator { private static void GenerateImplementationScript(ScriptGenerator generator, MemberSymbol symbol, SymbolImplementation implementation) { - foreach (Statement statement in implementation.Statements) { - StatementGenerator.GenerateStatement(generator, symbol, statement); + generator.StartImplementation(implementation); + try { + bool generateThisCacheStatement = false; + + if ((symbol.Visibility & MemberVisibility.Static) == 0) { + CodeMemberSymbol codeMemberSymbol = symbol as CodeMemberSymbol; + if ((codeMemberSymbol != null) && (codeMemberSymbol.AnonymousMethods != null)) { + foreach (AnonymousMethodSymbol anonymousMethod in codeMemberSymbol.AnonymousMethods) { + if ((anonymousMethod.Visibility & MemberVisibility.Static) == 0) { + generateThisCacheStatement = true; + break; + } + } + } + } + + if (generateThisCacheStatement) { + ScriptTextWriter writer = generator.Writer; + + writer.WriteLine("var $this = this;"); + writer.WriteLine(); + } + + foreach (Statement statement in implementation.Statements) { + StatementGenerator.GenerateStatement(generator, symbol, statement); + } + } + finally { + generator.EndImplementation(); } } diff --git a/src/Core/Compiler/Generator/DocCommentGenerator.cs b/src/Core/Compiler/Generator/DocCommentGenerator.cs index bc6ce1f2e..a3e7b9fdb 100644 --- a/src/Core/Compiler/Generator/DocCommentGenerator.cs +++ b/src/Core/Compiler/Generator/DocCommentGenerator.cs @@ -3,14 +3,14 @@ // This source code is subject to terms and conditions of the Apache License, Version 2.0. // -namespace ScriptSharp.Generator { +using System; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Xml; +using ScriptSharp.ScriptModel; - using System; - using System.Diagnostics; - using System.IO; - using System.Text; - using System.Xml; - using ScriptSharp.ScriptModel; +namespace ScriptSharp.Generator { internal static class DocCommentGenerator { @@ -22,7 +22,7 @@ public static void GenerateComment(ScriptGenerator generator, Symbol symbol) { GenerateClassComment(writer, (ClassSymbol)symbol); break; case SymbolType.Enumeration: - GenerateEnumerationComment(writer, (EnumerationSymbol)symbol); + // No-op - no doc-comments get generated for enums. break; case SymbolType.Event: GenerateEventComment(writer, (EventSymbol)symbol); @@ -74,7 +74,7 @@ private static void GenerateFormattedComment(ScriptTextWriter writer, string tex } private static void GenerateInterfaceComment(ScriptTextWriter writer, InterfaceSymbol interfaceSymbol) { - writer.WriteNewLine(); + writer.WriteLine(); writer.Indent++; GenerateSummaryComment(writer, interfaceSymbol); @@ -100,28 +100,6 @@ private static void GenerateEventComment(ScriptTextWriter writer, EventSymbol ev writer.WriteLine("/// ", eventSymbol.Parameters[0].Name); } - private static void GenerateEnumerationComment(ScriptTextWriter writer, EnumerationSymbol enumSymbol) { - writer.WriteNewLine(); - writer.Indent++; - - GenerateSummaryComment(writer, enumSymbol); - - foreach (MemberSymbol memberSymbol in enumSymbol.Members) { - EnumerationFieldSymbol fieldSymbol = memberSymbol as EnumerationFieldSymbol; - if (fieldSymbol != null) { - writer.WriteLine( - "/// ", - fieldSymbol.GeneratedName); - - GenerateFormattedComment(writer, fieldSymbol.Documentation); - - writer.WriteLine("/// "); - } - } - - writer.Indent--; - } - private static void GenerateFieldComment(ScriptTextWriter writer, FieldSymbol fieldSymbol) { writer.Write("/// 0) { - writer.WriteTrimmed(", "); - } - if (obfuscateParams) { - if (paramIndex == 0) { - obfuscationPrefix = "$p" + anonymousMethod.Depth.ToString(CultureInfo.InvariantCulture) + "_"; - } - parameterSymbol.SetTransformedName(obfuscationPrefix + paramIndex); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); paramIndex++; } } - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteLine(); + writer.WriteLine(") {"); writer.Indent++; CodeGenerator.GenerateScript(generator, anonymousMethod); writer.Indent--; writer.Write("}"); } + else if ((expression.Method.Visibility & MemberVisibility.Static) != 0) { + if (expression.Method.IsExtension) { + Debug.Assert(expression.Method.Parent.Type == SymbolType.Class); - if (createDelegate) { + ClassSymbol classSymbol = (ClassSymbol)expression.Method.Parent; + Debug.Assert(classSymbol.IsExtenderClass); + + writer.Write(classSymbol.Extendee); + writer.Write("."); + writer.Write(expression.Method.GeneratedName); + } + else { + ExpressionGenerator.GenerateExpression(generator, symbol, expression.ObjectReference); + writer.Write("."); + writer.Write(expression.Method.GeneratedName); + } + } + else { + writer.Write("ss.bind('"); + writer.Write(expression.Method.GeneratedName); + writer.Write("', "); + ExpressionGenerator.GenerateExpression(generator, symbol, expression.ObjectReference); writer.Write(")"); } } @@ -294,17 +283,36 @@ private static void GenerateEnumerationFieldExpression(ScriptGenerator generator private static void GenerateEventExpression(ScriptGenerator generator, MemberSymbol symbol, EventExpression expression) { ScriptTextWriter writer = generator.Writer; + EventSymbol eventSymbol = expression.Event; + ExpressionGenerator.GenerateExpression(generator, symbol, expression.ObjectReference); - if (expression.Type == ExpressionType.EventAdd) { - writer.Write(".add_"); + if (eventSymbol.HasCustomAccessors) { + writer.Write("."); + if (expression.Type == ExpressionType.EventAdd) { + writer.Write(eventSymbol.AddAccessor); + } + else { + writer.Write(eventSymbol.RemoveAccessor); + } + + writer.Write("('"); + writer.Write(expression.Event.GeneratedName); + writer.Write("', "); + ExpressionGenerator.GenerateExpression(generator, symbol, expression.Handler); + writer.Write(")"); } else { - writer.Write(".remove_"); + if (expression.Type == ExpressionType.EventAdd) { + writer.Write(".add_"); + } + else { + writer.Write(".remove_"); + } + writer.Write(expression.Event.GeneratedName); + writer.Write("("); + ExpressionGenerator.GenerateExpression(generator, symbol, expression.Handler); + writer.Write(")"); } - writer.Write(expression.Event.GeneratedName); - writer.Write("("); - ExpressionGenerator.GenerateExpression(generator, symbol, expression.Handler); - writer.Write(")"); } public static void GenerateExpression(ScriptGenerator generator, MemberSymbol symbol, Expression expression) { @@ -380,6 +388,9 @@ public static void GenerateExpression(ScriptGenerator generator, MemberSymbol sy case ExpressionType.InlineScript: GenerateInlineScriptExpression(generator, symbol, (InlineScriptExpression)expression); break; + case ExpressionType.NewDelegate: + GenerateExpression(generator, symbol, ((NewDelegateExpression)expression).TypeExpression); + break; default: Debug.Fail("Unexpected expression type: " + expression.Type); break; @@ -396,7 +407,7 @@ public static void GenerateExpressionList(ScriptGenerator generator, MemberSymbo bool firstExpression = true; foreach (Expression expression in expressions) { if (firstExpression == false) { - writer.WriteTrimmed(", "); + writer.Write(", "); } GenerateExpression(generator, symbol, expression); firstExpression = false; @@ -413,11 +424,11 @@ private static void GenerateExpressionListAsNameValuePairs(ScriptGenerator gener foreach (Expression expression in expressions) { if ((firstExpression == false) && (valueExpression == false)) { - writer.WriteTrimmed(", "); + writer.Write(", "); } if (valueExpression) { - writer.WriteTrimmed(": "); + writer.Write(": "); GenerateExpression(generator, symbol, expression); valueExpression = false; @@ -458,22 +469,21 @@ private static void GenerateFieldExpression(ScriptGenerator generator, MemberSym private static void GenerateIndexerExpression(ScriptGenerator generator, MemberSymbol symbol, IndexerExpression expression) { ScriptTextWriter writer = generator.Writer; - if (expression.Indexer.IsIntrinsic) { + if (expression.Indexer.UseScriptIndexer) { GenerateExpression(generator, symbol, expression.ObjectReference); writer.Write("["); GenerateExpressionList(generator, symbol, expression.Indices); writer.Write("]"); } else if (expression.ObjectReference is BaseExpression) { - Debug.Assert(symbol.Parent is ClassSymbol); - - writer.Write(((ClassSymbol)symbol.Parent).FullGeneratedName); - writer.Write(".callBaseMethod(this, 'get_"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.get_"); writer.Write(expression.Indexer.GeneratedName); - writer.Write("',"); - writer.WriteTrimmed(" [ "); + writer.Write(".call("); + writer.Write(generator.CurrentImplementation.ThisIdentifier); + writer.Write(", "); GenerateExpressionList(generator, symbol, expression.Indices); - writer.WriteTrimmed(" ])"); + writer.Write(")"); } else { GenerateExpression(generator, expression.Indexer, expression.ObjectReference); @@ -512,7 +522,7 @@ private static void GenerateInlineScriptExpression(ScriptGenerator generator, Me } } - script = String.Format(script, parameterScripts); + script = String.Format(CultureInfo.InvariantCulture, script, parameterScripts); } writer.Write(script); @@ -523,9 +533,7 @@ private static void GenerateLateBoundExpression(ScriptGenerator generator, Membe string name = null; LiteralExpression literalNameExpression = expression.NameExpression as LiteralExpression; - if (literalNameExpression != null) { - Debug.Assert(literalNameExpression.Value is string); - + if ((literalNameExpression != null) && (literalNameExpression.Value is string)) { name = (string)literalNameExpression.Value; Debug.Assert(String.IsNullOrEmpty(name) == false); } @@ -593,7 +601,7 @@ private static void GenerateLateBoundExpression(ScriptGenerator generator, Membe writer.Write("]"); } - writer.WriteTrimmed(" = "); + writer.Write(" = "); GenerateExpressionList(generator, symbol, expression.Parameters); break; case LateBoundOperation.DeleteField: @@ -626,10 +634,7 @@ private static void GenerateLateBoundExpression(ScriptGenerator generator, Membe writer.Write("]"); } - writer.Write(")"); - writer.WriteTrimmed(" === "); - writer.Write("'function'"); - writer.Write(")"); + writer.Write(") === 'function')"); break; } } @@ -664,9 +669,9 @@ private static void GenerateLiteralExpression(ScriptGenerator generator, MemberS textValue = "[]"; } else { - writer.WriteTrimmed("[ "); + writer.Write("[ "); GenerateExpressionList(generator, symbol, (Expression[])value); - writer.WriteTrimmed(" ]"); + writer.Write(" ]"); } } else { @@ -697,46 +702,60 @@ private static void GenerateMethodExpression(ScriptGenerator generator, MemberSy } if (expression.ObjectReference is BaseExpression) { - Debug.Assert(symbol.Parent is ClassSymbol); - Debug.Assert(expression.Method.IsGlobalMethod == false); + Debug.Assert(expression.Method.IsExtension == false); - writer.Write(((ClassSymbol)symbol.Parent).FullGeneratedName); - writer.Write(".callBaseMethod(this, '"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype."); writer.Write(expression.Method.GeneratedName); - writer.Write("'"); + writer.Write(".call("); + writer.Write(generator.CurrentImplementation.ThisIdentifier); if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) { - writer.Write(","); - writer.WriteTrimmed(" [ "); + writer.Write(", "); GenerateExpressionList(generator, symbol, expression.Parameters); - writer.WriteTrimmed(" ]"); } writer.Write(")"); } else { - if (expression.Method.IsGlobalMethod) { - if (expression.Method.Parent is ClassSymbol) { - string mixinRoot = ((ClassSymbol)expression.Method.Parent).MixinRoot; - if (String.IsNullOrEmpty(mixinRoot) == false) { - writer.Write(mixinRoot); - writer.Write("."); + if (expression.Method.IsAliased) { + writer.Write(expression.Method.Alias); + writer.Write("("); + if ((expression.Method.Visibility & MemberVisibility.Static) == 0) { + GenerateExpression(generator, symbol, expression.ObjectReference); + if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) { + writer.Write(", "); } } + if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) { + GenerateExpressionList(generator, symbol, expression.Parameters); + } + writer.Write(")"); } else { - GenerateExpression(generator, symbol, expression.ObjectReference); - if (expression.Method.GeneratedName.Length != 0) { + if (expression.Method.IsExtension) { + Debug.Assert(expression.Method.Parent.Type == SymbolType.Class); + + string extendee = ((ClassSymbol)expression.Method.Parent).Extendee; + Debug.Assert(String.IsNullOrEmpty(extendee) == false); + + writer.Write(extendee); writer.Write("."); } - } + else { + GenerateExpression(generator, symbol, expression.ObjectReference); + if (expression.Method.GeneratedName.Length != 0) { + writer.Write("."); + } + } - if (expression.Method.GeneratedName.Length != 0) { - writer.Write(expression.Method.GeneratedName); - } - writer.Write("("); - if (expression.Parameters != null) { - GenerateExpressionList(generator, symbol, expression.Parameters); + if (expression.Method.GeneratedName.Length != 0) { + writer.Write(expression.Method.GeneratedName); + } + writer.Write("("); + if (expression.Parameters != null) { + GenerateExpressionList(generator, symbol, expression.Parameters); + } + writer.Write(")"); } - writer.Write(")"); } } @@ -767,19 +786,41 @@ private static void GenerateNewExpression(ScriptGenerator generator, MemberSymbo writer.Write("{}"); } else { - writer.WriteTrimmed("{ "); + writer.Write("{ "); GenerateExpressionListAsNameValuePairs(generator, symbol, expression.Parameters); - writer.WriteTrimmed(" }"); + writer.Write(" }"); } return; } + else if (type.Equals("Tuple")) { + if ((expression.Parameters == null) || (expression.Parameters.Count == 0)) { + writer.Write("{ }"); + } + else { + writer.Write("{ "); + for (int i = 0; i < expression.Parameters.Count; i++) { + if (i != 0) { + writer.Write(", "); + } + + writer.Write("item"); + writer.Write(i + 1); + writer.Write(": "); + GenerateExpression(generator, symbol, expression.Parameters[i]); + } + writer.Write(" }"); + } + + return; + } else if (expression.AssociatedType.Type == SymbolType.Record) { - if (expression.AssociatedType.IgnoreNamespace == false) { - writer.Write(expression.AssociatedType.GeneratedNamespace); - writer.Write("."); + if (expression.AssociatedType.IsApplicationType && + ((RecordSymbol)expression.AssociatedType).Constructor == null) { + writer.Write("{ }"); + return; } - writer.Write("$create_"); - writer.Write(expression.AssociatedType.GeneratedName); + + writer.Write(expression.AssociatedType.FullGeneratedName); writer.Write("("); if (expression.Parameters != null) { GenerateExpressionList(generator, symbol, expression.Parameters); @@ -811,10 +852,15 @@ private static void GeneratePropertyExpression(ScriptGenerator generator, Member if (expression.ObjectReference is BaseExpression) { Debug.Assert(symbol.Parent is ClassSymbol); - writer.Write(((ClassSymbol)symbol.Parent).FullGeneratedName); - writer.Write(".callBaseMethod(this, 'get_"); + ClassSymbol baseClass = ((ClassSymbol)symbol.Parent).BaseClass; + Debug.Assert(baseClass != null); + + writer.Write(baseClass.FullGeneratedName); + writer.Write(".prototype.get_"); writer.Write(expression.Property.GeneratedName); - writer.Write("')"); + writer.Write(".call("); + writer.Write(generator.CurrentImplementation.ThisIdentifier); + writer.Write(")"); } else { ExpressionGenerator.GenerateExpression(generator, symbol, expression.ObjectReference); @@ -826,7 +872,7 @@ private static void GeneratePropertyExpression(ScriptGenerator generator, Member private static void GenerateThisExpression(ScriptGenerator generator, MemberSymbol symbol, ThisExpression expression) { ScriptTextWriter writer = generator.Writer; - writer.Write("this"); + writer.Write(generator.CurrentImplementation.ThisIdentifier); } private static void GenerateTypeExpression(ScriptGenerator generator, MemberSymbol symbol, TypeExpression expression) { @@ -854,18 +900,18 @@ private static void GenerateUnaryExpression(ScriptGenerator generator, MemberSym writer.Write(propExpression.Property.GeneratedName); writer.Write("()"); if ((expression.Operator == Operator.PreIncrement) || (expression.Operator == Operator.PostIncrement)) { - writer.WriteTrimmed(" + "); + writer.Write(" + "); fudgeOperator = " - "; } else { - writer.WriteTrimmed(" - "); + writer.Write(" - "); fudgeOperator = " + "; } writer.Write("1"); writer.Write(")"); if ((expression.Operator == Operator.PreIncrement) || (expression.Operator == Operator.PreDecrement)) { - writer.WriteTrimmed(fudgeOperator); + writer.Write(fudgeOperator); writer.Write("1"); } diff --git a/src/Core/Compiler/Generator/MemberGenerator.cs b/src/Core/Compiler/Generator/MemberGenerator.cs index a9181fb7c..78eadaf2a 100644 --- a/src/Core/Compiler/Generator/MemberGenerator.cs +++ b/src/Core/Compiler/Generator/MemberGenerator.cs @@ -17,12 +17,6 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev ScriptTextWriter writer = generator.Writer; ParameterSymbol valueParameter = eventSymbol.Parameters[0]; - if (generator.Options.Minimize) { - bool obfuscateParams = !eventSymbol.IsPublic; - if (obfuscateParams) { - valueParameter.SetTransformedName("$p0"); - } - } string eventName = eventSymbol.GeneratedName; string fieldName = eventName; @@ -56,23 +50,14 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("add_"); writer.Write(eventName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); + writer.Write(" = "); } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$add_"); - writer.Write(eventName); - } - writer.Write("("); + writer.Write("function("); writer.Write(valueParameter.GeneratedName); - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -81,13 +66,11 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev if (eventSymbol.DefaultImplementation) { writer.Write(fieldReference); - writer.WriteTrimmed(" = "); - writer.Write("ss.Delegate.combine("); + writer.Write(" = ss.bindAdd("); writer.Write(fieldReference); - writer.WriteTrimmed(", "); + writer.Write(", "); writer.Write(valueParameter.GeneratedName); - writer.Write(");"); - writer.WriteNewLine(); + writer.WriteLine(");"); } else { CodeGenerator.GenerateScript(generator, eventSymbol, /* add */ true); @@ -96,12 +79,11 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("}"); if (instanceMember == false) { - writer.WriteSignificantNewLine(); + writer.WriteLine(";"); } if (instanceMember) { - writer.Write(","); - writer.WriteNewLine(); + writer.WriteLine(","); } else { writer.Write(typeName); @@ -110,23 +92,14 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("remove_"); writer.Write(eventName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); - } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$remove_"); - writer.Write(eventName); + writer.Write(" = "); } - writer.Write("("); + writer.Write("function("); writer.Write(valueParameter.GeneratedName); - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -135,13 +108,11 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev if (eventSymbol.DefaultImplementation) { writer.Write(fieldReference); - writer.WriteTrimmed(" = "); - writer.Write("ss.Delegate.remove("); + writer.Write(" = ss.bindSub("); writer.Write(fieldReference); - writer.WriteTrimmed(", "); + writer.Write(", "); writer.Write(valueParameter.GeneratedName); - writer.Write(");"); - writer.WriteNewLine(); + writer.WriteLine(");"); } else { CodeGenerator.GenerateScript(generator, eventSymbol, /* add */ false); @@ -150,7 +121,7 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("}"); if (instanceMember == false) { - writer.WriteSignificantNewLine(); + writer.WriteLine(";"); } } @@ -166,16 +137,15 @@ private static void GenerateField(ScriptGenerator generator, string typeName, Fi writer.Write(fieldSymbol.GeneratedName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); + writer.Write(" = "); } CodeGenerator.GenerateScript(generator, fieldSymbol); if (instanceMember == false) { - writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(";"); } } @@ -184,53 +154,23 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, return; } - ScriptTextWriter writer = generator.Writer; - - bool instanceMember = true; - if ((indexerSymbol.Visibility & MemberVisibility.Static) != 0) { - instanceMember = false; - writer.Write(typeName); - writer.Write("."); - } + Debug.Assert((indexerSymbol.Visibility & MemberVisibility.Static) == 0); - bool obfuscateParams = !indexerSymbol.IsPublic; - if (obfuscateParams && generator.Options.Minimize) { - for (int i = 0; i < indexerSymbol.Parameters.Count; i++) { - ParameterSymbol parameterSymbol = indexerSymbol.Parameters[i]; - parameterSymbol.SetTransformedName("$p" + i); - } - } + ScriptTextWriter writer = generator.Writer; writer.Write("get_"); writer.Write(indexerSymbol.GeneratedName); - if (instanceMember) { - writer.WriteTrimmed(": "); - } - else { - writer.WriteTrimmed(" = "); - } - - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$get_"); - writer.Write(indexerSymbol.GeneratedName); - } - - writer.Write("("); + writer.Write(": function("); for (int i = 0; i < indexerSymbol.Parameters.Count - 1; i++) { ParameterSymbol parameterSymbol = indexerSymbol.Parameters[i]; if (i > 0) { - writer.WriteTrimmed(", "); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); } - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -241,46 +181,20 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, writer.Indent--; writer.Write("}"); - if (instanceMember == false) { - writer.WriteSignificantNewLine(); - } - if (indexerSymbol.IsReadOnly == false) { - if (instanceMember) { - writer.Write(","); - writer.WriteNewLine(); - } - else { - writer.Write(typeName); - writer.Write("."); - } + writer.WriteLine(","); writer.Write("set_"); writer.Write(indexerSymbol.GeneratedName); - if (instanceMember) { - writer.WriteTrimmed(": "); - } - else { - writer.WriteTrimmed(" = "); - } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$set_"); - writer.Write(indexerSymbol.GeneratedName); - } - writer.Write("("); + writer.Write(": function("); for (int i = 0; i < indexerSymbol.Parameters.Count; i++) { ParameterSymbol parameterSymbol = indexerSymbol.Parameters[i]; if (i > 0) { - writer.WriteTrimmed(", "); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); } - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -290,14 +204,9 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, CodeGenerator.GenerateScript(generator, (IndexerSymbol)indexerSymbol, /* getter */ false); writer.Write("return "); writer.Write(indexerSymbol.Parameters[indexerSymbol.Parameters.Count - 1].GeneratedName); - writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(";"); writer.Indent--; writer.Write("}"); - - if (instanceMember == false) { - writer.WriteSignificantNewLine(); - } } } @@ -310,16 +219,16 @@ private static void GenerateMethod(ScriptGenerator generator, string typeName, M bool instanceMember = ((methodSymbol.Visibility & MemberVisibility.Static) == 0); if (instanceMember == false) { - if (methodSymbol.IsGlobalMethod) { - string mixinRoot = null; + if (methodSymbol.IsExtension) { + string extendee = null; if (methodSymbol.Parent.Type == SymbolType.Class) { - mixinRoot = ((ClassSymbol)methodSymbol.Parent).MixinRoot; + extendee = ((ClassSymbol)methodSymbol.Parent).Extendee; } - if (String.IsNullOrEmpty(mixinRoot)) { - mixinRoot = "window"; + if (String.IsNullOrEmpty(extendee)) { + extendee = "this"; } - writer.Write(mixinRoot); + writer.Write(extendee); } else { writer.Write(typeName); @@ -330,42 +239,25 @@ private static void GenerateMethod(ScriptGenerator generator, string typeName, M writer.Write(methodSymbol.GeneratedName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); + writer.Write(" = "); } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$"); - writer.Write(methodSymbol.GeneratedName); - } - writer.Write("("); + writer.Write("function("); if (methodSymbol.Parameters != null) { - bool obfuscateParams = false; - if (generator.Options.Minimize) { - obfuscateParams = !methodSymbol.IsPublic; - } - int paramIndex = 0; foreach (ParameterSymbol parameterSymbol in methodSymbol.Parameters) { if (paramIndex > 0) { - writer.WriteTrimmed(", "); - } - if (obfuscateParams) { - parameterSymbol.SetTransformedName("$p" + paramIndex); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); paramIndex++; } } - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -377,7 +269,7 @@ private static void GenerateMethod(ScriptGenerator generator, string typeName, M writer.Write("}"); if (instanceMember == false) { - writer.WriteSignificantNewLine(); + writer.WriteLine(";"); } } @@ -398,21 +290,12 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("get_"); writer.Write(propertySymbol.GeneratedName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); + writer.Write(" = "); } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$get_"); - writer.Write(propertySymbol.GeneratedName); - } - writer.Write("()"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine("function() {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -424,21 +307,13 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("}"); if (instanceMember == false) { - writer.WriteSignificantNewLine(); + writer.WriteLine(";"); } if (propertySymbol.IsReadOnly == false) { ParameterSymbol valueParameter = propertySymbol.Parameters[0]; - if (generator.Options.Minimize) { - bool obfuscateParams = !propertySymbol.IsPublic; - if (obfuscateParams) { - valueParameter.SetTransformedName("$p0"); - } - } - if (instanceMember) { - writer.Write(","); - writer.WriteNewLine(); + writer.WriteLine(","); } else { writer.Write(typeName); @@ -448,23 +323,14 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("set_"); writer.Write(propertySymbol.GeneratedName); if (instanceMember) { - writer.WriteTrimmed(": "); + writer.Write(": "); } else { - writer.WriteTrimmed(" = "); - } - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(typeName.Replace(".", "_")); - writer.Write("$set_"); - writer.Write(propertySymbol.GeneratedName); + writer.Write(" = "); } - writer.Write("("); + writer.Write("function("); writer.Write(valueParameter.GeneratedName); - writer.Write(")"); - writer.WriteTrimmed(" {"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -475,12 +341,12 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("return "); writer.Write(valueParameter.GeneratedName); writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(); writer.Indent--; writer.Write("}"); if (instanceMember == false) { - writer.WriteSignificantNewLine(); + writer.WriteLine(";"); } } } diff --git a/src/Core/Compiler/Generator/NamespaceGenerator.cs b/src/Core/Compiler/Generator/NamespaceGenerator.cs deleted file mode 100644 index b1d09bc89..000000000 --- a/src/Core/Compiler/Generator/NamespaceGenerator.cs +++ /dev/null @@ -1,65 +0,0 @@ -// NamespaceGenerator.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using ScriptSharp; -using ScriptSharp.ScriptModel; - -namespace ScriptSharp.Generator { - - internal static class NamespaceGenerator { - - public static void GenerateScript(ScriptGenerator generator, NamespaceSymbol namespaceSymbol, Dictionary generatedNamespaces) { - Debug.Assert(generator != null); - Debug.Assert(namespaceSymbol != null); - Debug.Assert(namespaceSymbol.HasApplicationTypes); - - ScriptTextWriter writer = generator.Writer; - - // First generate enums and interfaces which do not have cross-dependencies - // (Classes for example, might have dependencies on enums) - - foreach (TypeSymbol type in namespaceSymbol.Types) { - if (type.IsApplicationType) { - if (type.IsTestType && (generator.Options.IncludeTests == false)) { - continue; - } - - string namespaceName = type.GeneratedNamespace; - if ((namespaceName.Length != 0) && - (generatedNamespaces.ContainsKey(namespaceName) == false)) { - writer.Write("Type.registerNamespace('"); - writer.Write(namespaceName); - writer.Write("');"); - writer.WriteNewLine(); - writer.WriteNewLine(); - generatedNamespaces[namespaceName] = true; - } - } - - if (type.IsApplicationType && - ((type.Type == SymbolType.Enumeration) || - (type.Type == SymbolType.Interface) || - (type.Type == SymbolType.Record) || - (type.Type == SymbolType.Resources))) { - TypeGenerator.GenerateScript(generator, type); - } - } - - foreach (TypeSymbol type in namespaceSymbol.Types) { - if (type.IsApplicationType && (type.Type == SymbolType.Class)) { - if (type.IsTestType && (generator.Options.IncludeTests == false)) { - continue; - } - - TypeGenerator.GenerateScript(generator, type); - } - } - } - } -} diff --git a/src/Core/Compiler/Generator/ScriptGenerator.cs b/src/Core/Compiler/Generator/ScriptGenerator.cs index 849b55fa8..0841df52b 100644 --- a/src/Core/Compiler/Generator/ScriptGenerator.cs +++ b/src/Core/Compiler/Generator/ScriptGenerator.cs @@ -9,6 +9,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; +using System.Linq; using ScriptSharp; using ScriptSharp.ScriptModel; @@ -18,23 +19,23 @@ internal sealed class ScriptGenerator { private ScriptTextWriter _writer; private CompilerOptions _options; - private IErrorHandler _errorHandler; + private SymbolSet _symbols; - private List _classes; + private Stack _implementationStack; - public ScriptGenerator(TextWriter writer, CompilerOptions options, IErrorHandler errorHandler) { + public ScriptGenerator(TextWriter writer, CompilerOptions options, SymbolSet symbols) { Debug.Assert(writer != null); - _writer = new ScriptTextWriter(writer, options); + _writer = new ScriptTextWriter(writer); _options = options; - _errorHandler = errorHandler; + _symbols = symbols; - _classes = new List(); + _implementationStack = new Stack(); } - public IErrorHandler ErrorHandler { + public SymbolImplementation CurrentImplementation { get { - return _errorHandler; + return _implementationStack.Peek(); } } @@ -50,59 +51,199 @@ public ScriptTextWriter Writer { } } - public void AddGeneratedClass(ClassSymbol classSymbol) { - Debug.Assert(classSymbol != null); - _classes.Add(classSymbol); - } - - private void GenerateClassRegistration(ClassSymbol classSymbol, List generatedClasses) { - Debug.Assert(classSymbol != null); - - if (generatedClasses.Contains(classSymbol)) { - return; - } - - ClassSymbol baseClass = classSymbol.BaseClass; - if ((baseClass != null) && baseClass.IsApplicationType) { - GenerateClassRegistration(baseClass, generatedClasses); - } - - TypeGenerator.GenerateClassRegistrationScript(this, classSymbol); - generatedClasses.Add(classSymbol); + public void EndImplementation() { + Debug.Assert(_implementationStack.Count != 0); + _implementationStack.Pop(); } public void GenerateScript(SymbolSet symbolSet) { Debug.Assert(symbolSet != null); - Dictionary generatedNamespaces = new Dictionary(); + List types = new List(); + List publicTypes = new List(); + List internalTypes = new List(); + + bool hasNonModuleInternalTypes = false; + foreach (NamespaceSymbol namespaceSymbol in symbolSet.Namespaces) { if (namespaceSymbol.HasApplicationTypes) { - NamespaceGenerator.GenerateScript(this, namespaceSymbol, generatedNamespaces); + foreach (TypeSymbol type in namespaceSymbol.Types) { + if (type.IsApplicationType == false) { + continue; + } + + if (type.Type == SymbolType.Delegate) { + // Nothing needs to be generated for delegate types. + continue; + } + + if (type.IsTestType && (_options.IncludeTests == false)) { + continue; + } + + if ((type.Type == SymbolType.Enumeration) && + ((type.IsPublic == false) || ((EnumerationSymbol)type).Constants)) { + // Internal enums can be skipped since their values have been inlined. + // Public enums marked as constants can also be skipped since their + // values will always be inlined. + continue; + } + + types.Add(type); + if (type.IsPublic) { + publicTypes.Add(type); + } + else { + if ((type.Type != SymbolType.Class) || + (((ClassSymbol)type).IsModuleClass == false)) { + hasNonModuleInternalTypes = true; + } + internalTypes.Add(type); + } + } } } - List generatedClasses = new List(_classes.Count); - foreach (ClassSymbol generatedClass in _classes) { - if (generatedClass.HasGlobalMethods == false) { - GenerateClassRegistration(generatedClass, generatedClasses); + // Sort the types, so similar types of types are grouped, and parent classes + // come before derived classes. + IComparer typeComparer = new TypeComparer(); + types = types.OrderBy(t => t, typeComparer).ToList(); + publicTypes = publicTypes.OrderBy(t => t, typeComparer).ToList(); + internalTypes = internalTypes.OrderBy(t => t, typeComparer).ToList(); + + bool initialIndent = false; + if (String.IsNullOrEmpty(_options.ScriptInfo.Template) == false) { + int scriptIndex = _options.ScriptInfo.Template.IndexOf("{script}"); + if ((scriptIndex > 0) && (_options.ScriptInfo.Template[scriptIndex - 1] == ' ')) { + // Heuristic to turn on initial indent: + // The script template has a space prior to {script}, i.e. {script} is not the + // first thing on a line within the template. + + initialIndent = true; } } + if (initialIndent) { + _writer.Indent++; + } - // TODO: Couple of line-breaks would be nice here - // but only if there are any classes with static - // ctors or members + foreach (TypeSymbol type in types) { + TypeGenerator.GenerateScript(this, type); + } - foreach (ClassSymbol generatedClass in _classes) { - TypeGenerator.GenerateClassConstructorScript(this, generatedClass); + bool generateModule = (publicTypes.Count != 0) || + ((internalTypes.Count != 0) && hasNonModuleInternalTypes); + + if (generateModule) { + _writer.Write("var $exports = ss.module('"); + _writer.Write(symbolSet.ScriptName); + _writer.Write("',"); + if ((internalTypes.Count != 0) && hasNonModuleInternalTypes) { + _writer.WriteLine(); + _writer.Indent++; + _writer.WriteLine("{"); + _writer.Indent++; + bool firstType = true; + foreach (TypeSymbol type in internalTypes) { + if ((type.Type == SymbolType.Class) && + (((ClassSymbol)type).IsExtenderClass || ((ClassSymbol)type).IsModuleClass)) { + continue; + } + if ((type.Type == SymbolType.Record) && + ((RecordSymbol)type).Constructor == null) { + continue; + } + + if (firstType == false) { + _writer.WriteLine(","); + } + TypeGenerator.GenerateRegistrationScript(this, type); + firstType = false; + } + _writer.Indent--; + _writer.WriteLine(); + _writer.Write("},"); + _writer.Indent--; + } + else { + _writer.Write(" null,"); + } + if (publicTypes.Count != 0) { + _writer.WriteLine(); + _writer.Indent++; + _writer.WriteLine("{"); + _writer.Indent++; + bool firstType = true; + foreach (TypeSymbol type in publicTypes) { + if ((type.Type == SymbolType.Class) && + ((ClassSymbol)type).IsExtenderClass) { + continue; + } + + if (firstType == false) { + _writer.WriteLine(","); + } + TypeGenerator.GenerateRegistrationScript(this, type); + firstType = false; + } + _writer.Indent--; + _writer.WriteLine(); + _writer.Write("}"); + _writer.Indent--; + } + else { + _writer.Write(" null"); + } + _writer.WriteLine(");"); + _writer.WriteLine(); } - if (Options.IncludeTests) { - foreach (ClassSymbol generatedClass in _classes) { - if (generatedClass.IsTestClass) { - TestGenerator.GenerateScript(this, generatedClass); + foreach (TypeSymbol type in types) { + if (type.Type == SymbolType.Class) { + TypeGenerator.GenerateClassConstructorScript(this, (ClassSymbol)type); + } + } + + if (_options.IncludeTests) { + foreach (TypeSymbol type in types) { + ClassSymbol classSymbol = type as ClassSymbol; + if ((classSymbol != null) && classSymbol.IsTestClass) { + TestGenerator.GenerateScript(this, classSymbol); } } } + + if (initialIndent) { + _writer.Indent--; + } + } + + public void StartImplementation(SymbolImplementation implementation) { + Debug.Assert(implementation != null); + _implementationStack.Push(implementation); + } + + + private sealed class TypeComparer : IComparer { + + public int Compare(TypeSymbol x, TypeSymbol y) { + if (x.Type != y.Type) { + // If types are different, then use the symbol type to + // similar types of types together. + return (int)x.Type - (int)y.Type; + } + + if (x.Type == SymbolType.Class) { + // For classes, sort by inheritance depth. This is a crude + // way to ensure the base class for a class is generated + // first, without specifically looking at the inheritance + // chain for any particular type. A parent class with lesser + // inheritance depth has to by definition come first. + + return ((ClassSymbol)x).InheritanceDepth - ((ClassSymbol)y).InheritanceDepth; + } + + return 0; + } } } } diff --git a/src/Core/Compiler/Generator/ScriptTextWriter.cs b/src/Core/Compiler/Generator/ScriptTextWriter.cs index 4eadfdc66..a1b324ae2 100644 --- a/src/Core/Compiler/Generator/ScriptTextWriter.cs +++ b/src/Core/Compiler/Generator/ScriptTextWriter.cs @@ -1,4 +1,4 @@ -// IndentedTextWriter.cs +// ScriptTextWriter.cs // Script#/Core/Compiler // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -14,7 +14,6 @@ namespace ScriptSharp.Generator { internal sealed class ScriptTextWriter : TextWriter { private TextWriter _writer; - private bool _minimize; private int _indentLevel; private bool _tabsPending; @@ -24,21 +23,12 @@ internal sealed class ScriptTextWriter : TextWriter { private int _globalIndentLevel; private bool _globalTabsPending; - public ScriptTextWriter(TextWriter writer, CompilerOptions options) + public ScriptTextWriter(TextWriter writer) : base(CultureInfo.InvariantCulture) { _writer = writer; _globalWriter = writer; -#if DEBUG - _minimize = options.Minimize && (options.InternalTestMode == false); -#else - _minimize = options.Minimize; -#endif - if (_minimize) { - NewLine = "\n"; - } - - _tabString = " "; + _tabString = " "; _indentLevel = 0; _tabsPending = false; } @@ -81,10 +71,8 @@ public override void Flush() { private void OutputTabs() { if (_tabsPending) { - if (_minimize == false) { - for (int i = 0; i < _indentLevel; i++) { - _writer.Write(_tabString); - } + for (int i = 0; i < _indentLevel; i++) { + _writer.Write(_tabString); } _tabsPending = false; } @@ -173,8 +161,9 @@ public override void Write(string format, params object[] arg) { _writer.Write(format, arg); } - public void WriteLineNoTabs(string s) { - _writer.WriteLine(s); + public override void WriteLine() { + _writer.WriteLine(); + _tabsPending = true; } public override void WriteLine(string s) { @@ -183,12 +172,6 @@ public override void WriteLine(string s) { _tabsPending = true; } - public override void WriteLine() { - OutputTabs(); - _writer.WriteLine(); - _tabsPending = true; - } - public override void WriteLine(bool value) { OutputTabs(); _writer.WriteLine(value); @@ -266,24 +249,5 @@ public override void WriteLine(UInt32 value) { _writer.WriteLine(value); _tabsPending = true; } - - public void WriteSignificantNewLine() { - WriteLine(); - } - - public void WriteNewLine() { - if (_minimize == false) { - WriteLine(); - } - } - - public void WriteTrimmed(string text) { - if (_minimize == false) { - Write(text); - } - else { - Write(text.Trim()); - } - } } } diff --git a/src/Core/Compiler/Generator/StatementGenerator.cs b/src/Core/Compiler/Generator/StatementGenerator.cs index ff5261917..079a26bcb 100644 --- a/src/Core/Compiler/Generator/StatementGenerator.cs +++ b/src/Core/Compiler/Generator/StatementGenerator.cs @@ -23,23 +23,23 @@ private static void GenerateBlockStatement(ScriptGenerator generator, MemberSymb private static void GenerateBreakStatement(ScriptGenerator generator, MemberSymbol symbol, BreakStatement statement) { ScriptTextWriter writer = generator.Writer; writer.Write("break;"); - writer.WriteNewLine(); + writer.WriteLine(); } private static void GenerateContinueStatement(ScriptGenerator generator, MemberSymbol symbol, ContinueStatement statement) { ScriptTextWriter writer = generator.Writer; writer.Write("continue;"); - writer.WriteNewLine(); + writer.WriteLine(); } private static void GenerateErrorStatement(ScriptGenerator generator, MemberSymbol symbol, ErrorStatement statement) { ScriptTextWriter writer = generator.Writer; writer.Write("// ERROR: "); writer.Write(statement.Message); - writer.WriteSignificantNewLine(); + writer.WriteLine(); writer.Write("// ERROR: at "); writer.Write(statement.Location); - writer.WriteSignificantNewLine(); + writer.WriteLine(); } private static void GenerateExpressionStatement(ScriptGenerator generator, MemberSymbol symbol, ExpressionStatement statement) { @@ -48,7 +48,7 @@ private static void GenerateExpressionStatement(ScriptGenerator generator, Membe ExpressionGenerator.GenerateExpression(generator, symbol, statement.Expression); if (statement.IsFragment == false) { writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(); } } @@ -59,7 +59,7 @@ private static void GenerateForStatement(ScriptGenerator generator, MemberSymbol ScriptTextWriter writer = generator.Writer; - writer.WriteTrimmed("for "); + writer.Write("for "); writer.Write("("); if (statement.Initializers != null) { ExpressionGenerator.GenerateExpressionList(generator, symbol, statement.Initializers); @@ -67,94 +67,92 @@ private static void GenerateForStatement(ScriptGenerator generator, MemberSymbol else if (statement.Variables != null) { GenerateVariableDeclarations(generator, symbol, statement.Variables); } - writer.WriteTrimmed("; "); + writer.Write("; "); if (statement.Condition != null) { ExpressionGenerator.GenerateExpression(generator, symbol, statement.Condition); } - writer.WriteTrimmed("; "); + writer.Write("; "); if (statement.Increments != null) { ExpressionGenerator.GenerateExpressionList(generator, symbol, statement.Increments); } - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; GenerateStatement(generator, symbol, statement.Body); writer.Indent--; writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine(); } private static void GenerateForInStatement(ScriptGenerator generator, MemberSymbol symbol, ForInStatement statement) { ScriptTextWriter writer = generator.Writer; if (statement.IsDictionaryEnumeration) { - writer.Write("var "); - writer.Write(statement.DictionaryVariable.GeneratedName); - writer.WriteTrimmed(" = "); - ExpressionGenerator.GenerateExpression(generator, symbol, statement.CollectionExpression); - writer.Write(";"); - writer.WriteNewLine(); + if (statement.DictionaryVariable != null) { + writer.Write("var "); + writer.Write(statement.DictionaryVariable.GeneratedName); + writer.Write(" = "); + ExpressionGenerator.GenerateExpression(generator, symbol, statement.CollectionExpression); + writer.Write(";"); + writer.WriteLine(); + } - writer.WriteTrimmed("for "); - writer.Write("(var "); + writer.Write("for (var "); writer.Write(statement.LoopVariable.GeneratedName); writer.Write(" in "); - writer.Write(statement.DictionaryVariable.GeneratedName); - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + if (statement.DictionaryVariable != null) { + writer.Write(statement.DictionaryVariable.GeneratedName); + } + else { + ExpressionGenerator.GenerateExpression(generator, symbol, statement.CollectionExpression); + } + writer.WriteLine(") {"); writer.Indent++; writer.Write("var "); writer.Write(statement.ItemVariable.GeneratedName); - writer.WriteTrimmed(" = "); - writer.WriteTrimmed("{ "); - writer.WriteTrimmed("key: "); + writer.Write(" = { key: "); writer.Write(statement.LoopVariable.GeneratedName); - writer.WriteTrimmed(", "); - writer.WriteTrimmed("value: "); - writer.Write(statement.DictionaryVariable.GeneratedName); + writer.Write(", value: "); + if (statement.DictionaryVariable != null) { + writer.Write(statement.DictionaryVariable.GeneratedName); + } + else { + ExpressionGenerator.GenerateExpression(generator, symbol, statement.CollectionExpression); + } writer.Write("["); writer.Write(statement.LoopVariable.GeneratedName); - writer.Write("]"); - writer.WriteTrimmed(" };"); - writer.WriteNewLine(); + writer.WriteLine("] };"); GenerateStatement(generator, symbol, statement.Body); writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } else { writer.Write("var "); writer.Write(statement.LoopVariable.GeneratedName); - writer.WriteTrimmed(" = "); + writer.Write(" = "); - writer.Write("ss.IEnumerator.getEnumerator("); + writer.Write("ss.enumerate("); ExpressionGenerator.GenerateExpression(generator, symbol, statement.CollectionExpression); writer.Write(");"); - writer.WriteNewLine(); + writer.WriteLine(); - writer.WriteTrimmed("while "); - writer.Write("("); + writer.Write("while ("); writer.Write(statement.LoopVariable.GeneratedName); - writer.WriteTrimmed(".moveNext()) "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(".moveNext()) {"); writer.Indent++; writer.Write("var "); writer.Write(statement.ItemVariable.GeneratedName); - writer.WriteTrimmed(" = "); + writer.Write(" = "); writer.Write(statement.LoopVariable.GeneratedName); writer.Write(".current;"); - writer.WriteNewLine(); + writer.WriteLine(); GenerateStatement(generator, symbol, statement.Body); writer.Indent--; writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine(); } } @@ -165,19 +163,16 @@ private static void GenerateIfElseStatement(ScriptGenerator generator, MemberSym ScriptTextWriter writer = generator.Writer; - writer.WriteTrimmed("if "); - writer.Write("("); + writer.Write("if ("); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Condition); - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); if (statement.IfStatement != null) { writer.Indent++; GenerateStatement(generator, symbol, statement.IfStatement); writer.Indent--; } writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine(); if (statement.ElseStatement != null) { bool writeEndBlock = false; @@ -185,17 +180,14 @@ private static void GenerateIfElseStatement(ScriptGenerator generator, MemberSym writer.Write("else "); } else { - writer.WriteTrimmed("else "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine("else {"); writeEndBlock = true; writer.Indent++; } GenerateStatement(generator, symbol, statement.ElseStatement); if (writeEndBlock) { writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } } } @@ -206,12 +198,10 @@ private static void GenerateReturnStatement(ScriptGenerator generator, MemberSym if (statement.Value != null) { writer.Write("return "); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Value); - writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(";"); } else { - writer.Write("return;"); - writer.WriteNewLine(); + writer.WriteLine("return;"); } } @@ -270,26 +260,21 @@ public static void GenerateStatement(ScriptGenerator generator, MemberSymbol sym private static void GenerateSwitchStatement(ScriptGenerator generator, MemberSymbol symbol, SwitchStatement statement) { ScriptTextWriter writer = generator.Writer; - writer.WriteTrimmed("switch "); - writer.Write("("); + writer.Write("switch ("); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Condition); - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; foreach (SwitchGroup group in statement.Groups) { if (group.Cases != null) { foreach (Expression caseExpression in group.Cases) { writer.Write("case "); ExpressionGenerator.GenerateExpression(generator, symbol, caseExpression); - writer.Write(":"); - writer.WriteNewLine(); + writer.WriteLine(":"); } } if (group.IncludeDefault) { - writer.Write("default:"); - writer.WriteNewLine(); + writer.WriteLine("default:"); } writer.Indent++; @@ -299,8 +284,7 @@ private static void GenerateSwitchStatement(ScriptGenerator generator, MemberSym writer.Indent--; } writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } private static void GenerateThrowStatement(ScriptGenerator generator, MemberSymbol symbol, ThrowStatement statement) { @@ -308,43 +292,32 @@ private static void GenerateThrowStatement(ScriptGenerator generator, MemberSymb writer.Write("throw "); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Value); - writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(";"); } private static void GenerateTryCatchFinallyStatement(ScriptGenerator generator, MemberSymbol symbol, TryCatchFinallyStatement statement) { ScriptTextWriter writer = generator.Writer; - writer.WriteTrimmed("try "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine("try {"); writer.Indent++; GenerateStatement(generator, symbol, statement.Body); writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); if (statement.Catch != null) { - writer.WriteTrimmed("catch "); - writer.Write("("); + writer.Write("catch ("); writer.Write(statement.ExceptionVariable.GeneratedName); - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; GenerateStatement(generator, symbol, statement.Catch); writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } if (statement.Finally != null) { - writer.WriteTrimmed("finally "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine("finally {"); writer.Indent++; GenerateStatement(generator, symbol, statement.Finally); writer.Indent--; - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } } @@ -356,13 +329,13 @@ private static void GenerateVariableDeclarations(ScriptGenerator generator, Memb writer.Write("var "); foreach (VariableSymbol variableSymbol in statement.Variables) { if (firstVariable == false) { - writer.WriteTrimmed(", "); + writer.Write(", "); } writer.Write(variableSymbol.GeneratedName); if (variableSymbol.Value != null) { - writer.WriteTrimmed(" = "); + writer.Write(" = "); ExpressionGenerator.GenerateExpression(generator, symbol, variableSymbol.Value); } @@ -374,8 +347,7 @@ private static void GenerateVariableDeclarationStatement(ScriptGenerator generat ScriptTextWriter writer = generator.Writer; GenerateVariableDeclarations(generator, symbol, statement); - writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(";"); } private static void GenerateWhileStatement(ScriptGenerator generator, MemberSymbol symbol, WhileStatement statement) { @@ -386,17 +358,12 @@ private static void GenerateWhileStatement(ScriptGenerator generator, MemberSymb ScriptTextWriter writer = generator.Writer; if (statement.PreCondition) { - writer.WriteTrimmed("while "); - writer.Write("("); + writer.Write("while ("); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Condition); - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); } else { - writer.WriteTrimmed("do "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine("do {"); } writer.Indent++; @@ -404,16 +371,12 @@ private static void GenerateWhileStatement(ScriptGenerator generator, MemberSymb writer.Indent--; if (statement.PreCondition) { - writer.Write("}"); - writer.WriteNewLine(); + writer.WriteLine("}"); } else { - writer.WriteTrimmed("} "); - writer.WriteTrimmed("while "); - writer.Write("("); + writer.Write("} while ("); ExpressionGenerator.GenerateExpression(generator, symbol, statement.Condition); - writer.Write(");"); - writer.WriteNewLine(); + writer.WriteLine(");"); } } } diff --git a/src/Core/Compiler/Generator/TypeGenerator.cs b/src/Core/Compiler/Generator/TypeGenerator.cs index eb667d64b..22ba64c38 100644 --- a/src/Core/Compiler/Generator/TypeGenerator.cs +++ b/src/Core/Compiler/Generator/TypeGenerator.cs @@ -14,40 +14,23 @@ namespace ScriptSharp.Generator { internal static class TypeGenerator { private static void GenerateClass(ScriptGenerator generator, ClassSymbol classSymbol) { - if (classSymbol.HasGlobalMethods) { - GenerateGlobalMethods(generator, classSymbol); - generator.AddGeneratedClass(classSymbol); - return; - } - ScriptTextWriter writer = generator.Writer; string name = classSymbol.FullGeneratedName; - if (classSymbol.Namespace.Length == 0) { - writer.Write("window."); - } - + writer.Write("function "); writer.Write(name); - writer.WriteTrimmed(" = "); - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(name.Replace(".", "_")); - } writer.Write("("); if ((classSymbol.Constructor != null) && (classSymbol.Constructor.Parameters != null)) { bool firstParameter = true; foreach (ParameterSymbol parameterSymbol in classSymbol.Constructor.Parameters) { if (firstParameter == false) { - writer.WriteTrimmed(", "); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); firstParameter = false; } } - writer.WriteTrimmed(") "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine(") {"); writer.Indent++; if (generator.Options.EnableDocComments) { @@ -61,24 +44,23 @@ private static void GenerateClass(ScriptGenerator generator, ClassSymbol classSy if (fieldSymbol.HasInitializer) { writer.Write("this."); writer.Write(fieldSymbol.GeneratedName); - writer.WriteTrimmed(" = "); + writer.Write(" = "); CodeGenerator.GenerateScript(generator, fieldSymbol); writer.Write(";"); - writer.WriteNewLine(); + writer.WriteLine(); } } } if (classSymbol.Constructor != null) { CodeGenerator.GenerateScript(generator, classSymbol.Constructor); } - else if (classSymbol.BaseClass != null) { - writer.Write(classSymbol.FullGeneratedName); - writer.Write(".initializeBase(this);"); - writer.WriteNewLine(); + else if ((classSymbol.BaseClass != null) && (classSymbol.IsTestClass == false)) { + writer.Write(classSymbol.BaseClass.FullGeneratedName); + writer.Write(".call(this);"); + writer.WriteLine(); } writer.Indent--; - writer.Write("}"); - writer.WriteSignificantNewLine(); + writer.WriteLine("}"); foreach (MemberSymbol memberSymbol in classSymbol.Members) { if ((memberSymbol.Type != SymbolType.Field) && @@ -87,101 +69,55 @@ private static void GenerateClass(ScriptGenerator generator, ClassSymbol classSy } } - bool hasPrototypeMembers = false; - bool firstMember = true; - bool lastMemberWasField = true; - foreach (MemberSymbol memberSymbol in classSymbol.Members) { - if ((memberSymbol.Visibility & MemberVisibility.Static) == 0) { - if ((memberSymbol.Type == SymbolType.Field) && - ((FieldSymbol)memberSymbol).HasInitializer) { - continue; - } + if (classSymbol.IsStaticClass == false) { + writer.Write("var "); + writer.Write(name); + writer.WriteLine("$ = {"); + writer.Indent++; - if ((memberSymbol is CodeMemberSymbol) && - ((CodeMemberSymbol)memberSymbol).IsAbstract) { - continue; - } + bool firstMember = true; + foreach (MemberSymbol memberSymbol in classSymbol.Members) { + if ((memberSymbol.Visibility & MemberVisibility.Static) == 0) { + if (memberSymbol.Type == SymbolType.Field) { + continue; + } - if (hasPrototypeMembers == false) { - hasPrototypeMembers = true; + if ((memberSymbol is CodeMemberSymbol) && + ((CodeMemberSymbol)memberSymbol).IsAbstract) { + continue; + } - writer.Write(name); - writer.Write(".prototype"); - writer.WriteTrimmed(" = "); - writer.Write("{"); - writer.WriteNewLine(); - writer.Indent++; - } + if (firstMember == false) { + writer.WriteLine(","); + } - if (firstMember == false) { - writer.Write(","); - writer.WriteNewLine(); - } - if ((lastMemberWasField == false) || !(memberSymbol is FieldSymbol)) { - writer.WriteNewLine(); + MemberGenerator.GenerateScript(generator, memberSymbol); + firstMember = false; } - - MemberGenerator.GenerateScript(generator, memberSymbol); - lastMemberWasField = (memberSymbol is FieldSymbol); - firstMember = false; } - } - if (classSymbol.Indexer != null) { - if (hasPrototypeMembers == false) { - hasPrototypeMembers = true; + if (classSymbol.Indexer != null) { + if (firstMember == false) { + writer.WriteLine(","); + } - writer.Write(name); - writer.Write(".prototype"); - writer.WriteTrimmed(" = "); - writer.Write("{"); - writer.WriteNewLine(); - writer.Indent++; - - } - if (firstMember == false) { - writer.Write(","); - writer.WriteNewLine(); + MemberGenerator.GenerateScript(generator, classSymbol.Indexer); } - MemberGenerator.GenerateScript(generator, classSymbol.Indexer); - } - - if (hasPrototypeMembers) { writer.Indent--; - writer.WriteNewLine(); - writer.Write("}"); - writer.WriteSignificantNewLine(); + writer.WriteLine(); + writer.Write("};"); + writer.WriteLine(); } - - generator.AddGeneratedClass(classSymbol); - } - - private static void GenerateDelegate(ScriptGenerator generator, DelegateSymbol delegateSymbol) { - // No-op - // There is currently nothing to generate for a particular delegate type } private static void GenerateEnumeration(ScriptGenerator generator, EnumerationSymbol enumSymbol) { ScriptTextWriter writer = generator.Writer; + string enumName = enumSymbol.FullGeneratedName; - if (enumSymbol.Namespace.Length == 0) { - writer.Write("window."); - } - - writer.Write(enumSymbol.FullGeneratedName); - writer.WriteTrimmed(" = "); - writer.Write("function()"); - writer.WriteTrimmed(" { "); - - if (generator.Options.EnableDocComments) { - DocCommentGenerator.GenerateComment(generator, enumSymbol); - } - - writer.Write("};"); - writer.WriteNewLine(); + writer.Write("var "); writer.Write(enumSymbol.FullGeneratedName); - writer.Write(".prototype = {"); + writer.Write(" = {"); writer.Indent++; bool firstValue = true; @@ -192,12 +128,12 @@ private static void GenerateEnumeration(ScriptGenerator generator, EnumerationSy } if (firstValue == false) { - writer.WriteTrimmed(", "); + writer.Write(", "); } - writer.WriteNewLine(); + writer.WriteLine(); writer.Write(fieldSymbol.GeneratedName); - writer.WriteTrimmed(": "); + writer.Write(": "); if (enumSymbol.UseNamedValues) { writer.Write(Utility.QuoteString(enumSymbol.CreateNamedValue(fieldSymbol))); } @@ -208,97 +144,18 @@ private static void GenerateEnumeration(ScriptGenerator generator, EnumerationSy } writer.Indent--; - writer.WriteNewLine(); - writer.WriteTrimmed("}"); - writer.WriteSignificantNewLine(); - - writer.Write(enumSymbol.FullGeneratedName); - writer.Write(".registerEnum('"); - writer.Write(enumSymbol.FullGeneratedName); - writer.WriteTrimmed("', "); - writer.Write(enumSymbol.Flags ? "true" : "false"); - writer.Write(");"); - writer.WriteNewLine(); + writer.WriteLine(); + writer.Write("};"); + writer.WriteLine(); } private static void GenerateInterface(ScriptGenerator generator, InterfaceSymbol interfaceSymbol) { ScriptTextWriter writer = generator.Writer; string interfaceName = interfaceSymbol.FullGeneratedName; - if (interfaceSymbol.Namespace.Length == 0) { - writer.Write("window."); - } - + writer.Write("function "); writer.Write(interfaceName); - writer.WriteTrimmed(" = "); - writer.Write("function()"); - writer.WriteTrimmed(" { "); - - if (generator.Options.EnableDocComments) { - DocCommentGenerator.GenerateComment(generator, interfaceSymbol); - } - - writer.Write("};"); - writer.WriteNewLine(); - - if (generator.Options.DebugFlavor) { - writer.Write(interfaceName); - writer.Write(".prototype = {"); - writer.WriteLine(); - writer.Indent++; - bool firstMember = true; - foreach (MemberSymbol member in interfaceSymbol.Members) { - if (firstMember == false) { - writer.Write(","); - writer.WriteLine(); - } - - if (member.Type == SymbolType.Property) { - writer.Write("get_"); - writer.Write(member.GeneratedName); - writer.WriteTrimmed(" : "); - writer.Write("null"); - - if (((PropertySymbol)member).IsReadOnly == false) { - writer.Write(","); - writer.WriteLine(); - - writer.Write("set_"); - writer.Write(member.GeneratedName); - writer.WriteTrimmed(" : "); - writer.Write("null"); - } - } - else if (member.Type == SymbolType.Event) { - writer.Write("add_"); - writer.Write(member.GeneratedName); - writer.WriteTrimmed(" : "); - writer.Write("null,"); - writer.WriteLine(); - - writer.Write("remove_"); - writer.Write(member.GeneratedName); - writer.WriteTrimmed(" : "); - writer.Write("null"); - } - else { - writer.Write(member.GeneratedName); - writer.WriteTrimmed(" : "); - writer.Write("null"); - } - firstMember = false; - } - writer.Indent--; - writer.WriteLine(); - writer.Write("}"); - writer.WriteSignificantNewLine(); - } - - writer.Write(interfaceName); - writer.Write(".registerInterface('"); - writer.Write(interfaceName); - writer.Write("');"); - writer.WriteNewLine(); + writer.WriteLine("() { }"); } public static void GenerateClassConstructorScript(ScriptGenerator generator, ClassSymbol classSymbol) { @@ -308,13 +165,17 @@ public static void GenerateClassConstructorScript(ScriptGenerator generator, Cla foreach (MemberSymbol memberSymbol in classSymbol.Members) { if ((memberSymbol.Type == SymbolType.Field) && ((memberSymbol.Visibility & MemberVisibility.Static) != 0)) { - if (((FieldSymbol)memberSymbol).IsConstant && + FieldSymbol fieldSymbol = (FieldSymbol)memberSymbol; + + if (fieldSymbol.IsConstant && ((memberSymbol.Visibility & (MemberVisibility.Public | MemberVisibility.Protected)) == 0)) { // PrivateInstance/Internal constant fields are omitted since they have been inlined continue; } - MemberGenerator.GenerateScript(generator, memberSymbol); + if (fieldSymbol.HasInitializer) { + MemberGenerator.GenerateScript(generator, memberSymbol); + } } } @@ -325,65 +186,19 @@ public static void GenerateClassConstructorScript(ScriptGenerator generator, Cla bool requiresFunctionScope = implementation.DeclaresVariables; if (requiresFunctionScope) { - writer.Write("(function"); - writer.WriteTrimmed(" () "); - writer.Write("{"); - writer.WriteNewLine(); + writer.WriteLine("(function() {"); writer.Indent++; } CodeGenerator.GenerateScript(generator, classSymbol.StaticConstructor); if (requiresFunctionScope) { writer.Indent--; writer.Write("})();"); - writer.WriteSignificantNewLine(); - } - } - } - - public static void GenerateClassRegistrationScript(ScriptGenerator generator, ClassSymbol classSymbol) { - // NOTE: This is emitted towards the end of the script file as opposed to immediately after the - // class definition, because it allows us to reference other class (base class, interfaces) - // without having to do a manual topological sort to get the ordering of class definitions - // that would be needed otherwise. - - ScriptTextWriter writer = generator.Writer; - string name = classSymbol.FullGeneratedName; - - writer.Write(name); - writer.Write(".registerClass('"); - writer.Write(name); - writer.Write("'"); - - // TODO: We need to introduce the notion of a base class that only exists in the metadata - // and not at runtime. At that point this check of IsTestClass can be generalized. - if (classSymbol.IsTestClass) { - writer.Write(");"); - writer.WriteNewLine(); - - return; - } - - if (classSymbol.BaseClass != null) { - writer.WriteTrimmed(", "); - writer.Write(classSymbol.BaseClass.FullGeneratedName); - } - - if (classSymbol.Interfaces != null) { - if (classSymbol.BaseClass == null) { - writer.WriteTrimmed(", "); - writer.Write("null"); - } - foreach (InterfaceSymbol interfaceSymbol in classSymbol.Interfaces) { - writer.WriteTrimmed(", "); - writer.Write(interfaceSymbol.FullGeneratedName); + writer.WriteLine(); } } - - writer.Write(");"); - writer.WriteNewLine(); } - private static void GenerateGlobalMethods(ScriptGenerator generator, ClassSymbol classSymbol) { + private static void GenerateExtensionMethods(ScriptGenerator generator, ClassSymbol classSymbol) { foreach (MemberSymbol memberSymbol in classSymbol.Members) { Debug.Assert(memberSymbol.Type == SymbolType.Method); Debug.Assert((memberSymbol.Visibility & MemberVisibility.Static) != 0); @@ -394,23 +209,10 @@ private static void GenerateGlobalMethods(ScriptGenerator generator, ClassSymbol private static void GenerateRecord(ScriptGenerator generator, RecordSymbol recordSymbol) { ScriptTextWriter writer = generator.Writer; - string recordName = recordSymbol.GeneratedName; + string recordName = recordSymbol.FullGeneratedName; - if ((recordSymbol.Namespace.Length == 0) || recordSymbol.IgnoreNamespace) { - writer.Write("window."); - } - else { - writer.Write(recordSymbol.GeneratedNamespace); - writer.Write("."); - } - writer.Write("$create_"); + writer.Write("function "); writer.Write(recordName); - writer.WriteTrimmed(" = "); - writer.Write("function"); - if (generator.Options.DebugFlavor) { - writer.Write(" "); - writer.Write(recordSymbol.FullGeneratedName.Replace(".", "_")); - } writer.Write("("); if (recordSymbol.Constructor != null) { ConstructorSymbol ctorSymbol = recordSymbol.Constructor; @@ -419,43 +221,91 @@ private static void GenerateRecord(ScriptGenerator generator, RecordSymbol recor bool firstParameter = true; foreach (ParameterSymbol parameterSymbol in ctorSymbol.Parameters) { if (firstParameter == false) { - writer.WriteTrimmed(", "); + writer.Write(", "); } writer.Write(parameterSymbol.GeneratedName); firstParameter = false; } } } - writer.WriteTrimmed(")"); - writer.WriteTrimmed(" {"); + writer.Write(") {"); if (recordSymbol.Constructor != null) { writer.Indent++; - writer.WriteNewLine(); - writer.Write("var $o"); - writer.WriteTrimmed(" = "); - writer.WriteTrimmed("{ "); - writer.Write("};"); - writer.WriteNewLine(); + writer.WriteLine(); + writer.WriteLine("var $o = {};"); CodeGenerator.GenerateScript(generator, recordSymbol.Constructor); writer.Write("return $o;"); - writer.WriteNewLine(); + writer.WriteLine(); writer.Indent--; } else { - writer.WriteTrimmed(" return {}; "); + writer.Write(" return {}; "); } writer.Write("}"); - writer.WriteSignificantNewLine(); + writer.WriteLine(); + } + + public static void GenerateRegistrationScript(ScriptGenerator generator, TypeSymbol typeSymbol) { + ClassSymbol classSymbol = typeSymbol as ClassSymbol; + + if ((classSymbol != null) && classSymbol.IsExtenderClass) { + return; + } + + ScriptTextWriter writer = generator.Writer; + + writer.Write(typeSymbol.GeneratedName); + writer.Write(": "); + + switch (typeSymbol.Type) { + case SymbolType.Class: + writer.Write("[ "); + writer.Write(typeSymbol.FullGeneratedName); + writer.Write(", "); + if (((ClassSymbol)typeSymbol).IsStaticClass == false) { + writer.Write(typeSymbol.FullGeneratedName); + writer.Write("$, "); + } + else { + writer.Write("null, "); + } + if ((classSymbol.BaseClass == null) || classSymbol.IsTestClass) { + // TODO: We need to introduce the notion of a base class that only exists in the metadata + // and not at runtime. At that point this check of IsTestClass can be generalized. + + writer.Write("null"); + } + else { + writer.Write(classSymbol.BaseClass.FullGeneratedName); + } + if (classSymbol.Interfaces != null) { + foreach (InterfaceSymbol interfaceSymbol in classSymbol.Interfaces) { + writer.Write(", "); + writer.Write(interfaceSymbol.FullGeneratedName); + } + } + writer.Write(" ]"); + break; + case SymbolType.Interface: + writer.Write("[ "); + writer.Write(typeSymbol.FullGeneratedName); + writer.Write(" ]"); + break; + case SymbolType.Record: + case SymbolType.Resources: + case SymbolType.Enumeration: + writer.Write(typeSymbol.FullGeneratedName); + break; + } } private static void GenerateResources(ScriptGenerator generator, ResourcesSymbol resourcesSymbol) { ScriptTextWriter writer = generator.Writer; string resourcesName = resourcesSymbol.FullGeneratedName; + writer.Write("var "); writer.Write(resourcesName); - writer.WriteTrimmed(" = "); - writer.WriteTrimmed("{ "); - writer.WriteNewLine(); + writer.WriteLine(" = {"); writer.Indent++; bool firstValue = true; @@ -468,7 +318,7 @@ private static void GenerateResources(ScriptGenerator generator, ResourcesSymbol } writer.Write(member.GeneratedName); - writer.WriteTrimmed(": "); + writer.Write(": "); writer.Write(Utility.QuoteString((string)member.Value)); firstValue = false; @@ -477,7 +327,7 @@ private static void GenerateResources(ScriptGenerator generator, ResourcesSymbol writer.Indent--; writer.WriteLine(); writer.Write("};"); - writer.WriteNewLine(); + writer.WriteLine(); } public static void GenerateScript(ScriptGenerator generator, TypeSymbol typeSymbol) { @@ -485,22 +335,37 @@ public static void GenerateScript(ScriptGenerator generator, TypeSymbol typeSymb Debug.Assert(typeSymbol != null); Debug.Assert(typeSymbol.IsApplicationType); - if ((typeSymbol.Type == SymbolType.Enumeration) && (typeSymbol.IsPublic == false)) { - // Internal enums can be skipped since their values have been inlined. + if (typeSymbol.Type == SymbolType.Delegate) { + // No-op ... there is currently nothing to generate for a particular delegate type return; } - ScriptTextWriter writer = generator.Writer; + if ((typeSymbol.Type == SymbolType.Record) && + (typeSymbol.IsPublic == false) && + (((RecordSymbol)typeSymbol).Constructor == null)) { + // Nothing to generate for internal records with no explicit ctor + return; + } - if (generator.Options.Minimize == false) { - writer.WriteLine(new String('/', 80)); - writer.WriteLine("// " + typeSymbol.FullGeneratedName); - writer.WriteLine(); + if ((typeSymbol.Type == SymbolType.Class) && + ((ClassSymbol)typeSymbol).IsModuleClass) { + // No members on script modules, which only contain startup code + return; } + ScriptTextWriter writer = generator.Writer; + + writer.WriteLine("// " + typeSymbol.FullName); + writer.WriteLine(); + switch (typeSymbol.Type) { case SymbolType.Class: - GenerateClass(generator, (ClassSymbol)typeSymbol); + if (((ClassSymbol)typeSymbol).IsExtenderClass) { + GenerateExtensionMethods(generator, (ClassSymbol)typeSymbol); + } + else { + GenerateClass(generator, (ClassSymbol)typeSymbol); + } break; case SymbolType.Interface: GenerateInterface(generator, (InterfaceSymbol)typeSymbol); @@ -508,9 +373,6 @@ public static void GenerateScript(ScriptGenerator generator, TypeSymbol typeSymb case SymbolType.Enumeration: GenerateEnumeration(generator, (EnumerationSymbol)typeSymbol); break; - case SymbolType.Delegate: - GenerateDelegate(generator, (DelegateSymbol)typeSymbol); - break; case SymbolType.Record: GenerateRecord(generator, (RecordSymbol)typeSymbol); break; @@ -519,8 +381,8 @@ public static void GenerateScript(ScriptGenerator generator, TypeSymbol typeSymb break; } - writer.WriteNewLine(); - writer.WriteNewLine(); + writer.WriteLine(); + writer.WriteLine(); } } } diff --git a/src/Core/Compiler/IStreamResolver.cs b/src/Core/Compiler/IStreamResolver.cs deleted file mode 100644 index 8835c50ee..000000000 --- a/src/Core/Compiler/IStreamResolver.cs +++ /dev/null @@ -1,15 +0,0 @@ -// IStreamResolver.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.IO; - -namespace ScriptSharp { - - public interface IStreamResolver { - - IStreamSource ResolveInclude(IStreamSource baseStream, string includePath); - } -} diff --git a/src/Core/Compiler/IScriptInfo.cs b/src/Core/Compiler/IStreamSourceResolver.cs similarity index 59% rename from src/Core/Compiler/IScriptInfo.cs rename to src/Core/Compiler/IStreamSourceResolver.cs index 89b246adb..22d19747f 100644 --- a/src/Core/Compiler/IScriptInfo.cs +++ b/src/Core/Compiler/IStreamSourceResolver.cs @@ -1,15 +1,14 @@ -// IScriptInfo.cs +// IStreamSourceResolver.cs // Script#/Core/Compiler // This source code is subject to terms and conditions of the Apache License, Version 2.0. // using System; -using System.IO; namespace ScriptSharp { - internal interface IScriptInfo { + public interface IStreamSourceResolver { - string GetValue(string name); + IStreamSource Resolve(string name); } } diff --git a/src/Core/Compiler/Importer/MetadataHelpers.cs b/src/Core/Compiler/Importer/MetadataHelpers.cs index d4e6d8c96..1659915f4 100644 --- a/src/Core/Compiler/Importer/MetadataHelpers.cs +++ b/src/Core/Compiler/Importer/MetadataHelpers.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Reflection; using ScriptSharp.Importer.IL; using ScriptSharp.ScriptModel; @@ -37,33 +38,87 @@ public static string GetScriptAlias(ICustomAttributeProvider attributeProvider) return null; } - public static string GetScriptAssemblyName(ICustomAttributeProvider attributeProvider) { - CustomAttribute scriptAssemblyAttribute = GetAttribute(attributeProvider, "System.Runtime.CompilerServices.ScriptAssemblyAttribute"); + public static string GetScriptAssemblyName(ICustomAttributeProvider attributeProvider, out string assemblyIdentifier) { + assemblyIdentifier = null; + + CustomAttribute scriptAssemblyAttribute = GetAttribute(attributeProvider, "System.ScriptAssemblyAttribute"); if (scriptAssemblyAttribute != null) { - return GetAttributeArgument(scriptAssemblyAttribute); + string name = GetAttributeArgument(scriptAssemblyAttribute); + if (scriptAssemblyAttribute.Properties.Count != 0) { + assemblyIdentifier = (string)scriptAssemblyAttribute.Properties[0].Argument.Value; + } + + return name; } return null; } - public static string GetScriptName(ICustomAttributeProvider attributeProvider) { - CustomAttribute scriptAssemblyAttribute = GetAttribute(attributeProvider, "System.Runtime.CompilerServices.ScriptNameAttribute"); - if (scriptAssemblyAttribute != null) { - return GetAttributeArgument(scriptAssemblyAttribute); + public static string GetScriptDependencyName(ICustomAttributeProvider attributeProvider, out string dependencyIdentifier) { + dependencyIdentifier = null; + + CustomAttribute scriptDependencyAttribute = GetAttribute(attributeProvider, "System.Runtime.CompilerServices.ScriptDependencyAttribute"); + if (scriptDependencyAttribute != null) { + string name = GetAttributeArgument(scriptDependencyAttribute); + if (scriptDependencyAttribute.Properties.Count != 0) { + dependencyIdentifier = (string)scriptDependencyAttribute.Properties[0].Argument.Value; + } + + return name; } return null; } - public static string GetScriptNamespace(ICustomAttributeProvider attributeProvider) { - CustomAttribute scriptNamespaceAttribute = GetAttribute(attributeProvider, "System.Runtime.CompilerServices.ScriptNamespaceAttribute"); - if (scriptNamespaceAttribute != null) { - return GetAttributeArgument(scriptNamespaceAttribute); + public static bool GetScriptEventAccessors(EventDefinition eventDefinition, out string addAccessor, out string removeAccessor) { + addAccessor = null; + removeAccessor = null; + + CustomAttribute eventAttribute = GetAttribute(eventDefinition, "System.Runtime.CompilerServices.ScriptEventAttribute"); + if (eventAttribute != null) { + addAccessor = eventAttribute.ConstructorArguments[0].Value as string; + removeAccessor = eventAttribute.ConstructorArguments[1].Value as string; + + return true; + } + + return false; + } + + public static string GetScriptMethodSelector(MethodDefinition method) { + CustomAttribute selectorAttribute = GetAttribute(method, "System.Runtime.CompilerServices.ScriptMethodAttribute"); + if (selectorAttribute != null) { + return GetAttributeArgument(selectorAttribute); } return null; } + public static string GetScriptName(ICustomAttributeProvider attributeProvider, out bool preserveName, out bool preserveCase) { + string name = null; + preserveName = false; + preserveCase = false; + + CustomAttribute nameAttribute = GetAttribute(attributeProvider, "System.ScriptNameAttribute"); + if (nameAttribute != null) { + if (nameAttribute.HasConstructorArguments) { + name = GetAttributeArgument(nameAttribute); + } + if (nameAttribute.HasProperties) { + for (int i = 0; i < nameAttribute.Properties.Count; i++) { + if (String.CompareOrdinal(nameAttribute.Properties[i].Name, "PreserveName") == 0) { + preserveName = (bool)nameAttribute.Properties[i].Argument.Value; + } + else { + preserveCase = (bool)nameAttribute.Properties[i].Argument.Value; + } + } + } + } + + return name; + } + public static bool IsCompilerGeneratedType(TypeDefinition type) { return GetAttribute(type, "System.Runtime.CompilerServices.CompilerGeneratedAttribute") != null; } @@ -89,40 +144,34 @@ public static bool IsEnum(TypeDefinition type) { return (String.CompareOrdinal(type.BaseType.FullName, "System.Enum") == 0); } - public static bool ShouldGlobalizeMembers(TypeDefinition type, out string mixinRoot) { - mixinRoot = null; - - CustomAttribute globalMethodsAttribute = GetAttribute(type, "System.Runtime.CompilerServices.GlobalMethodsAttribute"); - if (globalMethodsAttribute != null) { - return true; - } + public static bool IsScriptExtension(TypeDefinition type, out string extendee) { + extendee = null; - CustomAttribute mixinAttribute = GetAttribute(type, "System.Runtime.CompilerServices.MixinAttribute"); - if (mixinAttribute != null) { - mixinRoot = GetAttributeArgument(mixinAttribute); + CustomAttribute extensionAttribute = GetAttribute(type, "System.ScriptExtensionAttribute"); + if (extensionAttribute != null) { + extendee = GetAttributeArgument(extensionAttribute); + if (String.IsNullOrEmpty(extendee) == false) { + return true; + } } return false; } public static bool ShouldIgnoreNamespace(TypeDefinition type) { - return GetAttribute(type, "System.Runtime.CompilerServices.IgnoreNamespaceAttribute") != null; + return GetAttribute(type, "System.Runtime.CompilerServices.ScriptIgnoreNamespaceAttribute") != null; } public static bool ShouldImportScriptCoreType(TypeDefinition type) { - return GetAttribute(type, "System.Runtime.CompilerServices.NonScriptableAttribute") == null; - } - - public static bool ShouldPreserveCase(ICustomAttributeProvider attributeProvider) { - return GetAttribute(attributeProvider, "System.Runtime.CompilerServices.PreserveCaseAttribute") != null; + return GetAttribute(type, "System.Runtime.CompilerServices.ScriptIgnoreAttribute") == null; } public static bool ShouldSkipFromScript(ICustomAttributeProvider attributeProvider) { return GetAttribute(attributeProvider, "System.Runtime.CompilerServices.ScriptSkipAttribute") != null; } - public static bool ShouldTreatAsIntrinsicProperty(PropertyDefinition property) { - return GetAttribute(property, "System.Runtime.CompilerServices.IntrinsicPropertyAttribute") != null; + public static bool ShouldTreatAsScriptField(PropertyDefinition property) { + return GetAttribute(property, "System.Runtime.CompilerServices.ScriptFieldAttribute") != null; } public static bool ShouldTreatAsConditionalMethod(MethodDefinition method, out ICollection conditions) { @@ -143,20 +192,39 @@ public static bool ShouldTreatAsConditionalMethod(MethodDefinition method, out I } public static bool ShouldTreatAsRecordType(TypeDefinition type) { - if ((type.BaseType != null) && - (String.CompareOrdinal(type.BaseType.FullName, "System.Record") == 0)) { - return true; - } - - return false; + return GetAttribute(type, "System.ScriptObjectAttribute") != null; } public static bool ShouldUseEnumNames(TypeDefinition type) { - return GetAttribute(type, "System.Runtime.CompilerServices.NamedValuesAttribute") != null; + CustomAttribute attribute = GetAttribute(type, "System.ScriptConstantsAttribute"); + if (attribute != null) { + if (attribute.HasProperties) { + Debug.Assert(attribute.Properties.Count == 1); + Debug.Assert(String.CompareOrdinal(attribute.Properties[0].Name, "UseNames") == 0); + Debug.Assert(attribute.Properties[0].Argument.Value is bool); + + return (bool)attribute.Properties[0].Argument.Value; + } + } + + return false; } public static bool ShouldUseEnumValues(TypeDefinition type) { - return GetAttribute(type, "System.Runtime.CompilerServices.NumericValuesAttribute") != null; + CustomAttribute attribute = GetAttribute(type, "System.ScriptConstantsAttribute"); + if (attribute != null) { + if (attribute.HasProperties) { + Debug.Assert(attribute.Properties.Count == 1); + Debug.Assert(String.CompareOrdinal(attribute.Properties[0].Name, "UseNames") == 0); + Debug.Assert(attribute.Properties[0].Argument.Value is bool); + + return (bool)attribute.Properties[0].Argument.Value == false; + } + + return true; + } + + return false; } } } diff --git a/src/Core/Compiler/Importer/MetadataImporter.cs b/src/Core/Compiler/Importer/MetadataImporter.cs index f631ac90c..ae0004ddb 100644 --- a/src/Core/Compiler/Importer/MetadataImporter.cs +++ b/src/Core/Compiler/Importer/MetadataImporter.cs @@ -35,38 +35,6 @@ public MetadataImporter(CompilerOptions options, IErrorHandler errorHandler) { _errorHandler = errorHandler; } -#if STATIC_ARRAY_EXTENSIONS - private void ConvertInstanceMembersToStaticMembers() { - // Mark the following members on Array, ArrayList, Queue and Stack - // as generated static, as they aren't implemented as instance/prototype - // members at runtime. - - string[] members = new string[] { - "Add", "AddRange", "Aggregate", "Clear", "Clone", "Contains", - "Dequeue", "Enqueue", "Every", "Extract", "Filter", "ForEach", - "GetEnumerator", "GroupBy", "Index", "IndexOf", "Insert", "InsertRange", - "Map", "Peek", "Remove", "RemoveAt", "RemoveRange", "Some" - }; - - foreach (TypeSymbol typeSymbol in _importedTypes) { - if ((typeSymbol.Type == SymbolType.Class) && - (typeSymbol.Name.Equals("Array", StringComparison.Ordinal) || - typeSymbol.Name.Equals("ArrayList", StringComparison.Ordinal) || - typeSymbol.Name.Equals("ArrayGrouping", StringComparison.Ordinal) || - typeSymbol.Name.Equals("Queue", StringComparison.Ordinal) || - typeSymbol.Name.Equals("Stack", StringComparison.Ordinal))) { - - foreach (string memberName in members) { - MethodSymbol methodSymbol = typeSymbol.GetMember(memberName) as MethodSymbol; - if ((methodSymbol != null) && ((methodSymbol.Visibility & MemberVisibility.Static) == 0)) { - methodSymbol.GenerateAsStaticMethod(); - } - } - } - } - } -#endif // STATIC_ARRAY_EXTENSIONS - private ICollection ImportAssemblies(MetadataSource mdSource) { _importedTypes = new List(); @@ -112,9 +80,6 @@ private ICollection ImportAssemblies(MetadataSource mdSource) { ImportPseudoMembers(PseudoClassMembers.Object, (ClassSymbol)typeSymbol); } - else if (typeSymbol.Name.Equals("Type", StringComparison.Ordinal)) { - ImportPseudoMembers(PseudoClassMembers.Type, (ClassSymbol)typeSymbol); - } else if (typeSymbol.Name.Equals("Dictionary", StringComparison.Ordinal)) { // The Dictionary class contains static methods at runtime, rather // than instance methods. @@ -126,11 +91,6 @@ private ICollection ImportAssemblies(MetadataSource mdSource) { ImportPseudoMembers(PseudoClassMembers.Arguments, (ClassSymbol)typeSymbol); } - else if (typeSymbol.Name.Equals("String", StringComparison.Ordinal)) { - // We need to change generated names on Replace methods - - ImportPseudoMembers(PseudoClassMembers.String, (ClassSymbol)typeSymbol); - } } } @@ -216,10 +176,9 @@ private void ImportEnumFields(TypeSymbol enumTypeSymbol) { } string fieldName = field.Name; - int fieldValue = (int)field.Constant; EnumerationFieldSymbol fieldSymbol = - new EnumerationFieldSymbol(fieldName, enumTypeSymbol, fieldValue, fieldType); + new EnumerationFieldSymbol(fieldName, enumTypeSymbol, field.Constant, fieldType); ImportMemberDetails(fieldSymbol, null, field); enumTypeSymbol.AddMember(fieldSymbol); @@ -250,6 +209,12 @@ private void ImportEvents(TypeSymbol typeSymbol) { EventSymbol eventSymbol = new EventSymbol(eventName, typeSymbol, eventHandlerType); ImportMemberDetails(eventSymbol, eventDef.AddMethod, eventDef); + string addAccessor; + string removeAccessor; + if (MetadataHelpers.GetScriptEventAccessors(eventDef, out addAccessor, out removeAccessor)) { + eventSymbol.SetAccessors(addAccessor, removeAccessor); + } + typeSymbol.AddMember(eventSymbol); } } @@ -308,12 +273,16 @@ private void ImportMemberDetails(MemberSymbol memberSymbol, MethodDefinition met memberSymbol.SetVisibility(visibility); } - memberSymbol.SetNameCasing(MetadataHelpers.ShouldPreserveCase(attributeProvider)); + bool preserveName; + bool preserveCase; + string scriptName = MetadataHelpers.GetScriptName(attributeProvider, out preserveName, out preserveCase); - string scriptName = MetadataHelpers.GetScriptName(attributeProvider); + memberSymbol.SetNameCasing(preserveCase); if (scriptName != null) { memberSymbol.SetTransformedName(scriptName); } + + // PreserveName is ignored - it only is used for internal members, which are not imported. } private void ImportMembers(TypeSymbol typeSymbol) { @@ -358,11 +327,6 @@ public ICollection ImportMetadata(ICollection references, Sy return null; } -#if STATIC_ARRAY_EXTENSIONS - // Update instance members that need to be generated as static methods - ConvertInstanceMembersToStaticMembers(); -#endif // STATIC_ARRAY_EXTENSIONS - return importedTypes; } @@ -421,11 +385,14 @@ private void ImportMethods(TypeSymbol typeSymbol) { methodSymbol.SetSkipGeneration(); } - if ((methodSymbol.Visibility & MemberVisibility.Static) != 0) { - string alias = MetadataHelpers.GetScriptAlias(method); - if (String.IsNullOrEmpty(alias) == false) { - methodSymbol.SetAlias(alias); - } + string alias = MetadataHelpers.GetScriptAlias(method); + if (String.IsNullOrEmpty(alias) == false) { + methodSymbol.SetAlias(alias); + } + + string selector = MetadataHelpers.GetScriptMethodSelector(method); + if (String.IsNullOrEmpty(selector) == false) { + methodSymbol.SetSelector(selector); } ICollection conditions; @@ -452,8 +419,12 @@ private void ImportProperties(TypeSymbol typeSymbol) { } string propertyName = property.Name; - bool preserveCase = MetadataHelpers.ShouldPreserveCase(property); - bool intrinsicProperty = MetadataHelpers.ShouldTreatAsIntrinsicProperty(property); + bool scriptField = MetadataHelpers.ShouldTreatAsScriptField(property); + + // TODO: Why are we ignoring the other bits... + // bool dummyPreserveName; + // bool preserveCase; + // string dummyName = MetadataHelpers.GetScriptName(property, out dummyPreserveName, out preserveCase); TypeSymbol propertyType = ResolveType(property.PropertyType); if (propertyType == null) { @@ -465,15 +436,15 @@ private void ImportProperties(TypeSymbol typeSymbol) { IndexerSymbol indexerSymbol = new IndexerSymbol(typeSymbol, propertyType); ImportMemberDetails(indexerSymbol, property.GetMethod, property); - if (intrinsicProperty) { - indexerSymbol.SetIntrinsic(); + if (scriptField) { + indexerSymbol.SetScriptIndexer(); } propertySymbol = indexerSymbol; - propertySymbol.SetNameCasing(preserveCase); + // propertySymbol.SetNameCasing(preserveCase); } else { - if (intrinsicProperty) { + if (scriptField) { // Properties marked with this attribute are to be thought of as // fields. If they are read-only, the C# compiler will enforce that, // so we don't have to worry about making them read-write via a field @@ -516,40 +487,39 @@ private void ImportPseudoMembers(PseudoClassMembers memberSet, ClassSymbol class // and aren't meant to be referenced directly in C# code. if (memberSet == PseudoClassMembers.Script) { - TypeSymbol boolType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Boolean", null, SymbolFilter.Types); - Debug.Assert(boolType != null); - - TypeSymbol intType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Int32", null, SymbolFilter.Types); - Debug.Assert(intType != null); - - TypeSymbol floatType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Single", null, SymbolFilter.Types); - Debug.Assert(floatType != null); + TypeSymbol objectType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Object", null, SymbolFilter.Types); + Debug.Assert(objectType != null); TypeSymbol stringType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("String", null, SymbolFilter.Types); Debug.Assert(stringType != null); - // Define the Escape, Unescape, encodeURI, decodeURI, encodeURIComponent, decodeURIComponent methods - MethodSymbol escapeMethod = new MethodSymbol("Escape", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - classSymbol.AddMember(escapeMethod); + TypeSymbol boolType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Boolean", null, SymbolFilter.Types); + Debug.Assert(boolType != null); + + TypeSymbol dateType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Date", null, SymbolFilter.Types); + Debug.Assert(dateType != null); + + // Enumerate - IEnumerable.GetEnumerator gets mapped to this - MethodSymbol unescapeMethod = new MethodSymbol("Unescape", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - classSymbol.AddMember(unescapeMethod); + MethodSymbol enumerateMethod = new MethodSymbol("Enumerate", classSymbol, objectType, MemberVisibility.Public | MemberVisibility.Static); + enumerateMethod.SetAlias("ss.enumerate"); + enumerateMethod.AddParameter(new ParameterSymbol("obj", enumerateMethod, objectType, ParameterMode.In)); + classSymbol.AddMember(enumerateMethod); - MethodSymbol encodeURIMethod = new MethodSymbol("EncodeUri", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - encodeURIMethod.SetTransformedName("encodeURI"); - classSymbol.AddMember(encodeURIMethod); + // TypeName - Type.Name gets mapped to this - MethodSymbol decodeURIMethod = new MethodSymbol("DecodeUri", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - decodeURIMethod.SetTransformedName("decodeURI"); - classSymbol.AddMember(decodeURIMethod); + MethodSymbol typeNameMethod = new MethodSymbol("GetTypeName", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); + typeNameMethod.SetAlias("ss.typeName"); + typeNameMethod.AddParameter(new ParameterSymbol("obj", typeNameMethod, objectType, ParameterMode.In)); + classSymbol.AddMember(typeNameMethod); - MethodSymbol encodeURIComponentMethod = new MethodSymbol("EncodeUriComponent", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - encodeURIComponentMethod.SetTransformedName("encodeURIComponent"); - classSymbol.AddMember(encodeURIComponentMethod); + // CompareDates - Date equality checks get converted to call to compareDates - MethodSymbol decodeURIComponentMethod = new MethodSymbol("DecodeUriComponent", classSymbol, stringType, MemberVisibility.Public | MemberVisibility.Static); - decodeURIComponentMethod.SetTransformedName("decodeURIComponent"); - classSymbol.AddMember(decodeURIComponentMethod); + MethodSymbol compareDatesMethod = new MethodSymbol("CompareDates", classSymbol, boolType, MemberVisibility.Public | MemberVisibility.Static); + compareDatesMethod.SetAlias("ss.compareDates"); + compareDatesMethod.AddParameter(new ParameterSymbol("d1", compareDatesMethod, dateType, ParameterMode.In)); + compareDatesMethod.AddParameter(new ParameterSymbol("d2", compareDatesMethod, dateType, ParameterMode.In)); + classSymbol.AddMember(compareDatesMethod); return; } @@ -559,95 +529,36 @@ private void ImportPseudoMembers(PseudoClassMembers memberSet, ClassSymbol class Debug.Assert(objectType != null); IndexerSymbol indexer = new IndexerSymbol(classSymbol, objectType, MemberVisibility.Public | MemberVisibility.Static); - indexer.SetIntrinsic(); + indexer.SetScriptIndexer(); classSymbol.AddMember(indexer); return; } - if (memberSet == PseudoClassMembers.Type) { - // Define the Type.GetInstanceType static method which provides the functionality of - // Object.GetType instance method. We don't extend Object.prototype in script to add - // GetType, since we want to keep Object's protoype clean of any extensions. - // - // We create this symbol here, so that later the ExpressionBuilder can transform - // calls to Object.GetType to this. - TypeSymbol objectType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Object", null, SymbolFilter.Types); - Debug.Assert(objectType != null); - - TypeSymbol typeType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Type", null, SymbolFilter.Types); - Debug.Assert(objectType != null); - - MethodSymbol getTypeMethod = new MethodSymbol("GetInstanceType", classSymbol, typeType, MemberVisibility.Public | MemberVisibility.Static); - getTypeMethod.AddParameter(new ParameterSymbol("instance", getTypeMethod, objectType, ParameterMode.In)); - classSymbol.AddMember(getTypeMethod); - - return; - } - if (memberSet == PseudoClassMembers.Dictionary) { TypeSymbol intType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Int32", null, SymbolFilter.Types); Debug.Assert(intType != null); - TypeSymbol boolType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Boolean", null, SymbolFilter.Types); - Debug.Assert(boolType != null); - - TypeSymbol voidType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("Void", null, SymbolFilter.Types); - Debug.Assert(boolType != null); - TypeSymbol stringType = (TypeSymbol)((ISymbolTable)_symbols.SystemNamespace).FindSymbol("String", null, SymbolFilter.Types); - Debug.Assert(boolType != null); + Debug.Assert(stringType != null); // Define Dictionary.Keys MethodSymbol getKeysMethod = new MethodSymbol("GetKeys", classSymbol, _symbols.CreateArrayTypeSymbol(stringType), MemberVisibility.Public | MemberVisibility.Static); - getKeysMethod.SetTransformedName("keys"); + getKeysMethod.SetAlias("ss.keys"); classSymbol.AddMember(getKeysMethod); // Define Dictionary.GetCount MethodSymbol countMethod = new MethodSymbol("GetKeyCount", classSymbol, intType, MemberVisibility.Public | MemberVisibility.Static); + countMethod.SetAlias("ss.keyCount"); classSymbol.AddMember(countMethod); - // Define Dictionary.ClearKeys - MethodSymbol clearMethod = new MethodSymbol("ClearKeys", classSymbol, voidType, MemberVisibility.Public | MemberVisibility.Static); - classSymbol.AddMember(clearMethod); - - // Define Dictionary.DeleteKey - MethodSymbol deleteMethod = new MethodSymbol("DeleteKey", classSymbol, voidType, MemberVisibility.Public | MemberVisibility.Static); - classSymbol.AddMember(deleteMethod); - - // Define Dictionary.KeyExists - MethodSymbol existsMethod = new MethodSymbol("KeyExists", classSymbol, boolType, MemberVisibility.Public | MemberVisibility.Static); - classSymbol.AddMember(existsMethod); - return; } - - if (memberSet == PseudoClassMembers.String) { - // In script, String.replace replaces only the first occurrence of a string - // whereas in C# all occurrences are replaced. - // Replace becomes replaceAll (a method we add) in generated script - // ReplaceFirst becomes replace in generated script. - // ReplaceRegex also becomes replace in generated script. (We added ReplaceRegex so - // it could be mapped to the native replace method, rather than out replaceAll - // extension) - - MethodSymbol replaceFirstMethod = (MethodSymbol)classSymbol.GetMember("ReplaceFirst"); - Debug.Assert(replaceFirstMethod != null); - replaceFirstMethod.SetTransformedName("replace"); - - MethodSymbol replaceMethod = (MethodSymbol)classSymbol.GetMember("Replace"); - Debug.Assert(replaceMethod != null); - replaceMethod.SetTransformedName("replaceAll"); - - MethodSymbol replaceRegexMethod = (MethodSymbol)classSymbol.GetMember("ReplaceRegex"); - Debug.Assert(replaceRegexMethod != null); - replaceRegexMethod.SetTransformedName("replace"); - } } private void ImportScriptAssembly(MetadataSource mdSource, string assemblyPath, bool coreAssembly) { - string scriptNamespace = null; string scriptName = null; + string scriptIdentifier = null; AssemblyDefinition assembly; if (coreAssembly) { @@ -655,19 +566,15 @@ private void ImportScriptAssembly(MetadataSource mdSource, string assemblyPath, } else { assembly = mdSource.GetMetadata(assemblyPath); - scriptNamespace = MetadataHelpers.GetScriptNamespace(assembly); } - scriptName = MetadataHelpers.GetScriptAssemblyName(assembly); + string scriptNamespace = null; + scriptName = MetadataHelpers.GetScriptAssemblyName(assembly, out scriptIdentifier); if (String.IsNullOrEmpty(scriptName) == false) { - _options.AddReferencedDependency(scriptName); - } + ScriptReference dependency = new ScriptReference(scriptName, scriptIdentifier); - if (coreAssembly) { - // Always add an execution reference to the core assembly, since - // it contains things like the type system, and other APIs assumed by the compiler - Debug.Assert(String.IsNullOrEmpty(scriptName) == false); - _options.AddExecutionDependency(scriptName); + _symbols.AddDependency(dependency); + scriptNamespace = dependency.Identifier; } foreach (TypeDefinition type in assembly.MainModule.Types) { @@ -676,7 +583,7 @@ private void ImportScriptAssembly(MetadataSource mdSource, string assemblyPath, continue; } - ImportType(mdSource, type, coreAssembly, scriptNamespace, scriptName); + ImportType(mdSource, type, coreAssembly, scriptNamespace); } catch (Exception e) { Debug.Fail(e.ToString()); @@ -684,7 +591,7 @@ private void ImportScriptAssembly(MetadataSource mdSource, string assemblyPath, } } - private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScriptCoreAssembly, string assemblyScriptNamespace, string assemblyScriptName) { + private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScriptCoreAssembly, string scriptNamespace) { if (type.IsPublic == false) { return; } @@ -694,12 +601,9 @@ private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScr string name = type.Name; string namespaceName = type.Namespace; - string scriptNamespace = MetadataHelpers.GetScriptNamespace(type); - string scriptName = MetadataHelpers.GetScriptName(type); - if (String.IsNullOrEmpty(scriptNamespace) && (String.IsNullOrEmpty(assemblyScriptNamespace) == false)) { - scriptNamespace = assemblyScriptNamespace; - } + bool dummy; + string scriptName = MetadataHelpers.GetScriptName(type, out dummy, out dummy); NamespaceSymbol namespaceSymbol = _symbols.GetNamespace(namespaceName); TypeSymbol typeSymbol = null; @@ -725,13 +629,18 @@ private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScr else { if (MetadataHelpers.ShouldTreatAsRecordType(type)) { typeSymbol = new RecordSymbol(name, namespaceSymbol); + typeSymbol.SetTransformedName("Object"); } else { typeSymbol = new ClassSymbol(name, namespaceSymbol); - string mixinRoot; - if (MetadataHelpers.ShouldGlobalizeMembers(type, out mixinRoot)) { - ((ClassSymbol)typeSymbol).SetGlobalMethods(mixinRoot); + string extendee; + if (MetadataHelpers.IsScriptExtension(type, out extendee)) { + ((ClassSymbol)typeSymbol).SetExtenderClass(extendee); + } + + if (String.CompareOrdinal(scriptName, "Array") == 0) { + typeSymbol.SetArray(); } } } @@ -750,18 +659,25 @@ private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScr typeSymbol.AddGenericParameters(genericArguments); } - typeSymbol.SetImported(assemblyScriptName); + ScriptReference dependency = null; + string dependencyIdentifier; + string dependencyName = MetadataHelpers.GetScriptDependencyName(type, out dependencyIdentifier); + if (dependencyName != null) { + dependency = new ScriptReference(dependencyName, dependencyIdentifier); + scriptNamespace = dependency.Identifier; + } + + typeSymbol.SetImported(dependency); typeSymbol.SetMetadataToken(type, inScriptCoreAssembly); bool ignoreNamespace = MetadataHelpers.ShouldIgnoreNamespace(type); - if (ignoreNamespace) { + if (ignoreNamespace || String.IsNullOrEmpty(scriptNamespace)) { typeSymbol.SetIgnoreNamespace(); } - typeSymbol.SetPublic(); - - if (String.IsNullOrEmpty(scriptNamespace) == false) { - typeSymbol.ScriptNamespace = scriptNamespace; + else { + typeSymbol.ScriptNamespace = scriptNamespace; } + typeSymbol.SetPublic(); if (String.IsNullOrEmpty(scriptName) == false) { typeSymbol.SetTransformedName(scriptName); @@ -833,17 +749,13 @@ private TypeSymbol ResolveType(TypeReference type) { private enum PseudoClassMembers { - Type = 0, - - Script = 1, - - Dictionary = 2, + Script, - Arguments = 3, + Dictionary, - Object = 4, + Arguments, - String = 5 + Object } } } diff --git a/src/Core/Compiler/Importer/MetadataSource.cs b/src/Core/Compiler/Importer/MetadataSource.cs index ad076c647..9e0c879e9 100644 --- a/src/Core/Compiler/Importer/MetadataSource.cs +++ b/src/Core/Compiler/Importer/MetadataSource.cs @@ -126,7 +126,7 @@ public bool LoadReferences(ICollection references, IErrorHandler errorHa private bool VerifyScriptAssembly(AssemblyDefinition assembly) { foreach (CustomAttribute attribute in assembly.CustomAttributes) { - if (String.CompareOrdinal(attribute.Constructor.DeclaringType.FullName, "System.Runtime.CompilerServices.ScriptAssemblyAttribute") == 0) { + if (String.CompareOrdinal(attribute.Constructor.DeclaringType.FullName, "System.ScriptAssemblyAttribute") == 0) { return true; } } diff --git a/src/Core/Compiler/Preprocessor/CondenserTextReader.cs b/src/Core/Compiler/Preprocessor/CondenserTextReader.cs deleted file mode 100644 index 89fcdffac..000000000 --- a/src/Core/Compiler/Preprocessor/CondenserTextReader.cs +++ /dev/null @@ -1,210 +0,0 @@ -// CondenserTextReader.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace ScriptSharp.Preprocessor { - - internal sealed class CondenserTextReader : TextReader { - - private PreprocessorTextReader _sourceTextReader; - private bool _stripCommentsOnly; - - private int _peekedCharacter; - private int _lastCharacter; - - private bool _inDoubleQuotedString; - private bool _inSingleQuotedString; - private bool _inStringEscape; - private bool _inRegex; - private bool _inRegexEscape; - private bool _inSignificantComment; - private bool _inSignificantCommentStart; - - public CondenserTextReader(PreprocessorTextReader sourceTextReader, bool stripCommentsOnly) { - Debug.Assert(sourceTextReader != null); - _sourceTextReader = sourceTextReader; - _stripCommentsOnly = stripCommentsOnly; - - _peekedCharacter = -1; - _lastCharacter = ' '; - } - - private int GetNextCharacter() { - int ch = -1; - - while (ch == -1) { - ch = _sourceTextReader.Read(); - - if (ch == -1) { - break; - } - - if (_inStringEscape) { - _inStringEscape = false; - } - else if (_inRegexEscape) { - _inRegexEscape = false; - } - else if (_inDoubleQuotedString) { - if (ch == '"') { - _inDoubleQuotedString = false; - } - else if (ch == '\\') { - _inStringEscape = true; - } - } - else if (_inSingleQuotedString) { - if (ch == '\'') { - _inSingleQuotedString = false; - } - else if (ch == '\\') { - _inStringEscape = true; - } - } - else if (_inRegex) { - if (ch == '/') { - _inRegex = false; - } - else if (ch == '\\') { - _inRegexEscape = true; - } - } - else if (_inSignificantComment) { - if (_inSignificantCommentStart) { - Debug.Assert(ch == '!'); - ch = '/'; - - _inSignificantCommentStart = false; - } - if (ch == '\n') { - _inSignificantComment = false; - } - } - else { - if ((_stripCommentsOnly == false) && ((ch == ' ') || (ch == '\t') || (ch == '\n'))) { - if (ch == '\t') { - ch = ' '; - } - if ((_lastCharacter == ' ') || (_lastCharacter == '\n') || - (IsSpaceSignificantAfter(_lastCharacter) == false) || - (IsSpaceSignificantBefore(_sourceTextReader.Peek()) == false)) { - ch = -1; - } - } - else if (ch == '\'') { - _inSingleQuotedString = true; - } - else if (ch == '"') { - _inDoubleQuotedString = true; - } - else if (ch == '/') { - int nextChar = _sourceTextReader.Peek(); - if (nextChar == '/') { - // Process single line comment to strip it out, unless the - // comment is significant, i.e., //! - - // First consume the peeked '/', and then read until we see a new line - // or end of input itself. - _sourceTextReader.Read(); - - nextChar = _sourceTextReader.Peek(); - if (nextChar == '!') { - _inSignificantComment = true; - _inSignificantCommentStart = true; - } - else { - for (; ; ) { - ch = _sourceTextReader.Read(); - if ((ch == '\n') || (ch == -1)) { - ch = -1; - break; - } - } - } - } - else if (nextChar == '*') { - // Process multiline comment to strip it out. - - // First consume the peeked '*', and then read until we see the - // */ comment terminator. - _sourceTextReader.Read(); - for (; ; ) { - ch = _sourceTextReader.Read(); - if (ch == '*') { - if (_sourceTextReader.Peek() == '/') { - _sourceTextReader.Read(); - - ch = -1; - break; - } - } - else if (ch == -1) { - RaiseError("Unterminated multiline comment."); - } - } - } - else { - if ((_lastCharacter == '=') || (_lastCharacter == ':') || - (_lastCharacter == '(') || (_lastCharacter == ',')) { - _inRegex = true; - } - } - } - } - } - - return ch; - } - - private bool IsIdentifierCharacter(int ch) { - return ((ch == '_') || (ch == '$') || (ch > 127) || - ((ch >= 'a') && (ch <= 'z')) || - ((ch >= 'A') && (ch <= 'Z')) || - ((ch >= '0') && (ch <= '9'))); - } - - private bool IsSpaceSignificantAfter(int ch) { - return IsIdentifierCharacter(ch) || (ch == '\\') || (ch == '}'); - } - - private bool IsSpaceSignificantBefore(int ch) { - return IsIdentifierCharacter(ch); - } - - public override int Peek() { - if (_peekedCharacter == -1) { - _peekedCharacter = GetNextCharacter(); - } - - return _peekedCharacter; - } - - private void RaiseError(string errorMessage) { - throw new PreprocessorException(errorMessage, _sourceTextReader.CurrentLine, _sourceTextReader.CurrentFile, _sourceTextReader.CurrentLineNumber); - } - - public override int Read() { - if (_peekedCharacter != -1) { - _lastCharacter = _peekedCharacter; - _peekedCharacter = -1; - return _lastCharacter; - } - - _lastCharacter = GetNextCharacter(); - - if ((_lastCharacter == -1) && - (_inDoubleQuotedString || _inSingleQuotedString)) { - RaiseError("Unterminated string."); - } - - return _lastCharacter; - } - } -} diff --git a/src/Core/Compiler/Preprocessor/PreprocessorException.cs b/src/Core/Compiler/Preprocessor/PreprocessorException.cs deleted file mode 100644 index 9c655cf29..000000000 --- a/src/Core/Compiler/Preprocessor/PreprocessorException.cs +++ /dev/null @@ -1,48 +0,0 @@ -// PreprocessorException.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; - -namespace ScriptSharp.Preprocessor { - - internal sealed class PreprocessorException : Exception { - - private int _line; - private string _sourceFile; - private string _sourceCode; - - public PreprocessorException(string message, string sourceCode, string sourceFile, int line) - : base(message) { - _sourceFile = sourceFile; - _line = line; - _sourceCode = sourceCode; - } - - public PreprocessorException(string message, Exception innerException, string sourceCode, string sourceFile, int line) - : base(message, innerException) { - _sourceFile = sourceFile; - _line = line; - _sourceCode = sourceCode; - } - - public int Line { - get { - return _line; - } - } - - public string SourceCode { - get { - return _sourceCode; - } - } - - public string SourceFile { - get { - return _sourceFile; - } - } - } -} diff --git a/src/Core/Compiler/Preprocessor/PreprocessorTextReader.cs b/src/Core/Compiler/Preprocessor/PreprocessorTextReader.cs deleted file mode 100644 index fd4c2fd67..000000000 --- a/src/Core/Compiler/Preprocessor/PreprocessorTextReader.cs +++ /dev/null @@ -1,614 +0,0 @@ -// PreprocessorTextReader.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using ScriptSharp; - -namespace ScriptSharp.Preprocessor { - - internal sealed class PreprocessorTextReader : TextReader { - - private TextWriter _skipPreprocessingWriter; - - private IStreamSource _source; - private IStreamResolver _includeResolver; - private IScriptInfo _scriptInfo; - - private Dictionary _definedVariables; - private Stack _activeInstructions; - - private string _currentLine; - private int _currentLinePosition; - - private int _lineCounter; - - private Stream _sourceStream; - private TextReader _sourceTextReader; - - private IStreamSource _include; - private Stream _includeStream; - private TextReader _includeTextReader; - private int _includeLineCounter; - - public PreprocessorTextReader(IStreamSource source, ICollection predefinedVariables, IStreamResolver includeResolver, IScriptInfo scriptInfo) { - Debug.Assert(source != null); - - _source = source; - _includeResolver = includeResolver; - _scriptInfo = scriptInfo; - - _definedVariables = new Dictionary(); - _activeInstructions = new Stack(); - - if ((predefinedVariables != null) && (predefinedVariables.Count != 0)) { - foreach (string s in predefinedVariables) { - _definedVariables[s] = String.Empty; - } - } - - _currentLinePosition = -1; - } - - internal string CurrentFile { - get { - if (_includeTextReader != null) { - return _include.FullName; - } - return _source.FullName; - } - } - - internal string CurrentLine { - get { - return _currentLine; - } - } - - internal int CurrentLineNumber { - get { - if (_includeTextReader != null) { - return _includeLineCounter; - } - return _lineCounter; - } - } - - private void ClearLine() { - _currentLinePosition = -1; - _currentLine = null; - } - - public override void Close() { - if (_includeStream != null) { - _include.CloseStream(_includeStream); - _includeStream = null; - } - if (_sourceStream != null) { - _source.CloseStream(_sourceStream); - _sourceStream = null; - } - - base.Close(); - } - - private bool EnsureLine() { - if (_currentLine == null) { - Debug.Assert(_currentLinePosition == -1); - - _currentLine = GetNextLine(); - if (_currentLine != null) { - _currentLinePosition = 0; - return true; - } - else { - if (_activeInstructions.Count != 0) { - RaiseError("Unterminated '#if' instruction was detected."); - } - - return false; - } - } - - return true; - } - - private string GetNextLine() { - string line = null; - - while (line == null) { - if (_includeTextReader != null) { - line = _includeTextReader.ReadLine(); - _includeLineCounter++; - - if (line == null) { - _includeTextReader = null; - _includeLineCounter = 0; - - _include.CloseStream(_includeStream); - _includeStream = null; - _include = null; - } - } - if (line == null) { - line = _sourceTextReader.ReadLine(); - _lineCounter++; - } - - if (line == null) { - break; - } - - string trimmedLine = line.TrimStart(' ', '\t'); - - bool isActive = true; - if (_activeInstructions.Count != 0) { - Instruction currentInstruction = _activeInstructions.Peek(); - isActive = currentInstruction.IsActive; - } - - if (trimmedLine.StartsWith("##")) { - if (isActive == false) { - line = null; - } - if (line != null) { - line = ProcessSingleLineInstruction(trimmedLine); - } - } - else if (trimmedLine.StartsWith("#include[as-is] ")) { - if (isActive == false) { - line = null; - } - - if (line != null) { - _currentLine = line; - if (_includeResolver != null) { - ProcessIncludeInstruction(trimmedLine, /* skipPreprocessing */ true); - line = null; - } - else { - RaiseError("Includes are not supported in this file."); - } - } - } - else if (trimmedLine.StartsWith("#include ")) { - if (isActive == false) { - line = null; - } - - if (line != null) { - _currentLine = line; - if (_includeResolver != null) { - if (_includeStream == null) { - ProcessIncludeInstruction(trimmedLine, /* skipPreprocessing */ false); - line = null; - } - else { - RaiseError("Nested includes are not supported."); - } - } - else { - RaiseError("Includes are not supported in this file."); - } - } - } - else if (trimmedLine.StartsWith("#")) { - if ((isActive == false) && - (trimmedLine.StartsWith("#elseif ") == false) && - (trimmedLine.StartsWith("#elif ") == false) && - (trimmedLine.StartsWith("#else") == false) && - (trimmedLine.StartsWith("#endif") == false)) { - line = null; - } - - if (line != null) { - ProcessInstruction(trimmedLine); - line = null; - } - } - else { - if (isActive == false) { - line = null; - } - } - } - - return ProcessInlineInstruction(line); - } - - public bool Initialize(TextWriter skipPreprocessingWriter) { - _skipPreprocessingWriter = skipPreprocessingWriter; - - _sourceStream = _source.GetStream(); - if (_sourceStream == null) { - return false; - } - - _sourceTextReader = new StreamReader(_sourceStream); - return true; - } - - private string ParseInstructionVariable(string instructionLine, int startIndex, out int endIndex) { - endIndex = -1; - - int i = startIndex; - while (i < instructionLine.Length) { - char ch = instructionLine[i]; - if ((ch != ' ') && (ch != '\t')) { - break; - } - i++; - } - - if (i < instructionLine.Length) { - int j = i; - while (j < instructionLine.Length) { - char ch = instructionLine[j]; - if ((ch == ' ') || (ch == '\t')) { - break; - } - j++; - } - - endIndex = j; - return instructionLine.Substring(i, j - i); - } - - return null; - } - - public override int Peek() { - if (EnsureLine() == false) { - return -1; - } - - int ch; - if (_currentLinePosition == _currentLine.Length) { - ch = '\n'; - } - else { - ch = _currentLine[_currentLinePosition]; - } - - return ch; - } - - private void ProcessIncludeInstruction(string instructionLine, bool skipPreprocessing) { - Debug.Assert(_includeStream == null); - Debug.Assert(_includeTextReader == null); - - bool included = false; - int beginQuoteIndex = instructionLine.IndexOf('"'); - int endQuoteIndex = 0; - - if (beginQuoteIndex > 0) { - endQuoteIndex = instructionLine.IndexOf('"', beginQuoteIndex + 1); - } - - if (endQuoteIndex > 0) { - Exception resolveException = null; - string includePath = instructionLine.Substring(beginQuoteIndex + 1, endQuoteIndex - beginQuoteIndex - 1); - try { - _include = _includeResolver.ResolveInclude(_source, includePath); - - if (_include != null) { - _includeStream = _include.GetStream(); - if (_includeStream != null) { - _includeTextReader = new StreamReader(_includeStream); - _includeLineCounter = 0; - - if (skipPreprocessing) { - string includeText = _includeTextReader.ReadToEnd(); - _skipPreprocessingWriter.Write(includeText); - - _include.CloseStream(_includeStream); - _includeTextReader = null; - _includeStream = null; - - included = true; - } - } - } - } - catch (Exception e) { - resolveException = e; - } - - if ((included == false) && (_includeTextReader == null)) { - RaiseError("Unable to resolve or open included file '" + includePath + "'", resolveException); - } - } - else { - RaiseError("Invalid #include instruction."); - } - } - - private string ProcessInlineInstruction(string line) { - if (String.IsNullOrEmpty(line)) { - return line; - } - - int inlineInstructionIndex; - - // Processes inline instructions within the line such as - // ... #= XYZ ## ... - inlineInstructionIndex = line.IndexOf("#="); - while (inlineInstructionIndex >= 0) { - int variableEndIndex; - string variable = ParseInstructionVariable(line, inlineInstructionIndex + 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '#=' instruction."); - continue; - } - - string value = _scriptInfo.GetValue(variable); - if (value == null) { - RaiseError("Unknown variable name, '" + variable + "' after '#=' instruction."); - continue; - } - - int inlineInstructionEndIndex = line.IndexOf("##", variableEndIndex); - if (inlineInstructionEndIndex < 0) { - RaiseError("Invalid instruction. Missing ending '##' after '#='."); - continue; - } - - if (line.Length > inlineInstructionEndIndex + 2) { - line = line.Substring(0, inlineInstructionIndex) + value + line.Substring(inlineInstructionEndIndex + 2); - } - else { - line = line.Substring(0, inlineInstructionIndex) + value; - } - - inlineInstructionIndex = line.IndexOf("#="); - } - - // Processes inline instructions within the line such as - // ... #? DEBUG ... ## ... - inlineInstructionIndex = line.IndexOf("#?"); - while (inlineInstructionIndex >= 0) { - int variableEndIndex; - string variable = ParseInstructionVariable(line, inlineInstructionIndex + 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '#?' instruction."); - continue; - } - - int inlineInstructionEndIndex = line.IndexOf("##", variableEndIndex); - if (inlineInstructionEndIndex < 0) { - RaiseError("Invalid instruction. Missing ending '##' after '#?'."); - continue; - } - - if (_definedVariables.ContainsKey(variable)) { - int scriptIndex = variableEndIndex + 1; - if (line.Length > scriptIndex) { - line = line.Remove(inlineInstructionEndIndex, 2); - line = line.Remove(inlineInstructionIndex, variableEndIndex - inlineInstructionIndex); - } - else { - RaiseError("No script was present on the line after the '##' instruction."); - } - } - else { - // Update the line to be everything except for the inline instruction - line = line.Remove(inlineInstructionIndex, inlineInstructionEndIndex - inlineInstructionIndex + 2); - } - - inlineInstructionIndex = line.IndexOf("#?"); - } - - return line; - } - - private void ProcessInstruction(string instructionLine) { - int dummy; - if (instructionLine.StartsWith("#define ")) { - string variableName = ParseInstructionVariable(instructionLine, 8, out dummy); - if (variableName == null) { - RaiseError("Missing variable following the '#define' instruction."); - } - if (_definedVariables.ContainsKey(variableName)) { - RaiseError("Duplicate definition of variable '" + variableName + "'."); - } - - _definedVariables[variableName] = String.Empty; - } - else if (instructionLine.StartsWith("#undefine ")) { - string variableName = ParseInstructionVariable(instructionLine, 10, out dummy); - - if (variableName == null) { - RaiseError("Missing variable following the '#undefine' instruction."); - } - if (_definedVariables.ContainsKey(variableName) == false) { - RaiseError("The variable '" + variableName + "' has not been defined yet."); - } - - _definedVariables.Remove(variableName); - } - else if (instructionLine.StartsWith("#if ")) { - string variableName = ParseInstructionVariable(instructionLine, 4, out dummy); - - if (variableName == null) { - RaiseError("Missing variable following the '#if' instruction."); - } - - Instruction instruction = new Instruction(); - _activeInstructions.Push(instruction); - - instruction.AddVariable(variableName, _definedVariables); - } - else if (instructionLine.StartsWith("#elseif ") || - instructionLine.StartsWith("#elif ")) { - string variableName = ParseInstructionVariable(instructionLine, 8, out dummy); - if (variableName == null) { - RaiseError("Missing variable following the '#elif' instruction."); - } - - if (_activeInstructions.Count == 0) { - RaiseError("Unexpected '#elif' instruction."); - } - - Instruction currentInstruction = _activeInstructions.Peek(); - bool added = currentInstruction.AddVariable(variableName, _definedVariables); - - if (added == false) { - RaiseError("The specified '" + variableName + "' has already been used, or an '#else' instruction has already been specified."); - } - } - else if (instructionLine.StartsWith("#else")) { - if (_activeInstructions.Count == 0) { - RaiseError("Unexpected '#else' instruction."); - } - - Instruction currentInstruction = _activeInstructions.Peek(); - bool added = currentInstruction.AddVariable(null, _definedVariables); - - if (added == false) { - RaiseError("Only a single '#else' instruction is allowed for a given '#if' instruction."); - } - } - else if (instructionLine.StartsWith("#endif")) { - if (_activeInstructions.Count == 0) { - RaiseError("Unexpected '#endif' instruction."); - } - - _activeInstructions.Pop(); - } - } - - private string ProcessSingleLineInstruction(string instructionLine) { - string scriptLine = null; - - int variableEndIndex; - string variable = ParseInstructionVariable(instructionLine, 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '##' instruction."); - } - - if (_definedVariables.ContainsKey(variable)) { - int scriptIndex = variableEndIndex + 1; - if (instructionLine.Length > scriptIndex) { - scriptLine = instructionLine.Substring(scriptIndex); - } - else { - RaiseError("No script was present on the line after the '##' instruction."); - } - } - - return scriptLine; - } - - private void RaiseError(string errorMessage) { - RaiseError(errorMessage, null); - } - - private void RaiseError(string errorMessage, Exception innerException) { - string path = CurrentFile; - int lineNumber = CurrentLineNumber; - - if (_includeStream != null) { - _includeStream.Close(); - _includeStream = null; - - _includeTextReader = null; - } - - if (innerException == null) { - throw new PreprocessorException(errorMessage, _currentLine, path, lineNumber); - } - else { - throw new PreprocessorException(errorMessage, _currentLine, path, lineNumber); - } - } - - public override int Read() { - if (EnsureLine() == false) { - return -1; - } - - int ch; - if (_currentLinePosition == _currentLine.Length) { - ch = '\n'; - ClearLine(); - } - else { - ch = _currentLine[_currentLinePosition]; - _currentLinePosition++; - } - - return ch; - } - - - private sealed class Instruction { - - private ArrayList _variables; - private bool _active; - private bool _activated; - private bool _canAddVariables; - - public Instruction() { - _variables = new ArrayList(); - _canAddVariables = true; - } - - public bool IsActive { - get { - return _active; - } - } - - public bool AddVariable(string variable, Dictionary definedVariables) { - if (variable == null) { - if (_canAddVariables == false) { - // already seen #else - return false; - } - - _canAddVariables = false; - if (_activated == false) { - // #else should be active if no other block was activated - _active = true; - _activated = true; - } - else { - _active = false; - } - return true; - } - else { - if (_canAddVariables == false) { - // already seen #else - return false; - } - - if (_variables.Contains(variable)) { - // duplicate use of same variable - return false; - } - - _variables.Add(variable); - if (_active) { - // no longer active - _active = false; - } - else if (_activated == false) { - if (definedVariables.ContainsKey(variable)) { - // variable is defined, so the block becomes activated - _active = true; - _activated = true; - } - } - - return true; - } - } - } - } -} diff --git a/src/Core/Compiler/PreprocessorOptions.cs b/src/Core/Compiler/PreprocessorOptions.cs deleted file mode 100644 index 8fb4c8aa8..000000000 --- a/src/Core/Compiler/PreprocessorOptions.cs +++ /dev/null @@ -1,93 +0,0 @@ -// PreprocessorOptions.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace ScriptSharp { - - /// - /// Script# pre-processor options. - /// - public sealed class PreprocessorOptions { - - private ICollection _preprocessorVariables; - private IStreamSource _sourceFile; - private IStreamSource _targetFile; - private bool _stripCommentsOnly; - private bool _useWindowsLineBreaks; - private bool _debug; - private bool _minimize; - - public bool DebugFlavor { - get { - return _debug; - } - set { - _debug = value; - } - } - - public bool Minimize { - get { - if (!DebugFlavor) { - return _minimize; - } - return false; - } - set { - _minimize = value; - } - } - - public ICollection PreprocessorVariables { - get { - return _preprocessorVariables; - } - set { - _preprocessorVariables = value; - } - } - - public IStreamSource SourceFile { - get { - return _sourceFile; - } - set { - _sourceFile = value; - } - } - - public bool StripCommentsOnly { - get { - return _stripCommentsOnly; - } - set { - _stripCommentsOnly = value; - } - } - - public IStreamSource TargetFile { - get { - return _targetFile; - } - set { - _targetFile = value; - } - } - - public bool UseWindowsLineBreaks { - get { - return _useWindowsLineBreaks; - } - set { - _useWindowsLineBreaks = value; - } - } - } -} diff --git a/src/Core/Compiler/ScriptCompiler.cs b/src/Core/Compiler/ScriptCompiler.cs index 3dd0c405f..b2700fbb4 100644 --- a/src/Core/Compiler/ScriptCompiler.cs +++ b/src/Core/Compiler/ScriptCompiler.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.IO; using System.Text; +using System.Text.RegularExpressions; using ScriptSharp.CodeModel; using ScriptSharp.Compiler; using ScriptSharp.Generator; @@ -22,7 +23,7 @@ namespace ScriptSharp { /// /// The Script# compiler. /// - public sealed class ScriptCompiler : IErrorHandler, IStreamResolver, IScriptInfo { + public sealed class ScriptCompiler : IErrorHandler { private CompilerOptions _options; private IErrorHandler _errorHandler; @@ -89,14 +90,8 @@ private void BuildMetadata() { MetadataBuilder mdBuilder = new MetadataBuilder(this); _appSymbols = mdBuilder.BuildMetadata(_compilationUnitList, _symbols, _options); - // Check if any of the types defined in this assembly conflict against types in - // imported assemblies. - + // Check if any of the types defined in this assembly conflict. Dictionary types = new Dictionary(); - foreach (TypeSymbol importedType in _importedSymbols) { - types[importedType.FullGeneratedName] = importedType; - } - foreach (TypeSymbol appType in _appSymbols) { if ((appType.IsApplicationType == false) || (appType.Type == SymbolType.Delegate)) { // Skip the check for types that are marked as imported, as they @@ -113,9 +108,13 @@ private void BuildMetadata() { continue; } - string name = appType.FullGeneratedName; + // TODO: We could allow conflicting types as long as both aren't public + // since they won't be on the exported types list. Internal types that + // conflict could be generated using full name. + + string name = appType.GeneratedName; if (types.ContainsKey(name)) { - string error = "The type '" + name + "' conflicts with another existing type with the same full name. This might be because a referenced assembly uses the same type, or you have multiple types with the same name across namespaces mapped to the same script namespace."; + string error = "The type '" + appType.FullName + "' conflicts with with '" + types[name].FullName + "' as they have the same name."; ((IErrorHandler)this).ReportError(error, null); } else { @@ -152,11 +151,17 @@ private void BuildMetadata() { } #endif // DEBUG + ISymbolTransformer transformer = null; if (_options.Minimize) { - SymbolObfuscator obfuscator = new SymbolObfuscator(); - SymbolSetTransformer obfuscationTransformer = new SymbolSetTransformer(obfuscator); + transformer = new SymbolObfuscator(); + } + else { + transformer = new SymbolInternalizer(); + } - ICollection obfuscatedSymbols = obfuscationTransformer.TransformSymbolSet(_symbols, /* useInheritanceOrder */ true); + if (transformer != null) { + SymbolSetTransformer symbolSetTransformer = new SymbolSetTransformer(transformer); + ICollection transformedSymbols = symbolSetTransformer.TransformSymbolSet(_symbols, /* useInheritanceOrder */ true); #if DEBUG if (_options.InternalTestType == "minimizationMap") { @@ -165,21 +170,14 @@ private void BuildMetadata() { testWriter.WriteLine("Minimization Map"); testWriter.WriteLine("================================================================"); - List sortedObfuscatedSymbols = new List(obfuscatedSymbols); - sortedObfuscatedSymbols.Sort(delegate(Symbol s1, Symbol s2) { + List sortedTransformedSymbols = new List(transformedSymbols); + sortedTransformedSymbols.Sort(delegate(Symbol s1, Symbol s2) { return String.Compare(s1.Name, s2.Name); }); - foreach (Symbol obfuscatedSymbol in sortedObfuscatedSymbols) { - if (obfuscatedSymbol is TypeSymbol) { - TypeSymbol typeSymbol = (TypeSymbol)obfuscatedSymbol; - - testWriter.WriteLine("Type '" + typeSymbol.FullName + "' renamed to '" + typeSymbol.GeneratedName + "'"); - } - else { - Debug.Assert(obfuscatedSymbol is MemberSymbol); - testWriter.WriteLine(" Member '" + obfuscatedSymbol.Name + "' renamed to '" + obfuscatedSymbol.GeneratedName + "'"); - } + foreach (Symbol transformedSymbol in sortedTransformedSymbols) { + Debug.Assert(transformedSymbol is MemberSymbol); + testWriter.WriteLine(" Member '" + transformedSymbol.Name + "' renamed to '" + transformedSymbol.GeneratedName + "'"); } testWriter.WriteLine(); @@ -189,14 +187,6 @@ private void BuildMetadata() { } #endif // DEBUG } - else { - if (_options.DebugFlavor) { - SymbolInternalizer internalizer = new SymbolInternalizer(); - SymbolSetTransformer internalizingTransformer = new SymbolSetTransformer(internalizer); - - internalizingTransformer.TransformSymbolSet(_symbols, /* useInheritanceOrder */ true); - } - } } public bool Compile(CompilerOptions options) { @@ -237,187 +227,174 @@ public bool Compile(CompilerOptions options) { } private void GenerateScript() { - if (_options.TemplateFile != null) { - PreprocessorOptions preprocessorOptions = new PreprocessorOptions(); - preprocessorOptions.SourceFile = _options.TemplateFile; - preprocessorOptions.TargetFile = _options.ScriptFile; - preprocessorOptions.DebugFlavor = _options.DebugFlavor; - preprocessorOptions.Minimize = _options.Minimize; - // preprocessorOptions.StripCommentsOnly = _options.StripCommentsOnly; - preprocessorOptions.UseWindowsLineBreaks = !_options.Minimize; - preprocessorOptions.PreprocessorVariables = _options.Defines; - - ScriptPreprocessor preprocessor = new ScriptPreprocessor(this, this, this); - preprocessor.Preprocess(preprocessorOptions); - } - else { - Stream outputStream = null; - TextWriter outputWriter = null; - - try { - outputStream = _options.ScriptFile.GetStream(); - if (outputStream == null) { - ((IErrorHandler)this).ReportError("Unable to write to file " + _options.ScriptFile.FullName, - _options.ScriptFile.FullName); - return; - } + Stream outputStream = null; + TextWriter outputWriter = null; + + try { + outputStream = _options.ScriptFile.GetStream(); + if (outputStream == null) { + ((IErrorHandler)this).ReportError("Unable to write to file " + _options.ScriptFile.FullName, + _options.ScriptFile.FullName); + return; + } - outputWriter = new StreamWriter(outputStream); + outputWriter = new StreamWriter(outputStream); #if DEBUG - if (_options.InternalTestMode) { - if (_testOutput != null) { - outputWriter.Write(_testOutput); - outputWriter.WriteLine("Script"); - outputWriter.WriteLine("================================================================"); - outputWriter.WriteLine(); - outputWriter.WriteLine(); - } + if (_options.InternalTestMode) { + if (_testOutput != null) { + outputWriter.Write(_testOutput); + outputWriter.WriteLine("Script"); + outputWriter.WriteLine("================================================================"); + outputWriter.WriteLine(); + outputWriter.WriteLine(); } + } #endif // DEBUG - GenerateScriptCore(outputWriter); - } - catch (Exception e) { - Debug.Fail(e.ToString()); + string script = GenerateScriptWithTemplate(); + outputWriter.Write(script); + } + catch (Exception e) { + Debug.Fail(e.ToString()); + } + finally { + if (outputWriter != null) { + outputWriter.Flush(); } - finally { - if (outputWriter != null) { - outputWriter.Flush(); - } - if (outputStream != null) { - _options.ScriptFile.CloseStream(outputStream); - } + if (outputStream != null) { + _options.ScriptFile.CloseStream(outputStream); } } } - private void GenerateScriptCore(TextWriter writer) { - ScriptGenerator scriptGenerator = new ScriptGenerator(writer, _options, this); - scriptGenerator.GenerateScript(_symbols); - } - - private void ImportMetadata() { - MetadataImporter mdImporter = new MetadataImporter(_options, this); - - _importedSymbols = mdImporter.ImportMetadata(_options.References, _symbols); - } - - #region Implementation of IErrorHandler - void IErrorHandler.ReportError(string errorMessage, string location) { - _hasErrors = true; + private string GenerateScriptCore() { + StringWriter scriptWriter = new StringWriter(); - if (_errorHandler != null) { - _errorHandler.ReportError(errorMessage, location); - return; + try { + ScriptGenerator scriptGenerator = new ScriptGenerator(scriptWriter, _options, _symbols); + scriptGenerator.GenerateScript(_symbols); } - - if (String.IsNullOrEmpty(location) == false) { - Console.Error.Write(location); - Console.Error.Write(": "); + catch (Exception e) { + Debug.Fail(e.ToString()); + } + finally { + scriptWriter.Flush(); } - Console.Error.WriteLine(errorMessage); + return scriptWriter.ToString(); } - #endregion - #region Implementation of IStreamResolver - IStreamSource IStreamResolver.ResolveInclude(IStreamSource baseStream, string includePath) { - if (includePath == "%code%") { - StringBuilder sb = new StringBuilder(4096); - StringWriter sw = new StringWriter(sb); + private string GenerateScriptWithTemplate() { + string script = GenerateScriptCore(); - sw.WriteLine(); - GenerateScriptCore(sw); - - string compiledCode = sb.ToString(); - return new CodeStreamSource(compiledCode); + string template = _options.ScriptInfo.Template; + if (String.IsNullOrEmpty(template)) { + return script; } - else { - IStreamResolver resolver = baseStream as IStreamResolver; - if (resolver != null) { - return resolver.ResolveInclude(baseStream, includePath); - } - string resolvedPath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(baseStream.FullName)), includePath); - return new FileInputStreamSource(resolvedPath); - } - } - #endregion + template = PreprocessTemplate(template); - #region Implementation of IScriptInfo - string IScriptInfo.GetValue(string name) { - if (_symbols == null) { - return null; - } + StringBuilder requiresBuilder = new StringBuilder(); + StringBuilder dependenciesBuilder = new StringBuilder(); + StringBuilder depLookupBuilder = new StringBuilder(); - if (String.CompareOrdinal(name, "Name") == 0) { - if (String.IsNullOrEmpty(_options.ScriptNameSuffix) == false) { - return _symbols.ScriptName + "." + _options.ScriptNameSuffix; + bool firstDependency = true; + foreach (ScriptReference dependency in _symbols.Dependencies) { + if (dependency.DelayLoaded) { + continue; } - return _symbols.ScriptName; - } - if (String.CompareOrdinal(name, "ExecutionDependencies") == 0) { - if (_options.ExecutionDependencies == null) { - return String.Empty; + + if (firstDependency) { + depLookupBuilder.Append("var "); + } + else { + requiresBuilder.Append(", "); + dependenciesBuilder.Append(", "); + depLookupBuilder.Append(",\r\n "); } - bool first = true; - StringBuilder sb = new StringBuilder(); - foreach (string scriptName in _options.ExecutionDependencies) { - if (first == false) { - sb.Append(","); - } - sb.Append(scriptName); - first = false; + string name = dependency.Name; + if (name == "ss") { + // TODO: This is a hack... to make generated node.js scripts + // be able to reference the 'scriptsharp' node module. + // Fix this in a better/1st class manner by allowing + // script assemblies to declare such things. + name = "scriptsharp"; } - return sb.ToString(); - } - if (String.CompareOrdinal(name, "ScriptFile") == 0) { - return Path.GetFileName(_options.ScriptFile.Name); - } - if (String.CompareOrdinal(name, "CompilerVersion") == 0) { - string exePath = typeof(ScriptCompiler).Assembly.GetModules()[0].FullyQualifiedName; - FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(exePath); + requiresBuilder.Append("'" + dependency.Path + "'"); + dependenciesBuilder.Append(dependency.Identifier); + + depLookupBuilder.Append(dependency.Identifier); + depLookupBuilder.Append(" = require('" + name + "')"); - return versionInfo.FileVersion; + firstDependency = false; } - return null; + depLookupBuilder.Append(";"); + + return template.TrimStart() + .Replace("{name}", _symbols.ScriptName) + .Replace("{description}", _options.ScriptInfo.Description ?? String.Empty) + .Replace("{copyright}", _options.ScriptInfo.Copyright ?? String.Empty) + .Replace("{version}", _options.ScriptInfo.Version ?? String.Empty) + .Replace("{compiler}", typeof(ScriptCompiler).Assembly.GetName().Version.ToString()) + .Replace("{description}", _options.ScriptInfo.Description) + .Replace("{requires}", requiresBuilder.ToString()) + .Replace("{dependencies}", dependenciesBuilder.ToString()) + .Replace("{dependenciesLookup}", depLookupBuilder.ToString()) + .Replace("{script}", script); } - #endregion + private void ImportMetadata() { + MetadataImporter mdImporter = new MetadataImporter(_options, this); - private sealed class CodeStreamSource : IStreamSource { - - private string _code; + _importedSymbols = mdImporter.ImportMetadata(_options.References, _symbols); + } - public CodeStreamSource(string code) { - _code = code; + private string PreprocessTemplate(string template) { + if (_options.IncludeResolver == null) { + return template; } - public string FullName { - get { - return "%code%"; - } - } + Regex includePattern = new Regex("\\{include:([^\\}]+)\\}", RegexOptions.Multiline | RegexOptions.CultureInvariant); + return includePattern.Replace(template, delegate(Match include) { + string includedScript = String.Empty; + + if (include.Groups.Count == 2) { + string includePath = include.Groups[1].Value; - public string Name { - get { - return "%code%"; + IStreamSource includeSource = _options.IncludeResolver.Resolve(includePath); + if (includeSource != null) { + Stream includeStream = includeSource.GetStream(); + StreamReader reader = new StreamReader(includeStream); + + includedScript = reader.ReadToEnd(); + includeSource.CloseStream(includeStream); + } } - } - public void CloseStream(Stream stream) { - Debug.Assert(stream != null); - stream.Close(); + return includedScript; + }); + } + + #region Implementation of IErrorHandler + void IErrorHandler.ReportError(string errorMessage, string location) { + _hasErrors = true; + + if (_errorHandler != null) { + _errorHandler.ReportError(errorMessage, location); + return; } - public Stream GetStream() { - byte[] buffer = Encoding.Default.GetBytes(_code); - return new MemoryStream(buffer); + if (String.IsNullOrEmpty(location) == false) { + Console.Error.Write(location); + Console.Error.Write(": "); } + + Console.Error.WriteLine(errorMessage); } + #endregion } } diff --git a/src/Core/Compiler/ScriptInfo.cs b/src/Core/Compiler/ScriptInfo.cs new file mode 100644 index 000000000..e977cbc9f --- /dev/null +++ b/src/Core/Compiler/ScriptInfo.cs @@ -0,0 +1,47 @@ +// ScriptInfo.cs +// Script#/Core/Compiler +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; + +namespace ScriptSharp { + + public sealed class ScriptInfo { + + private static readonly string DefaultScriptTemplate = @" +""use strict""; + +define('{name}', [{requires}], function({dependencies}) { + var $global = this; + + {script} + return $exports; +}); +"; + + public ScriptInfo() { + Template = DefaultScriptTemplate; + } + + public string Copyright { + get; + set; + } + + public string Description { + get; + set; + } + + public string Template { + get; + set; + } + + public string Version { + get; + set; + } + } +} diff --git a/src/Core/Compiler/ScriptModel/Expressions/ExpressionType.cs b/src/Core/Compiler/ScriptModel/Expressions/ExpressionType.cs index 34b8b799c..9d2dd9842 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/ExpressionType.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/ExpressionType.cs @@ -53,6 +53,8 @@ internal enum ExpressionType { LateBound = 21, - InlineScript = 22 + InlineScript = 22, + + NewDelegate = 23, } } diff --git a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs index 26baf48d7..0df7088b5 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs @@ -23,6 +23,9 @@ public LiteralExpression(TypeSymbol valueType, object value) protected override bool IsParenthesisRedundant { get { + // Numeric literals need to be paranthesized in script when followed by a + // dot member access, so it is not redundant for numbers. + if ((_value is String) || (_value is Boolean)) { return true; } diff --git a/src/Core/Compiler/ScriptModel/Expressions/NewDelegateExpression.cs b/src/Core/Compiler/ScriptModel/Expressions/NewDelegateExpression.cs new file mode 100644 index 000000000..fdca60cd5 --- /dev/null +++ b/src/Core/Compiler/ScriptModel/Expressions/NewDelegateExpression.cs @@ -0,0 +1,69 @@ +// NewExpression.cs +// Script#/Core/Compiler +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; + +namespace ScriptSharp.ScriptModel { + + internal sealed class NewDelegateExpression : Expression { + + private TypeSymbol _associatedType; + private Expression _typeExpression; + + public NewDelegateExpression(TypeSymbol associatedType) + : base(ExpressionType.NewDelegate, associatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { + + Debug.Assert(associatedType.Type == SymbolType.Delegate); + _associatedType = associatedType; + } + + public NewDelegateExpression(Expression typeExpression, TypeSymbol associatedType) + : base(ExpressionType.NewDelegate, associatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { + + Debug.Assert(associatedType.Type == SymbolType.Delegate); + _typeExpression = typeExpression; + _associatedType = associatedType; + } + + public TypeSymbol AssociatedType { + get { + return _associatedType; + } + } + + public bool IsSpecificType { + get { + return (_typeExpression == null); + } + } + + public override bool RequiresThisContext { + get + { + if ((_typeExpression != null) && _typeExpression.RequiresThisContext) { + return true; + } + + return false; + } + } + + protected override bool IsParenthesisRedundant { + get { + return false; + } + } + + public Expression TypeExpression { + get { + return _typeExpression; + } + } + } +} diff --git a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs index d6620bab4..ff9fdffe6 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs @@ -48,7 +48,6 @@ public static Operator OperatorFromToken(TokenType token) { case TokenType.LogAnd: return Operator.LogicalAnd; case TokenType.LogOr: - case TokenType.Coalesce: return Operator.LogicalOr; case TokenType.EqualEqual: return Operator.EqualEqualEqual; diff --git a/src/Core/Compiler/ScriptModel/Statements/ForInStatement.cs b/src/Core/Compiler/ScriptModel/Statements/ForInStatement.cs index 6bd7006cc..8a06b5996 100644 --- a/src/Core/Compiler/ScriptModel/Statements/ForInStatement.cs +++ b/src/Core/Compiler/ScriptModel/Statements/ForInStatement.cs @@ -16,14 +16,18 @@ internal sealed class ForInStatement : Statement { private Expression _collectionExpression; private Statement _body; + private bool _dictionaryEnumeration; + public ForInStatement(Expression collectionExpression) : this(collectionExpression, null) { + _dictionaryEnumeration = false; } public ForInStatement(Expression collectionExpression, VariableSymbol dictionaryVariable) : base(StatementType.ForIn) { _collectionExpression = collectionExpression; _dictionaryVariable = dictionaryVariable; + _dictionaryEnumeration = true; } public Statement Body { @@ -46,7 +50,7 @@ public VariableSymbol DictionaryVariable { public bool IsDictionaryEnumeration { get { - return (_dictionaryVariable != null); + return _dictionaryEnumeration; } } diff --git a/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs index 1cebbf747..ad5d8392b 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs @@ -23,9 +23,10 @@ internal class ClassSymbol : TypeSymbol { private ConstructorSymbol _staticConstructor; private IndexerSymbol _indexer; - private bool _globalMethods; - private string _mixinRoot; + private string _extendee; private bool _testClass; + private bool _moduleClass; + private bool _staticClass; private ClassSymbol _primaryPartialClass; @@ -58,6 +59,12 @@ public ConstructorSymbol Constructor { } } + public string Extendee { + get { + return _extendee; + } + } + public override string GeneratedName { get { if (_primaryPartialClass != null) { @@ -67,12 +74,6 @@ public override string GeneratedName { } } - public bool HasGlobalMethods { - get { - return _globalMethods; - } - } - public IndexerSymbol Indexer { get { if (_primaryPartialClass != null) { @@ -108,6 +109,31 @@ public ICollection Interfaces { } } + public bool IsExtenderClass { + get { + if (_primaryPartialClass != null) { + return _primaryPartialClass.IsExtenderClass; + } + + return (String.IsNullOrEmpty(_extendee) == false); + } + } + + public bool IsModuleClass { + get { + return _moduleClass; + } + } + + public bool IsStaticClass { + get { + if (_primaryPartialClass != null) { + return _primaryPartialClass.IsStaticClass; + } + return _staticClass; + } + } + public bool IsTestClass { get { if (_primaryPartialClass != null) { @@ -150,12 +176,6 @@ public int MinimizationDepth { } } - public string MixinRoot { - get { - return _mixinRoot; - } - } - public ClassSymbol PrimaryPartialClass { get { if (_primaryPartialClass != null) { @@ -263,9 +283,15 @@ public override MemberSymbol GetMember(string name) { return base.GetMember(name); } - public void SetGlobalMethods(string mixinRoot) { - _globalMethods = true; - _mixinRoot = mixinRoot; + public void SetExtenderClass(string extendee) { + Debug.Assert(String.IsNullOrEmpty(extendee) == false); + + if (_primaryPartialClass != null) { + _primaryPartialClass.SetExtenderClass(extendee); + return; + } + + _extendee = extendee; } public void SetInheritance(ClassSymbol baseClass, ICollection interfaces) { @@ -276,6 +302,10 @@ public void SetInheritance(ClassSymbol baseClass, ICollection i _interfaces = interfaces; } + public void SetModuleClass() { + _moduleClass = true; + } + public void SetPrimaryPartialClass(ClassSymbol primaryPartialClass) { Debug.Assert(_primaryPartialClass == null); Debug.Assert(primaryPartialClass != null); @@ -283,6 +313,15 @@ public void SetPrimaryPartialClass(ClassSymbol primaryPartialClass) { _primaryPartialClass = primaryPartialClass; } + public void SetStaticClass() { + if (_primaryPartialClass != null) { + _primaryPartialClass.SetStaticClass(); + return; + } + + _staticClass = true; + } + public void SetTestClass() { if (_primaryPartialClass != null) { _primaryPartialClass.SetTestClass(); diff --git a/src/Core/Compiler/ScriptModel/Symbols/EnumerationSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/EnumerationSymbol.cs index 44c2a6f20..b0ebd8b10 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/EnumerationSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/EnumerationSymbol.cs @@ -23,6 +23,12 @@ public EnumerationSymbol(string name, NamespaceSymbol parent, bool flags) _transformationCookie = -1; } + public bool Constants { + get { + return _namedValues || _numericValues; + } + } + public bool Flags { get { return _flags; diff --git a/src/Core/Compiler/ScriptModel/Symbols/EventSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/EventSymbol.cs index cccd15990..b52c22715 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/EventSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/EventSymbol.cs @@ -11,6 +11,9 @@ namespace ScriptSharp.ScriptModel { internal sealed class EventSymbol : CodeMemberSymbol { + private string _addAccessor; + private string _removeAccessor; + private SymbolImplementation _adderImplementation; private SymbolImplementation _removerImplementation; @@ -20,6 +23,12 @@ public EventSymbol(string name, TypeSymbol parent, TypeSymbol handlerType) AddParameter(valueParameter); } + public string AddAccessor { + get { + return _addAccessor; + } + } + public SymbolImplementation AdderImplementation { get { Debug.Assert(_adderImplementation != null); @@ -49,6 +58,18 @@ public override string DocumentationID { } } + public bool HasCustomAccessors { + get { + return (_addAccessor != null) && (_removeAccessor != null); + } + } + + public string RemoveAccessor { + get { + return _removeAccessor; + } + } + public SymbolImplementation RemoverImplementation { get { Debug.Assert(_removerImplementation != null); @@ -68,5 +89,14 @@ public void AddImplementation(SymbolImplementation implementation, bool adder) { _removerImplementation = implementation; } } + + public void SetAccessors(string addAccessor, string removeAccessor) { + Debug.Assert((_addAccessor == null) && (_removeAccessor == null)); + Debug.Assert(String.IsNullOrEmpty(addAccessor) == false); + Debug.Assert(String.IsNullOrEmpty(removeAccessor) == false); + + _addAccessor = addAccessor; + _removeAccessor = removeAccessor; + } } } diff --git a/src/Core/Compiler/ScriptModel/Symbols/IndexerSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/IndexerSymbol.cs index 0503ab04c..f32e16e24 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/IndexerSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/IndexerSymbol.cs @@ -11,7 +11,7 @@ namespace ScriptSharp.ScriptModel { internal sealed class IndexerSymbol : PropertySymbol { - private bool _intrinsic; + private bool _scriptIndexer; public IndexerSymbol(TypeSymbol parent, TypeSymbol propertyType) : base(SymbolType.Indexer, "Item", parent, propertyType) { @@ -41,15 +41,15 @@ public override string DocumentationID { } } - public bool IsIntrinsic { + public bool UseScriptIndexer { get { - return _intrinsic; + return _scriptIndexer; } } - public void SetIntrinsic() { - Debug.Assert(_intrinsic == false); - _intrinsic = true; + public void SetScriptIndexer() { + Debug.Assert(_scriptIndexer == false); + _scriptIndexer = true; } } } diff --git a/src/Core/Compiler/ScriptModel/Symbols/IntrinsicType.cs b/src/Core/Compiler/ScriptModel/Symbols/IntrinsicType.cs index 07fa3844e..20d49e07a 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/IntrinsicType.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/IntrinsicType.cs @@ -35,6 +35,8 @@ internal enum IntrinsicType { Single, + Date, + Double, Decimal, diff --git a/src/Core/Compiler/ScriptModel/Symbols/MethodSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/MethodSymbol.cs index eaa3ab92e..4ee8db62f 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/MethodSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/MethodSymbol.cs @@ -13,8 +13,9 @@ namespace ScriptSharp.ScriptModel { internal class MethodSymbol : CodeMemberSymbol { + private string _alias; private ICollection _conditions; - private bool _aliased; + private string _selector; private bool _skipGeneration; private ICollection _genericArguments; @@ -33,6 +34,12 @@ protected MethodSymbol(SymbolType type, string name, TypeSymbol parent, TypeSymb : base(type, name, parent, returnType) { } + public string Alias { + get { + return _alias; + } + } + public ICollection Conditions { get { return _conditions; @@ -75,6 +82,12 @@ public ICollection GenericArguments { } } + public bool HasSelector { + get { + return (_selector != null); + } + } + public SymbolImplementation Implementation { get { Debug.Assert(_implementation != null); @@ -82,26 +95,35 @@ public SymbolImplementation Implementation { } } - public bool IsGeneric { + public bool IsAliased { get { - return (_genericArguments != null) && - (_genericArguments.Count != 0); + return String.IsNullOrEmpty(_alias) == false; } } - public bool IsGlobalMethod { + public bool IsExtension { get { - if (_aliased) { - // Methods with a script alias are considered global methods. - return true; - } if (Parent.Type == SymbolType.Class) { - return ((ClassSymbol)Parent).HasGlobalMethods; + return ((ClassSymbol)Parent).IsExtenderClass; } return false; } } + public bool IsGeneric { + get { + return (_genericArguments != null) && + (_genericArguments.Count != 0); + } + } + + public string Selector { + get { + Debug.Assert(_selector != null); + return _selector; + } + } + public bool SkipGeneration { get { return _skipGeneration; @@ -137,10 +159,11 @@ public bool MatchesConditions(ICollection defines) { } public void SetAlias(string alias) { - Debug.Assert((Visibility & MemberVisibility.Static) != 0); + Debug.Assert(_alias == null); + Debug.Assert(String.IsNullOrEmpty(alias) == false); + _alias = alias; SetTransformedName(alias); - _aliased = true; } public void SetConditions(ICollection conditions) { @@ -150,6 +173,13 @@ public void SetConditions(ICollection conditions) { _conditions = conditions; } + public void SetSelector(string selector) { + Debug.Assert(_selector == null); + Debug.Assert(String.IsNullOrEmpty(selector) == false); + + _selector = selector; + } + public void SetSkipGeneration() { Debug.Assert(_skipGeneration == false); _skipGeneration = true; diff --git a/src/Core/Compiler/ScriptModel/Symbols/SymbolImplementation.cs b/src/Core/Compiler/ScriptModel/Symbols/SymbolImplementation.cs index 848a23cce..7bd9553f0 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/SymbolImplementation.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/SymbolImplementation.cs @@ -15,10 +15,12 @@ internal sealed class SymbolImplementation { private SymbolScope _scope; private ICollection _statements; + private string _thisIdentifier; - public SymbolImplementation(ICollection statements, SymbolScope scope) { + public SymbolImplementation(ICollection statements, SymbolScope scope, string thisIdentifier) { _scope = scope; _statements = statements; + _thisIdentifier = thisIdentifier; } public bool DeclaresVariables { @@ -32,12 +34,6 @@ public bool DeclaresVariables { } } - public SymbolScope Scope { - get { - return _scope; - } - } - public bool RequiresThisContext { get { foreach (Statement statement in _statements) { @@ -49,10 +45,22 @@ public bool RequiresThisContext { } } + public SymbolScope Scope { + get { + return _scope; + } + } + public ICollection Statements { get { return _statements; } } + + public string ThisIdentifier { + get { + return _thisIdentifier; + } + } } } diff --git a/src/Core/Compiler/ScriptModel/Symbols/SymbolInternalizer.cs b/src/Core/Compiler/ScriptModel/Symbols/SymbolInternalizer.cs index 8a6145ffb..13252aa54 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/SymbolInternalizer.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/SymbolInternalizer.cs @@ -51,35 +51,30 @@ private string TransformMember(MemberSymbol memberSymbol) { } } - private string TransformType(TypeSymbol typeSymbol, out bool transformChildren) { - transformChildren = (typeSymbol.Type != SymbolType.Interface) && - (typeSymbol.Type != SymbolType.Delegate); - - if ((typeSymbol.Type == SymbolType.Enumeration) && - ((EnumerationSymbol)typeSymbol).UseNamedValues) { - // If the enum uses named values, then don't transform, as its - // unlikely the code wants to use some random generated name as the - // named value. - transformChildren = false; - } - - if ((typeSymbol.IsPublic == false) && typeSymbol.IsTransformAllowed) { - return GenerateName(typeSymbol.Name); - } - - return null; - } - #region Implementation of ISymbolTransformer string ISymbolTransformer.TransformSymbol(Symbol symbol, out bool transformChildren) { transformChildren = false; if (symbol is TypeSymbol) { - if ((symbol.Type == SymbolType.Class) && ((ClassSymbol)symbol).IsTestType) { - return null; + transformChildren = (symbol.Type != SymbolType.Interface) && + (symbol.Type != SymbolType.Delegate); + + if ((symbol.Type == SymbolType.Enumeration) && + ((EnumerationSymbol)symbol).UseNamedValues) { + // If the enum uses named values, then don't transform, as its + // unlikely the code wants to use some random generated name as the + // named value. + transformChildren = false; } - return TransformType((TypeSymbol)symbol, out transformChildren); + if ((symbol.Type == SymbolType.Class) && + ((ClassSymbol)symbol).IsExtenderClass) { + // Unlikely that classes adding members to another object contain + // members that should be renamed. + transformChildren = false; + } + + return null; } else if (symbol is MemberSymbol) { return TransformMember((MemberSymbol)symbol); diff --git a/src/Core/Compiler/ScriptModel/Symbols/SymbolObfuscator.cs b/src/Core/Compiler/ScriptModel/Symbols/SymbolObfuscator.cs index e50a4c828..740cefa56 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/SymbolObfuscator.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/SymbolObfuscator.cs @@ -10,35 +10,16 @@ namespace ScriptSharp.ScriptModel { internal sealed class SymbolObfuscator : ISymbolTransformer { - private int _count; - private static string GenerateName(int index, int offset) { - if (offset == 0) { - return String.Format("${0:X}", index); - } - return String.Format("${0:X}_{1:X}", offset, index); - } - - private string TransformLocal(LocalSymbol localSymbol) { - int depth = 0; + // Shorten the name - the use of "$" ensures it won't conflict with a + // name in the source code. - AnonymousMethodSymbol parentMethod = localSymbol.Parent as AnonymousMethodSymbol; - if (parentMethod != null) { - // If an anonymous method contains a local variable with the - // same name as a variable in the containing method, they will - // conflict at runtime, i.e. the value in the inner method - // will override the value of the outer method when it is run. - // Note that right now we aren't seeing if there is actually a conflict. - // We're always qualifying the inner variable with a depth prefix. - // REVIEW: Should we try to optimize when we qualify? + string name = Utility.CreateEncodedName(index, /* useDigits */ true); - depth = parentMethod.Depth; + if (offset == 0) { + return "$" + name; } - - string transformedName = GenerateName(_count, depth); - _count++; - - return transformedName; + return Utility.CreateEncodedName(offset, /* useDigits */ false) + "$" + name; } private string TransformMember(MemberSymbol memberSymbol) { @@ -110,44 +91,34 @@ private string TransformMember(MemberSymbol memberSymbol) { return null; } - private string TransformType(TypeSymbol typeSymbol, out bool transformChildren) { - string transformedName = null; - transformChildren = (typeSymbol.Type != SymbolType.Interface) && - (typeSymbol.Type != SymbolType.Delegate); - - if ((typeSymbol.IsPublic == false) && typeSymbol.IsTransformAllowed) { - string prefix = typeSymbol.SymbolSet.ScriptPrefix; - - string name = String.Format("{0}${1:X}", prefix, _count); - if ((typeSymbol.Name.Length + 1) < name.Length) { - transformedName = "_" + typeSymbol.Name; - } - else { - transformedName = name; - _count++; - } - } - - return transformedName; - } - #region Implementation of ISymbolTransformer string ISymbolTransformer.TransformSymbol(Symbol symbol, out bool transformChildren) { transformChildren = false; if (symbol is TypeSymbol) { - if ((symbol.Type == SymbolType.Class) && ((ClassSymbol)symbol).IsTestType) { - return null; + transformChildren = (symbol.Type != SymbolType.Interface) && + (symbol.Type != SymbolType.Delegate); + + if ((symbol.Type == SymbolType.Enumeration) && + ((EnumerationSymbol)symbol).UseNamedValues) { + // If the enum uses named values, then don't transform, as its + // unlikely the code wants to use some random generated name as the + // named value. + transformChildren = false; + } + + if ((symbol.Type == SymbolType.Class) && + ((ClassSymbol)symbol).IsExtenderClass) { + // Unlikely that classes adding members to another object contain + // members that should be renamed. + transformChildren = false; } - return TransformType((TypeSymbol)symbol, out transformChildren); + return null; } else if (symbol is MemberSymbol) { return TransformMember((MemberSymbol)symbol); } - else if (symbol is LocalSymbol) { - return TransformLocal((LocalSymbol)symbol); - } return null; } diff --git a/src/Core/Compiler/ScriptModel/Symbols/SymbolSet.cs b/src/Core/Compiler/ScriptModel/Symbols/SymbolSet.cs index 469b0c028..5bd83149f 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/SymbolSet.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/SymbolSet.cs @@ -26,7 +26,8 @@ internal sealed class SymbolSet : ISymbolTable { private MemberSymbol _entryPoint; private string _scriptName; - private string _scriptPrefix; + private List _dependencies; + private Dictionary _dependencySet; private Dictionary> _resources; @@ -45,9 +46,17 @@ public SymbolSet() { _namespaces.Add(_systemNamespace); _namespaceMap["System"] = _systemNamespace; + _dependencies = new List(); + _dependencySet = new Dictionary(StringComparer.Ordinal); _resources = new Dictionary>(StringComparer.OrdinalIgnoreCase); } + public IEnumerable Dependencies { + get { + return _dependencies; + } + } + public MemberSymbol EntryPoint { get { return _entryPoint; @@ -81,18 +90,31 @@ public string ScriptName { } } - public string ScriptPrefix { + public NamespaceSymbol SystemNamespace { get { - return _scriptPrefix; - } - set { - _scriptPrefix = value; + return _systemNamespace; } } - public NamespaceSymbol SystemNamespace { - get { - return _systemNamespace; + public void AddDependency(ScriptReference dependency) { + ScriptReference existingDependency; + if (_dependencySet.TryGetValue(dependency.Name, out existingDependency)) { + // The dependency already exists ... copy over identifier + // from the new one to the existing one. + + // This is to support the scenario where a dependency got defined + // by virtue of the app using a [ScriptReference] to specify path/delayLoad + // semnatics, and we're finding the imported dependency later on + // such as when a type with a dependency is referred in the code. + + if ((existingDependency.HasIdentifier == false) && + dependency.HasIdentifier) { + existingDependency.Identifier = dependency.Identifier; + } + } + else { + _dependencies.Add(dependency); + _dependencySet[dependency.Name] = dependency; } } @@ -124,7 +146,7 @@ private TypeSymbol CreateArrayTypeCore(TypeSymbol itemTypeSymbol) { IndexerSymbol indexerSymbol = new IndexerSymbol(specificArrayTypeSymbol, itemTypeSymbol, MemberVisibility.Public); - indexerSymbol.SetIntrinsic(); + indexerSymbol.SetScriptIndexer(); specificArrayTypeSymbol.AddMember(indexerSymbol); specificArrayTypeSymbol.SetIgnoreNamespace(); specificArrayTypeSymbol.SetArray(); @@ -148,8 +170,8 @@ private MemberSymbol CreateGenericMember(MemberSymbol templateMember, IList _imports; private IDictionary _aliases; - private string _dependencyName; + private ScriptReference _dependency; private bool _applicationType; private bool _isPublic; private bool _isArray; @@ -49,9 +49,9 @@ public IDictionary Aliases { } } - public string DependencyName { + public ScriptReference Dependency { get { - return _dependencyName; + return _dependency; } } @@ -69,23 +69,22 @@ public override string DocumentationID { public string FullGeneratedName { get { - if (_ignoreNamespace == false) { + if ((IsApplicationType == false) && (_ignoreNamespace == false)) { string namespaceName = GeneratedNamespace; if (namespaceName.Length != 0) { return namespaceName + "." + GeneratedName; } } + return GeneratedName; } } public string FullName { get { - if (_ignoreNamespace == false) { - string namespaceName = Namespace; - if (namespaceName.Length != 0) { - return namespaceName + "." + Name; - } + string namespaceName = Namespace; + if (namespaceName.Length != 0) { + return namespaceName + "." + Name; } return Name; } @@ -93,7 +92,10 @@ public string FullName { public string GeneratedNamespace { get { - return _scriptNamespace != null ? _scriptNamespace : Namespace; + if (IsApplicationType) { + return Namespace.Replace(".", "$"); + } + return _scriptNamespace != null ? _scriptNamespace : String.Empty; } } @@ -253,11 +255,11 @@ public void SetIgnoreNamespace() { _ignoreNamespace = true; } - public void SetImported(string dependencyName) { + public void SetImported(ScriptReference dependency) { Debug.Assert(_applicationType == true); _applicationType = false; - _dependencyName = dependencyName; + _dependency = dependency; } public void SetArray() { diff --git a/src/Core/Compiler/ScriptPreprocessor.cs b/src/Core/Compiler/ScriptPreprocessor.cs deleted file mode 100644 index 294daaca1..000000000 --- a/src/Core/Compiler/ScriptPreprocessor.cs +++ /dev/null @@ -1,85 +0,0 @@ -// ScriptSharpPreprocessor.cs -// Script#/Core/Compiler -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Diagnostics; -using System.IO; -using ScriptSharp.Preprocessor; - -namespace ScriptSharp { - - public sealed class ScriptPreprocessor { - - private IScriptInfo _scriptInfo; - private IStreamResolver _includeResolver; - private IErrorHandler _errorHandler; - - public ScriptPreprocessor() - : this(null, null, null) { - } - - public ScriptPreprocessor(IStreamResolver includeResolver, IErrorHandler errorHandler) - : this(includeResolver, errorHandler, null) { - } - - internal ScriptPreprocessor(IStreamResolver includeResolver, IErrorHandler errorHandler, IScriptInfo scriptInfo) { - _scriptInfo = scriptInfo; - _includeResolver = includeResolver; - _errorHandler = errorHandler; - } - - public void Preprocess(PreprocessorOptions options) { - Stream outputStream = options.TargetFile.GetStream(); - StreamWriter outputWriter = null; - - PreprocessorTextReader preprocessor = null; - try { - if (outputStream != null) { - outputWriter = new StreamWriter(outputStream); - preprocessor = new PreprocessorTextReader(options.SourceFile, - options.PreprocessorVariables, - _includeResolver, - _scriptInfo); - - TextReader contentReader = preprocessor; - if (options.Minimize) { - contentReader = new CondenserTextReader(preprocessor, options.StripCommentsOnly); - } - - if (preprocessor.Initialize(outputWriter)) { - int ch; - while ((ch = contentReader.Read()) != -1) { - if (options.UseWindowsLineBreaks && (ch == '\n')) { - outputWriter.Write('\r'); - } - outputWriter.Write((char)ch); - } - } - } - } - catch (PreprocessorException pe) { - if (_errorHandler != null) { - _errorHandler.ReportError(pe.Message, pe.SourceFile + " (" + pe.Line + ", 1)"); - } - - if (pe.InnerException != null) { - throw pe.InnerException; - } - } - finally { - if (preprocessor != null) { - preprocessor.Close(); - } - if (outputWriter != null) { - outputWriter.Flush(); - } - if (outputStream != null) { - options.TargetFile.CloseStream(outputStream); - } - } - } - } -} diff --git a/src/Core/Compiler/ScriptReference.cs b/src/Core/Compiler/ScriptReference.cs new file mode 100644 index 000000000..9f06bba26 --- /dev/null +++ b/src/Core/Compiler/ScriptReference.cs @@ -0,0 +1,66 @@ +// ScriptReference.cs +// Script#/Core/Compiler +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Diagnostics; + +namespace ScriptSharp { + + public sealed class ScriptReference { + + private string _name; + private string _identifier; + + private string _path; + private bool _delayLoaded; + + public ScriptReference(string name, string identifier) { + Debug.Assert(String.IsNullOrEmpty(name) == false); + Debug.Assert((identifier == null) || (identifier.Length != 0)); + + _name = name; + _identifier = identifier; + } + + public bool DelayLoaded { + get { + return _delayLoaded; + } + set { + _delayLoaded = value; + } + } + + public bool HasIdentifier { + get { + return _identifier != null; + } + } + + public string Identifier { + get { + return _identifier ?? _name; + } + set { + _identifier = value; + } + } + + public string Name { + get { + return _name; + } + } + + public string Path { + get { + return _path ?? _name; + } + set { + _path = value; + } + } + } +} diff --git a/src/Core/Compiler/Utility.cs b/src/Core/Compiler/Utility.cs index 89f04f4c0..a63978eed 100644 --- a/src/Core/Compiler/Utility.cs +++ b/src/Core/Compiler/Utility.cs @@ -14,6 +14,9 @@ namespace ScriptSharp { internal static class Utility { + private static readonly string Base64Alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; + private static readonly string Base54Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; + private static readonly string[] ScriptKeywords = new string[] { // Current keywords @@ -29,7 +32,7 @@ internal static class Utility { "protected", "throws", "class", "final", "interface", "public", "transient", "const", "float", "long", "short", "volatile", // Script#-specific words - "ss" + "ss", "global" }; private static Hashtable _keywordTable; @@ -77,6 +80,23 @@ public static string CreateCamelCaseName(string name) { } } + public static string CreateEncodedName(int number, bool useDigits) { + string alphabet = useDigits ? Base64Alphabet : Base54Alphabet; + if (number == 0) { + return alphabet[0].ToString(); + } + + string name = String.Empty; + while (number > 0) { + int remainder = number % alphabet.Length; + number = (int)(number / alphabet.Length); + + name = alphabet[remainder] + name; + } + + return name; + } + public static string GetResourceFileLocale(string fileName) { string extension = Path.GetExtension(fileName); diff --git a/src/Core/Compiler/Validator/CustomTypeNodeValidator.cs b/src/Core/Compiler/Validator/CustomTypeNodeValidator.cs index 7b0682487..4ad76361e 100644 --- a/src/Core/Compiler/Validator/CustomTypeNodeValidator.cs +++ b/src/Core/Compiler/Validator/CustomTypeNodeValidator.cs @@ -18,11 +18,13 @@ internal sealed class CustomTypeNodeValidator : IParseNodeValidator { bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) { CustomTypeNode typeNode = (CustomTypeNode)node; - bool restrictToMethodMembers = false; + bool extensionRestrictions = false; + bool moduleRestrictions = false; + bool recordRestrictions = false; bool hasCodeMembers = false; ParseNode codeMemberNode = null; - AttributeNode importedTypeAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "Imported"); + AttributeNode importedTypeAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "ScriptImport"); if (importedTypeAttribute != null) { // This is an imported type definition... we'll assume its valid, since // the set of restrictions for such types is fewer, and different, so @@ -31,16 +33,6 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro return false; } - AttributeNode scriptNamespaceNode = AttributeNode.FindAttribute(typeNode.Attributes, "ScriptNamespace"); - if (scriptNamespaceNode != null) { - string scriptNamespace = (string)((LiteralNode)scriptNamespaceNode.Arguments[0]).Value; - - if (Utility.IsValidScriptNamespace(scriptNamespace) == false) { - errorHandler.ReportError("A script namespace must be a valid script identifier.", - scriptNamespaceNode.Token.Location); - } - } - if (typeNode.Type == TokenType.Struct) { errorHandler.ReportError("Struct types are not supported. Use classes annotated with the Record metadata attribute.", typeNode.Token.Location); @@ -66,18 +58,7 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro NameNode baseTypeNameNode = typeNode.BaseTypes[0] as NameNode; if (baseTypeNameNode != null) { - if (String.CompareOrdinal(baseTypeNameNode.Name, "Record") == 0) { - if ((typeNode.Modifiers & Modifiers.Sealed) == 0) { - errorHandler.ReportError("Classes derived from the Record base class must be marked as sealed.", - typeNode.Token.Location); - } - - if (typeNode.BaseTypes.Count != 1) { - errorHandler.ReportError("Classes derived from the Record base class cannot implement interfaces.", - typeNode.Token.Location); - } - } - else if (String.CompareOrdinal(baseTypeNameNode.Name, "TestClass") == 0) { + if (String.CompareOrdinal(baseTypeNameNode.Name, "TestClass") == 0) { if ((typeNode.Modifiers & Modifiers.Internal) == 0) { errorHandler.ReportError("Classes derived from TestClass must be marked as internal.", typeNode.Token.Location); @@ -98,22 +79,46 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro } } - AttributeNode globalMethodsAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "GlobalMethods"); - if (globalMethodsAttribute != null) { - restrictToMethodMembers = true; + AttributeNode objectAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "ScriptObject"); + if (objectAttribute != null) { + if ((typeNode.Modifiers & Modifiers.Sealed) == 0) { + errorHandler.ReportError("ScriptObject attribute can only be set on sealed classes.", + typeNode.Token.Location); + } - if ((typeNode.Modifiers & Modifiers.Static) == 0) { - errorHandler.ReportError("GlobalMethods attribute can only be set on static classes.", + if (typeNode.BaseTypes.Count != 0) { + errorHandler.ReportError("Classes marked with ScriptObject must not derive from another class or implement interfaces.", typeNode.Token.Location); } + + recordRestrictions = true; } - AttributeNode mixinAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "Mixin"); - if (mixinAttribute != null) { - restrictToMethodMembers = true; + AttributeNode extensionAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "ScriptExtension"); + if (extensionAttribute != null) { + extensionRestrictions = true; if ((typeNode.Modifiers & Modifiers.Static) == 0) { - errorHandler.ReportError("Mixin attribute can only be set on static classes.", + errorHandler.ReportError("ScriptExtension attribute can only be set on static classes.", + typeNode.Token.Location); + } + + if ((extensionAttribute.Arguments.Count != 1) || + !(extensionAttribute.Arguments[0] is LiteralNode) || + !(((LiteralNode)extensionAttribute.Arguments[0]).Value is string) || + String.IsNullOrEmpty((string)((LiteralNode)extensionAttribute.Arguments[0]).Value)) { + errorHandler.ReportError("ScriptExtension attribute declaration must specify the object being extended.", + typeNode.Token.Location); + } + } + + AttributeNode moduleAttribute = AttributeNode.FindAttribute(typeNode.Attributes, "ScriptModule"); + if (moduleAttribute != null) { + moduleRestrictions = true; + + if (((typeNode.Modifiers & Modifiers.Static) == 0) || + ((typeNode.Modifiers & Modifiers.Internal) == 0)) { + errorHandler.ReportError("ScriptModule attribute can only be set on internal static classes.", typeNode.Token.Location); } } @@ -137,10 +142,21 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro continue; } - if (restrictToMethodMembers && - (memberNode.NodeType != ParseNodeType.MethodDeclaration) && - (memberNode.NodeType != ParseNodeType.ConstructorDeclaration)) { - errorHandler.ReportError("Classes marked with GlobalMethods or Mixin attribute should only have methods.", + if (extensionRestrictions && (memberNode.NodeType != ParseNodeType.MethodDeclaration)) { + errorHandler.ReportError("Classes marked with ScriptExtension attribute should only have methods.", + memberNode.Token.Location); + } + + if (moduleRestrictions && (memberNode.NodeType != ParseNodeType.ConstructorDeclaration)) { + errorHandler.ReportError("Classes marked with ScriptModule attribute should only have a static constructor.", + memberNode.Token.Location); + } + + if (recordRestrictions && + (((memberNode.Modifiers & Modifiers.Static) != 0) || + ((memberNode.NodeType != ParseNodeType.ConstructorDeclaration) && + (memberNode.NodeType != ParseNodeType.FieldDeclaration)))) { + errorHandler.ReportError("Classes marked with ScriptObject attribute should only have a constructor and field members.", memberNode.Token.Location); } @@ -167,8 +183,23 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro memberNames[name] = null; - bool preserveCase = (AttributeNode.FindAttribute(memberNode.Attributes, "PreserveCase") != null); - if (Utility.IsKeyword(name, /* testCamelCase */ (preserveCase == false))) { + string nameToValidate = name; + bool preserveCase = false; + AttributeNode nameAttribute = AttributeNode.FindAttribute(memberNode.Attributes, "ScriptName"); + if ((nameAttribute != null) && (nameAttribute.Arguments.Count != 0)) { + foreach (ParseNode argNode in nameAttribute.Arguments) { + if (argNode.NodeType == ParseNodeType.Literal) { + nameToValidate = (string)((LiteralNode)argNode).Value; + } + else if (argNode.NodeType == ParseNodeType.BinaryExpression) { + if (String.CompareOrdinal(((NameNode)((BinaryExpressionNode)argNode).LeftChild).Name, "PreserveCase") == 0) { + preserveCase = (bool)((LiteralNode)((BinaryExpressionNode)argNode).RightChild).Value; + } + } + } + } + + if (Utility.IsKeyword(nameToValidate, /* testCamelCase */ (preserveCase == false))) { errorHandler.ReportError("Invalid member name. Member names should not use keywords.", memberNode.Token.Location); } @@ -183,11 +214,6 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro } } - if ((typeNode.Type == TokenType.Struct) && hasCodeMembers) { - errorHandler.ReportError("A struct type is limited to field and constructor members.", - codeMemberNode.Token.Location); - } - return true; } } diff --git a/src/Core/Compiler/Validator/MethodDeclarationNodeValidator.cs b/src/Core/Compiler/Validator/MethodDeclarationNodeValidator.cs index 6020b67a8..266d75ef3 100644 --- a/src/Core/Compiler/Validator/MethodDeclarationNodeValidator.cs +++ b/src/Core/Compiler/Validator/MethodDeclarationNodeValidator.cs @@ -22,14 +22,6 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro } if ((methodNode.Modifiers & Modifiers.Extern) != 0) { - AttributeNode altSigAttribute - = AttributeNode.FindAttribute(methodNode.Attributes, "AlternateSignature"); - if (altSigAttribute == null) { - errorHandler.ReportError("Extern methods should only be used to declare alternate signatures and marked with [AlternateSignature].", - methodNode.Token.Location); - return false; - } - CustomTypeNode typeNode = (CustomTypeNode)methodNode.Parent; MethodDeclarationNode implMethodNode = null; diff --git a/src/Core/Compiler/Validator/NamespaceNodeValidator.cs b/src/Core/Compiler/Validator/NamespaceNodeValidator.cs index 8ad4bb978..b3a5983b6 100644 --- a/src/Core/Compiler/Validator/NamespaceNodeValidator.cs +++ b/src/Core/Compiler/Validator/NamespaceNodeValidator.cs @@ -34,7 +34,7 @@ bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErro if (childNode is UserTypeNode) { ParseNodeList attributes = ((UserTypeNode)childNode).Attributes; - if (AttributeNode.FindAttribute(attributes, "Imported") != null) { + if (AttributeNode.FindAttribute(attributes, "ScriptImport") != null) { allowed = true; } } diff --git a/src/Core/CoreLib/Action.cs b/src/Core/CoreLib/Action.cs index 10e69032a..9dc28c674 100644 --- a/src/Core/CoreLib/Action.cs +++ b/src/Core/CoreLib/Action.cs @@ -7,39 +7,39 @@ namespace System { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T arg); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); } diff --git a/src/Core/CoreLib/Arguments.cs b/src/Core/CoreLib/Arguments.cs index 7049210d3..8e3413b9a 100644 --- a/src/Core/CoreLib/Arguments.cs +++ b/src/Core/CoreLib/Arguments.cs @@ -11,8 +11,8 @@ namespace System { /// /// Provides access to the arguments of the current function. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("arguments")] public static class Arguments { @@ -21,7 +21,7 @@ public static class Arguments { /// /// The arguments list. [ScriptAlias("arguments")] - [IntrinsicProperty] + [ScriptField] public static object[] Current { get { return null; @@ -32,7 +32,7 @@ public static object[] Current { /// Retrieves the number of actual arguments passed to the function. /// /// The count of arguments. - [IntrinsicProperty] + [ScriptField] public static int Length { get { return 0; diff --git a/src/Core/CoreLib/Array.cs b/src/Core/CoreLib/Array.cs index 346c4b6c4..2820d5516 100644 --- a/src/Core/CoreLib/Array.cs +++ b/src/Core/CoreLib/Array.cs @@ -4,27 +4,29 @@ // using System.Collections; +using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System { - // NOTE: Keep in sync with ArrayGrouping and ArrayList + // NOTE: Keep in sync with ArrayList and List /// /// Equivalent to the Array type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Array")] public sealed class Array : IEnumerable { - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public object this[int index] { get { return null; @@ -33,10 +35,6 @@ public object this[int index] { } } - public Array Clone() { - return null; - } - public Array Concat(params object[] objects) { return null; } @@ -53,14 +51,6 @@ public bool Every(ArrayItemFilterCallback itemFilterCallback) { return false; } - public Array Extract(int index) { - return null; - } - - public Array Extract(int index, int count) { - return null; - } - public Array Filter(ArrayFilterCallback filterCallback) { return null; } @@ -79,11 +69,11 @@ public IEnumerator GetEnumerator() { return null; } - public ArrayGrouping[] GroupBy(ArrayItemKeyGenerator keyCallback) { + public Array GetRange(int index) { return null; } - public Dictionary Index(ArrayItemKeyGenerator keyCallback) { + public Array GetRange(int index, int count) { return null; } @@ -119,6 +109,7 @@ public Array Map(ArrayItemMapCallback mapItemCallback) { return null; } + [ScriptAlias("ss.array")] public static Array Parse(string s) { return null; } @@ -190,11 +181,20 @@ public void Splice(int start, int deleteCount) { public void Splice(int start, int deleteCount, params object[] itemsToInsert) { } + [ScriptAlias("ss.array")] public static Array ToArray(object o) { return null; } public void Unshift(params object[] items) { } + + public static explicit operator ArrayList(Array array) { + return null; + } + + public static explicit operator List(Array array) { + return null; + } } } diff --git a/src/Core/CoreLib/Boolean.cs b/src/Core/CoreLib/Boolean.cs index 1ee623d22..8883155a5 100644 --- a/src/Core/CoreLib/Boolean.cs +++ b/src/Core/CoreLib/Boolean.cs @@ -10,8 +10,8 @@ namespace System { /// /// Equivalent to the Boolean type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public struct Boolean { /// @@ -19,6 +19,7 @@ public struct Boolean { /// /// The string to be parsed. /// The resulting boolean value. + [ScriptAlias("ss.boolean")] public static bool Parse(string s) { return false; } diff --git a/src/Core/CoreLib/Byte.cs b/src/Core/CoreLib/Byte.cs index d58139790..f163f73b7 100644 --- a/src/Core/CoreLib/Byte.cs +++ b/src/Core/CoreLib/Byte.cs @@ -10,19 +10,11 @@ namespace System { /// /// The byte data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Byte { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - /// /// Converts the value to its string representation. /// diff --git a/src/Core/CoreLib/Callback.cs b/src/Core/CoreLib/Callback.cs index 96c17b502..98a8462c0 100644 --- a/src/Core/CoreLib/Callback.cs +++ b/src/Core/CoreLib/Callback.cs @@ -7,7 +7,7 @@ namespace System { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void Callback(object arg); } diff --git a/src/Core/CoreLib/CancelEventArgs.cs b/src/Core/CoreLib/CancelEventArgs.cs index c8dfdc2e8..61acffcc1 100644 --- a/src/Core/CoreLib/CancelEventArgs.cs +++ b/src/Core/CoreLib/CancelEventArgs.cs @@ -11,14 +11,13 @@ namespace System { /// /// The event argument associated with cancelable events. /// - [ScriptNamespace("ss")] - [Imported] + [ScriptImport] public class CancelEventArgs : EventArgs { /// /// Whether the event has been canceled. /// - [IntrinsicProperty] + [ScriptField] public bool Cancel { get { return false; diff --git a/src/Core/CoreLib/Char.cs b/src/Core/CoreLib/Char.cs index 568f5151d..305a34a2e 100644 --- a/src/Core/CoreLib/Char.cs +++ b/src/Core/CoreLib/Char.cs @@ -10,8 +10,8 @@ namespace System { /// /// The char data type which is mapped to the String type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("String")] public struct Char { diff --git a/src/Core/CoreLib/Collections/ArrayCallback.cs b/src/Core/CoreLib/Collections/ArrayCallback.cs index 66fae5390..430e2b204 100644 --- a/src/Core/CoreLib/Collections/ArrayCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ArrayCallback(object value, int index, Array array); } diff --git a/src/Core/CoreLib/Collections/ArrayFilterCallback.cs b/src/Core/CoreLib/Collections/ArrayFilterCallback.cs index 4bdcd1a4a..36c73fc33 100644 --- a/src/Core/CoreLib/Collections/ArrayFilterCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayFilterCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ArrayFilterCallback(object value, int index, Array array); } diff --git a/src/Core/CoreLib/Collections/ArrayGrouping.cs b/src/Core/CoreLib/Collections/ArrayGrouping.cs deleted file mode 100644 index a458697ef..000000000 --- a/src/Core/CoreLib/Collections/ArrayGrouping.cs +++ /dev/null @@ -1,147 +0,0 @@ -// ArrayGrouping.cs -// Script#/Libraries/CoreLib -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Runtime.CompilerServices; - -namespace System.Collections { - - // NOTE: Keep in sync with Array - - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] - public sealed class ArrayGrouping : IEnumerable { - - private ArrayGrouping() { - } - - [IntrinsicProperty] - public string Key { - get { - return null; - } - } - - [IntrinsicProperty] - public int Length { - get { - return 0; - } - } - - [IntrinsicProperty] - public object this[int index] { - get { - return null; - } - set { - } - } - - public Array Clone() { - return null; - } - - public Array Concat(params object[] objects) { - return null; - } - - public bool Contains(object item) { - return false; - } - - public bool Every(ArrayFilterCallback filterCallback) { - return false; - } - - public bool Every(ArrayItemFilterCallback itemFilterCallback) { - return false; - } - - public Array Extract(int index) { - return null; - } - - public Array Extract(int index, int count) { - return null; - } - - public Array Filter(ArrayFilterCallback filterCallback) { - return null; - } - - public Array Filter(ArrayItemFilterCallback itemFilterCallback) { - return null; - } - - public void ForEach(ArrayCallback callback) { - } - - public void ForEach(ArrayItemCallback itemCallback) { - } - - public IEnumerator GetEnumerator() { - return null; - } - - public ArrayGrouping[] GroupBy(ArrayItemKeyGenerator keyCallback) { - return null; - } - - public Dictionary Index(ArrayItemKeyGenerator keyCallback) { - return null; - } - - public int IndexOf(object item) { - return 0; - } - - public int IndexOf(object item, int startIndex) { - return 0; - } - - public string Join() { - return null; - } - - public string Join(string delimiter) { - return null; - } - - public int LastIndexOf(object item) { - return 0; - } - - public int LastIndexOf(object item, int fromIndex) { - return 0; - } - - public Array Map(ArrayMapCallback mapCallback) { - return null; - } - - public Array Map(ArrayItemMapCallback mapItemCallback) { - return null; - } - - public void Reverse() { - } - - public bool Some(ArrayFilterCallback filterCallback) { - return false; - } - - public bool Some(ArrayItemFilterCallback itemFilterCallback) { - return false; - } - - public void Sort() { - } - - public void Sort(CompareCallback compareCallback) { - } - } -} diff --git a/src/Core/CoreLib/Collections/ArrayItemCallback.cs b/src/Core/CoreLib/Collections/ArrayItemCallback.cs index 0c764e143..bd9370684 100644 --- a/src/Core/CoreLib/Collections/ArrayItemCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayItemCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ArrayItemCallback(object value); } diff --git a/src/Core/CoreLib/Collections/ArrayItemFilterCallback.cs b/src/Core/CoreLib/Collections/ArrayItemFilterCallback.cs index 836d9b5b9..005d276ae 100644 --- a/src/Core/CoreLib/Collections/ArrayItemFilterCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayItemFilterCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ArrayItemFilterCallback(object value); } diff --git a/src/Core/CoreLib/Collections/ArrayItemKeyGenerator.cs b/src/Core/CoreLib/Collections/ArrayItemKeyGenerator.cs deleted file mode 100644 index 3b737c896..000000000 --- a/src/Core/CoreLib/Collections/ArrayItemKeyGenerator.cs +++ /dev/null @@ -1,14 +0,0 @@ -// ArrayItemKeyGenerator.cs -// Script#/Libraries/CoreLib -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Runtime.CompilerServices; - -namespace System.Collections { - - [IgnoreNamespace] - [Imported] - public delegate string ArrayItemKeyGenerator(object value, int index); -} diff --git a/src/Core/CoreLib/Collections/ArrayItemMapCallback.cs b/src/Core/CoreLib/Collections/ArrayItemMapCallback.cs index a388c2cd1..9eaf02e81 100644 --- a/src/Core/CoreLib/Collections/ArrayItemMapCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayItemMapCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ArrayItemMapCallback(object value); } diff --git a/src/Core/CoreLib/Collections/ArrayItemReduceCallback.cs b/src/Core/CoreLib/Collections/ArrayItemReduceCallback.cs index 3685de1f0..b05c2fdcf 100644 --- a/src/Core/CoreLib/Collections/ArrayItemReduceCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayItemReduceCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ArrayItemReduceCallback(object previousValue, object value); } diff --git a/src/Core/CoreLib/Collections/ArrayList.cs b/src/Core/CoreLib/Collections/ArrayList.cs index a2b906762..e5ed40ae5 100644 --- a/src/Core/CoreLib/Collections/ArrayList.cs +++ b/src/Core/CoreLib/Collections/ArrayList.cs @@ -4,17 +4,18 @@ // using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System.Collections { - // NOTE: Keep in sync with ArrayGrouping and Array + // NOTE: Keep in sync with Array and List /// /// Equivalent to the Array type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Array")] public sealed class ArrayList : IEnumerable { @@ -27,7 +28,7 @@ public ArrayList(int capacity) { public ArrayList(params object[] items) { } - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] public int Count { get { @@ -35,7 +36,7 @@ public int Count { } } - [IntrinsicProperty] + [ScriptField] public object this[int index] { get { return null; @@ -44,17 +45,12 @@ public object this[int index] { } } + [ScriptName("push")] public void Add(object item) { } - public void AddRange(object[] items) { - } - - public void AddRange(ArrayList items) { - } - - public ArrayList Clone() { - return null; + [ScriptName("push")] + public void AddRange(params object[] items) { } public void Clear() { @@ -76,14 +72,6 @@ public bool Every(ArrayItemFilterCallback itemFilterCallback) { return false; } - public Array Extract(int index) { - return null; - } - - public Array Extract(int index, int count) { - return null; - } - public Array Filter(ArrayFilterCallback filterCallback) { return null; } @@ -102,11 +90,11 @@ public IEnumerator GetEnumerator() { return null; } - public ArrayGrouping[] GroupBy(ArrayItemKeyGenerator keyCallback) { + public Array GetRange(int index) { return null; } - public Dictionary Index(ArrayItemKeyGenerator keyCallback) { + public Array GetRange(int index, int count) { return null; } @@ -121,7 +109,7 @@ public int IndexOf(object item, int startIndex) { public void Insert(int index, object item) { } - public void InsertRange(int index, object[] items) { + public void InsertRange(int index, params object[] items) { } public string Join() { @@ -184,6 +172,7 @@ public object ReduceRight(ArrayItemReduceCallback callback, object initialValue) return null; } + [ScriptAlias("ss.remove")] public bool Remove(object item) { return false; } @@ -233,7 +222,19 @@ public void Splice(int start, int deleteCount, params object[] itemsToInsert) { public void Unshift(params object[] items) { } - public static explicit operator Array(ArrayList list) { + public static implicit operator Array(ArrayList list) { + return null; + } + + public static implicit operator object[](ArrayList list) { + return null; + } + + public static implicit operator List(ArrayList list) { + return null; + } + + public static explicit operator ArrayList(object[] array) { return null; } } diff --git a/src/Core/CoreLib/Collections/ArrayMapCallback.cs b/src/Core/CoreLib/Collections/ArrayMapCallback.cs index a6c55e06a..88a3eddfc 100644 --- a/src/Core/CoreLib/Collections/ArrayMapCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayMapCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ArrayMapCallback(object value, int index, Array array); } diff --git a/src/Core/CoreLib/Collections/ArrayReduceCallback.cs b/src/Core/CoreLib/Collections/ArrayReduceCallback.cs index b320b009e..22b9ffddd 100644 --- a/src/Core/CoreLib/Collections/ArrayReduceCallback.cs +++ b/src/Core/CoreLib/Collections/ArrayReduceCallback.cs @@ -8,7 +8,7 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ArrayReduceCallback(object previousValue, object value, int index, Array array); } diff --git a/src/Core/CoreLib/Collections/Dictionary.cs b/src/Core/CoreLib/Collections/Dictionary.cs index d14823d47..cdef8d27b 100644 --- a/src/Core/CoreLib/Collections/Dictionary.cs +++ b/src/Core/CoreLib/Collections/Dictionary.cs @@ -11,8 +11,8 @@ namespace System.Collections { /// /// The Dictionary data type which is mapped to the Object type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class Dictionary : IEnumerable { @@ -34,7 +34,7 @@ public string[] Keys { } } - [IntrinsicProperty] + [ScriptField] public object this[string key] { get { return null; @@ -43,9 +43,11 @@ public object this[string key] { } } + [ScriptAlias("ss.clearKeys")] public void Clear() { } + [ScriptAlias("ss.keyExists")] public bool ContainsKey(string key) { return false; } diff --git a/src/Core/CoreLib/Collections/DictionaryEntry.cs b/src/Core/CoreLib/Collections/DictionaryEntry.cs index d9f5c0cb0..25980db41 100644 --- a/src/Core/CoreLib/Collections/DictionaryEntry.cs +++ b/src/Core/CoreLib/Collections/DictionaryEntry.cs @@ -8,21 +8,21 @@ namespace System.Collections { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DictionaryEntry { internal DictionaryEntry() { } - [IntrinsicProperty] + [ScriptField] public string Key { get { return null; } } - [IntrinsicProperty] + [ScriptField] public object Value { get { return null; diff --git a/src/Core/CoreLib/Collections/Generic/CompareCallback.cs b/src/Core/CoreLib/Collections/Generic/CompareCallback.cs index 050193a4b..711ae7143 100644 --- a/src/Core/CoreLib/Collections/Generic/CompareCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/CompareCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate int CompareCallback(T x, T y); } diff --git a/src/Core/CoreLib/Collections/Generic/Dictionary.cs b/src/Core/CoreLib/Collections/Generic/Dictionary.cs index fd177f233..ec2458cdd 100644 --- a/src/Core/CoreLib/Collections/Generic/Dictionary.cs +++ b/src/Core/CoreLib/Collections/Generic/Dictionary.cs @@ -10,8 +10,8 @@ namespace System.Collections.Generic { /// /// The Dictionary data type which is mapped to the Object type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class Dictionary : IEnumerable> { @@ -37,7 +37,7 @@ public IReadonlyCollection Keys { } } - [IntrinsicProperty] + [ScriptField] public TValue this[TKey key] { get { return default(TValue); @@ -50,9 +50,11 @@ public TValue this[TKey key] { public void Add(TKey key, TValue value) { } + [ScriptAlias("ss.clearKeys")] public void Clear() { } + [ScriptAlias("ss.keyExists")] public bool ContainsKey(TKey key) { return false; } diff --git a/src/Core/CoreLib/Collections/Generic/ICollection.cs b/src/Core/CoreLib/Collections/Generic/ICollection.cs index c5d8fe3fa..669a41543 100644 --- a/src/Core/CoreLib/Collections/Generic/ICollection.cs +++ b/src/Core/CoreLib/Collections/Generic/ICollection.cs @@ -7,18 +7,17 @@ namespace System.Collections.Generic { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ICollection")] public interface ICollection : IEnumerable { - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] int Count { get; } - [IntrinsicProperty] + [ScriptField] T this[int index] { get; set; diff --git a/src/Core/CoreLib/Collections/Generic/IEnumerable.cs b/src/Core/CoreLib/Collections/Generic/IEnumerable.cs index 0204fe624..9099a169f 100644 --- a/src/Core/CoreLib/Collections/Generic/IEnumerable.cs +++ b/src/Core/CoreLib/Collections/Generic/IEnumerable.cs @@ -7,8 +7,7 @@ namespace System.Collections.Generic { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("IEnumerable")] public interface IEnumerable { diff --git a/src/Core/CoreLib/Collections/Generic/IEnumerator.cs b/src/Core/CoreLib/Collections/Generic/IEnumerator.cs index c5fe31031..e8a6af20e 100644 --- a/src/Core/CoreLib/Collections/Generic/IEnumerator.cs +++ b/src/Core/CoreLib/Collections/Generic/IEnumerator.cs @@ -7,12 +7,11 @@ namespace System.Collections.Generic { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("IEnumerator")] public interface IEnumerator { - [IntrinsicProperty] + [ScriptField] T Current { get; } diff --git a/src/Core/CoreLib/Collections/Generic/IReadonlyCollection.cs b/src/Core/CoreLib/Collections/Generic/IReadonlyCollection.cs index f32938f80..b4b743f5d 100644 --- a/src/Core/CoreLib/Collections/Generic/IReadonlyCollection.cs +++ b/src/Core/CoreLib/Collections/Generic/IReadonlyCollection.cs @@ -7,18 +7,17 @@ namespace System.Collections.Generic { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ICollection")] public interface IReadonlyCollection : IEnumerable { - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] int Count { get; } - [IntrinsicProperty] + [ScriptField] T this[int index] { get; } diff --git a/src/Core/CoreLib/Collections/Generic/KeyValuePair.cs b/src/Core/CoreLib/Collections/Generic/KeyValuePair.cs index fa9b564f1..194327d48 100644 --- a/src/Core/CoreLib/Collections/Generic/KeyValuePair.cs +++ b/src/Core/CoreLib/Collections/Generic/KeyValuePair.cs @@ -7,22 +7,22 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KeyValuePair { internal KeyValuePair() { } - [IntrinsicProperty] + [ScriptField] public TKey Key { get { return default(TKey); } } - [IntrinsicProperty] + [ScriptField] public TValue Value { get { return default(TValue); diff --git a/src/Core/CoreLib/Collections/Generic/List.cs b/src/Core/CoreLib/Collections/Generic/List.cs index b27784457..0cdf95a1f 100644 --- a/src/Core/CoreLib/Collections/Generic/List.cs +++ b/src/Core/CoreLib/Collections/Generic/List.cs @@ -7,11 +7,13 @@ namespace System.Collections.Generic { + // NOTE: Keep in sync with ArrayList and Array + /// /// Equivalent to the Array type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Array")] public sealed class List : ICollection { @@ -24,7 +26,7 @@ public List(int capacity) { public List(params T[] items) { } - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] public int Count { get { @@ -32,7 +34,7 @@ public int Count { } } - [IntrinsicProperty] + [ScriptField] public T this[int index] { get { return default(T); @@ -41,17 +43,12 @@ public T this[int index] { } } + [ScriptName("push")] public void Add(T item) { } - public void AddRange(T[] items) { - } - - public void AddRange(List items) { - } - - public List Clone() { - return null; + [ScriptName("push")] + public void AddRange(params T[] items) { } public void Clear() { @@ -73,14 +70,6 @@ public bool Every(ListItemFilterCallback itemFilterCallback) { return false; } - public List Extract(int index) { - return null; - } - - public List Extract(int index, int count) { - return null; - } - public List Filter(ListFilterCallback filterCallback) { return null; } @@ -99,17 +88,13 @@ public IEnumerator GetEnumerator() { return null; } - public ListGrouping[] GroupBy(ListItemKeyGenerator keyCallback) { + public List GetRange(int index) { return null; } - /* - // HACK: This should be T instead of object, but we have a problem - // handling partial generic types in the compiler. - public Dictionary Index(ListItemKeyGenerator keyCallback) { + public List GetRange(int index, int count) { return null; } - */ public int IndexOf(T item) { return 0; @@ -122,7 +107,7 @@ public int IndexOf(T item, int startIndex) { public void Insert(int index, T item) { } - public void InsertRange(int index, T[] items) { + public void InsertRange(int index, params T[] items) { } public string Join() { @@ -185,6 +170,7 @@ public TReduced ReduceRight(ListItemReduceCallback callba return default(TReduced); } + [ScriptAlias("ss.remove")] public bool Remove(T item) { return false; } @@ -233,5 +219,21 @@ public void Unshift(params T[] items) { public static explicit operator Array(List list) { return null; } + + public static explicit operator object[](List list) { + return null; + } + + public static implicit operator T[](List list) { + return null; + } + + public static explicit operator ArrayList(List list) { + return null; + } + + public static explicit operator List(T[] array) { + return null; + } } } diff --git a/src/Core/CoreLib/Collections/Generic/ListCallback.cs b/src/Core/CoreLib/Collections/Generic/ListCallback.cs index 6025a0f84..17dfaabf2 100644 --- a/src/Core/CoreLib/Collections/Generic/ListCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ListCallback(T value, int index, IReadonlyCollection list); } diff --git a/src/Core/CoreLib/Collections/Generic/ListFilterCallback.cs b/src/Core/CoreLib/Collections/Generic/ListFilterCallback.cs index 84381bf45..5a94378d8 100644 --- a/src/Core/CoreLib/Collections/Generic/ListFilterCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListFilterCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ListFilterCallback(T value, int index, IReadonlyCollection list); } diff --git a/src/Core/CoreLib/Collections/Generic/ListGrouping.cs b/src/Core/CoreLib/Collections/Generic/ListGrouping.cs deleted file mode 100644 index 543ab994e..000000000 --- a/src/Core/CoreLib/Collections/Generic/ListGrouping.cs +++ /dev/null @@ -1,133 +0,0 @@ -// ListGrouping.cs -// Script#/Libraries/CoreLib -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System.Runtime.CompilerServices; - -namespace System.Collections.Generic { - - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] - public sealed class ListGrouping : IReadonlyCollection { - - private ListGrouping() { - } - - [IntrinsicProperty] - public string Key { - get { - return null; - } - } - - [IntrinsicProperty] - [ScriptName("length")] - public int Count { - get { - return 0; - } - } - - [IntrinsicProperty] - public T this[int index] { - get { - return default(T); - } - } - - public bool Contains(T item) { - return false; - } - - public bool Every(ListFilterCallback filterCallback) { - return false; - } - - public bool Every(ListItemFilterCallback itemFilterCallback) { - return false; - } - - public List Extract(int index) { - return null; - } - - public List Extract(int index, int count) { - return null; - } - - public List Filter(ListFilterCallback filterCallback) { - return null; - } - - public List Filter(ListItemFilterCallback itemFilterCallback) { - return null; - } - - public void ForEach(ListCallback callback) { - } - - public void ForEach(ListItemCallback itemCallback) { - } - - public IEnumerator GetEnumerator() { - return null; - } - - public ListGrouping[] GroupBy(ListItemKeyGenerator keyCallback) { - return null; - } - - /* - // HACK: This should be T instead of object, but we have a problem - // handling partial generic types in the compiler. - public Dictionary Index(ListItemKeyGenerator keyCallback) { - return null; - } - */ - - public int IndexOf(T item) { - return 0; - } - - public int IndexOf(T item, int startIndex) { - return 0; - } - - public string Join() { - return null; - } - - public string Join(string delimiter) { - return null; - } - - public int LastIndexOf(object item) { - return 0; - } - - public int LastIndexOf(object item, int fromIndex) { - return 0; - } - - public List Map(ListMapCallback mapCallback) { - return null; - } - - public List Map(ListItemMapCallback mapItemCallback) { - return null; - } - - public void Reverse() { - } - - public bool Some(ListFilterCallback filterCallback) { - return false; - } - - public bool Some(ListItemFilterCallback itemFilterCallback) { - return false; - } - } -} diff --git a/src/Core/CoreLib/Collections/Generic/ListItemCallback.cs b/src/Core/CoreLib/Collections/Generic/ListItemCallback.cs index fc13e08f0..024e02ad1 100644 --- a/src/Core/CoreLib/Collections/Generic/ListItemCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListItemCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ListItemCallback(T value); } diff --git a/src/Core/CoreLib/Collections/Generic/ListItemFilterCallback.cs b/src/Core/CoreLib/Collections/Generic/ListItemFilterCallback.cs index bb28466d6..8d732ef72 100644 --- a/src/Core/CoreLib/Collections/Generic/ListItemFilterCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListItemFilterCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ListItemFilterCallback(T value); } diff --git a/src/Core/CoreLib/Collections/Generic/ListItemKeyGenerator.cs b/src/Core/CoreLib/Collections/Generic/ListItemKeyGenerator.cs deleted file mode 100644 index 08cc715c4..000000000 --- a/src/Core/CoreLib/Collections/Generic/ListItemKeyGenerator.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ListItemKeyGenerator.cs -// Script#/Libraries/CoreLib -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System.Runtime.CompilerServices; - -namespace System.Collections.Generic { - - [IgnoreNamespace] - [Imported] - public delegate string ListItemKeyGenerator(T value, int index); -} diff --git a/src/Core/CoreLib/Collections/Generic/ListItemMapCallback.cs b/src/Core/CoreLib/Collections/Generic/ListItemMapCallback.cs index a5403956e..81f3c9c78 100644 --- a/src/Core/CoreLib/Collections/Generic/ListItemMapCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListItemMapCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TTarget ListItemMapCallback(TSource value); } diff --git a/src/Core/CoreLib/Collections/Generic/ListItemReduceCallback.cs b/src/Core/CoreLib/Collections/Generic/ListItemReduceCallback.cs index b4c398ee2..61f8a401c 100644 --- a/src/Core/CoreLib/Collections/Generic/ListItemReduceCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListItemReduceCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TReduced ListItemReduceCallback(TReduced previousValue, TValue value); } diff --git a/src/Core/CoreLib/Collections/Generic/ListMapCallback.cs b/src/Core/CoreLib/Collections/Generic/ListMapCallback.cs index ce3f4b557..b41a11fe0 100644 --- a/src/Core/CoreLib/Collections/Generic/ListMapCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListMapCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TTarget ListMapCallback(TSource value, int index, IReadonlyCollection list); } diff --git a/src/Core/CoreLib/Collections/Generic/ListReduceCallback.cs b/src/Core/CoreLib/Collections/Generic/ListReduceCallback.cs index 0179c0797..d58cedc6c 100644 --- a/src/Core/CoreLib/Collections/Generic/ListReduceCallback.cs +++ b/src/Core/CoreLib/Collections/Generic/ListReduceCallback.cs @@ -7,7 +7,7 @@ namespace System.Collections.Generic { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TReduced ListReduceCallback(TReduced previousValue, TValue value, int index, List list); } diff --git a/src/Core/CoreLib/Collections/Generic/ObservableCollection.cs b/src/Core/CoreLib/Collections/Generic/ObservableCollection.cs index 94d22451e..01500f0ff 100644 --- a/src/Core/CoreLib/Collections/Generic/ObservableCollection.cs +++ b/src/Core/CoreLib/Collections/Generic/ObservableCollection.cs @@ -8,8 +8,7 @@ namespace System.Collections.Generic { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ObservableCollection")] public sealed class ObservableCollection : IEnumerable { diff --git a/src/Core/CoreLib/Collections/Generic/Queue.cs b/src/Core/CoreLib/Collections/Generic/Queue.cs index a95151422..c864cf14b 100644 --- a/src/Core/CoreLib/Collections/Generic/Queue.cs +++ b/src/Core/CoreLib/Collections/Generic/Queue.cs @@ -7,16 +7,11 @@ namespace System.Collections.Generic { - /// - /// The Queue data type which is mapped to the Array type in Javascript. - /// - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] + [ScriptImport] + [ScriptName("Queue")] public sealed class Queue { - [IntrinsicProperty] - [ScriptName("length")] + [ScriptField] public int Count { get { return 0; diff --git a/src/Core/CoreLib/Collections/Generic/Stack.cs b/src/Core/CoreLib/Collections/Generic/Stack.cs index 4da84b79e..a2affe659 100644 --- a/src/Core/CoreLib/Collections/Generic/Stack.cs +++ b/src/Core/CoreLib/Collections/Generic/Stack.cs @@ -7,16 +7,11 @@ namespace System.Collections.Generic { - /// - /// The Stack data type which is mapped to the Array type in Javascript. - /// - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] + [ScriptImport] + [ScriptName("Stack")] public sealed class Stack { - [IntrinsicProperty] - [ScriptName("length")] + [ScriptField] public int Count { get { return 0; diff --git a/src/Core/CoreLib/Collections/ICollection.cs b/src/Core/CoreLib/Collections/ICollection.cs index 9e386bae7..367ad4d88 100644 --- a/src/Core/CoreLib/Collections/ICollection.cs +++ b/src/Core/CoreLib/Collections/ICollection.cs @@ -7,18 +7,17 @@ namespace System.Collections { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ICollection")] public interface ICollection : IEnumerable { - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] int Count { get; } - [IntrinsicProperty] + [ScriptField] object this[int index] { get; set; diff --git a/src/Core/CoreLib/Collections/IEnumerable.cs b/src/Core/CoreLib/Collections/IEnumerable.cs index 2a33d13c4..5452a49ef 100644 --- a/src/Core/CoreLib/Collections/IEnumerable.cs +++ b/src/Core/CoreLib/Collections/IEnumerable.cs @@ -7,8 +7,7 @@ namespace System.Collections { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IEnumerable { IEnumerator GetEnumerator(); diff --git a/src/Core/CoreLib/Collections/IEnumerator.cs b/src/Core/CoreLib/Collections/IEnumerator.cs index 4127b595b..0bc656b0c 100644 --- a/src/Core/CoreLib/Collections/IEnumerator.cs +++ b/src/Core/CoreLib/Collections/IEnumerator.cs @@ -7,11 +7,10 @@ namespace System.Collections { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IEnumerator { - [IntrinsicProperty] + [ScriptField] object Current { get; } diff --git a/src/Core/CoreLib/Collections/IReadonlyCollection.cs b/src/Core/CoreLib/Collections/IReadonlyCollection.cs index 07901b436..c7e2b0889 100644 --- a/src/Core/CoreLib/Collections/IReadonlyCollection.cs +++ b/src/Core/CoreLib/Collections/IReadonlyCollection.cs @@ -7,18 +7,17 @@ namespace System.Collections { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ICollection")] public interface IReadonlyCollection : IEnumerable { - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] int Count { get; } - [IntrinsicProperty] + [ScriptField] object this[int index] { get; } diff --git a/src/Core/CoreLib/Collections/ObservableCollection.cs b/src/Core/CoreLib/Collections/ObservableCollection.cs index f2ae87ba9..662350681 100644 --- a/src/Core/CoreLib/Collections/ObservableCollection.cs +++ b/src/Core/CoreLib/Collections/ObservableCollection.cs @@ -8,8 +8,7 @@ namespace System.Collections { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("ObservableCollection")] public sealed class ObservableCollection : IEnumerable { diff --git a/src/Core/CoreLib/Collections/Queue.cs b/src/Core/CoreLib/Collections/Queue.cs index 9b7772218..1d8a89aff 100644 --- a/src/Core/CoreLib/Collections/Queue.cs +++ b/src/Core/CoreLib/Collections/Queue.cs @@ -8,16 +8,10 @@ namespace System.Collections { - /// - /// The Queue data type which is mapped to the Array type in Javascript. - /// - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] + [ScriptImport] public sealed class Queue { - [IntrinsicProperty] - [ScriptName("length")] + [ScriptField] public int Count { get { return 0; diff --git a/src/Core/CoreLib/Collections/Stack.cs b/src/Core/CoreLib/Collections/Stack.cs index 53515bf54..0cc0d320b 100644 --- a/src/Core/CoreLib/Collections/Stack.cs +++ b/src/Core/CoreLib/Collections/Stack.cs @@ -8,16 +8,10 @@ namespace System.Collections { - /// - /// The Stack data type which is mapped to the Array type in Javascript. - /// - [IgnoreNamespace] - [Imported] - [ScriptName("Array")] + [ScriptImport] public sealed class Stack { - [IntrinsicProperty] - [ScriptName("length")] + [ScriptField] public int Count { get { return 0; diff --git a/src/Core/CoreLib/CompareCallback.cs b/src/Core/CoreLib/CompareCallback.cs index 11aa154a0..7484d0fa8 100644 --- a/src/Core/CoreLib/CompareCallback.cs +++ b/src/Core/CoreLib/CompareCallback.cs @@ -7,7 +7,7 @@ namespace System { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate int CompareCallback(object x, object y); } diff --git a/src/Core/CoreLib/ComponentModel/DependencyAttribute.cs b/src/Core/CoreLib/ComponentModel/DependencyAttribute.cs index 60048593e..f2188893b 100644 --- a/src/Core/CoreLib/ComponentModel/DependencyAttribute.cs +++ b/src/Core/CoreLib/ComponentModel/DependencyAttribute.cs @@ -13,8 +13,8 @@ namespace System.ComponentModel { /// When placed on a property or parameter this can be used to mark a dependency /// and whether it is optional or not. /// - [Imported] - [NonScriptable] + [ScriptImport] + [ScriptIgnore] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] public sealed class DependencyAttribute : Attribute { diff --git a/src/Core/CoreLib/ComponentModel/IApplication.cs b/src/Core/CoreLib/ComponentModel/IApplication.cs index 02c4a0e3b..e35416a02 100644 --- a/src/Core/CoreLib/ComponentModel/IApplication.cs +++ b/src/Core/CoreLib/ComponentModel/IApplication.cs @@ -11,8 +11,7 @@ namespace System.ComponentModel { /// /// Defines contextual information about the current application. /// - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IApplication { /// diff --git a/src/Core/CoreLib/ComponentModel/IContainer.cs b/src/Core/CoreLib/ComponentModel/IContainer.cs index ad1fc4b5a..908ecd14e 100644 --- a/src/Core/CoreLib/ComponentModel/IContainer.cs +++ b/src/Core/CoreLib/ComponentModel/IContainer.cs @@ -12,8 +12,7 @@ namespace System.ComponentModel { /// Encapsulates the functionality of a container that defines a scope of /// composition where objects can be registered and dependencies can be resolved. /// - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IContainer { /// diff --git a/src/Core/CoreLib/ComponentModel/IEventManager.cs b/src/Core/CoreLib/ComponentModel/IEventManager.cs index e1b595fa1..6a8668cd3 100644 --- a/src/Core/CoreLib/ComponentModel/IEventManager.cs +++ b/src/Core/CoreLib/ComponentModel/IEventManager.cs @@ -12,8 +12,7 @@ namespace System.ComponentModel { /// Provides a simple pub/sub mechanism to allow objects to broadcast and /// listen to messages or events without being coupled to each other. /// - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IEventManager { /// diff --git a/src/Core/CoreLib/ComponentModel/IInitializable.cs b/src/Core/CoreLib/ComponentModel/IInitializable.cs index a8a948470..698545481 100644 --- a/src/Core/CoreLib/ComponentModel/IInitializable.cs +++ b/src/Core/CoreLib/ComponentModel/IInitializable.cs @@ -13,8 +13,7 @@ namespace System.ComponentModel { /// Implemented by objects that supports a simple, transacted notification for batch /// initialization. /// - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IInitializable { /// diff --git a/src/Core/CoreLib/ComponentModel/IObserver.cs b/src/Core/CoreLib/ComponentModel/IObserver.cs index 57e8ad57a..f7ab0755b 100644 --- a/src/Core/CoreLib/ComponentModel/IObserver.cs +++ b/src/Core/CoreLib/ComponentModel/IObserver.cs @@ -8,8 +8,7 @@ namespace System.ComponentModel { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("IObserver")] public interface IObserver { diff --git a/src/Core/CoreLib/ComponentModel/Observable.cs b/src/Core/CoreLib/ComponentModel/Observable.cs index 53765677c..d821bf001 100644 --- a/src/Core/CoreLib/ComponentModel/Observable.cs +++ b/src/Core/CoreLib/ComponentModel/Observable.cs @@ -8,8 +8,7 @@ namespace System.ComponentModel { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("Observable")] public sealed class Observable { diff --git a/src/Core/CoreLib/ComponentModel/ObserverManager.cs b/src/Core/CoreLib/ComponentModel/ObserverManager.cs index 473235a55..290a8b65e 100644 --- a/src/Core/CoreLib/ComponentModel/ObserverManager.cs +++ b/src/Core/CoreLib/ComponentModel/ObserverManager.cs @@ -8,8 +8,7 @@ namespace System.ComponentModel { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("Observable")] public static class ObserverManager { diff --git a/src/Core/CoreLib/CoreLib.csproj b/src/Core/CoreLib/CoreLib.csproj index f8dd6d256..bb70b9313 100644 --- a/src/Core/CoreLib/CoreLib.csproj +++ b/src/Core/CoreLib/CoreLib.csproj @@ -50,7 +50,6 @@ - @@ -60,7 +59,6 @@ - @@ -78,6 +76,7 @@ + @@ -101,10 +100,8 @@ - - @@ -117,7 +114,6 @@ - @@ -140,7 +136,7 @@ - + diff --git a/src/Core/CoreLib/Date.cs b/src/Core/CoreLib/Date.cs index 468e0c6f2..f4e5b6cef 100644 --- a/src/Core/CoreLib/Date.cs +++ b/src/Core/CoreLib/Date.cs @@ -10,15 +10,10 @@ namespace System { /// /// Equivalent to the Date type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Date { - /// - /// Represents a null date. - /// - public static readonly Date Empty; - /// /// Creates a new instance of Date initialized from the current time. /// @@ -97,6 +92,8 @@ public Date(int year, int month, int date, int hours, int minutes, int seconds, /// /// Returns the current date and time. /// + [ScriptField] + [ScriptAlias("ss.now()")] public static Date Now { get { return null; @@ -106,16 +103,14 @@ public static Date Now { /// /// Returns the current date with the time part set to 00:00:00. /// + [ScriptField] + [ScriptAlias("ss.today()")] public static Date Today { get { return null; } } - public string Format(string format) { - return null; - } - public int GetDate() { return 0; } @@ -188,15 +183,7 @@ public int GetUTCSeconds() { return 0; } - public static bool IsEmpty(Date d) { - return false; - } - - public string LocaleFormat(string format) { - return null; - } - - [ScriptName("parseDate")] + [ScriptAlias("ss.date")] public static Date Parse(string value) { return null; } @@ -279,27 +266,27 @@ public string ToUTCString() { return null; } - [PreserveCase] + [ScriptName(PreserveCase = true)] public static int UTC(int year, int month, int day) { return 0; } - [PreserveCase] + [ScriptName(PreserveCase = true)] public static int UTC(int year, int month, int day, int hours) { return 0; } - [PreserveCase] + [ScriptName(PreserveCase = true)] public static int UTC(int year, int month, int day, int hours, int minutes) { return 0; } - [PreserveCase] + [ScriptName(PreserveCase = true)] public static int UTC(int year, int month, int day, int hours, int minutes, int seconds) { return 0; } - [PreserveCase] + [ScriptName(PreserveCase = true)] public static int UTC(int year, int month, int day, int hours, int minutes, int seconds, int milliseconds) { return 0; } diff --git a/src/Core/CoreLib/Decimal.cs b/src/Core/CoreLib/Decimal.cs index 17b6ffd70..69f698667 100644 --- a/src/Core/CoreLib/Decimal.cs +++ b/src/Core/CoreLib/Decimal.cs @@ -12,8 +12,8 @@ namespace System { /// /// The decimal data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Decimal { diff --git a/src/Core/CoreLib/Delegate.cs b/src/Core/CoreLib/Delegate.cs index eef11f582..44c6b0541 100644 --- a/src/Core/CoreLib/Delegate.cs +++ b/src/Core/CoreLib/Delegate.cs @@ -7,44 +7,46 @@ namespace System { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public abstract class Delegate { - public static readonly Delegate Empty = null; - protected Delegate(object target, string method) { } protected Delegate(Type target, string method) { } - public static void ClearExport(string name) { - } - + [ScriptAlias("ss.bindAdd")] public static Delegate Combine(Delegate a, Delegate b) { return null; } - public static Delegate Create(object instance, Function f) { + [ScriptAlias("ss.bind")] + public static Delegate Create(Function f, object instance) { return null; } - public static string CreateExport(Delegate d) { + [ScriptAlias("ss.bindExport")] + public static Export Export(Delegate d) { return null; } - public static string CreateExport(Delegate d, bool multiUse) { + [ScriptAlias("ss.bindExport")] + public static Export Export(Delegate d, bool multiUse) { return null; } - public static string CreateExport(Delegate d, bool multiUse, string name) { + [ScriptAlias("ss.bindExport")] + public static Export Export(Delegate d, bool multiUse, string name) { return null; } - public static void DeleteExport(string name) { + [ScriptAlias("ss.bindExport")] + public static Export Export(Delegate d, bool multiUse, string name, object root) { + return null; } + [ScriptAlias("ss.bindSub")] public static Delegate Remove(Delegate source, Delegate value) { return null; } diff --git a/src/Core/CoreLib/Diagnostics/ConditionalAttribute.cs b/src/Core/CoreLib/Diagnostics/ConditionalAttribute.cs index 7abdf8d86..2a1cd7ae2 100644 --- a/src/Core/CoreLib/Diagnostics/ConditionalAttribute.cs +++ b/src/Core/CoreLib/Diagnostics/ConditionalAttribute.cs @@ -10,8 +10,8 @@ namespace System.Diagnostics { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - [NonScriptable] - [Imported] + [ScriptIgnore] + [ScriptImport] public sealed class ConditionalAttribute : Attribute { private string _conditionString; diff --git a/src/Core/CoreLib/Diagnostics/Debug.cs b/src/Core/CoreLib/Diagnostics/Debug.cs index 55e2bcc8a..f98c92c66 100644 --- a/src/Core/CoreLib/Diagnostics/Debug.cs +++ b/src/Core/CoreLib/Diagnostics/Debug.cs @@ -8,8 +8,8 @@ namespace System.Diagnostics { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("console")] public static class Debug { @@ -22,6 +22,7 @@ public static void Assert(bool condition, string message) { } [Conditional("DEBUG")] + [ScriptAlias("ss.fail")] public static void Fail(string message) { } diff --git a/src/Core/CoreLib/Diagnostics/SuppressMessageAttribute.cs b/src/Core/CoreLib/Diagnostics/SuppressMessageAttribute.cs index b9af5c7cc..753e4440b 100644 --- a/src/Core/CoreLib/Diagnostics/SuppressMessageAttribute.cs +++ b/src/Core/CoreLib/Diagnostics/SuppressMessageAttribute.cs @@ -10,8 +10,8 @@ namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] - [NonScriptable] - [Imported] + [ScriptIgnore] + [ScriptImport] public sealed class SuppressMessageAttribute : Attribute { private string _category; diff --git a/src/Core/CoreLib/Diagnostics/SyntaxValidationAttribute.cs b/src/Core/CoreLib/Diagnostics/SyntaxValidationAttribute.cs index 21ac87257..5157e0174 100644 --- a/src/Core/CoreLib/Diagnostics/SyntaxValidationAttribute.cs +++ b/src/Core/CoreLib/Diagnostics/SyntaxValidationAttribute.cs @@ -10,8 +10,8 @@ namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = true)] - [NonScriptable] - [Imported] + [ScriptIgnore] + [ScriptImport] public sealed class SyntaxValidationAttribute : Attribute { private string _syntax; diff --git a/src/Core/CoreLib/Double.cs b/src/Core/CoreLib/Double.cs index 3e98b170a..3f6a44058 100644 --- a/src/Core/CoreLib/Double.cs +++ b/src/Core/CoreLib/Double.cs @@ -10,18 +10,25 @@ namespace System { /// /// The double data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Double { - public string Format(string format) { - return null; - } + [ScriptName("MAX_VALUE")] + public const double MaxValue = 0; - public string LocaleFormat(string format) { - return null; - } + [ScriptName("MIN_VALUE")] + public const double MinValue = 0; + + [ScriptName(PreserveCase = true)] + public const double NaN = 0; + + [ScriptName("NEGATIVE_INFINITY")] + public const double NegativeInfinity = 0; + + [ScriptName("POSITIVE_INFINITY")] + public const double PositiveInfinity = 0; [ScriptAlias("parseFloat")] public static double Parse(string s) { diff --git a/src/Core/CoreLib/Enum.cs b/src/Core/CoreLib/Enum.cs index 5f31be2e2..cd8db34e1 100644 --- a/src/Core/CoreLib/Enum.cs +++ b/src/Core/CoreLib/Enum.cs @@ -7,8 +7,7 @@ namespace System { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public abstract class Enum : ValueType { } } diff --git a/src/Core/CoreLib/EventArgs.cs b/src/Core/CoreLib/EventArgs.cs index c0830b6d4..cf9a98d47 100644 --- a/src/Core/CoreLib/EventArgs.cs +++ b/src/Core/CoreLib/EventArgs.cs @@ -10,15 +10,14 @@ namespace System { /// /// Used by event sources to pass event argument information. /// - [ScriptNamespace("ss")] - [Imported] + [ScriptImport] public class EventArgs { /// /// A static object of type that is used as a convenient way to /// specify an empty EventArgs instance. /// - [PreserveCase] + [ScriptName(PreserveCase = true)] public static readonly EventArgs Empty = null; } } diff --git a/src/Core/CoreLib/EventHandler.cs b/src/Core/CoreLib/EventHandler.cs index bbc6e4bce..46c068847 100644 --- a/src/Core/CoreLib/EventHandler.cs +++ b/src/Core/CoreLib/EventHandler.cs @@ -12,11 +12,11 @@ namespace System { /// /// The object that raised the event. /// The object that contains the event data. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void EventHandler(object sender, EventArgs e); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void EventHandler(object sender, TArgument e) where TArgument : EventArgs; } diff --git a/src/Core/CoreLib/Exception.cs b/src/Core/CoreLib/Exception.cs index d656bab17..9718d2baf 100644 --- a/src/Core/CoreLib/Exception.cs +++ b/src/Core/CoreLib/Exception.cs @@ -11,29 +11,29 @@ namespace System { /// /// Equivalent to the Error type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Error")] public sealed class Exception { public Exception(string message) { } - [IntrinsicProperty] + [ScriptField] public Exception InnerException { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Message { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("stack")] public string StackTrace { get { @@ -41,19 +41,19 @@ public string StackTrace { } } - [IntrinsicProperty] + [ScriptField] public object this[string key] { get { return null; } } - [ScriptAlias("Error.createError")] + [ScriptAlias("ss.error")] public static Exception Create(string message, Dictionary errorInfo) { return null; } - [ScriptAlias("Error.createError")] + [ScriptAlias("ss.error")] public static Exception Create(string message, Dictionary errorInfo, Exception innerException) { return null; } diff --git a/src/Core/CoreLib/Export.cs b/src/Core/CoreLib/Export.cs new file mode 100644 index 000000000..f49892f23 --- /dev/null +++ b/src/Core/CoreLib/Export.cs @@ -0,0 +1,30 @@ +// Export.cs +// Script#/Libraries/CoreLib +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Export : IDisposable { + + private Export() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + + public void Detach() { + } + + public void Dispose() { + } + } +} diff --git a/src/Core/CoreLib/Func.cs b/src/Core/CoreLib/Func.cs index 6aac90d78..b1193ec9e 100644 --- a/src/Core/CoreLib/Func.cs +++ b/src/Core/CoreLib/Func.cs @@ -7,39 +7,39 @@ namespace System { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T arg); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); } diff --git a/src/Core/CoreLib/Function.cs b/src/Core/CoreLib/Function.cs index 337560146..9149983aa 100644 --- a/src/Core/CoreLib/Function.cs +++ b/src/Core/CoreLib/Function.cs @@ -10,8 +10,8 @@ namespace System { /// /// Equivalent to the Function type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Function { /// @@ -33,7 +33,7 @@ public Function(string functionBody, params string[] argNames) { /// /// Gets the number of parameters expected by the function. /// - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; diff --git a/src/Core/CoreLib/Globalization/CultureInfo.cs b/src/Core/CoreLib/Globalization/CultureInfo.cs index 904f06c82..b481be1c2 100644 --- a/src/Core/CoreLib/Globalization/CultureInfo.cs +++ b/src/Core/CoreLib/Globalization/CultureInfo.cs @@ -3,48 +3,51 @@ // This source code is subject to terms and conditions of the Apache License, Version 2.0. // +using System; using System.Runtime.CompilerServices; namespace System.Globalization { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] + [ScriptName("culture")] public sealed class CultureInfo { private CultureInfo() { } - [PreserveCase] - [IntrinsicProperty] + [ScriptField] + [ScriptName("current")] public static CultureInfo CurrentCulture { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("dtf")] public DateFormatInfo DateFormat { get { return null; } } - [PreserveCase] - [IntrinsicProperty] + [ScriptField] + [ScriptName("neutral")] public static CultureInfo InvariantCulture { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("nf")] public NumberFormatInfo NumberFormat { get { return null; diff --git a/src/Core/CoreLib/Globalization/DateFormatInfo.cs b/src/Core/CoreLib/Globalization/DateFormatInfo.cs index be191f07d..5cef3704f 100644 --- a/src/Core/CoreLib/Globalization/DateFormatInfo.cs +++ b/src/Core/CoreLib/Globalization/DateFormatInfo.cs @@ -3,137 +3,156 @@ // This source code is subject to terms and conditions of the Apache License, Version 2.0. // +using System; using System.Runtime.CompilerServices; namespace System.Globalization { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DateFormatInfo { private DateFormatInfo() { } - [IntrinsicProperty] + [ScriptField] + [ScriptName("am")] public string AMDesignator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("pm")] public string PMDesignator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("ds")] public string DateSeparator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("ts")] public string TimeSeparator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("gmt")] public string GMTDateTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("uni")] public string UniversalDateTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("sort")] public string SortableDateTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("dt")] public string DateTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("ld")] public string LongDatePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("sd")] public string ShortDatePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("lt")] public string LongTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("st")] public string ShortTimePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("day0")] public int FirstDayOfWeek { get { return 0; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("day")] public string[] DayNames { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("sday")] public string[] ShortDayNames { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("mday")] public string[] MinimizedDayNames { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("mon")] public string[] MonthNames { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("smon")] public string[] ShortMonthNames { get { return null; diff --git a/src/Core/CoreLib/Globalization/NumberFormatInfo.cs b/src/Core/CoreLib/Globalization/NumberFormatInfo.cs index d017fc396..60ab5ae0a 100644 --- a/src/Core/CoreLib/Globalization/NumberFormatInfo.cs +++ b/src/Core/CoreLib/Globalization/NumberFormatInfo.cs @@ -3,172 +3,196 @@ // This source code is subject to terms and conditions of the Apache License, Version 2.0. // +using System; using System.Runtime.CompilerServices; namespace System.Globalization { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class NumberFormatInfo { private NumberFormatInfo() { } - [IntrinsicProperty] + [ScriptField] + [ScriptName("nan")] public string NaNSymbol { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("neg")] public string NegativeSign { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("pos")] public string PositiveSign { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("negInf")] public string NegativeInfinityText { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("posInf")] public string PositiveInfinityText { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("per")] public string PercentSymbol { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("perGW")] public int[] PercentGroupSizes { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("perDD")] public int PercentDecimalDigits { get { return 0; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("perDS")] public string PercentDecimalSeparator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("perGS")] public string PercentGroupSeparator { get { return null; } } - [IntrinsicProperty] - public string PercentPositivePattern { + [ScriptField] + [ScriptName("perNP")] + public string PercentNegativePattern { get { return null; } } - [IntrinsicProperty] - public string PercentNegativePattern { + [ScriptField] + [ScriptName("perPP")] + public string PercentPositivePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("cur")] public string CurrencySymbol { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("curGW")] public int[] CurrencyGroupSizes { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("curDD")] public int CurrencyDecimalDigits { get { return 0; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("curDS")] public string CurrencyDecimalSeparator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("curGS")] public string CurrencyGroupSeparator { get { return null; } } - [IntrinsicProperty] - public string CurrencyPositivePattern { + [ScriptField] + [ScriptName("curNP")] + public string CurrencyNegativePattern { get { return null; } } - [IntrinsicProperty] - public string CurrencyNegativePattern { + [ScriptField] + [ScriptName("curPP")] + public string CurrencyPositivePattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("gw")] public int[] NumberGroupSizes { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("dd")] public int NumberDecimalDigits { get { return 0; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("ds")] public string NumberDecimalSeparator { get { return null; } } - [IntrinsicProperty] + [ScriptField] + [ScriptName("gs")] public string NumberGroupSeparator { get { return null; diff --git a/src/Core/CoreLib/IDisposable.cs b/src/Core/CoreLib/IDisposable.cs index 036a4f8e7..6cac96b00 100644 --- a/src/Core/CoreLib/IDisposable.cs +++ b/src/Core/CoreLib/IDisposable.cs @@ -8,8 +8,7 @@ namespace System { // Script Equivalent: IDisposable - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public interface IDisposable { void Dispose(); diff --git a/src/Core/CoreLib/Int16.cs b/src/Core/CoreLib/Int16.cs index 431f6f916..06f6d4884 100644 --- a/src/Core/CoreLib/Int16.cs +++ b/src/Core/CoreLib/Int16.cs @@ -10,18 +10,16 @@ namespace System { /// /// The short data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Int16 { - public string Format(string format) { - return null; - } + [ScriptName("MAX_VALUE")] + public const int MaxValue = 0; - public string LocaleFormat(string format) { - return null; - } + [ScriptName("MIN_VALUE")] + public const int MinValue = 0; /// /// Converts the value to its string representation. diff --git a/src/Core/CoreLib/Int32.cs b/src/Core/CoreLib/Int32.cs index 3745cb01f..1fa09fe7a 100644 --- a/src/Core/CoreLib/Int32.cs +++ b/src/Core/CoreLib/Int32.cs @@ -10,18 +10,16 @@ namespace System { /// /// The int data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Int32 { - public string Format(string format) { - return null; - } + [ScriptName("MAX_VALUE")] + public const int MaxValue = 0; - public string LocaleFormat(string format) { - return null; - } + [ScriptName("MIN_VALUE")] + public const int MinValue = 0; [ScriptAlias("parseInt")] public static int Parse(string s) { diff --git a/src/Core/CoreLib/Int64.cs b/src/Core/CoreLib/Int64.cs index bd7117d65..e7bd43ae6 100644 --- a/src/Core/CoreLib/Int64.cs +++ b/src/Core/CoreLib/Int64.cs @@ -10,18 +10,16 @@ namespace System { /// /// The long data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Int64 { - public string Format(string format) { - return null; - } + [ScriptName("MAX_VALUE")] + public const long MaxValue = 0; - public string LocaleFormat(string format) { - return null; - } + [ScriptName("MIN_VALUE")] + public const long MinValue = 0; /// /// Converts the value to its string representation. diff --git a/src/Core/CoreLib/Math.cs b/src/Core/CoreLib/Math.cs index b2d5014d2..914c6a604 100644 --- a/src/Core/CoreLib/Math.cs +++ b/src/Core/CoreLib/Math.cs @@ -10,32 +10,32 @@ namespace System { /// /// Equivalent to the Math object in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class Math { - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double E; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double LN2; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double LN10; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double LOG2E; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double LOG10E; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double PI; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double SQRT1_2; - [PreserveCase] + [ScriptName(PreserveCase = true)] public static double SQRT2; public static Number Abs(Number n) { @@ -110,17 +110,17 @@ public static Number Tan(Number n) { return 0; } - [ScriptAlias("parseInt")] + [ScriptAlias("ss.truncate")] public static int Truncate(Number n) { return 0; } - [ScriptAlias("parseInt")] + [ScriptAlias("ss.truncate")] public static int Truncate(double n) { return 0; } - [ScriptAlias("parseInt")] + [ScriptAlias("ss.truncate")] public static int Truncate(float n) { return 0; } diff --git a/src/Core/CoreLib/Nullable.cs b/src/Core/CoreLib/Nullable.cs index adaba4464..93d922a62 100644 --- a/src/Core/CoreLib/Nullable.cs +++ b/src/Core/CoreLib/Nullable.cs @@ -8,8 +8,8 @@ namespace System { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public struct Nullable where T : struct { public Nullable(T value) { diff --git a/src/Core/CoreLib/Number.cs b/src/Core/CoreLib/Number.cs index dccaf45ee..fbc368082 100644 --- a/src/Core/CoreLib/Number.cs +++ b/src/Core/CoreLib/Number.cs @@ -10,28 +10,24 @@ namespace System { /// /// Equivalent to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Number { - [PreserveCase] - public const int MAX_VALUE = 0; + [ScriptName("MAX_VALUE")] + public const double MaxValue = 0; - [PreserveCase] - public const int MIN_VALUE = 0; + [ScriptName("MIN_VALUE")] + public const double MinValue = 0; - [PreserveCase] - public const int NaN = 0; + [ScriptName(PreserveCase = true)] + public const double NaN = 0; - [PreserveCase] - public const int NEGATIVE_INFINITY = 0; + [ScriptName("NEGATIVE_INFINITY")] + public const double NegativeInfinity = 0; - [PreserveCase] - public const int POSITIVE_INFINITY = 0; - - public string Format(string format) { - return null; - } + [ScriptName("POSITIVE_INFINITY")] + public const double PositiveInfinity = 0; [ScriptAlias("isFinite")] public static bool IsFinite(Number n) { @@ -43,10 +39,7 @@ public static bool IsNaN(Number n) { return false; } - public string LocaleFormat(string format) { - return null; - } - + [ScriptAlias("ss.number")] public static Number Parse(string s) { return null; } diff --git a/src/Core/CoreLib/Object.cs b/src/Core/CoreLib/Object.cs index 2158c0879..3a930850c 100644 --- a/src/Core/CoreLib/Object.cs +++ b/src/Core/CoreLib/Object.cs @@ -10,14 +10,15 @@ namespace System { /// /// Equivalent to the Object type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class Object { /// /// Retrieves the type associated with an object instance. /// /// The type of the object. + [ScriptAlias("ss.typeOf")] public Type GetType() { return null; } diff --git a/src/Core/CoreLib/Properties/AssemblyInfo.cs b/src/Core/CoreLib/Properties/AssemblyInfo.cs index 6078594a1..ddf931d18 100644 --- a/src/Core/CoreLib/Properties/AssemblyInfo.cs +++ b/src/Core/CoreLib/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("mscorlib")] [assembly: AssemblyDescription("Script# Core Assembly")] -[assembly: ScriptAssembly("core")] +[assembly: ScriptAssembly("ss")] diff --git a/src/Core/CoreLib/Record.cs b/src/Core/CoreLib/Record.cs deleted file mode 100644 index ecfa6191b..000000000 --- a/src/Core/CoreLib/Record.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Record.cs -// Script#/Libraries/CoreLib -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace System { - - [Imported] - [ScriptNamespace("ss")] - public abstract class Record { - - /// - public static implicit operator Dictionary(Record r) { - return null; - } - - /// - public static implicit operator Dictionary(Record r) { - return null; - } - - /// - public static implicit operator Record(Dictionary d) { - return null; - } - - /// - public static implicit operator Record(Dictionary d) { - return null; - } - } -} diff --git a/src/Core/CoreLib/RegularExpression.cs b/src/Core/CoreLib/RegExp.cs similarity index 72% rename from src/Core/CoreLib/RegularExpression.cs rename to src/Core/CoreLib/RegExp.cs index a43805d10..283017dbd 100644 --- a/src/Core/CoreLib/RegularExpression.cs +++ b/src/Core/CoreLib/RegExp.cs @@ -1,4 +1,4 @@ -// RegularExpression.cs +// RegExp.cs // Script#/Libraries/CoreLib // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -10,18 +10,18 @@ namespace System { /// /// Equivalent to the RegExp type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("RegExp")] - public sealed class RegularExpression { + public sealed class RegExp { - public RegularExpression(string pattern) { + public RegExp(string pattern) { } - public RegularExpression(string pattern, string flags) { + public RegExp(string pattern, string flags) { } - [IntrinsicProperty] + [ScriptField] public int LastIndex { get { return 0; @@ -30,35 +30,35 @@ public int LastIndex { } } - [IntrinsicProperty] + [ScriptField] public bool Global { get { return false; } } - [IntrinsicProperty] + [ScriptField] public bool IgnoreCase { get { return false; } } - [IntrinsicProperty] + [ScriptField] public bool Multiline { get { return false; } } - [IntrinsicProperty] + [ScriptField] public string Pattern { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Source { get { return null; @@ -69,7 +69,8 @@ public string[] Exec(string s) { return null; } - public static RegularExpression Parse(string s) { + [ScriptAlias("ss.regexp")] + public static RegExp Parse(string s) { return null; } diff --git a/src/Core/CoreLib/Runtime.cs b/src/Core/CoreLib/Runtime.cs index a905f9ca5..63c298b1f 100644 --- a/src/Core/CoreLib/Runtime.cs +++ b/src/Core/CoreLib/Runtime.cs @@ -10,38 +10,32 @@ namespace System { [AttributeUsage(AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class FlagsAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public abstract class MarshalByRefObject { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public abstract class ValueType { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public struct IntPtr { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public struct UIntPtr { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public abstract class MulticastDelegate : Delegate { protected MulticastDelegate(object target, string method) @@ -54,32 +48,27 @@ protected MulticastDelegate(Type target, string method) } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public struct RuntimeTypeHandle { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public struct RuntimeFieldHandle { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public abstract class Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class ParamArrayAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public enum AttributeTargets { Assembly = 0x0001, Module = 0x0002, @@ -104,8 +93,7 @@ public enum AttributeTargets { [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.Class, Inherited = true)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AttributeUsageAttribute : Attribute { private AttributeTargets _attributeTarget = AttributeTargets.All; @@ -144,8 +132,7 @@ public bool Inherited { [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class ObsoleteAttribute : Attribute { private bool _error; @@ -178,8 +165,7 @@ public string Message { [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.All, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class CLSCompliantAttribute : Attribute { private bool _isCompliant; @@ -200,8 +186,7 @@ namespace System.CodeDom.Compiler { [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class GeneratedCodeAttribute : Attribute { private string _tool; @@ -235,15 +220,13 @@ namespace System.ComponentModel { /// [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Method, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class BrowsableAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate | AttributeTargets.Interface)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class EditorBrowsableAttribute : Attribute { private EditorBrowsableState _browsableState; @@ -260,8 +243,7 @@ public EditorBrowsableState State { } [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public enum EditorBrowsableState { Always = 0, Never = 1, @@ -272,8 +254,7 @@ public enum EditorBrowsableState { namespace System.Reflection { [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class DefaultMemberAttribute { private string _memberName; @@ -290,8 +271,7 @@ public string MemberName { } [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyCopyrightAttribute : Attribute { private string _copyright; @@ -309,8 +289,7 @@ public string Copyright { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyTrademarkAttribute : Attribute { private string _trademark; @@ -328,8 +307,7 @@ public string Trademark { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyProductAttribute : Attribute { private string _product; @@ -347,8 +325,7 @@ public string Product { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyCompanyAttribute : Attribute { private string _company; @@ -366,8 +343,7 @@ public string Company { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyDescriptionAttribute : Attribute { private string _description; @@ -385,8 +361,7 @@ public string Description { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyTitleAttribute : Attribute { private string _title; @@ -403,8 +378,7 @@ public string Title { } [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyConfigurationAttribute : Attribute { private string _configuration; @@ -422,8 +396,7 @@ public string Configuration { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyFileVersionAttribute : Attribute { private string _version; @@ -441,8 +414,7 @@ public string Version { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyInformationalVersionAttribute : Attribute { private string _informationalVersion; @@ -460,8 +432,7 @@ public string InformationalVersion { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyCultureAttribute : Attribute { private string _culture; @@ -479,8 +450,7 @@ public string Culture { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyVersionAttribute : Attribute { private string _version; @@ -498,8 +468,7 @@ public string Version { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyKeyFileAttribute : Attribute { private string _keyFile; @@ -517,8 +486,7 @@ public string KeyFile { [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class AssemblyDelaySignAttribute : Attribute { private bool _delaySign; @@ -538,8 +506,7 @@ public bool DelaySign { namespace System.Runtime.CompilerServices { [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public class RuntimeHelpers { public static void InitializeArray(Array array, RuntimeFieldHandle handle) { @@ -548,8 +515,7 @@ public static void InitializeArray(Array array, RuntimeFieldHandle handle) { [AttributeUsage(AttributeTargets.All, Inherited = true)] [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class CompilerGeneratedAttribute : Attribute { public CompilerGeneratedAttribute() { @@ -558,8 +524,7 @@ public CompilerGeneratedAttribute() { [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class DecimalConstantAttribute : Attribute { public DecimalConstantAttribute(byte scale, byte sign, int hi, int mid, int low) { @@ -579,18 +544,73 @@ public decimal Value { namespace System.Runtime.InteropServices { + [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] - [NonScriptable] - [Imported] - public class OutAttribute { + [ScriptIgnore] + public sealed class OutAttribute : Attribute { + } +} + +namespace System.Runtime.Serialization { + + [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class DataContractAttribute : Attribute { + + public bool IsReference { + get; + set; + } + + public string Name { + get; + set; + } + + public string Namespace { + get; + set; + } + } + + [AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class DataMemberAttribute : Attribute { + + public bool EmitDefaultValue { + get; + set; + } + + public bool IsReference { + get; + set; + } + + public string Name { + get; + set; + } + + public int Order { + get; + set; + } + } + + [AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class IgnoreDataMemberAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class TargetFrameworkAttribute : Attribute { private string _frameworkName; diff --git a/src/Core/CoreLib/SByte.cs b/src/Core/CoreLib/SByte.cs index 0565ecd57..f5be6295c 100644 --- a/src/Core/CoreLib/SByte.cs +++ b/src/Core/CoreLib/SByte.cs @@ -10,19 +10,11 @@ namespace System { /// /// The signed byte data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct SByte { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - /// /// Converts the value to its string representation. /// diff --git a/src/Core/CoreLib/Script.cs b/src/Core/CoreLib/Script.cs index 09e63423e..3e25f586a 100644 --- a/src/Core/CoreLib/Script.cs +++ b/src/Core/CoreLib/Script.cs @@ -3,6 +3,7 @@ // This source code is subject to terms and conditions of the Apache License, Version 2.0. // +using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System { @@ -11,11 +12,34 @@ namespace System { /// The Script class contains various methods that represent global /// methods present in the underlying script engine. /// - [GlobalMethods] - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class Script { + [ScriptField] + [ScriptAlias("$global")] + public static object Global { + get { + return null; + } + } + + [ScriptField] + [ScriptAlias("ss.modules")] + public static Dictionary Modules { + get { + return null; + } + } + + [ScriptField] + [ScriptAlias("undefined")] + public static object Undefined { + get { + return null; + } + } + /// /// Converts an object into a boolean. /// @@ -25,22 +49,14 @@ public static bool Boolean(object o) { return false; } + [ScriptAlias("clearInterval")] public static void ClearInterval(int intervalID) { } + [ScriptAlias("clearTimeout")] public static void ClearTimeout(int timeoutID) { } - /// - /// Prompts the user with a yes/no question. - /// - /// The text of the question. - /// true if the user chooses yes; false otherwise. - [Obsolete("Use Window.Confirm instead.", true)] - public static bool Confirm(string message) { - return false; - } - public static object CreateInstance(Type type, params object[] arguments) { return null; } @@ -58,6 +74,7 @@ public static void DeleteField(Type type, string name) { /// /// The script to be evaluated. /// The result of the evaluation. + [ScriptAlias("eval")] public static object Eval(string s) { return null; } @@ -114,6 +131,26 @@ public static T InvokeMethod(Type type, string name, params object[] args) { return default(T); } + /// + /// Checks if the specified object has a falsey value, i.e. it is null or + /// undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a falsey value; false otherwise. + public static bool IsFalsey(object o) { + return false; + } + + [ScriptAlias("isFinite")] + public static bool IsFinite(object o) { + return false; + } + + [ScriptAlias("isNaN")] + public static bool IsNaN(object o) { + return false; + } + /// /// Checks if the specified object is null. /// @@ -159,6 +196,16 @@ public static bool IsValue(object o) { return false; } + /// + /// Checks if the specified object has a truthy value, i.e. it is not + /// null or undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a truthy value; false otherwise. + public static bool IsTruthy(object o) { + return false; + } + /// /// Enables you to generate an arbitrary (literal) script expression. /// The script can contain simple String.Format style tokens (such as @@ -171,60 +218,83 @@ public static object Literal(string script, params object[] args) { return null; } + /// + /// Gets the first truthy (true, non-null, non-undefined, non-empty, non-zero) value. + /// + /// The type of the value. + /// The value to check for validity. + /// The alternate value to use if the first is invalid. + /// Additional alternative values to use if the first is invalid. + /// The first valid value. + public static TValue Or(TValue value, TValue alternateValue, params TValue[] alternateValues) { + return default(TValue); + } + public static void SetField(object instance, string name, object value) { } public static void SetField(Type type, string name, object value) { } + [ScriptAlias("setInterval")] public static int SetInterval(string code, int milliseconds) { return 0; } + [ScriptAlias("setInterval")] public static int SetInterval(Action callback, int milliseconds) { return 0; } + [ScriptAlias("setInterval")] public static int SetInterval(Action callback, int milliseconds, T arg) { return 0; } + [ScriptAlias("setInterval")] public static int SetInterval(Action callback, int milliseconds, T1 arg1, T2 arg2) { return 0; } + [ScriptAlias("setInterval")] public static int SetInterval(Delegate d, int milliseconds, params object[] args) { return 0; } + [ScriptAlias("setTimeout")] public static int SetTimeout(string code, int milliseconds) { return 0; } + [ScriptAlias("setTimeout")] public static int SetTimeout(Action callback, int milliseconds) { return 0; } + [ScriptAlias("setTimeout")] public static int SetTimeout(Action callback, int milliseconds, T arg) { return 0; } + [ScriptAlias("setTimeout")] public static int SetTimeout(Action callback, int milliseconds, T1 arg1, T2 arg2) { return 0; } + [ScriptAlias("setTimeout")] public static int SetTimeout(Delegate d, int milliseconds, params object[] args) { return 0; } /// - /// Gets the first valid (non-null, non-undefined, non-empty) value. + /// Gets the first non-null and non-undefined value. /// /// The type of the value. /// The value to check for validity. /// The alternate value to use if the first is invalid. /// Additional alternative values to use if the first is invalid. /// The first valid value. + [ScriptAlias("ss.value")] public static TValue Value(TValue value, TValue alternateValue, params TValue[] alternateValues) { return default(TValue); } diff --git a/src/Core/CoreLib/ScriptMetadata.cs b/src/Core/CoreLib/ScriptMetadata.cs index 1d4d51295..3d0412ec8 100644 --- a/src/Core/CoreLib/ScriptMetadata.cs +++ b/src/Core/CoreLib/ScriptMetadata.cs @@ -7,28 +7,7 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -namespace System.Runtime.CompilerServices { - - /// - /// This attribute can be placed on types in system script assemblies that should not - /// be imported. It is only meant to be used within mscorlib.dll. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class NonScriptableAttribute : Attribute { - } - - /// - /// This attribute can be placed on types that should not be emitted into generated - /// script, as they represent existing script or native types. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Delegate | AttributeTargets.Struct)] - [NonScriptable] - [Imported] - public sealed class ImportedAttribute : Attribute { - } +namespace System { /// /// Marks an assembly as a script assembly that can be used with Script#. @@ -39,11 +18,12 @@ public sealed class ImportedAttribute : Attribute { /// shorter name if needed. /// [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] + [ScriptImport] public sealed class ScriptAssemblyAttribute : Attribute { private string _name; + private string _identifier; public ScriptAssemblyAttribute(string name) { _name = name; @@ -54,65 +34,79 @@ public string Name { return _name; } } + + public string Identifier { + get { + return _identifier; + } + set { + _identifier = value; + } + } } - /// - /// Provides a prefix to use when generating types internal to this assembly so that - /// they can be unique within a given a script namespace. - /// The specified prefix overrides the script name provided in the ScriptAssembly - /// attribute. - /// - [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class ScriptQualifierAttribute : Attribute { + [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)] + [ScriptIgnore] + [ScriptImport] + public sealed class ScriptReferenceAttribute : Attribute { + + private string _name; - private string _prefix; + private string _identifier; + private string _path; + private bool _delayLoad; - public ScriptQualifierAttribute(string prefix) { - _prefix = prefix; + public ScriptReferenceAttribute(string name) { + _name = name; } - public string Prefix { + public bool DelayLoad { get { - return _prefix; + return _delayLoad; + } + set { + _delayLoad = value; } } - } - /// - /// This attribute indicates that the namespace of type within a system assembly - /// should be ignored at script generation time. It is useful for creating namespaces - /// for the purpose of c# code that don't exist at runtime. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Struct, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class IgnoreNamespaceAttribute : Attribute { + public string Identifier { + get { + return _identifier; + } + set { + _identifier = value; + } + } + + public string Name { + get { + return _name; + } + } + + public string Path { + get { + return _path; + } + set { + _path = value; + } + } } - /// - /// Specifies the namespace that should be used in generated script. The script namespace - /// is typically a short name, that is often shared across multiple assemblies. - /// The developer is responsible for ensuring that public types across assemblies that share - /// a script namespace are unique. - /// For internal types, the ScriptQualifier attribute can be used to provide a short prefix - /// to generate unique names. - /// - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Type, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class ScriptNamespaceAttribute : Attribute { + [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptTemplateAttribute : Attribute { - private string _name; + private string _template; - public ScriptNamespaceAttribute(string name) { - _name = name; + public ScriptTemplateAttribute(string template) { + _template = template; } - public string Name { + public string Template { get { - return _name; + return _template; } } } @@ -122,30 +116,18 @@ public string Name { /// fields representing a set of resource strings. /// [AttributeUsage(AttributeTargets.Class)] - [NonScriptable] - [Imported] - public sealed class ResourcesAttribute : Attribute { - } - - /// - /// This attribute turns methods on a static class as global methods in the generated - /// script. Note that the class must be static, and must contain only methods. - /// - [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] - [NonScriptable] - [Imported] - public sealed class GlobalMethodsAttribute : Attribute { + [ScriptIgnore] + public sealed class ScriptResourcesAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class MixinAttribute : Attribute { + [ScriptIgnore] + public sealed class ScriptExtensionAttribute : Attribute { private string _expression; - public MixinAttribute(string expression) { - _expression = expression; + public ScriptExtensionAttribute(string extendeeExpression) { + _expression = extendeeExpression; } public string Expression { @@ -155,62 +137,119 @@ public string Expression { } } + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptModuleAttribute : Attribute { + } + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptObjectAttribute : Attribute { + } + /// - /// This attribute marks an enumeration type within a system assembly as as a set of - /// names. Rather than the specific value, the name of the enumeration field is - /// used as a string. + /// This attribute is used to mark an enum as a set of constant values, i.e. if + /// specified, the enum does not exist/is not generated, but rather its values + /// are inlined as constants. If the UseName property is set to true, then instead + /// of actual values, the names of the fields are used as string constants. /// [AttributeUsage(AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class NamedValuesAttribute : Attribute { + [ScriptIgnore] + public sealed class ScriptConstantsAttribute : Attribute { + + private bool _useNames; + + public bool UseNames { + get { + return _useNames; + } + set { + _useNames = value; + } + } } + /// - /// This attribute marks an enumeration type within a system assembly as as a set of - /// numeric values. Rather than the enum field, the value of the enumeration field is - /// used as a literal. + /// Allows specifying the name to use for a type or member in the generated script. /// - [AttributeUsage(AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class NumericValuesAttribute : Attribute { + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptNameAttribute : Attribute { + + private string _name; + private bool _preserveCase; + private bool _preserveName; + + public ScriptNameAttribute() { + } + + public ScriptNameAttribute(string name) { + _name = name; + } + + public string Name { + get { + return _name; + } + } + + public bool PreserveCase { + get { + return _preserveCase; + } + set { + _preserveCase = true; + } + } + + public bool PreserveName { + get { + return _preserveName; + } + set { + _preserveName = value; + } + } } +} + +namespace System.Runtime.CompilerServices { /// - /// This attribute allows defining an alternate method signature that is not generated - /// into script, but can be used for defining overloads to enable optional parameter semantics - /// for a method. It must be applied on a method defined as extern, since an alternate signature - /// method does not contain an actual method body. + /// This attribute can be placed on types in system script assemblies that should not + /// be imported. It is only meant to be used within mscorlib.dll. /// - [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class AlternateSignatureAttribute : Attribute { + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + [ScriptImport] + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class ScriptIgnoreAttribute : Attribute { } /// - /// This attribute denotes a C# property that manifests like a field in the generated - /// JavaScript (i.e. is not accessed via get/set methods). This is really meant only - /// for use when defining OM corresponding to native objects exposed to script. + /// This attribute can be placed on types that should not be emitted into generated + /// script, as they represent existing script or native types. /// - [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class IntrinsicPropertyAttribute : Attribute { + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Delegate | AttributeTargets.Struct)] + [ScriptIgnore] + [ScriptImport] + public sealed class ScriptImportAttribute : Attribute { } /// - /// Allows specifying the name to use for a type or member in the generated script. + /// Marks a type with a script dependency that is required at runtime. + /// The specified name is used as the name of the dependency, and the runtime identifier. /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event, Inherited = false, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class ScriptNameAttribute : Attribute { + [AttributeUsage(AttributeTargets.Type, Inherited = false, AllowMultiple = false)] + [ScriptIgnore] + [ScriptImport] + public sealed class ScriptDependencyAttribute : Attribute { private string _name; + private string _identifier; - public ScriptNameAttribute(string name) { + public ScriptDependencyAttribute(string name) { _name = name; } @@ -219,26 +258,25 @@ public string Name { return _name; } } - } - /// - /// This attribute allows suppressing the default behavior of converting - /// member names to camel-cased equivalents in the generated JavaScript. - /// - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Field, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class PreserveCaseAttribute : Attribute { + public string Identifier { + get { + return _identifier; + } + set { + _identifier = value; + } + } } /// - /// This attribute allows suppressing the default behavior of minimizing - /// private type names and member names in the generated JavaScript. + /// This attribute indicates that the namespace of type within a system assembly + /// should be ignored at script generation time. It is useful for creating namespaces + /// for the purpose of c# code that don't exist at runtime. /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Field, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] - public sealed class PreserveNameAttribute : Attribute { + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Struct, Inherited = true, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptIgnoreNamespaceAttribute : Attribute { } /// @@ -248,8 +286,7 @@ public sealed class PreserveNameAttribute : Attribute { /// // REVIEW: Eventually do we want to support this on properties/field and instance methods as well? [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class ScriptAliasAttribute : Attribute { private string _alias; @@ -266,8 +303,60 @@ public string Alias { } [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] - [NonScriptable] - [Imported] + [ScriptIgnore] public sealed class ScriptSkipAttribute : Attribute { } + + /// + /// This attribute denotes a C# property that manifests like a field in the generated + /// JavaScript (i.e. is not accessed via get/set methods). This is really meant only + /// for use when defining OM corresponding to native objects exposed to script. + /// + [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptFieldAttribute : Attribute { + } + + [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptMethodAttribute : Attribute { + + private string _selector; + + public ScriptMethodAttribute(string selector) { + _selector = selector; + } + + public string Selector { + get { + return _selector; + } + } + } + + + [AttributeUsage(AttributeTargets.Event, Inherited = true, AllowMultiple = false)] + [ScriptIgnore] + public sealed class ScriptEventAttribute : Attribute { + + private string _addAccessor; + private string _removeAccessor; + + public ScriptEventAttribute(string addAccessor, string removeAccessor) { + _addAccessor = addAccessor; + _removeAccessor = removeAccessor; + } + + public string AddAccessor { + get { + return _addAccessor; + } + } + + public string RemoveAccessor { + get { + return _removeAccessor; + } + } + } } diff --git a/src/Core/CoreLib/Serialization/Json.cs b/src/Core/CoreLib/Serialization/Json.cs index a3bb1a359..12f37ad7b 100644 --- a/src/Core/CoreLib/Serialization/Json.cs +++ b/src/Core/CoreLib/Serialization/Json.cs @@ -8,8 +8,8 @@ namespace System.Serialization { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("JSON")] public static class Json { diff --git a/src/Core/CoreLib/Serialization/JsonParseCallback.cs b/src/Core/CoreLib/Serialization/JsonParseCallback.cs index 3712e8e7c..aafca314c 100644 --- a/src/Core/CoreLib/Serialization/JsonParseCallback.cs +++ b/src/Core/CoreLib/Serialization/JsonParseCallback.cs @@ -17,7 +17,7 @@ namespace System.Serialization { /// The name of the member. /// The value of the member. /// The transformed value. - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public delegate object JsonParseCallback(string name, object value); } diff --git a/src/Core/CoreLib/Serialization/JsonStringifyCallback.cs b/src/Core/CoreLib/Serialization/JsonStringifyCallback.cs index 322341004..cfe2c8e40 100644 --- a/src/Core/CoreLib/Serialization/JsonStringifyCallback.cs +++ b/src/Core/CoreLib/Serialization/JsonStringifyCallback.cs @@ -16,7 +16,7 @@ namespace System.Serialization { /// The name of the member. /// The value of the member. /// The value to be serialized. - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public delegate object JsonStringifyCallback(string name, object value); } diff --git a/src/Core/CoreLib/Single.cs b/src/Core/CoreLib/Single.cs index 4556144f3..1e41edcaa 100644 --- a/src/Core/CoreLib/Single.cs +++ b/src/Core/CoreLib/Single.cs @@ -12,19 +12,11 @@ namespace System { /// /// The float data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct Single { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - [ScriptAlias("parseFloat")] public static float Parse(string s) { return 0; diff --git a/src/Core/CoreLib/String.cs b/src/Core/CoreLib/String.cs index e6b28f70d..e445f6acc 100644 --- a/src/Core/CoreLib/String.cs +++ b/src/Core/CoreLib/String.cs @@ -4,6 +4,7 @@ // using System.ComponentModel; +using System.Globalization; using System.Runtime.CompilerServices; namespace System { @@ -11,20 +12,19 @@ namespace System { /// /// Equivalent to the String type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class String { /// /// An empty zero-length string. /// - [PreserveCase] public static readonly String Empty = ""; /// /// The number of characters in the string. /// - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; @@ -36,7 +36,7 @@ public int Length { /// /// The specified 0-based position. /// The character within the string. - [IntrinsicProperty] + [ScriptField] public char this[int index] { get { return '\0'; @@ -61,30 +61,27 @@ public int CharCodeAt(int index) { return 0; } + [ScriptAlias("ss.compareStrings")] public static int Compare(string s1, string s2) { return 0; } + [ScriptAlias("ss.compareStrings")] public static int Compare(string s1, string s2, bool ignoreCase) { return 0; } - public int CompareTo(string s) { - return 0; - } - - public int CompareTo(string s, bool ignoreCase) { - return 0; - } - + [ScriptAlias("ss.string")] public static string Concat(string s1, string s2) { return null; } + [ScriptAlias("ss.string")] public static string Concat(string s1, string s2, string s3) { return null; } + [ScriptAlias("ss.string")] public static string Concat(string s1, string s2, string s3, string s4) { return null; } @@ -94,26 +91,31 @@ public static string Concat(string s1, string s2, string s3, string s4) { /// /// The sequence of strings /// The concatenated string. + [ScriptAlias("ss.string")] public static string Concat(params string[] strings) { return null; } [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptAlias("ss.string")] public static string Concat(object o1, object o2) { return null; } [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptAlias("ss.string")] public static string Concat(object o1, object o2, object o3) { return null; } [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptAlias("ss.string")] public static string Concat(object o1, object o2, object o3, object o4) { return null; } [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptAlias("ss.string")] public static string Concat(params object[] o) { return null; } @@ -122,7 +124,7 @@ public static string Concat(params object[] o) { /// Returns the unencoded version of a complete encoded URI. /// /// The unencoded string. - [ScriptName("decodeURI")] + [ScriptAlias("decodeURI")] public string DecodeUri() { return null; } @@ -131,7 +133,7 @@ public string DecodeUri() { /// Returns the unencoded version of a single part or component of an encoded URI. /// /// The unencoded string. - [ScriptName("decodeURIComponent")] + [ScriptAlias("decodeURIComponent")] public string DecodeUriComponent() { return null; } @@ -140,7 +142,7 @@ public string DecodeUriComponent() { /// Encodes the complete URI. /// /// The encoded string. - [ScriptName("encodeURI")] + [ScriptAlias("encodeURI")] public string EncodeUri() { return null; } @@ -149,7 +151,7 @@ public string EncodeUri() { /// Encodes a single part or component of a URI. /// /// The encoded string. - [ScriptName("encodeURIComponent")] + [ScriptAlias("encodeURIComponent")] public string EncodeUriComponent() { return null; } @@ -159,6 +161,7 @@ public string EncodeUriComponent() { /// /// The character to test for. /// true if the string ends with the character; false otherwise. + [ScriptAlias("ss.endsWith")] public bool EndsWith(char ch) { return false; } @@ -168,43 +171,40 @@ public bool EndsWith(char ch) { /// /// The string to test for. /// true if the string ends with the suffix; false otherwise. + [ScriptAlias("ss.endsWith")] public bool EndsWith(string suffix) { return false; } - /// - /// Determines if the strings are equal. - /// - /// true if the string s1 = s2; false otherwise. - public static bool Equals(string s1, string s2, bool ignoreCase) { - return false; - } - /// /// Encodes a string by replacing punctuation, spaces etc. with their escaped equivalents. /// /// The escaped string. + [ScriptAlias("escape")] public string Escape() { return null; } + [ScriptAlias("ss.format")] public static string Format(string format, params object[] values) { return null; } - public static string FromChar(char ch, int count) { + [ScriptAlias("ss.format")] + public static string Format(CultureInfo culture, string format, params object[] values) { return null; } - public static string FromCharCode(params int[] charCodes) { + [ScriptAlias("ss.string")] + public static string FromChar(char ch, int count) { return null; } - public string HtmlDecode() { + public static string FromCharCode(int charCode) { return null; } - public string HtmlEncode() { + public static string FromCharCode(params int[] charCodes) { return null; } @@ -224,26 +224,17 @@ public int IndexOf(string subString, int startIndex) { return 0; } - public int IndexOfAny(char[] ch) { - return 0; - } - - public int IndexOfAny(char[] ch, int startIndex) { - return 0; - } - - public int IndexOfAny(char[] ch, int startIndex, int count) { - return 0; - } - + [ScriptAlias("ss.insertString")] public string Insert(int index, string value) { return null; } + [ScriptAlias("ss.emptyString")] public static bool IsNullOrEmpty(string s) { return false; } + [ScriptAlias("ss.whitespace")] public static bool IsNullOrWhiteSpace(string s) { return false; } @@ -264,71 +255,61 @@ public int LastIndexOf(string subString, int startIndex) { return 0; } - public int LastIndexOfAny(char[] ch) { - return 0; - } - - public int LastIndexOfAny(char[] ch, int startIndex) { - return 0; - } - - public int LastIndexOfAny(char[] ch, int startIndex, int count) { - return 0; - } - - public int LocaleCompare(string string2) { - return 0; - } - - public static string LocaleFormat(string format, params object[] values) { - return null; - } - - public string[] Match(RegularExpression regex) { + public string[] Match(RegExp regex) { return null; } + [ScriptAlias("ss.padLeft")] public string PadLeft(int totalWidth) { return null; } + [ScriptAlias("ss.padLeft")] public string PadLeft(int totalWidth, char ch) { return null; } + [ScriptAlias("ss.padRight")] public string PadRight(int totalWidth) { return null; } + [ScriptAlias("ss.padRight")] public string PadRight(int totalWidth, char ch) { return null; } + [ScriptAlias("ss.removeString")] public string Remove(int index) { return null; } + [ScriptAlias("ss.removeString")] public string Remove(int index, int count) { return null; } + [ScriptAlias("ss.replaceString")] public string Replace(string oldText, string replaceText) { return null; } + [ScriptName("replace")] public string ReplaceFirst(string oldText, string replaceText) { return null; } - public string ReplaceRegex(RegularExpression regex, string replaceText) { + [ScriptName("replace")] + public string ReplaceRegex(RegExp regex, string replaceText) { return null; } - public string ReplaceRegex(RegularExpression regex, StringReplaceCallback callback) { + [ScriptName("replace")] + public string ReplaceRegex(RegExp regex, StringReplaceCallback callback) { return null; } - public int Search(RegularExpression regex) { + public int Search(RegExp regex) { return 0; } @@ -348,18 +329,20 @@ public string[] Split(string separator, int limit) { return null; } - public string[] Split(RegularExpression regex) { + public string[] Split(RegExp regex) { return null; } - public string[] Split(RegularExpression regex, int limit) { + public string[] Split(RegExp regex, int limit) { return null; } + [ScriptAlias("ss.startsWith")] public bool StartsWith(char ch) { return false; } + [ScriptAlias("ss.startsWith")] public bool StartsWith(string prefix) { return false; } @@ -396,22 +379,41 @@ public string ToUpperCase() { return null; } + [ScriptAlias("ss.trim")] public string Trim() { return null; } - public string TrimStart() { + [ScriptAlias("ss.trim")] + public string Trim(char[] trimCharacters) { return null; } + [ScriptAlias("ss.trimEnd")] public string TrimEnd() { return null; } + [ScriptAlias("ss.trimEnd")] + public string TrimEnd(char[] trimCharacters) { + return null; + } + + [ScriptAlias("ss.trimStart")] + public string TrimStart() { + return null; + } + + [ScriptAlias("ss.trimStart")] + public string TrimStart(char[] trimCharacters) { + return null; + } + /// /// Decodes a string by replacing escaped parts with their equivalent textual representation. /// /// The unescaped string. + [ScriptAlias("unescape")] public string Unescape() { return null; } diff --git a/src/Core/CoreLib/StringBuilder.cs b/src/Core/CoreLib/StringBuilder.cs index 30e3d1aab..a07abc6be 100644 --- a/src/Core/CoreLib/StringBuilder.cs +++ b/src/Core/CoreLib/StringBuilder.cs @@ -10,8 +10,7 @@ namespace System { /// /// Provides an optimized mechanism to concatenate strings. /// - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public sealed class StringBuilder { /// @@ -33,7 +32,7 @@ public StringBuilder(string initialText) { /// Gets whether the object has any content. /// /// true if the StringBuilder instance contains no text; otherwise, false. - [IntrinsicProperty] + [ScriptField] public bool IsEmpty { get { return false; diff --git a/src/Core/CoreLib/StringReplaceCallback.cs b/src/Core/CoreLib/StringReplaceCallback.cs index 1b396d955..39be30a33 100644 --- a/src/Core/CoreLib/StringReplaceCallback.cs +++ b/src/Core/CoreLib/StringReplaceCallback.cs @@ -12,7 +12,7 @@ namespace System { // but there isn't a way to express the varying number of parameters in the // middle of the signature! - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate string StringReplaceCallback(string matchedValue); } diff --git a/src/Core/CoreLib/Testing/Assert.cs b/src/Core/CoreLib/Testing/Assert.cs index 4309103de..1d3456cd5 100644 --- a/src/Core/CoreLib/Testing/Assert.cs +++ b/src/Core/CoreLib/Testing/Assert.cs @@ -8,8 +8,8 @@ namespace System.Testing { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class Assert { [ScriptAlias("QUnit.equal")] diff --git a/src/Core/CoreLib/Testing/TestClass.cs b/src/Core/CoreLib/Testing/TestClass.cs index 2c9264978..796f76dff 100644 --- a/src/Core/CoreLib/Testing/TestClass.cs +++ b/src/Core/CoreLib/Testing/TestClass.cs @@ -8,8 +8,8 @@ namespace System.Testing { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public abstract class TestClass { public virtual void Cleanup() { diff --git a/src/Core/CoreLib/Testing/TestEngine.cs b/src/Core/CoreLib/Testing/TestEngine.cs index b5a629f7f..7445aaa21 100644 --- a/src/Core/CoreLib/Testing/TestEngine.cs +++ b/src/Core/CoreLib/Testing/TestEngine.cs @@ -8,8 +8,8 @@ namespace System.Testing { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class TestEngine { [ScriptAlias("QUnit.log")] diff --git a/src/Core/CoreLib/Threading/Deferred.cs b/src/Core/CoreLib/Threading/Deferred.cs index d18f3e5c8..dd046dbb8 100644 --- a/src/Core/CoreLib/Threading/Deferred.cs +++ b/src/Core/CoreLib/Threading/Deferred.cs @@ -8,17 +8,34 @@ namespace System.Threading { - [Imported] - [ScriptNamespace("ss")] - public class Deferred { + [ScriptImport] + public abstract class Deferred { - [IntrinsicProperty] + internal Deferred() { + } + + [ScriptField] public Task Task { get { return null; } } + [ScriptAlias("ss.deferred")] + public static Deferred Create() { + return null; + } + + [ScriptAlias("ss.deferred")] + public static Deferred Create() { + return null; + } + + [ScriptAlias("ss.deferred")] + public static Deferred Create(T result) { + return null; + } + public void Reject() { } @@ -29,12 +46,14 @@ public void Resolve() { } } - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("Deferred")] public sealed class Deferred : Deferred { - [IntrinsicProperty] + private Deferred() { + } + + [ScriptField] public new Task Task { get { return null; diff --git a/src/Core/CoreLib/Threading/Task.cs b/src/Core/CoreLib/Threading/Task.cs index 752d9ba6f..2ab3bce7f 100644 --- a/src/Core/CoreLib/Threading/Task.cs +++ b/src/Core/CoreLib/Threading/Task.cs @@ -8,8 +8,7 @@ namespace System.Threading { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] public class Task { internal Task() { @@ -21,14 +20,14 @@ public bool Completed { } } - [IntrinsicProperty] + [ScriptField] public Exception Error { get { return null; } } - [IntrinsicProperty] + [ScriptField] public TaskStatus Status { get { return TaskStatus.Pending; @@ -51,6 +50,10 @@ public static Task Any(int timeout, params Task[] tasks) { return null; } + public Task ChangeWith(Func continuation) { + return null; + } + public Task ContinueWith(Action continuation) { return null; } @@ -72,21 +75,24 @@ public Task Then(Action doneCallback, Action failCallback) { } } - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] [ScriptName("Task")] public sealed class Task : Task { internal Task() { } - [IntrinsicProperty] + [ScriptField] public T Result { get { return default(T); } } + public Task ChangeWith(Func, TResult> continuation) { + return null; + } + public Task ContinueWith(Action> continuation) { return null; } diff --git a/src/Core/CoreLib/Threading/TaskStatus.cs b/src/Core/CoreLib/Threading/TaskStatus.cs index d49a30ca0..f014364a7 100644 --- a/src/Core/CoreLib/Threading/TaskStatus.cs +++ b/src/Core/CoreLib/Threading/TaskStatus.cs @@ -8,9 +8,9 @@ namespace System.Threading { - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum TaskStatus { Pending, diff --git a/src/Core/CoreLib/Tuple.cs b/src/Core/CoreLib/Tuple.cs index e0da0d8a2..08af86116 100644 --- a/src/Core/CoreLib/Tuple.cs +++ b/src/Core/CoreLib/Tuple.cs @@ -8,19 +8,19 @@ namespace System { - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Tuple")] public sealed class Tuple { public Tuple() { } - public Tuple(T1 first, T2 second) { + public Tuple(T1 item1, T2 item2) { } - [IntrinsicProperty] - public T1 First { + [ScriptField] + public T1 Item1 { get { return default(T1); } @@ -28,8 +28,8 @@ public T1 First { } } - [IntrinsicProperty] - public T2 Second { + [ScriptField] + public T2 Item2 { get { return default(T2); } @@ -38,19 +38,19 @@ public T2 Second { } } - [Imported] - [ScriptNamespace("ss")] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Tuple")] public sealed class Tuple { public Tuple() { } - public Tuple(T1 first, T2 second, T3 third) { + public Tuple(T1 item1, T2 item2, T3 item3) { } - [IntrinsicProperty] - public T1 First { + [ScriptField] + public T1 Item1 { get { return default(T1); } @@ -58,8 +58,8 @@ public T1 First { } } - [IntrinsicProperty] - public T2 Second { + [ScriptField] + public T2 Item2 { get { return default(T2); } @@ -67,8 +67,8 @@ public T2 Second { } } - [IntrinsicProperty] - public T3 Third { + [ScriptField] + public T3 Item3 { get { return default(T3); } @@ -76,4 +76,52 @@ public T3 Third { } } } + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Tuple")] + public sealed class Tuple { + + public Tuple() { + } + + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) { + } + + [ScriptField] + public T1 Item1 { + get { + return default(T1); + } + set { + } + } + + [ScriptField] + public T2 Item2 { + get { + return default(T2); + } + set { + } + } + + [ScriptField] + public T3 Item3 { + get { + return default(T3); + } + set { + } + } + + [ScriptField] + public T4 Item4 { + get { + return default(T4); + } + set { + } + } + } } diff --git a/src/Core/CoreLib/Type.cs b/src/Core/CoreLib/Type.cs index 9a7802682..7de772c3d 100644 --- a/src/Core/CoreLib/Type.cs +++ b/src/Core/CoreLib/Type.cs @@ -12,22 +12,18 @@ namespace System { /// /// The Type data type which is mapped to the Function type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Type { + [ScriptName("$base")] + [ScriptField] public Type BaseType { get { return null; } } - public string FullName { - get { - return null; - } - } - public string Name { get { return null; @@ -37,29 +33,34 @@ public string Name { /// /// Gets the prototype associated with the type. /// - [IntrinsicProperty] + [ScriptField] public Dictionary Prototype { get { return null; } } + [ScriptAlias("ss.type")] public static Type GetType(string typeName) { return null; } + [ScriptAlias("ss.canAssign")] public bool IsAssignableFrom(Type type) { return false; } + [ScriptAlias("ss.isClass")] public static bool IsClass(Type type) { return false; } + [ScriptAlias("ss.isInterface")] public static bool IsInterface(Type type) { return false; } + [ScriptAlias("ss.instanceOf")] public bool IsInstanceOfType(object instance) { return false; } diff --git a/src/Core/CoreLib/UInt16.cs b/src/Core/CoreLib/UInt16.cs index 69c95865b..5cb4bb8f7 100644 --- a/src/Core/CoreLib/UInt16.cs +++ b/src/Core/CoreLib/UInt16.cs @@ -10,19 +10,11 @@ namespace System { /// /// The ushort data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct UInt16 { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - /// /// Converts the value to its string representation. /// diff --git a/src/Core/CoreLib/UInt32.cs b/src/Core/CoreLib/UInt32.cs index 59fc0975c..2f5d66c02 100644 --- a/src/Core/CoreLib/UInt32.cs +++ b/src/Core/CoreLib/UInt32.cs @@ -10,19 +10,11 @@ namespace System { /// /// The uint data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct UInt32 { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - /// /// Converts the value to its string representation. /// diff --git a/src/Core/CoreLib/UInt64.cs b/src/Core/CoreLib/UInt64.cs index 95769d7b1..1a5fa9e5a 100644 --- a/src/Core/CoreLib/UInt64.cs +++ b/src/Core/CoreLib/UInt64.cs @@ -10,19 +10,11 @@ namespace System { /// /// The ulong data type which is mapped to the Number type in Javascript. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Number")] public struct UInt64 { - public string Format(string format) { - return null; - } - - public string LocaleFormat(string format) { - return null; - } - /// /// Converts the value to its string representation. /// diff --git a/src/Core/CoreLib/Void.cs b/src/Core/CoreLib/Void.cs index aae509021..e2b7a54df 100644 --- a/src/Core/CoreLib/Void.cs +++ b/src/Core/CoreLib/Void.cs @@ -10,8 +10,8 @@ namespace System { // This doesn't map to an actual type, but needs to be present // in the set of types, so that the C# void type can be mapped - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public struct Void { } } diff --git a/src/Core/CoreScript/BCL/App.js b/src/Core/CoreScript/BCL/App.js deleted file mode 100644 index 705767e12..000000000 --- a/src/Core/CoreScript/BCL/App.js +++ /dev/null @@ -1,17 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Interfaces - -ss.IApplication = function() { }; -ss.IApplication.registerInterface('IApplication'); - -ss.IContainer = function () { }; -ss.IContainer.registerInterface('IContainer'); - -ss.IObjectFactory = function () { }; -ss.IObjectFactory.registerInterface('IObjectFactory'); - -ss.IEventManager = function () { }; -ss.IEventManager.registerInterface('IEventManager'); - -ss.IInitializable = function () { }; -ss.IInitializable.registerInterface('IInitializable'); diff --git a/src/Core/CoreScript/BCL/ArrayEnumerator.js b/src/Core/CoreScript/BCL/ArrayEnumerator.js deleted file mode 100644 index 4e64575b0..000000000 --- a/src/Core/CoreScript/BCL/ArrayEnumerator.js +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// ArrayEnumerator - -ss.ArrayEnumerator = function#? DEBUG ArrayEnumerator$##(array) { - this._array = array; - this._index = -1; - this.current = null; -} -ss.ArrayEnumerator.prototype = { - moveNext: function#? DEBUG ArrayEnumerator$moveNext##() { - this._index++; - this.current = this._array[this._index]; - return (this._index < this._array.length); - }, - reset: function#? DEBUG ArrayEnumerator$reset##() { - this._index = -1; - this.current = null; - } -} - -ss.ArrayEnumerator.registerClass('ArrayEnumerator', null, ss.IEnumerator); diff --git a/src/Core/CoreScript/BCL/CancelEventArgs.js b/src/Core/CoreScript/BCL/CancelEventArgs.js deleted file mode 100644 index 995711126..000000000 --- a/src/Core/CoreScript/BCL/CancelEventArgs.js +++ /dev/null @@ -1,8 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// CancelEventArgs - -ss.CancelEventArgs = function#? DEBUG CancelEventArgs$##() { - ss.CancelEventArgs.initializeBase(this); - this.cancel = false; -} -ss.CancelEventArgs.registerClass('CancelEventArgs', ss.EventArgs); diff --git a/src/Core/CoreScript/BCL/CultureInfo.js b/src/Core/CoreScript/BCL/CultureInfo.js deleted file mode 100644 index bad1298d1..000000000 --- a/src/Core/CoreScript/BCL/CultureInfo.js +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// CultureInfo - -ss.CultureInfo = function#? DEBUG CultureInfo$##(name, numberFormat, dateFormat) { - this.name = name; - this.numberFormat = numberFormat; - this.dateFormat = dateFormat; -} -ss.CultureInfo.registerClass('CultureInfo'); - -ss.CultureInfo.InvariantCulture = new ss.CultureInfo('en-US', - { - naNSymbol: 'NaN', - negativeSign: '-', - positiveSign: '+', - negativeInfinityText: '-Infinity', - positiveInfinityText: 'Infinity', - - percentSymbol: '%', - percentGroupSizes: [3], - percentDecimalDigits: 2, - percentDecimalSeparator: '.', - percentGroupSeparator: ',', - percentPositivePattern: '{0} %', - percentNegativePattern: '-{0} %', - - currencySymbol:'$', - currencyGroupSizes: [3], - currencyDecimalDigits: 2, - currencyDecimalSeparator: '.', - currencyGroupSeparator: ',', - currencyNegativePattern: '(${0})', - currencyPositivePattern: '${0}', - - numberGroupSizes: [3], - numberDecimalDigits: 2, - numberDecimalSeparator: '.', - numberGroupSeparator: ',' - }, - { - amDesignator: 'AM', - pmDesignator: 'PM', - - dateSeparator: '/', - timeSeparator: ':', - - gmtDateTimePattern: 'ddd, dd MMM yyyy HH:mm:ss \'GMT\'', - universalDateTimePattern: 'yyyy-MM-dd HH:mm:ssZ', - sortableDateTimePattern: 'yyyy-MM-ddTHH:mm:ss', - dateTimePattern: 'dddd, MMMM dd, yyyy h:mm:ss tt', - - longDatePattern: 'dddd, MMMM dd, yyyy', - shortDatePattern: 'M/d/yyyy', - - longTimePattern: 'h:mm:ss tt', - shortTimePattern: 'h:mm tt', - - firstDayOfWeek: 0, - dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], - shortDayNames: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'], - minimizedDayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], - - monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December',''], - shortMonthNames: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec',''] - }); -ss.CultureInfo.CurrentCulture = ss.CultureInfo.InvariantCulture; diff --git a/src/Core/CoreScript/BCL/Debug.js b/src/Core/CoreScript/BCL/Debug.js deleted file mode 100644 index 6cdab136c..000000000 --- a/src/Core/CoreScript/BCL/Debug.js +++ /dev/null @@ -1,18 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Debug Extensions - -if (!global.console) { - global.console = { - log: function() { - }, - assert: function() { - } - } -} - -console.fail = function(message) { - console.assert(false, message); - if (global.navigator && (global.navigator.userAgent.indexOf('MSIE') > 0)) { - eval('debugger;'); - } -} diff --git a/src/Core/CoreScript/BCL/Delegate.js b/src/Core/CoreScript/BCL/Delegate.js deleted file mode 100644 index f894bc164..000000000 --- a/src/Core/CoreScript/BCL/Delegate.js +++ /dev/null @@ -1,120 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Delegate - -ss.Delegate = function#? DEBUG Delegate$##() { -} -ss.Delegate.registerClass('Delegate'); - -ss.Delegate.empty = function() { } - -ss.Delegate._contains = function#? DEBUG Delegate$_contains##(targets, object, method) { - for (var i = 0; i < targets.length; i += 2) { - if (targets[i] === object && targets[i + 1] === method) { - return true; - } - } - return false; -} - -ss.Delegate._create = function#? DEBUG Delegate$_create##(targets) { - var delegate = function() { - if (targets.length == 2) { - return targets[1].apply(targets[0], arguments); - } - else { - var clone = targets.clone(); - for (var i = 0; i < clone.length; i += 2) { - if (ss.Delegate._contains(targets, clone[i], clone[i + 1])) { - clone[i + 1].apply(clone[i], arguments); - } - } - return null; - } - }; - delegate._targets = targets; - - return delegate; -} - -ss.Delegate.create = function#? DEBUG Delegate$create##(object, method) { - if (!object) { - return method; - } - return ss.Delegate._create([object, method]); -} - -ss.Delegate.combine = function#? DEBUG Delegate$combine##(delegate1, delegate2) { - if (!delegate1) { - if (!delegate2._targets) { - return ss.Delegate.create(null, delegate2); - } - return delegate2; - } - if (!delegate2) { - if (!delegate1._targets) { - return ss.Delegate.create(null, delegate1); - } - return delegate1; - } - - var targets1 = delegate1._targets ? delegate1._targets : [null, delegate1]; - var targets2 = delegate2._targets ? delegate2._targets : [null, delegate2]; - - return ss.Delegate._create(targets1.concat(targets2)); -} - -ss.Delegate.remove = function#? DEBUG Delegate$remove##(delegate1, delegate2) { - if (!delegate1 || (delegate1 === delegate2)) { - return null; - } - if (!delegate2) { - return delegate1; - } - - var targets = delegate1._targets; - var object = null; - var method; - if (delegate2._targets) { - object = delegate2._targets[0]; - method = delegate2._targets[1]; - } - else { - method = delegate2; - } - - for (var i = 0; i < targets.length; i += 2) { - if ((targets[i] === object) && (targets[i + 1] === method)) { - if (targets.length == 2) { - return null; - } - targets.splice(i, 2); - return ss.Delegate._create(targets); - } - } - - return delegate1; -} - -ss.Delegate.createExport = function#? DEBUG Delegate$createExport##(delegate, multiUse, name) { - // Generate a unique name if one is not specified - name = name || '__' + (new Date()).valueOf(); - - // Exported delegates go on global object (so they are callable using a simple identifier). - - // Multi-use delegates are exported directly; for the rest a stub is exported, and the stub - // first deletes, and then invokes the actual delegate. - global[name] = multiUse ? delegate : function() { - try { delete global[name]; } catch(e) { global[name] = undefined; } - delegate.apply(null, arguments); - }; - - return name; -} - -ss.Delegate.deleteExport = function#? DEBUG Delegate$deleteExport##(name) { - delete global[name]; -} - -ss.Delegate.clearExport = function#? DEBUG Delegate$clearExport##(name) { - global[name] = ss.Delegate.empty; -} diff --git a/src/Core/CoreScript/BCL/EventArgs.js b/src/Core/CoreScript/BCL/EventArgs.js deleted file mode 100644 index cced080ca..000000000 --- a/src/Core/CoreScript/BCL/EventArgs.js +++ /dev/null @@ -1,8 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// EventArgs - -ss.EventArgs = function#? DEBUG EventArgs$##() { -} -ss.EventArgs.registerClass('EventArgs'); - -ss.EventArgs.Empty = new ss.EventArgs(); diff --git a/src/Core/CoreScript/BCL/IDisposable.js b/src/Core/CoreScript/BCL/IDisposable.js deleted file mode 100644 index 707bcc387..000000000 --- a/src/Core/CoreScript/BCL/IDisposable.js +++ /dev/null @@ -1,10 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// IDisposable - -ss.IDisposable = function#? DEBUG IDisposable$##() { }; -#if DEBUG -ss.IDisposable.prototype = { - dispose: null -} -#endif // DEBUG -ss.IDisposable.registerInterface('IDisposable'); diff --git a/src/Core/CoreScript/BCL/IEnumerable.js b/src/Core/CoreScript/BCL/IEnumerable.js deleted file mode 100644 index 866b36bcf..000000000 --- a/src/Core/CoreScript/BCL/IEnumerable.js +++ /dev/null @@ -1,10 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// IEnumerable - -ss.IEnumerable = function#? DEBUG IEnumerable$##() { }; -#if DEBUG -ss.IEnumerable.prototype = { - getEnumerator: null -} -#endif // DEBUG -ss.IEnumerable.registerInterface('IEnumerable'); diff --git a/src/Core/CoreScript/BCL/IEnumerator.js b/src/Core/CoreScript/BCL/IEnumerator.js deleted file mode 100644 index eb1f6a7a9..000000000 --- a/src/Core/CoreScript/BCL/IEnumerator.js +++ /dev/null @@ -1,20 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// IEnumerator - -ss.IEnumerator = function#? DEBUG IEnumerator$##() { }; -#if DEBUG -ss.IEnumerator.prototype = { - get_current: null, - moveNext: null, - reset: null -} -#endif // DEBUG - -ss.IEnumerator.getEnumerator = function#? DEBUG ss_IEnumerator$getEnumerator##(enumerable) { - if (enumerable) { - return enumerable.getEnumerator ? enumerable.getEnumerator() : new ss.ArrayEnumerator(enumerable); - } - return null; -} - -ss.IEnumerator.registerInterface('IEnumerator'); diff --git a/src/Core/CoreScript/BCL/Observable.js b/src/Core/CoreScript/BCL/Observable.js deleted file mode 100644 index 464fee830..000000000 --- a/src/Core/CoreScript/BCL/Observable.js +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Observable - -ss.Observable = function(v) { - this._v = v; - this._observers = null; -} -ss.Observable.prototype = { - - getValue: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._v; - }, - setValue: function (v) { - if (this._v !== v) { - this._v = v; - - var observers = this._observers; - if (observers) { - this._observers = null; - ss.Observable._invalidateObservers(observers); - } - } - } -}; - -ss.Observable._observerStack = []; -ss.Observable._observerRegistration = { - dispose: function () { - ss.Observable._observerStack.pop(); - } -} -ss.Observable.registerObserver = function (o) { - ss.Observable._observerStack.push(o); - return ss.Observable._observerRegistration; -} -ss.Observable._captureObservers = function (observers) { - var registeredObservers = ss.Observable._observerStack; - var observerCount = registeredObservers.length; - - if (observerCount) { - observers = observers || []; - for (var i = 0; i < observerCount; i++) { - var observer = registeredObservers[i]; - if (!observers.contains(observer)) { - observers.push(observer); - } - } - return observers; - } - return null; -} -ss.Observable._invalidateObservers = function (observers) { - for (var i = 0, len = observers.length; i < len; i++) { - observers[i].invalidateObserver(); - } -} - -ss.Observable.registerClass('Observable'); - - -ss.ObservableCollection = function (items) { - this._items = items || []; - this._observers = null; -} -ss.ObservableCollection.prototype = { - - get_item: function (index) { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items[index]; - }, - set_item: function (index, item) { - this._items[index] = item; - this._updated(); - }, - get_length: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items.length; - }, - add: function (item) { - this._items.push(item); - this._updated(); - }, - clear: function () { - this._items.clear(); - this._updated(); - }, - contains: function (item) { - return this._items.contains(item); - }, - getEnumerator: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items.getEnumerator(); - }, - indexOf: function (item) { - return this._items.indexOf(item); - }, - insert: function (index, item) { - this._items.insert(index, item); - this._updated(); - }, - remove: function (item) { - if (this._items.remove(item)) { - this._updated(); - return true; - } - return false; - }, - removeAt: function (index) { - this._items.removeAt(index); - this._updated(); - }, - toArray: function () { - return this._items; - }, - _updated: function() { - var observers = this._observers; - if (observers) { - this._observers = null; - ss.Observable._invalidateObservers(observers); - } - } -} -ss.ObservableCollection.registerClass('ObservableCollection', null, ss.IEnumerable); diff --git a/src/Core/CoreScript/BCL/StringBuilder.js b/src/Core/CoreScript/BCL/StringBuilder.js deleted file mode 100644 index 4613da55a..000000000 --- a/src/Core/CoreScript/BCL/StringBuilder.js +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// StringBuilder - -ss.StringBuilder = function#? DEBUG StringBuilder$##(s) { - this._parts = ss.isNullOrUndefined(s) || s === '' ? [] : [s]; - this.isEmpty = this._parts.length == 0; -} -ss.StringBuilder.prototype = { - append: function#? DEBUG StringBuilder$append##(s) { - if (!ss.isNullOrUndefined(s) && s !== '') { - this._parts.add(s); - this.isEmpty = false; - } - return this; - }, - - appendLine: function#? DEBUG StringBuilder$appendLine##(s) { - this.append(s); - this.append('\r\n'); - this.isEmpty = false; - return this; - }, - - clear: function#? DEBUG StringBuilder$clear##() { - this._parts = []; - this.isEmpty = true; - }, - - toString: function#? DEBUG StringBuilder$toString##(s) { - return this._parts.join(s || ''); - } -}; - -ss.StringBuilder.registerClass('StringBuilder'); diff --git a/src/Core/CoreScript/BCL/Tuple.js b/src/Core/CoreScript/BCL/Tuple.js deleted file mode 100644 index ffc881939..000000000 --- a/src/Core/CoreScript/BCL/Tuple.js +++ /dev/null @@ -1,11 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Tuple - -ss.Tuple = function (first, second, third) { - this.first = first; - this.second = second; - if (arguments.length == 3) { - this.third = third; - } -} -ss.Tuple.registerClass('Tuple'); diff --git a/src/Core/CoreScript/CoreScript.csproj b/src/Core/CoreScript/CoreScript.csproj deleted file mode 100644 index 415ad76b9..000000000 --- a/src/Core/CoreScript/CoreScript.csproj +++ /dev/null @@ -1,55 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {8780581F-7C26-4B64-9235-BA1C458DF36E} - ..\..\..\tools\bin - - - ..\..\..\bin\Debug\ - - - ..\..\..\bin\Release\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Core/CoreScript/Extensions/Array.js b/src/Core/CoreScript/Extensions/Array.js deleted file mode 100644 index 43226a194..000000000 --- a/src/Core/CoreScript/Extensions/Array.js +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Array Extensions - -Array.__typeName = 'Array'; -Array.__interfaces = [ ss.IEnumerable ]; - -Array.prototype.add = function#? DEBUG Array$add##(item) { - this[this.length] = item; -} - -Array.prototype.addRange = function#? DEBUG Array$addRange##(items) { - this.push.apply(this, items); -} - -Array.prototype.clear = function#? DEBUG Array$clear##() { - this.length = 0; -} - -Array.prototype.clone = function#? DEBUG Array$clone##() { - if (this.length === 1) { - return [this[0]]; - } - else { - return Array.apply(null, this); - } -} - -Array.prototype.contains = function#? DEBUG Array$contains##(item) { - var index = this.indexOf(item); - return (index >= 0); -} - -Array.prototype.dequeue = function#? DEBUG Array$dequeue##() { - return this.shift(); -} - -Array.prototype.enqueue = function#? DEBUG Array$enqueue##(item) { - // We record that this array instance is a queue, so we - // can implement the right behavior in the peek method. - this._queue = true; - this.push(item); -} - -Array.prototype.peek = function#? DEBUG Array$peek##() { - if (this.length) { - var index = this._queue ? 0 : this.length - 1; - return this[index]; - } - return null; -} - -if (!Array.prototype.every) { - Array.prototype.every = function#? DEBUG Array$every##(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this && !callback.call(instance, this[i], i, this)) { - return false; - } - } - return true; - } -} - -Array.prototype.extract = function#? DEBUG Array$extract##(index, count) { - if (!count) { - return this.slice(index); - } - return this.slice(index, index + count); -} - -if (!Array.prototype.filter) { - Array.prototype.filter = function#? DEBUG Array$filter##(callback, instance) { - var length = this.length; - var filtered = []; - for (var i = 0; i < length; i++) { - if (i in this) { - var val = this[i]; - if (callback.call(instance, val, i, this)) { - filtered.push(val); - } - } - } - return filtered; - } -} - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function#? DEBUG Array$forEach##(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this) { - callback.call(instance, this[i], i, this); - } - } - } -} - -Array.prototype.getEnumerator = function#? DEBUG Array$getEnumerator##() { - return new ss.ArrayEnumerator(this); -} - -Array.prototype.groupBy = function#? DEBUG Array$groupBy##(callback, instance) { - var length = this.length; - var groups = []; - var keys = {}; - for (var i = 0; i < length; i++) { - if (i in this) { - var key = callback.call(instance, this[i], i); - if (String.isNullOrEmpty(key)) { - continue; - } - var items = keys[key]; - if (!items) { - items = []; - items.key = key; - - keys[key] = items; - groups.add(items); - } - items.add(this[i]); - } - } - return groups; -} - -Array.prototype.index = function#? DEBUG Array$index##(callback, instance) { - var length = this.length; - var items = {}; - for (var i = 0; i < length; i++) { - if (i in this) { - var key = callback.call(instance, this[i], i); - if (String.isNullOrEmpty(key)) { - continue; - } - items[key] = this[i]; - } - } - return items; -} - -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function#? DEBUG Array$indexOf##(item, startIndex) { - startIndex = startIndex || 0; - var length = this.length; - if (length) { - for (var index = startIndex; index < length; index++) { - if (this[index] === item) { - return index; - } - } - } - return -1; - } -} - -Array.prototype.insert = function#? DEBUG Array$insert##(index, item) { - this.splice(index, 0, item); -} - -Array.prototype.insertRange = function#? DEBUG Array$insertRange##(index, items) { - if (index === 0) { - this.unshift.apply(this, items); - } - else { - for (var i = 0; i < items.length; i++) { - this.splice(index + i, 0, items[i]); - } - } -} - -if (!Array.prototype.lastIndexOf) { - Array.prototype.lastIndexOf = function#? DEBUG Array$lastIndexOf##(item, fromIndex) { - fromIndex = fromIndex || this.length - 1; - for (var index = fromIndex; index >= 0; index--) { - if (this[index] === item) { - return index; - } - } - return -1; - } -} - -if (!Array.prototype.map) { - Array.prototype.map = function#? DEBUG Array$map##(callback, instance) { - var length = this.length; - var mapped = new Array(length); - for (var i = 0; i < length; i++) { - if (i in this) { - mapped[i] = callback.call(instance, this[i], i, this); - } - } - return mapped; - } -} - -Array.parse = function#? DEBUG Array$parse##(s) { - return eval('(' + s + ')'); -} - -if (!Array.prototype.reduce) { - Array.prototype.reduce = function#? DEBUG Array$reduce##(callback, initialValue) { - var value = initialValue; - var length = this.length; - if (length) { - var i = 0; - if (arguments.length == 1) { - value = this[0]; - i++; - } - for (; i < length; i++) { - value = callback(value, this[i], i, this); - } - } - return value; - } - Array.prototype.reduceRight = function#? DEBUG Array$reduceRight##(callback, initialValue) { - var value = initialValue; - var length = this.length; - if (length) { - var i = length - 1; - if (arguments.length == 1) { - value = this[i]; - i--; - } - for (; i >= 0; i--) { - value = callback(value, this[i], i, this); - } - } - return value; - } -} - -Array.prototype.remove = function#? DEBUG Array$remove##(item) { - var index = this.indexOf(item); - if (index >= 0) { - this.splice(index, 1); - return true; - } - return false; -} - -Array.prototype.removeAt = function#? DEBUG Array$removeAt##(index) { - this.splice(index, 1); -} - -Array.prototype.removeRange = function#? DEBUG Array$removeRange##(index, count) { - return this.splice(index, count); -} - -if (!Array.prototype.some) { - Array.prototype.some = function#? DEBUG Array$some##(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this && callback.call(instance, this[i], i, this)) { - return true; - } - } - return false; - } -} - -Array.toArray = function#? DEBUG Array$toArray##(obj) { - return Array.prototype.slice.call(obj); -} diff --git a/src/Core/CoreScript/Extensions/Boolean.js b/src/Core/CoreScript/Extensions/Boolean.js deleted file mode 100644 index 558d86217..000000000 --- a/src/Core/CoreScript/Extensions/Boolean.js +++ /dev/null @@ -1,8 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Boolean Extensions - -Boolean.__typeName = 'Boolean'; - -Boolean.parse = function#? DEBUG Boolean$parse##(s) { - return (s.toLowerCase() == 'true'); -} diff --git a/src/Core/CoreScript/Extensions/Date.js b/src/Core/CoreScript/Extensions/Date.js deleted file mode 100644 index 00bb0b0b5..000000000 --- a/src/Core/CoreScript/Extensions/Date.js +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Date Extensions - -Date.__typeName = 'Date'; - -Date.empty = null; - -Date.get_now = function#? DEBUG Date$get_now##() { - return new Date(); -} - -Date.get_today = function#? DEBUG Date$get_today##() { - var d = new Date(); - return new Date(d.getFullYear(), d.getMonth(), d.getDate()); -} - -Date.isEmpty = function#? DEBUG Date$isEmpty##(d) { - return (d === null) || (d.valueOf() === 0); -} - -Date.prototype.format = function#? DEBUG Date$format##(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toString(); - } - if (format == 'id') { - return this.toDateString(); - } - if (format == 'it') { - return this.toTimeString(); - } - - return this._netFormat(format, false); -} - -Date.prototype.localeFormat = function#? DEBUG Date$localeFormat##(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toLocaleString(); - } - if (format == 'id') { - return this.toLocaleDateString(); - } - if (format == 'it') { - return this.toLocaleTimeString(); - } - - return this._netFormat(format, true); -} - -Date.prototype._netFormat = function#? DEBUG Date$_netFormat##(format, useLocale) { - var dt = this; - var dtf = useLocale ? ss.CultureInfo.CurrentCulture.dateFormat : ss.CultureInfo.InvariantCulture.dateFormat; - - if (format.length == 1) { - switch (format) { - case 'f': format = dtf.longDatePattern + ' ' + dtf.shortTimePattern; break; - case 'F': format = dtf.dateTimePattern; break; - - case 'd': format = dtf.shortDatePattern; break; - case 'D': format = dtf.longDatePattern; break; - - case 't': format = dtf.shortTimePattern; break; - case 'T': format = dtf.longTimePattern; break; - - case 'g': format = dtf.shortDatePattern + ' ' + dtf.shortTimePattern; break; - case 'G': format = dtf.shortDatePattern + ' ' + dtf.longTimePattern; break; - - case 'R': case 'r': - dtf = ss.CultureInfo.InvariantCulture.dateFormat; - format = dtf.gmtDateTimePattern; - break; - case 'u': format = dtf.universalDateTimePattern; break; - case 'U': - format = dtf.dateTimePattern; - dt = new Date(dt.getUTCFullYear(), dt.getUTCMonth(), dt.getUTCDate(), - dt.getUTCHours(), dt.getUTCMinutes(), dt.getUTCSeconds(), dt.getUTCMilliseconds()); - break; - - case 's': format = dtf.sortableDateTimePattern; break; - } - } - - if (format.charAt(0) == '%') { - format = format.substr(1); - } - - if (!Date._formatRE) { - Date._formatRE = /'.*?[^\\]'|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g; - } - - var re = Date._formatRE; - var sb = new ss.StringBuilder(); - - re.lastIndex = 0; - while (true) { - var index = re.lastIndex; - var match = re.exec(format); - - sb.append(format.slice(index, match ? match.index : format.length)); - if (!match) { - break; - } - - var fs = match[0]; - var part = fs; - switch (fs) { - case 'dddd': - part = dtf.dayNames[dt.getDay()]; - break; - case 'ddd': - part = dtf.shortDayNames[dt.getDay()]; - break; - case 'dd': - part = dt.getDate().toString().padLeft(2, '0'); - break; - case 'd': - part = dt.getDate(); - break; - case 'MMMM': - part = dtf.monthNames[dt.getMonth()]; - break; - case 'MMM': - part = dtf.shortMonthNames[dt.getMonth()]; - break; - case 'MM': - part = (dt.getMonth() + 1).toString().padLeft(2, '0'); - break; - case 'M': - part = (dt.getMonth() + 1); - break; - case 'yyyy': - part = dt.getFullYear(); - break; - case 'yy': - part = (dt.getFullYear() % 100).toString().padLeft(2, '0'); - break; - case 'y': - part = (dt.getFullYear() % 100); - break; - case 'h': case 'hh': - part = dt.getHours() % 12; - if (!part) { - part = '12'; - } - else if (fs == 'hh') { - part = part.toString().padLeft(2, '0'); - } - break; - case 'HH': - part = dt.getHours().toString().padLeft(2, '0'); - break; - case 'H': - part = dt.getHours(); - break; - case 'mm': - part = dt.getMinutes().toString().padLeft(2, '0'); - break; - case 'm': - part = dt.getMinutes(); - break; - case 'ss': - part = dt.getSeconds().toString().padLeft(2, '0'); - break; - case 's': - part = dt.getSeconds(); - break; - case 't': case 'tt': - part = (dt.getHours() < 12) ? dtf.amDesignator : dtf.pmDesignator; - if (fs == 't') { - part = part.charAt(0); - } - break; - case 'fff': - part = dt.getMilliseconds().toString().padLeft(3, '0'); - break; - case 'ff': - part = dt.getMilliseconds().toString().padLeft(3).substr(0, 2); - break; - case 'f': - part = dt.getMilliseconds().toString().padLeft(3).charAt(0); - break; - case 'z': - part = dt.getTimezoneOffset() / 60; - part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)); - break; - case 'zz': case 'zzz': - part = dt.getTimezoneOffset() / 60; - part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)).toString().padLeft(2, '0'); - if (fs == 'zzz') { - part += dtf.timeSeparator + Math.abs(dt.getTimezoneOffset() % 60).toString().padLeft(2, '0'); - } - break; - default: - if (part.charAt(0) == '\'') { - part = part.substr(1, part.length - 2).replace(/\\'/g, '\''); - } - break; - } - sb.append(part); - } - - return sb.toString(); -} - -Date.parseDate = function#? DEBUG Date$parse##(s) { - // Date.parse returns the number of milliseconds - // so we use that to create an actual Date instance - return new Date(Date.parse(s)); -} diff --git a/src/Core/CoreScript/Extensions/Error.js b/src/Core/CoreScript/Extensions/Error.js deleted file mode 100644 index 72085e441..000000000 --- a/src/Core/CoreScript/Extensions/Error.js +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Error Extensions - -Error.__typeName = 'Error'; - -Error.prototype.popStackFrame = function Error$popStackFrame() { - if (ss.isNullOrUndefined(this.stack) || - ss.isNullOrUndefined(this.fileName) || - ss.isNullOrUndefined(this.lineNumber)) { - return; - } - - var stackFrames = this.stack.split('\n'); - var currentFrame = stackFrames[0]; - var pattern = this.fileName + ':' + this.lineNumber; - while (!ss.isNullOrUndefined(currentFrame) && - currentFrame.indexOf(pattern) === -1) { - stackFrames.shift(); - currentFrame = stackFrames[0]; - } - - var nextFrame = stackFrames[1]; - if (isNullOrUndefined(nextFrame)) { - return; - } - - var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/); - if (ss.isNullOrUndefined(nextFrameParts)) { - return; - } - - stackFrames.shift(); - this.stack = stackFrames.join("\n"); - this.fileName = nextFrameParts[1]; - this.lineNumber = parseInt(nextFrameParts[2]); -} - -Error.createError = function#? DEBUG Error$createError##(message, errorInfo, innerException) { - var e = new Error(message); - if (errorInfo) { - for (var v in errorInfo) { - e[v] = errorInfo[v]; - } - } - if (innerException) { - e.innerException = innerException; - } - - e.popStackFrame(); - return e; -} diff --git a/src/Core/CoreScript/Extensions/Number.js b/src/Core/CoreScript/Extensions/Number.js deleted file mode 100644 index 7763aefcb..000000000 --- a/src/Core/CoreScript/Extensions/Number.js +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Number Extensions - -Number.__typeName = 'Number'; - -Number.parse = function#? DEBUG Number$parse##(s) { - if (!s || !s.length) { - return 0; - } - if ((s.indexOf('.') >= 0) || (s.indexOf('e') >= 0) || - s.endsWith('f') || s.endsWith('F')) { - return parseFloat(s); - } - return parseInt(s, 10); -} - -Number.prototype.format = function#? DEBUG Number$format##(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toString(); - } - return this._netFormat(format, false); -} - -Number.prototype.localeFormat = function#? DEBUG Number$format##(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toLocaleString(); - } - return this._netFormat(format, true); -} - -Number._commaFormat = function#? DEBUG Number$_commaFormat##(number, groups, decimal, comma) { - var decimalPart = null; - var decimalIndex = number.indexOf(decimal); - if (decimalIndex > 0) { - decimalPart = number.substr(decimalIndex); - number = number.substr(0, decimalIndex); - } - - var negative = number.startsWith('-'); - if (negative) { - number = number.substr(1); - } - - var groupIndex = 0; - var groupSize = groups[groupIndex]; - if (number.length < groupSize) { - return decimalPart ? number + decimalPart : number; - } - - var index = number.length; - var s = ''; - var done = false; - while (!done) { - var length = groupSize; - var startIndex = index - length; - if (startIndex < 0) { - groupSize += startIndex; - length += startIndex; - startIndex = 0; - done = true; - } - if (!length) { - break; - } - - var part = number.substr(startIndex, length); - if (s.length) { - s = part + comma + s; - } - else { - s = part; - } - index -= length; - - if (groupIndex < groups.length - 1) { - groupIndex++; - groupSize = groups[groupIndex]; - } - } - - if (negative) { - s = '-' + s; - } - return decimalPart ? s + decimalPart : s; -} - -Number.prototype._netFormat = function#? DEBUG Number$_netFormat##(format, useLocale) { - var nf = useLocale ? ss.CultureInfo.CurrentCulture.numberFormat : ss.CultureInfo.InvariantCulture.numberFormat; - - var s = ''; - var precision = -1; - - if (format.length > 1) { - precision = parseInt(format.substr(1)); - } - - var fs = format.charAt(0); - switch (fs) { - case 'd': case 'D': - s = parseInt(Math.abs(this)).toString(); - if (precision != -1) { - s = s.padLeft(precision, '0'); - } - if (this < 0) { - s = '-' + s; - } - break; - case 'x': case 'X': - s = parseInt(Math.abs(this)).toString(16); - if (fs == 'X') { - s = s.toUpperCase(); - } - if (precision != -1) { - s = s.padLeft(precision, '0'); - } - break; - case 'e': case 'E': - if (precision == -1) { - s = this.toExponential(); - } - else { - s = this.toExponential(precision); - } - if (fs == 'E') { - s = s.toUpperCase(); - } - break; - case 'f': case 'F': - case 'n': case 'N': - if (precision == -1) { - precision = nf.numberDecimalDigits; - } - s = this.toFixed(precision).toString(); - if (precision && (nf.numberDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.numberDecimalSeparator + s.substr(index + 1); - } - if ((fs == 'n') || (fs == 'N')) { - s = Number._commaFormat(s, nf.numberGroupSizes, nf.numberDecimalSeparator, nf.numberGroupSeparator); - } - break; - case 'c': case 'C': - if (precision == -1) { - precision = nf.currencyDecimalDigits; - } - s = Math.abs(this).toFixed(precision).toString(); - if (precision && (nf.currencyDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.currencyDecimalSeparator + s.substr(index + 1); - } - s = Number._commaFormat(s, nf.currencyGroupSizes, nf.currencyDecimalSeparator, nf.currencyGroupSeparator); - if (this < 0) { - s = String.format(nf.currencyNegativePattern, s); - } - else { - s = String.format(nf.currencyPositivePattern, s); - } - break; - case 'p': case 'P': - if (precision == -1) { - precision = nf.percentDecimalDigits; - } - s = (Math.abs(this) * 100.0).toFixed(precision).toString(); - if (precision && (nf.percentDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.percentDecimalSeparator + s.substr(index + 1); - } - s = Number._commaFormat(s, nf.percentGroupSizes, nf.percentDecimalSeparator, nf.percentGroupSeparator); - if (this < 0) { - s = String.format(nf.percentNegativePattern, s); - } - else { - s = String.format(nf.percentPositivePattern, s); - } - break; - } - - return s; -} diff --git a/src/Core/CoreScript/Extensions/Object.js b/src/Core/CoreScript/Extensions/Object.js deleted file mode 100644 index 42d1723d7..000000000 --- a/src/Core/CoreScript/Extensions/Object.js +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Object Extensions - -Object.__typeName = 'Object'; -Object.__baseType = null; - -Object.clearKeys = function#? DEBUG Object$clearKeys##(d) { - for (var n in d) { - delete d[n]; - } -} - -Object.keyExists = function#? DEBUG Object$keyExists##(d, key) { - return d[key] !== undefined; -} - -if (!Object.keys) { - Object.keys = function#? DEBUG Object$keys##(d) { - var keys = []; - for (var n in d) { - keys.push(n); - } - return keys; - } - - Object.getKeyCount = function#? DEBUG Object$getKeyCount##(d) { - var count = 0; - for (var n in d) { - count++; - } - return count; - } -} -else { - Object.getKeyCount = function#? DEBUG Object$getKeyCount##(d) { - return Object.keys(d).length; - } -} diff --git a/src/Core/CoreScript/Extensions/RegExp.js b/src/Core/CoreScript/Extensions/RegExp.js deleted file mode 100644 index ea0ec4cef..000000000 --- a/src/Core/CoreScript/Extensions/RegExp.js +++ /dev/null @@ -1,17 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// RegExp Extensions - -RegExp.__typeName = 'RegExp'; - -RegExp.parse = function#? DEBUG RegExp$parse##(s) { - if (s.startsWith('/')) { - var endSlashIndex = s.lastIndexOf('/'); - if (endSlashIndex > 1) { - var expression = s.substring(1, endSlashIndex); - var flags = s.substr(endSlashIndex + 1); - return new RegExp(expression, flags); - } - } - - return null; -} diff --git a/src/Core/CoreScript/Extensions/String.js b/src/Core/CoreScript/Extensions/String.js deleted file mode 100644 index 5f19f6ebb..000000000 --- a/src/Core/CoreScript/Extensions/String.js +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// String Extensions - -String.__typeName = 'String'; -String.Empty = ''; - -String.compare = function#? DEBUG String$compare##(s1, s2, ignoreCase) { - if (ignoreCase) { - if (s1) { - s1 = s1.toUpperCase(); - } - if (s2) { - s2 = s2.toUpperCase(); - } - } - s1 = s1 || ''; - s2 = s2 || ''; - - if (s1 == s2) { - return 0; - } - if (s1 < s2) { - return -1; - } - return 1; -} - -String.prototype.compareTo = function#? DEBUG String$compareTo##(s, ignoreCase) { - return String.compare(this, s, ignoreCase); -} - -String.concat = function#? DEBUG String$concat##() { - if (arguments.length === 2) { - return arguments[0] + arguments[1]; - } - return Array.prototype.join.call(arguments, ''); -} - -String.prototype.endsWith = function#? DEBUG String$endsWith##(suffix) { - if (!suffix.length) { - return true; - } - if (suffix.length > this.length) { - return false; - } - return (this.substr(this.length - suffix.length) == suffix); -} - -String.equals = function#? DEBUG String$equals1##(s1, s2, ignoreCase) { - return String.compare(s1, s2, ignoreCase) == 0; -} - -String._format = function#? DEBUG String$_format##(format, values, useLocale) { - if (!String._formatRE) { - String._formatRE = /(\{[^\}^\{]+\})/g; - } - - return format.replace(String._formatRE, - function(str, m) { - var index = parseInt(m.substr(1)); - var value = values[index + 1]; - if (ss.isNullOrUndefined(value)) { - return ''; - } - if (value.format) { - var formatSpec = null; - var formatIndex = m.indexOf(':'); - if (formatIndex > 0) { - formatSpec = m.substring(formatIndex + 1, m.length - 1); - } - return useLocale ? value.localeFormat(formatSpec) : value.format(formatSpec); - } - else { - return useLocale ? value.toLocaleString() : value.toString(); - } - }); -} - -String.format = function#? DEBUG String$format##(format) { - return String._format(format, arguments, /* useLocale */ false); -} - -String.fromChar = function#? DEBUG String$fromChar##(ch, count) { - var s = ch; - for (var i = 1; i < count; i++) { - s += ch; - } - return s; -} - -String.prototype.htmlDecode = function#? DEBUG String$htmlDecode##() { - var div = document.createElement('div'); - div.innerHTML = this; - return div.textContent || div.innerText; -} - -String.prototype.htmlEncode = function#? DEBUG String$htmlEncode##() { - var div = document.createElement('div'); - div.appendChild(document.createTextNode(this)); - return div.innerHTML.replace(/\"/g, '"'); -} - -String.prototype.indexOfAny = function#? DEBUG String$indexOfAny##(chars, startIndex, count) { - var length = this.length; - if (!length) { - return -1; - } - - startIndex = startIndex || 0; - count = count || length; - - var endIndex = startIndex + count - 1; - if (endIndex >= length) { - endIndex = length - 1; - } - - for (var i = startIndex; i <= endIndex; i++) { - if (chars.indexOf(this.charAt(i)) >= 0) { - return i; - } - } - return -1; -} - -String.prototype.insert = function#? DEBUG String$insert##(index, value) { - if (!value) { - return this.valueOf(); - } - if (!index) { - return value + this; - } - var s1 = this.substr(0, index); - var s2 = this.substr(index); - return s1 + value + s2; -} - -String.isNullOrEmpty = function#? DEBUG String$isNullOrEmpty##(s) { - return !s || !s.length; -} - -String.isNullOrWhiteSpace = function#? DEBUG String$isNullOrWhiteSpace##(s) { - return String.isNullOrEmpty(s) || s.trim() === ""; -} - -String.prototype.lastIndexOfAny = function#? DEBUG String$lastIndexOfAny##(chars, startIndex, count) { - var length = this.length; - if (!length) { - return -1; - } - - startIndex = startIndex || length - 1; - count = count || length; - - var endIndex = startIndex - count + 1; - if (endIndex < 0) { - endIndex = 0; - } - - for (var i = startIndex; i >= endIndex; i--) { - if (chars.indexOf(this.charAt(i)) >= 0) { - return i; - } - } - return -1; -} - -String.localeFormat = function#? DEBUG String$localeFormat##(format) { - return String._format(format, arguments, /* useLocale */ true); -} - -String.prototype.padLeft = function#? DEBUG String$padLeft##(totalWidth, ch) { - if (this.length < totalWidth) { - ch = ch || ' '; - return String.fromChar(ch, totalWidth - this.length) + this; - } - return this.valueOf(); -} - -String.prototype.padRight = function#? DEBUG String$padRight##(totalWidth, ch) { - if (this.length < totalWidth) { - ch = ch || ' '; - return this + String.fromChar(ch, totalWidth - this.length); - } - return this.valueOf(); -} - -String.prototype.remove = function#? DEBUG String$remove##(index, count) { - if (!count || ((index + count) > this.length)) { - return this.substr(0, index); - } - return this.substr(0, index) + this.substr(index + count); -} - -String.prototype.replaceAll = function#? DEBUG String$replaceAll##(oldValue, newValue) { - newValue = newValue || ''; - return this.split(oldValue).join(newValue); -} - -String.prototype.startsWith = function#? DEBUG String$startsWith##(prefix) { - if (!prefix.length) { - return true; - } - if (prefix.length > this.length) { - return false; - } - return (this.substr(0, prefix.length) == prefix); -} - -if (!String.prototype.trim) { - String.prototype.trim = function#? DEBUG String$trim##() { - return this.trimEnd().trimStart(); - } -} - -String.prototype.trimEnd = function#? DEBUG String$trimEnd##() { - return this.replace(/\s*$/, ''); -} - -String.prototype.trimStart = function#? DEBUG String$trimStart##() { - return this.replace(/^\s*/, ''); -} diff --git a/src/Core/CoreScript/TypeSystem/Type.js b/src/Core/CoreScript/TypeSystem/Type.js deleted file mode 100644 index d8cf9c465..000000000 --- a/src/Core/CoreScript/TypeSystem/Type.js +++ /dev/null @@ -1,235 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Type System Implementation - -global.Type = Function; -Type.__typeName = 'Type'; - -var __namespaces = {}; -var __rootNamespaces = []; - -function ns(name) { - this.__typeName = name; -} -ns.prototype = { - __namespace: true, - getName: function() { - return this.__typeName; - } -} - -Type.registerNamespace = function#? DEBUG Type$registerNamespace##(name) { - if (__namespaces[name]) { - return; - } - - var nsi = global; - var nameParts = name.split('.'); - - for (var i = 0; i < nameParts.length; i++) { - var part = nameParts[i]; - var nso = nsi[part]; - if (!nso) { - nsi[part] = nso = new ns(nameParts.slice(0, i + 1).join('.')); - if (i == 0) { - __rootNamespaces.add(nso); - } - } - nsi = nso; - } - - __namespaces[name] = nsi; -} - -Type.prototype.registerClass = function#? DEBUG Type$registerClass##(name, baseType, interfaceType) { - this.prototype.constructor = this; - this.__typeName = name; - this.__class = true; - this.__baseType = baseType || Object; - if (baseType) { - this.__basePrototypePending = true; - } - - if (interfaceType) { - this.__interfaces = []; - for (var i = 2; i < arguments.length; i++) { - interfaceType = arguments[i]; - this.__interfaces.add(interfaceType); - } - } -} - -Type.prototype.registerInterface = function#? DEBUG Type$createInterface##(name) { - this.__typeName = name; - this.__interface = true; -} - -Type.prototype.registerEnum = function#? DEBUG Type$createEnum##(name, flags) { - for (var field in this.prototype) { - this[field] = this.prototype[field]; - } - - this.__typeName = name; - this.__enum = true; - if (flags) { - this.__flags = true; - } -} - -Type.prototype.setupBase = function#? DEBUG Type$setupBase##() { - if (this.__basePrototypePending) { - var baseType = this.__baseType; - if (baseType.__basePrototypePending) { - baseType.setupBase(); - } - - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!this.prototype[memberName]) { - this.prototype[memberName] = memberValue; - } - } - - delete this.__basePrototypePending; - } -} - -if (!Type.prototype.resolveInheritance) { - // This function is not used by Script#; Visual Studio relies on it - // for JavaScript IntelliSense support of derived types. - Type.prototype.resolveInheritance = Type.prototype.setupBase; -} - -Type.prototype.initializeBase = function#? DEBUG Type$initializeBase##(instance, args) { - if (this.__basePrototypePending) { - this.setupBase(); - } - - if (!args) { - this.__baseType.apply(instance); - } - else { - this.__baseType.apply(instance, args); - } -} - -Type.prototype.callBaseMethod = function#? DEBUG Type$callBaseMethod##(instance, name, args) { - var baseMethod = this.__baseType.prototype[name]; - if (!args) { - return baseMethod.apply(instance); - } - else { - return baseMethod.apply(instance, args); - } -} - -Type.prototype.get_baseType = function#? DEBUG Type$get_baseType##() { - return this.__baseType || null; -} - -Type.prototype.get_fullName = function#? DEBUG Type$get_fullName##() { - return this.__typeName; -} - -Type.prototype.get_name = function#? DEBUG Type$get_name##() { - var fullName = this.__typeName; - var nsIndex = fullName.lastIndexOf('.'); - if (nsIndex > 0) { - return fullName.substr(nsIndex + 1); - } - return fullName; -} - -Type.prototype.isInstanceOfType = function#? DEBUG Type$isInstanceOfType##(instance) { - if (ss.isNullOrUndefined(instance)) { - return false; - } - if ((this == Object) || (instance instanceof this)) { - return true; - } - - var type = Type.getInstanceType(instance); - return this.isAssignableFrom(type); -} - -Type.prototype.isAssignableFrom = function#? DEBUG Type$isAssignableFrom##(type) { - if ((this == Object) || (this == type)) { - return true; - } - if (this.__class) { - var baseType = type.__baseType; - while (baseType) { - if (this == baseType) { - return true; - } - baseType = baseType.__baseType; - } - } - else if (this.__interface) { - var interfaces = type.__interfaces; - if (interfaces && interfaces.contains(this)) { - return true; - } - - var baseType = type.__baseType; - while (baseType) { - interfaces = baseType.__interfaces; - if (interfaces && interfaces.contains(this)) { - return true; - } - baseType = baseType.__baseType; - } - } - return false; -} - -Type.isClass = function#? DEBUG Type$isClass##(obj) { - return (obj.__class == true); -} - -Type.isInterface = function#? DEBUG Type$isInterface##(obj) { - return (obj.__interface == true); -} - -Type.canCast = function#? DEBUG Type$canCast##(instance, type) { - return type.isInstanceOfType(instance); -} - -Type.safeCast = function#? DEBUG Type$safeCast##(instance, type) { - if (type.isInstanceOfType(instance)) { - return instance; - } - return null; -} - -Type.getInstanceType = function#? DEBUG Type$getInstanceType##(instance) { - var ctor = null; - - // NOTE: We have to catch exceptions because the constructor - // cannot be looked up on native COM objects - try { - ctor = instance.constructor; - } - catch (ex) { - } - if (!ctor || !ctor.__typeName) { - ctor = Object; - } - return ctor; -} - -Type.getType = function#? DEBUG Type$getType##(typeName) { - if (!typeName) { - return null; - } - - if (!Type.__typeCache) { - Type.__typeCache = {}; - } - - var type = Type.__typeCache[typeName]; - if (!type) { - type = eval(typeName); - Type.__typeCache[typeName] = type; - } - return type; -} diff --git a/src/Core/CoreScript/loader.js b/src/Core/CoreScript/loader.js deleted file mode 100644 index b938a520a..000000000 --- a/src/Core/CoreScript/loader.js +++ /dev/null @@ -1,492 +0,0 @@ -(function () { - var _head = document.getElementsByTagName('head')[0]; - - var _downloaderType = navigator.userAgent.indexOf('MSIE') > 0 ? 'img' : 'object'; - var _xdomainRegex = /^https?:\/\/.*/; - - // Storage cookie defaults to 'scripts', but can be overriden via a scriptCookie - // expando on the document. - var _storageCookie = document.scriptCookie || 'scripts'; - - // Debuggable scripts defaults to false, but can be overriden via a scriptDebugging - // flag set to true on the document object. - var _debuggableScripts = document.scriptDebugging || false; - - // The script loader provides functionality to download scripts from the network - // and load/save from/to local storage. A script loader can be specified on the - // document, and if not a default implementation if used here. - var _scriptLoader = document.scriptLoader || - { - download: function (script, callback) { - // Use the x-domain loader if the script is x-domain, or we're - // in debug mode (when using the x-domain loader, we end up - // inserting an actual script element to subsequently load the script - // into the page, enabling debugging) - - if (_debuggableScripts || _xdomainRegex.test(script.src)) { - // Downloads script using an img tag (in IE) or an object tag (in other - // browsers). - var downloader = document.createElement(_downloaderType); - downloader.style.width = downloader.style.height = '0px'; - downloader.onload = downloader.onerror = function () { - downloader.onload = downloader.onerror = null; - callback(); - }; - downloader.src = downloader.data = script.src; - document.body.appendChild(downloader); - } - else { - // Downloads script using an XHR object. This allows us to retrieve the - // content of the script and thereby allow us to subsequently use the - // script text to insert a script element into the page, when the time - // comes to load the script. - var downloader = new XMLHttpRequest(); - downloader.onreadystatechange = function () { - if (downloader.readyState == 4) { - downloader.onreadystatechange = null; - - script.useText = true; - script.text = downloader.responseText; - callback(); - } - }; - downloader.open('GET', script.src, true); - downloader.send(); - } - }, - - canStore: !!window.localStorage, - - load: function (name) { - return window.localStorage['script.' + name]; - }, - - save: function (name, version, text) { - window.localStorage['script.' + name] = text; - - // Save the fact that we have stored this script into the local storage - // by updating the index with the new script information, and using - // the index as the value of the cookie sent to the server as well. - var scriptIndex = window.localStorage['script.$']; - - scriptIndex = scriptIndex ? JSON.parse(scriptIndex) : {}; - scriptIndex[name] = version; - - scriptIndex = JSON.stringify(scriptIndex); - window.localStorage['script.$'] = scriptIndex; - - // A cookie with 180 days = 60 * 60 * 24 * 180 seconds - document.cookie = _storageCookie + '=' + encodeURIComponent(scriptIndex) + - '; max-age=15552000; path=/'; - } - }; - - var _initCallbacks = []; - var _readyCallbacks = []; - var _registeredScripts = {}; - var _started = false; - - // Checks if the specified required scripts have been loaded. - function checkScripts(name, requiredNames) { - if (requiredNames) { - requiredNames.split(',').forEach(function (s) { - if (!_registeredScripts[s] || !_registeredScripts[s].loaded) { - console.error(s + ' has not been loaded before ' + name); - } - }); - } - } - - // Loads the specified script or scripts (identified by their registered - // names) and invokes the specified callback (along with optional context) - // when the scripts have been loaded. - function loadScripts(scriptNames, callback, context) { - scriptNames = scriptNames['push'] ? scriptNames : [scriptNames]; - _loadScripts(scriptNames, callback, context); - } - - // Registers a callback to be invoked before script initialization occurs. - // This is raised in response to the DOMContentLoaded event. - // If initialization is complete, the callback is immediately invoked. - function registerInitCallback(callback) { - _initCallbacks ? _initCallbacks.push(callback) : setTimeout(callback, 0); - } - - // Registers a callback to be invoked once startup scripts have been loaded - // into the page, and any inline scripts have been executed. - // If the page is ready, the callback is immediately invoked. - function registerReadyCallback(callback) { - _readyCallbacks ? _readyCallbacks.push(callback) : setTimeout(callback, 0); - } - - // Registers a script programmatically. A script object has the following - // structure: - // { - // name: , - // src: , - // requires: - // } - function registerScript(script) { - script.loaded = false; - _registeredScripts[script.name] = script; - } - - // Downloads the script into the browser's cache, and invokes the specified - // callback (optional) upon completion. The script is not loaded into the page, - // i.e. it is not executed just yet. - function _downloadScript(script, callback) { - if (script.downloaded) { - // Already downloaded, so invoke the callback immediately. - if (callback) { - callback(script); - } - return; - } - if (script.store && _scriptLoader.canStore) { - if (script.store == 'load') { - // Load the script content from local storage using the script name - // as a key into local storage. - script.useText = true; - script.text = _scriptLoader.load(script.name); - } - else { - // Save the inline script content using specified version into local - // storage, using the name as a key. The value of data-store on the - // script element is interpreted as the version identifier. - - script.useText = true; - _scriptLoader.save(script.name, script.store, script.text); - } - - script.downloaded = true; - if (callback) { - callback(script); - } - return; - } - if (script.downloading) { - // The script is already being downloaded, so just tack on the - // callback to the script element. - if (callback) { - if (!script.downloadCallbacks) { - script.downloadCallbacks = [callback]; - } - else { - script.downloadCallbacks.push(callback); - } - } - return; - } - - script.downloading = true; - - var cb = function () { - script.downloaded = true; - script.downloading = false; - if (callback) { - callback(script); - } - if (script.downloadCallbacks) { - script.downloadCallbacks.forEach(function (cb) { - cb(script); - }); - delete script.downloadCallbacks; - } - }; - - _scriptLoader.download(script, cb); - } - - // Loads the script into the page, by inserting an actual script element, - // and invoking the specified callback once the script has been loaded. - function _execScript(script, callback) { - if (script.loaded) { - // Already loaded. Invoke the callback immediately. - callback(script); - return; - } - - var s = document.createElement('script'); - s.type = 'text/javascript'; - if (script.useText) { - // Load the script with script content inline. This allows us to load script - // while making sure another download is not incurred. - s.text = script.text; - setTimeout(function () { - script.loaded = true; - callback(script); - }, 0); - } - else { - // Load the script with its src. This ensures the script is debuggable, i.e. listed - // within the browser's loaded scripts. - s.onload = s.onreadystatechange = function () { - if (s.readyState && s.readyState != 'complete' && s.readyState != 'loaded') { - return; - } - s.onload = s.onreadystatechange = null; - script.loaded = true; - callback(script); - }; - s.src = script.src; - } - _head.appendChild(s); - } - - // Loads script with script content inline. - function _evalScript(script) { - var s = document.createElement('script'); - s.type = 'text/javascript'; - s.text = script.text; - _head.appendChild(s); - } - - // Helper to invoke a set of callbacks. - function _invokeCallbacks(callbacks) { - if (callbacks && callbacks.length) { - callbacks.forEach(function (callback) { - callback(); - }); - } - } - - // Loads a set of scripts and invokes the specified callback along - // with specified context. - function _loadScripts(scriptNames, callback, context) { - if (scriptNames.length == 0) { - callback(context); - return; - } - - var loadCount = 0; - var downloaded = []; - - // This is invoked everytime a script has been loaded/executed within the page. - function scriptLoaded(script) { - loadCount++; - if (scriptNames.length == loadCount) { - // All scripts have been loaded, so now invoke the passed in callback. - callback(context); - } - else { - if (downloaded.length) { - // Try to process any downloads that need to be downloaded, as this - // script might have been the dependency of one of those pending scripts. - processDownloaded(); - } - } - } - - // This is invoked everytime a script has been downloaded. We add it to the list - // of downloaded scripts and attempt to process it further. - function scriptDownloaded(script) { - downloaded.push(script); - processDownloaded(); - } - - // This processes a set of downloaded scripts. Any scripts whose dependencies - // have also been loaded will be executed. - function processDownloaded() { - // Hold on to the list of downloaded scripts needing to be processed - // in this iteration. - var scripts = downloaded; - if (scripts.length) { - // Reset the downloaded scripts array, so scripts can be added to it - // for being processed in a subsequent iteration. - downloaded = []; - scripts.forEach(function (script) { - var load = true; - if (script.requires) { - // Check if all dependencies have been loaded to determine if this - // script should now be loaded into the page. - load = script.requires.every(function (dependencyName) { - return _registeredScripts[dependencyName].loaded; - }); - } - if (load) { - _execScript(script, scriptLoaded); - } - else { - // A dependency has not yet been loaded, so re-add it to - // the list of downloads. The list of downloads will be - // re-examined when another script is downloaded or loaded - // into the page. - downloaded.push(script); - } - }); - } - } - - // Expand the list of script names to include any dependencies not - // already included in the list that haven't already been loaded. - var scriptMap = {}; - scriptNames.forEach(function (name) { - scriptMap[name] = name; - }); - - var i = 0; - do { - var script = _registeredScripts[scriptNames[i++]]; - if (script.requires) { - for (var j = script.requires.length - 1; j >= 0; j--) { - var dependencyName = script.requires[j]; - if (!scriptMap[dependencyName] && !_registeredScripts[dependencyName].loaded) { - // Found a dependency that needs to be included into the list - // of scripts to be loaded, since it is a required dependency. - scriptNames.push(dependencyName); - scriptMap[dependencyName] = dependencyName; - } - } - } - } while (i < scriptNames.length); - - // Kick off downloading any scripts that need to be downloaded. - // For those scripts that have been loaded, we don't need to attempt - // downloading/loading them, but we do need to track them, so we know when - // all required scripts have been loaded so as to invoke the passed in - // callback. - var done = true; - scriptNames.forEach(function (name) { - var script = _registeredScripts[name]; - if (script.loaded) { - loadCount++; - } - else { - _downloadScript(script, scriptDownloaded); - done = false; - } - }); - - // If we're done, i.e. all scripts were already loaded, then just go ahead - // and invoke the passed in callback. - if (done) { - callback(context); - } - } - - // Invoke any ready callbacks that have been registered. - function _raiseReady(deferredScripts) { - // Kick off downloads for any deferred scripts (but don't load them into the - // page just yet). - deferredScripts.forEach(function (name) { - var script = _registeredScripts[name]; - if (script.loaded) { - return; - } - _downloadScript(script); - }); - - var readyCallbacks = _readyCallbacks; - _readyCallbacks = null; - _invokeCallbacks(readyCallbacks); - } - - // Perform the page startup logic (in response to the DOMContentLoaded - // notification raised by the DOM document, or an explicit call to load). - function _startup() { - if (_started) { - return; - } - _started = true; - - // First invoke the registered init callbacks. This allows page code - // to programmatically register scripts. - var initCallbacks = _initCallbacks; - _initCallbacks = null; - _invokeCallbacks(initCallbacks); - - // Storage cookie defaults to 'scripts', but can be overriden via an - // attribute on the body element. - _storageCookie = document.body.getAttribute('data-scripts-cookie') || 'scripts'; - - var startupScripts = []; - var deferredScripts = []; - var inlineScripts = []; - - // Extract the list of registered scripts and inline scripts by enumerating - // script elements with type = text/script. - - var scriptElements = document.getElementsByTagName('script'); - for (var i = 0, count = scriptElements.length; i < count; i++) { - var scriptElement = scriptElements[i]; - if (scriptElement.type == 'text/script') { - var script = { - name: scriptElement.getAttribute('data-name'), - src: scriptElement.getAttribute('data-src'), - requires: scriptElement.getAttribute('data-requires'), - mode: scriptElement.getAttribute('data-mode') || 'startup', - text: scriptElement.text, - store: scriptElement.getAttribute('data-store') - }; - if (script.requires) { - script.requires = script.requires.split(','); - } - - if (script.name) { - registerScript(script); - if (script.mode == 'startup') { - startupScripts.push(script.name); - } - else if (script.mode == 'deferred') { - deferredScripts.push(script.name); - } - // TODO: Error check - script.mode must be 'ondemand' - } - else { - inlineScripts.push(script); - } - } - } - - // Load the startup scripts, and once that is done, execute any inline - // scripts there are on the page. - _loadScripts(startupScripts, function () { - var inlinesProcessed = 0; - if (inlineScripts.length) { - inlineScripts.forEach(function (script) { - if (script.requires) { - // If an inline script has a dependency on other scripts, ensure - // they are loaded first. - _loadScripts(script.requires, function (s) { - _evalScript(s); - inlinesProcessed++; - - // If all the inlines have been processed, then go ahead and invoke - // the ready callbacks. - if (inlinesProcessed == inlineScripts.length) { - _raiseReady(deferredScripts); - } - }, script); - } - else { - _evalScript(script); - inlinesProcessed++; - } - }); - } - - // If all the inlines have been processed, then go ahead and invoke - // the ready callbacks. - if (inlinesProcessed == inlineScripts.length) { - _raiseReady(deferredScripts); - } - }); - } - - window.loader = { - load: _startup, - loadScripts: loadScripts, - checkScripts: checkScripts, - registerScript: registerScript, - init: registerInitCallback, - ready: registerReadyCallback - }; - if (document.addEventListener) { - document.readyState == 'complete' ? _startup() : document.addEventListener('DOMContentLoaded', _startup, false); - } - else if (window.attachEvent) { - window.attachEvent('onload', function () { - _startup(); - }); - } -})(); diff --git a/src/Core/CoreScript/mscorlib.js b/src/Core/CoreScript/mscorlib.js deleted file mode 100644 index ea432309b..000000000 --- a/src/Core/CoreScript/mscorlib.js +++ /dev/null @@ -1,71 +0,0 @@ -//! Script# Core Runtime -//! More information at http://projects.nikhilk.net/ScriptSharp -//! - -(function(global) { - global.ss = { - version: '0.7.6.0', - - isUndefined: function(o) { - return (o === undefined); - }, - - isNull: function(o) { - return (o === null); - }, - - isNullOrUndefined: function(o) { - return (o === null) || (o === undefined); - }, - - isValue: function(o) { - return (o !== null) && (o !== undefined); - } - }; - -#include "Extensions\Object.js" - -#include "Extensions\Boolean.js" - -#include "Extensions\Number.js" - -#include "Extensions\String.js" - -#include "Extensions\Array.js" - -#include "Extensions\RegExp.js" - -#include "Extensions\Date.js" - -#include "Extensions\Error.js" - -#include "BCL\Debug.js" - -#include "TypeSystem\Type.js" - -#include "BCL\Delegate.js" - -#include "BCL\CultureInfo.js" - -#include "BCL\IEnumerator.js" - -#include "BCL\IEnumerable.js" - -#include "BCL\ArrayEnumerator.js" - -#include "BCL\IDisposable.js" - -#include "BCL\StringBuilder.js" - -#include "BCL\EventArgs.js" - -#include "BCL\CancelEventArgs.js" - -#include "BCL\Tuple.js" - -#include "BCL\Observable.js" - -#include "BCL\Task.js" - -#include "BCL\App.js" -})(this); diff --git a/src/Core/Scripts/Loader.js b/src/Core/Scripts/Loader.js new file mode 100644 index 000000000..324da6236 --- /dev/null +++ b/src/Core/Scripts/Loader.js @@ -0,0 +1,402 @@ +/*! Script# Loader + * Designed and licensed for use and distribution with Script#-generated scripts. + * Copyright (c) 2012, Nikhil Kothari, and the Script# Project. + * More information at http://scriptsharp.com + */ + +"use strict"; +(function(global) { + // Helpers + + function each(items, action) { + var results = []; + if (items) { + for (var i = 0, len = items.length; i < len; i++) { + results.push(action(items[i], i)); + } + } + return results; + } + + // Script management + // Each script has a name, and an associated url or script text. + // Scripts can be registered in advance using script tags on the page, + // either with a url: + // + // or with text: + // + // The use of text/script ensures the script does not run immediately. + // + // If a script has not been explicitly registered, a url can be created + // using a convention. The current convention is simply: + // /scripts/.js. + // + // Script registration provides additional capabilities: + // Auto-loading: If data-autoload is set to true, then the script is + // automatically loaded on startup. + // Pre-loading: If data-preload="true" is set, then after all startup + // scripts have been loaded, any preloadable scripts are + // loaded (but not executed). + // Pre-loading is only supported on scripts from the same + // domain. + // Local storage: If data-store is set on a script with inline text with + // the version of the script, it is saved to local storage. + // A scripts cookie is updated to indicate the client has + // a copy of the script, allowing the server to generate + // a script tag with data-store set to 'load'. This allows + // inlining the script on the first request which saves + // roundtrips, and not paying the price of inlining on + // subsequent requests. + // + // Scripts not following the AMD patten can be shimmed by explicitly + // specifying the exported object using data-export. Optionally dependencies + // can be specified as well, using the data-requires attribute. + // + // TODO: Provide ability to plug in other types of loaders (like for css + // and templates). + + var _xdomainRegex = /^https?:\/\/.*/; + + var _scripts = {}; + var _startupScripts = []; + var _deferredScripts = []; + function _getScript(name) { + var script = _scripts[name]; + if (!script) { + // Create a script object with a url based on convention + script = _scripts[name] = { + name: name, amd: true, + src: define.config.scriptPath.replace('{name}', name) + }; + } + return script; + } + function _loadScriptConfiguration() { + var scriptElements = document.getElementsByTagName('script'); + for (var i = 0, count = scriptElements.length; i < count; i++) { + var scriptElement = scriptElements[i]; + if (scriptElement.type == 'text/script') { + var name = scriptElement.getAttribute('data-name'); + var inline = false; + if (!name) { + // If there was no name set, assume this script has inline text, + // generate a name, so it can be managed, and include it as a + // startup script that is auto-loaded. + + name = 's' + (new Date()).valueOf(); + inline = true; + } + + var script = _scripts[name] = { + name: name, + amd: true, + src: scriptElement.getAttribute('data-src') + }; + + if (!script.src) { + // No src was specified, so use script text instead. + var text; + + var storage = define.config.localStore ? scriptElement.getAttribute('data-store') : null; + if (storage == 'load') { + // Storage was set to load, so load script text from local storage. + text = _loadLocalScript(name); + } + else { + // Use the inlined script text. + text = scriptElement.text; + if (storage) { + // Storage was specified, so save the text to local storage for use + // on a subsequent page load, and use the value of the storage attribute + // as the version marker to communicate to the server that we + // have a particular script in storage. + + _saveLocalScript(name, text, storage); + } + } + + if (inline) { + // Assumption is if the name wasn't specified on the script tag, then + // it wasn't specified in the define call either. Patch up the script + // text to use the auto-generated module name for the module name + // specified in the call to define (so that the callbacks associated + // with this module get invoked when the script executes). + + text = text.replace('define([', 'define(\'' + script.name + '\', ['); + } + script.text = text; + script.useText = true; + } + else { + var exp = scriptElement.getAttribute('data-export'); + if (exp) { + script.amd = false; + script.exp = exp; + + var requires = scriptElement.getAttribute('data-requires'); + if (requires) { + script.requires = requires.split(','); + } + } + } + + if (inline || scriptElement.hasAttribute('data-autoload')) { + _startupScripts.push(script.name); + } + if (!_xdomainRegex.test(script.src) && scriptElement.hasAttribute('data-preload')) { + _deferredScripts.push(script.name); + } + } + } + } + + // Local storage + // Scripts are stored in local storage with a key = script.. + // Additionally a script.$ key is stored containing the versions of all scripts + // that have been saved to storage. This is also set as the cookie value, so + // a server can detect which scripts exist on the client. + function _loadLocalScript(name) { + return localStorage['script.' + name]; + } + function _saveLocalScript(name, text, version) { + localStorage['script.' + name] = text; + + // Save the fact that we have stored this script into the local storage + // by updating the index with the new script information, and using + // the index as the value of the cookie sent to the server as well. + var scriptIndex = localStorage['script.$']; + + scriptIndex = scriptIndex ? JSON.parse(scriptIndex) : {}; + scriptIndex[name] = version; + + scriptIndex = JSON.stringify(scriptIndex); + localStorage['script.$'] = scriptIndex; + + // A cookie with 180 days = 60 * 60 * 24 * 180 seconds + document.cookie = define.config.cookie + '=' + encodeURIComponent(scriptIndex) + + '; max-age=15552000; path=/'; + } + function _downloadScript(name) { + var script = _scripts[name]; + + var downloader = new XMLHttpRequest(); + downloader.onreadystatechange = function() { + if (downloader.readyState == 4) { + downloader.onreadystatechange = null; + + if (downloader.status == 200) { + script.useText = true; + script.text = downloader.responseText; + } + } + }; + downloader.open('GET', script.src, true); + downloader.send(); + } + + + // Script loading + // Scripts are loaded by creating script elements and inserting + // into the document's head element. + // Scripts can either be loaded from a url (using the src attribute) + // or loaded from previously loaded script text (using the text property). + // + // The assumption is the script uses the AMD pattern, so doesn't need + // to be tracked - the call to define will indicate the script has been + // loaded and executed. + // + // TODO: Provide ability to plug in a shim for scripts that don't follow + // the AMD pattern. + + var _head = document.getElementsByTagName('head')[0]; + function _loadScript(scriptName) { + var script = _getScript(scriptName); + if (script.amd) { + // We don't listen to load events, since the expectation is an AMD + // compatible script will call into define(). Consequently, we require + // define() calls to include the leading module identifier to + // know which module was just loaded. + + var scriptElement = document.createElement('script'); + scriptElement.type = 'text/javascript'; + if (script.useText) { + scriptElement.text = script.text; + } + else { + scriptElement.src = script.src; + } + + _head.appendChild(scriptElement); + } + else { + script.requires ? + require(script.requires, function() { _loadNonAMDScript(script); }) : + _loadNonAMDScript(script); + } + } + + function _loadNonAMDScript(script) { + // Listen the loaded/readystatechange events to figure out when the + // script is loaded, and when has, evaluate the export expression to + // get a reference to the object that will be treated as the module + // object. + + var scriptElement = document.createElement('script'); + scriptElement.type = 'text/javascript'; + scriptElement.src = script.src; + + scriptElement.onload = scriptElement.onreadystatechange = function() { + var rs = scriptElement.readyState; + if (rs && rs != 'complete' && rs != 'loaded') { + return; + } + + scriptElement.onload = scriptElement.onreadystatechange = null; + try { + _completeModule(script.name, eval(script.exp)); + } + catch (e) { + } + } + _head.appendChild(scriptElement); + } + + + // Module management + + var _modules = {}; + function _getModule(name) { + return _modules[name] || + (_modules[name] = { name: name, exports: null, callbacks: [], loading: false }); + } + function _loadModule(name, callback) { + var module = _getModule(name); + + if (module.callbacks) { + // Module hasn't loaded yet, since we're still hanging on + // to dependents, so add this callback to the list. + + module.callbacks.push(callback); + + if (!module.loading) { + // Kick off loading the module if this is the first dependent. + module.loading = true; + _loadScript(name); + } + + return 0; + } + + // Module is already loaded, so invoke the callback but use a + // setTimeout to mimic how the callback is invoked asynchronously + // in the usual case when the module hasn't already been loaded. + return setTimeout(callback, 0); + } + function _completeModule(name, exports) { + var module = _modules[name]; + + var callbacks = module.callbacks; + module.callbacks = null; + + module.exports = exports; + module.loading = false; + + each(callbacks, function(callback) { + callback(); + }); + } + + + // Exported APIs + // As per the AMD pattern, we're exporting require and define. + // Our version of define only works with explicitly specified + // module names (which is anyway true if individual modules are + // combined into a single script on the server). + + function require(dependencyNames, callback) { + dependencyNames = dependencyNames || []; + + var dependencyCount = dependencyNames.length; + if (dependencyCount == 0) { + // No dependencies, so go ahead and invoke the callback + // immediately, but do so in an async way to mimic how + // it would have been invoked if there were dependencies. + setTimeout(callback, 0); + return; + } + + var dependenciesAvailable = 0; + var localCallback = function() { + dependenciesAvailable++; + if (dependenciesAvailable == dependencyCount) { + var dependencies = each(dependencyNames, function(dependencyName) { + return _getModule(dependencyName).exports; + }); + + callback.apply(global, dependencies); + } + }; + + each(dependencyNames, function(dependencyName) { + _loadModule(dependencyName, localCallback); + }); + } + + function define(name, dependencyNames, callback) { + var m = _getModule(name); + if (!m.callbacks) { + // Looks like a module is being reloaded... for now, just + // ignore, i.e. don't execute the script. This is because we already + // have an object representing this module that might have been handed + // out as a depedency to other modules. + return; + } + m.loading = true; + require(dependencyNames, function() { + _completeModule(name, callback.apply(global, arguments)); + }); + } + + // Enable using this loader to load jQuery (1.7+) as well. + define.amd = { jQuery: true }; + + // Customizable configuration + define.config = { + scriptPath: '/scripts/{name}.js', + cookie: 'scripts', + localStore: !!global.localStorage + }; + + // Export define and require as API additions on the global object + global.require = require; + global.define = define; + + // Bootstrapping + // If the document has already loaded (i.e. when this script was + // dynamically added to the DOM), go ahead and run startup immediately. + // Otherwise hookup to the DOMContentLoaded event on the document + // which is when the DOM is ready for programmatic access, or if + // this is an older browser, simply do the next best thing - wait for + // the page to be loaded completely. + + function _startup() { + _loadScriptConfiguration(); + require(_startupScripts, function(startupObjects) { + each(_deferredScripts, function(name) { + _downloadScript(name); + }); + }); + } + + if (document.addEventListener) { + var rs = document.readyState; + rs == 'complete' || rs == 'interactive' ? + setTimeout(_startup, 0) : + document.addEventListener('DOMContentLoaded', _startup, false); + } + else if (global.attachEvent) { + global.attachEvent('onload', function() { + _startup(); + }); + } +})(window); diff --git a/src/Core/Scripts/Package/package.json b/src/Core/Scripts/Package/package.json new file mode 100644 index 000000000..80826f7d6 --- /dev/null +++ b/src/Core/Scripts/Package/package.json @@ -0,0 +1,17 @@ +{ + "name": "scriptsharp", + "version": "0.8.0", + "description": "Script# Runtime", + "keywords": [ "scriptsharp", "script#" ], + "author": "Nikhil Kothari", + "license": "Apache 2.0", + "repository": { + "type": "git", + "url": "https://github.com/nikhilk/scriptsharp" + }, + "main": "ss.js", + "dependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/src/Core/Scripts/Package/readme.md b/src/Core/Scripts/Package/readme.md new file mode 100644 index 000000000..b71dace71 --- /dev/null +++ b/src/Core/Scripts/Package/readme.md @@ -0,0 +1,4 @@ +Script# Runtime + +This packages the script# runtime as a node module for node.js applications written using c# and compiled into javascript using the script# compiler. +More information is at [http://scriptsharp.com](http://scriptsharp.com). diff --git a/src/Core/Scripts/Runtime.js b/src/Core/Scripts/Runtime.js new file mode 100644 index 000000000..beba55767 --- /dev/null +++ b/src/Core/Scripts/Runtime.js @@ -0,0 +1,115 @@ +/*! Script# Runtime + * Designed and licensed for use and distribution with Script#-generated scripts. + * Copyright (c) 2012, Nikhil Kothari, and the Script# Project. + * More information at http://scriptsharp.com + */ + +"use strict"; + +(function(global) { + function _ss() { + + #include "Runtime\Misc.js" + #include "Runtime\Collections.js" + #include "Runtime\String.js" + #include "Runtime\Delegate.js" + #include "Runtime\EventArgs.js" + #include "Runtime\Contracts.js" + #include "Runtime\StringBuilder.js" + #include "Runtime\Observable.js" + #include "Runtime\Task.js" + #include "Runtime\Culture.js" + #include "Runtime\Format.js" + #include "Runtime\TypeSystem.js" + + return extend(module('ss', null, { + IDisposable: [ IDisposable ], + IEnumerable: [ IEnumerable ], + IEnumerator: [ IEnumerator ], + IObserver: [ IObserver ], + IApplication: [ IApplication ], + IContainer: [ IContainer ], + IObjectFactory: [ IObjectFactory ], + IEventManager: [ IEventManager ], + IInitializable: [ IInitializable ], + EventArgs: [ EventArgs, { } ], + CancelEventArgs: [ CancelEventArgs, { }, EventArgs ], + StringBuilder: [ StringBuilder, StringBuilder$ ], + Stack: [ Stack, Stack$ ], + Queue: [ Queue, Queue$ ], + Observable: [ Observable, Observable$ ], + ObservableCollection: [ ObservableCollection, ObservableCollection$, null, IEnumerable ], + Task: [ Task, Task$ ] + }), { + version: '0.8', + + isValue: isValue, + value: value, + extend: extend, + keys: keys, + keyCount: keyCount, + keyExists: keyExists, + clearKeys: clearKeys, + enumerate: enumerate, + array: toArray, + remove: removeItem, + boolean: parseBoolean, + regexp: parseRegExp, + number: parseNumber, + date: parseDate, + truncate: truncate, + now: now, + today: today, + compareDates: compareDates, + error: error, + string: string, + emptyString: emptyString, + whitespace: whitespace, + format: format, + compareStrings: compareStrings, + startsWith: startsWith, + endsWith: endsWith, + padLeft: padLeft, + padRight: padRight, + trim: trim, + trimStart: trimStart, + trimEnd: trimEnd, + insertString: insertString, + removeString: removeString, + replaceString: replaceString, + bind: bind, + bindAdd: bindAdd, + bindSub: bindSub, + bindExport: bindExport, + deferred: deferred, + + module: module, + modules: _modules, + + isClass: isClass, + isInterface: isInterface, + typeOf: typeOf, + type: type, + typeName: typeName, + canCast: canCast, + safeCast: safeCast, + canAssign: canAssign, + instanceOf: instanceOf, + + culture: { + neutral: neutralCulture, + current: currentCulture + }, + + fail: fail + }); + } + + + function _export() { + var ss = _ss(); + typeof exports == 'object' ? ss.extend(exports, ss) : global.ss = ss; + } + + global.define ? global.define('ss', [], _ss) : _export(); +})(this); diff --git a/src/Core/Scripts/Runtime/Collections.js b/src/Core/Scripts/Runtime/Collections.js new file mode 100644 index 000000000..8ae38403a --- /dev/null +++ b/src/Core/Scripts/Runtime/Collections.js @@ -0,0 +1,155 @@ +// Collections + +function toArray(obj) { + return obj ? (typeof obj == 'string' ? JSON.parse('(' + obj + ')') : Array.prototype.slice.call(obj)) : null; +} +function removeItem(a, item) { + var index = a.indexOf(item); + return index >= 0 ? (a.splice(index, 1), true) : false; +} + +function clearKeys(obj) { + for (var key in obj) { + delete obj[key]; + } +} +function keyExists(obj, key) { + return obj[key] !== undefined; +} +function keys(obj) { + if (Object.keys) { + return Object.keys(obj); + } + var keys = []; + for (var key in obj) { + keys.push(key); + } + return keys; +} +function keyCount(obj) { + return keys(obj).length; +} + +function Enumerator(obj, keys) { + var index = -1; + var length = keys ? keys.length : obj.length; + var lookup = keys ? function() { return { key: keys[index], value: obj[keys[index]] }; } : + function() { return obj[index]; }; + + this.current = null; + this.moveNext = function() { + index++; + this.current = lookup(); + return index < length; + }; + this.reset = function() { + index = -1; + this.current = null; + }; +} +var _nopEnumerator = { + current: null, + moveNext: function() { return false; }, + reset: _nop +}; + +function enumerate(o) { + if (!isValue(o)) { + return _nopEnumerator; + } + if (o.getEnumerator) { + return o.getEnumerator(); + } + if (o.length !== undefined) { + return new Enumerator(o); + } + return new Enumerator(o, keys(o)); +} + +function Stack() { + this.count = 0; + this._items = []; +} +var Stack$ = { + + clear: function() { + this._items.length = 0; + this.count = 0; + }, + contains: function(item) { + for (var i = this.count - 1; i >= 0; i--) { + if (this._items[i] === item) { + return true; + } + } + return false; + }, + getEnumerator: function() { + return new Enumerator(this._items.reverse()); + }, + peek: function() { + return this._items[this.count - 1]; + }, + push: function(item) { + this._items.push(item); + this.count++; + }, + pop: function() { + if (this.count) { + this.count--; + return this._items.pop(); + } + return undefined; + } +} + +function Queue() { + this.count = 0; + this._items = []; + this._offset = 0; +} +function _cleanQueue(q) { + q._items = q._items.slice(q._offset); + q._offset = 0; +} +var Queue$ = { + + clear: function() { + this._items.length = 0; + this._offset = 0; + this.count = 0; + }, + contains: function(item) { + for (var i = this._offset, length = this._items.length; i <= length; i++) { + if (this._items[i] === item) { + return true; + } + } + return false; + }, + dequeue: function() { + if (this.count) { + var item = this._items[this._offset]; + if (++this._offset * 2 >= this._items.length) { + _cleanQueue(this); + } + this.count--; + return item; + } + return undefined; + }, + enqueue: function(item) { + this._items.push(item); + this.count++; + }, + getEnumerator: function() { + if (this._offset != 0) { + _cleanQueue(this); + } + return new Enumerator(this._items); + }, + peek: function() { + return this._items.length ? this._items[this._offset] : undefined; + } +} + diff --git a/src/Core/Scripts/Runtime/Contracts.js b/src/Core/Scripts/Runtime/Contracts.js new file mode 100644 index 000000000..2cf892301 --- /dev/null +++ b/src/Core/Scripts/Runtime/Contracts.js @@ -0,0 +1,12 @@ +// Contracts + +function IDisposable() { } +function IEnumerable() { } +function IEnumerator() { } +function IObserver() { } +function IApplication() { } +function IContainer() { } +function IObjectFactory() { } +function IEventManager() { } +function IInitializable() { } + diff --git a/src/Core/Scripts/Runtime/Culture.js b/src/Core/Scripts/Runtime/Culture.js new file mode 100644 index 000000000..87e61be5a --- /dev/null +++ b/src/Core/Scripts/Runtime/Culture.js @@ -0,0 +1,72 @@ +// Culture + +var neutralCulture = { + name: '', + // numberFormat + nf: { + nan: 'NaN', // naNSymbol + neg: '-', // negativeSign + pos: '+', // positiveSign + negInf: '-Infinity', // negativeInfinityText + posInf: 'Infinity', // positiveInfinityText + gw: [3], // numberGroupSizes + dd: 2, // numberDecimalDigits + ds: '.', // numberDecimalSeparator + gs: ',', // numberGroupSeparator + + per: '%', // percentSymbol + perGW: [3], // percentGroupSizes + perDD: 2, // percentDecimalDigits + perDS: '.', // percentDecimalSeparator + perGS: ',', // percentGroupSeparator + perPP: '{0} %', // percentPositivePattern + perNP: '-{0} %', // percentNegativePattern + + cur: '$', // currencySymbol + curGW: [3], // currencyGroupSizes + curDD: 2, // currencyDecimalDigits + curDS: '.', // currencyDecimalSeparator + curGS: ',', // currencyGroupSeparator + curNP: '(${0})', // currencyNegativePattern + curPP: '${0}' // currencyPositivePattern + }, + // dateFormat + dtf: { + am: 'AM', // amDesignator + pm: 'PM', // pmDesignator + + ds: '/', // dateSeparator + ts: ':', // timeSeparator + + gmt: 'ddd, dd MMM yyyy HH:mm:ss \'GMT\'', // gmtDateTimePattern + uni: 'yyyy-MM-dd HH:mm:ssZ', // universalDateTimePattern + sort: 'yyyy-MM-ddTHH:mm:ss', // sortableDateTimePattern + dt: 'dddd, MMMM dd, yyyy h:mm:ss tt', // dateTimePattern + + ld: 'dddd, MMMM dd, yyyy', // longDatePattern + sd: 'M/d/yyyy', // shortDatePattern + + lt: 'h:mm:ss tt', // longTimePattern + st: 'h:mm tt', // shortTimePattern + + day0: 0, // firstDayOfWeek + day: ['Sunday', 'Monday', 'Tuesday', + 'Wednesday', 'Thursday', + 'Friday', 'Saturday'], // dayNames + sday: ['Sun', 'Mon', 'Tue', 'Wed', + 'Thu', 'Fri', 'Sat'], // shortDayNames + mday: ['Su', 'Mo', 'Tu', 'We', + 'Th', 'Fr', 'Sa'], // minimizedDayNames + + mon: ['January', 'February', 'March', + 'April', 'May', 'June', 'July', + 'August', 'September', 'October', + 'November', 'December', ''], // monthNames + smon: ['Jan', 'Feb', 'Mar', 'Apr', + 'May', 'Jun', 'Jul', 'Aug', + 'Sep', 'Oct', 'Nov', 'Dec', ''] // shortMonthNames + } +}; + +var currentCulture = { name: 'en-us', dtf: neutralCulture.dtf, nf: neutralCulture.nf }; + diff --git a/src/Core/Scripts/Runtime/Delegate.js b/src/Core/Scripts/Runtime/Delegate.js new file mode 100644 index 000000000..1f82c2087 --- /dev/null +++ b/src/Core/Scripts/Runtime/Delegate.js @@ -0,0 +1,102 @@ +// Delegate Functionality + +function _bindList(fnList) { + var d = function() { + var args = arguments; + var result = null; + for (var i = 0, l = fnList.length; i < l; i++) { + result = args.length ? fnList[i].apply(null, args) : fnList[i].call(null); + } + return result; + }; + d._fnList = fnList; + return d; +} + +function bind(fn, o) { + if (!o) { + return fn; + } + + var name = null; + fn = typeof fn == 'string' ? o[name = fn] : fn; + + var cache = name ? o.$$b || (o.$$b = {}) : null; + var binding = cache ? cache[name] : null; + + if (!binding) { + // Create a function that invokes the specified function, in the + // context of the specified object. + binding = function() { + return fn.apply(o, arguments); + }; + + if (cache) { + cache[name] = binding; + } + } + return binding; +} + +function bindAdd(binding, value) { + if (!binding) { + return value; + } + if (!value) { + return binding; + } + + var fnList = [].concat(binding._fnList || binding, value); + return _bindList(fnList); +} + +function bindSub(binding, value) { + if (!binding) { + return null; + } + if (!value) { + return binding; + } + + var fnList = binding._fnList || [binding]; + var index = fnList.indexOf(value); + if (index >= 0) { + if (fnList.length == 1) { + return null; + } + + fnList = index ? fnList.slice(0, index).concat(fnList.slice(index + 1)) : fnList.slice(1); + return _bindList(fnList); + } + return binding; +} + + +function bindExport(fn, multiUse, name, root) { + // Generate a unique name if one is not specified + name = name || '__' + (new Date()).valueOf(); + + // If unspecified, exported bindings go on the global object + // (so they are callable using a simple identifier). + root = root || global; + + var exp = { + name: name, + detach: function() { + root[name] = _nop; + }, + dispose: function() { + try { delete root[name]; } catch (e) { root[name] = undefined; } + } + }; + + // Multi-use bindings are exported directly; for the rest a stub is exported, and the stub + // first auto-disposes, and then invokes the actual binding. + root[name] = multiUse ? fn : function() { + exp.dispose(); + return fn.apply(null, arguments); + }; + + return exp; +} + diff --git a/src/Core/Scripts/Runtime/EventArgs.js b/src/Core/Scripts/Runtime/EventArgs.js new file mode 100644 index 000000000..ba34e53d2 --- /dev/null +++ b/src/Core/Scripts/Runtime/EventArgs.js @@ -0,0 +1,10 @@ +// EventArgs + +function EventArgs() { +} +EventArgs.Empty = new EventArgs(); + +function CancelEventArgs() { + this.cancel = false; +} + diff --git a/src/Core/Scripts/Runtime/Format.js b/src/Core/Scripts/Runtime/Format.js new file mode 100644 index 000000000..fddce5620 --- /dev/null +++ b/src/Core/Scripts/Runtime/Format.js @@ -0,0 +1,315 @@ +// Formatting Helpers + +function _commaFormatNumber(number, groups, decimal, comma) { + var decimalPart = null; + var decimalIndex = number.indexOf(decimal); + if (decimalIndex > 0) { + decimalPart = number.substr(decimalIndex); + number = number.substr(0, decimalIndex); + } + + var negative = number.startsWith('-'); + if (negative) { + number = number.substr(1); + } + + var groupIndex = 0; + var groupSize = groups[groupIndex]; + if (number.length < groupSize) { + return decimalPart ? number + decimalPart : number; + } + + var index = number.length; + var s = ''; + var done = false; + while (!done) { + var length = groupSize; + var startIndex = index - length; + if (startIndex < 0) { + groupSize += startIndex; + length += startIndex; + startIndex = 0; + done = true; + } + if (!length) { + break; + } + + var part = number.substr(startIndex, length); + if (s.length) { + s = part + comma + s; + } + else { + s = part; + } + index -= length; + + if (groupIndex < groups.length - 1) { + groupIndex++; + groupSize = groups[groupIndex]; + } + } + + if (negative) { + s = '-' + s; + } + return decimalPart ? s + decimalPart : s; +} + +_formatters['Number'] = function(number, format, culture) { + var nf = culture.nf; + var s = ''; + var precision = -1; + + if (format.length > 1) { + precision = parseInt(format.substr(1)); + } + + var fs = format.charAt(0); + switch (fs) { + case 'd': case 'D': + s = parseInt(Math.abs(number)).toString(); + if (precision != -1) { + s = padLeft(s, precision, '0'); + } + if (number < 0) { + s = '-' + s; + } + break; + case 'x': case 'X': + s = parseInt(Math.abs(number)).toString(16); + if (fs == 'X') { + s = s.toUpperCase(); + } + if (precision != -1) { + s = padLeft(s, precision, '0'); + } + break; + case 'e': case 'E': + if (precision == -1) { + s = number.toExponential(); + } + else { + s = number.toExponential(precision); + } + if (fs == 'E') { + s = s.toUpperCase(); + } + break; + case 'f': case 'F': + case 'n': case 'N': + if (precision == -1) { + precision = nf.dd; + } + s = number.toFixed(precision).toString(); + if (precision && (nf.ds != '.')) { + var index = s.indexOf('.'); + s = s.substr(0, index) + nf.ds + s.substr(index + 1); + } + if ((fs == 'n') || (fs == 'N')) { + s = _commaFormatNumber(s, nf.gw, nf.ds, nf.gs); + } + break; + case 'c': case 'C': + if (precision == -1) { + precision = nf.curDD; + } + s = Math.abs(number).toFixed(precision).toString(); + if (precision && (nf.curDS != '.')) { + var index = s.indexOf('.'); + s = s.substr(0, index) + nf.curDS + s.substr(index + 1); + } + s = _commaFormatNumber(s, nf.curGW, nf.curDS, nf.curGS); + if (number < 0) { + s = String.format(culture, nf.curNP, s); + } + else { + s = String.format(culture, nf.curPP, s); + } + break; + case 'p': case 'P': + if (precision == -1) { + precision = nf.perDD; + } + s = (Math.abs(number) * 100.0).toFixed(precision).toString(); + if (precision && (nf.perDS != '.')) { + var index = s.indexOf('.'); + s = s.substr(0, index) + nf.perDS + s.substr(index + 1); + } + s = _commaFormatNumber(s, nf.perGW, nf.perDS, nf.perGS); + if (number < 0) { + s = String.format(culture, nf.perNP, s); + } + else { + s = String.format(culture, nf.perPP, s); + } + break; + } + + return s; +} + + +var _dateFormatRE = /'.*?[^\\]'|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g; + +_formatters['Date'] = function(dt, format, culture) { + if (format == 'iso') { + return dt.toISOString(); + } + else if (format.charAt(0) == 'i') { + var fnName = 'String'; + switch (format) { + case 'id': fnName = 'DateString'; break; + case 'it': fnName = 'TimeString'; break; + } + return culture == neutralCulture ? dt['to' + fnName]() : dt['toLocale' + fnName](); + } + + var dtf = culture.dtf; + + if (format.length == 1) { + switch (format) { + case 'f': format = dtf.ld + ' ' + dtf.st; break; + case 'F': format = dtf.dt; break; + + case 'd': format = dtf.sd; break; + case 'D': format = dtf.ld; break; + + case 't': format = dtf.st; break; + case 'T': format = dtf.lt; break; + + case 'g': format = dtf.sd + ' ' + dtf.st; break; + case 'G': format = dtf.sd + ' ' + dtf.lt; break; + + case 'R': case 'r': + dtf = neutralCulture.dtf; + format = dtf.gmt; + break; + case 'u': format = dtf.uni; break; + case 'U': + format = dtf.dt; + dt = new Date(dt.getUTCFullYear(), dt.getUTCMonth(), dt.getUTCDate(), + dt.getUTCHours(), dt.getUTCMinutes(), dt.getUTCSeconds(), dt.getUTCMilliseconds()); + break; + + case 's': format = dtf.sort; break; + } + } + + if (format.charAt(0) == '%') { + format = format.substr(1); + } + + var sb = new StringBuilder(); + + _dateFormatRE.lastIndex = 0; + while (true) { + var index = _dateFormatRE.lastIndex; + var match = _dateFormatRE.exec(format); + + sb.append(format.slice(index, match ? match.index : format.length)); + if (!match) { + break; + } + + var fs = match[0]; + var part = fs; + switch (fs) { + case 'dddd': + part = dtf.day[dt.getDay()]; + break; + case 'ddd': + part = dtf.sday[dt.getDay()]; + break; + case 'dd': + part = padLeft(dt.getDate().toString(), 2, '0'); + break; + case 'd': + part = dt.getDate(); + break; + case 'MMMM': + part = dtf.mon[dt.getMonth()]; + break; + case 'MMM': + part = dtf.smon[dt.getMonth()]; + break; + case 'MM': + part = padLeft((dt.getMonth() + 1).toString(), 2, '0'); + break; + case 'M': + part = (dt.getMonth() + 1); + break; + case 'yyyy': + part = dt.getFullYear(); + break; + case 'yy': + part = padLeft((dt.getFullYear() % 100).toString(), 2, '0'); + break; + case 'y': + part = (dt.getFullYear() % 100); + break; + case 'h': case 'hh': + part = dt.getHours() % 12; + if (!part) { + part = '12'; + } + else if (fs == 'hh') { + part = padLeft(part.toString(), 2, '0'); + } + break; + case 'HH': + part = padLeft(dt.getHours().toString(), 2, '0'); + break; + case 'H': + part = dt.getHours(); + break; + case 'mm': + part = padLeft(dt.getMinutes().toString(), 2, '0'); + break; + case 'm': + part = dt.getMinutes(); + break; + case 'ss': + part = padLeft(dt.getSeconds().toString(), 2, '0'); + break; + case 's': + part = dt.getSeconds(); + break; + case 't': case 'tt': + part = (dt.getHours() < 12) ? dtf.am : dtf.pm; + if (fs == 't') { + part = part.charAt(0); + } + break; + case 'fff': + part = padLeft(dt.getMilliseconds().toString(), 3, '0'); + break; + case 'ff': + part = padLeft(dt.getMilliseconds().toString(), 3).substr(0, 2); + break; + case 'f': + part = padLeft(dt.getMilliseconds().toString(), 3).charAt(0); + break; + case 'z': + part = dt.getTimezoneOffset() / 60; + part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)); + break; + case 'zz': case 'zzz': + part = dt.getTimezoneOffset() / 60; + part = ((part >= 0) ? '-' : '+') + padLeft(Math.floor(Math.abs(part)).toString(), 2, '0'); + if (fs == 'zzz') { + part += dtf.ts + padLeft(Math.abs(dt.getTimezoneOffset() % 60).toString(), 2, '0'); + } + break; + default: + if (part.charAt(0) == '\'') { + part = part.substr(1, part.length - 2).replace(/\\'/g, '\''); + } + break; + } + sb.append(part); + } + + return sb.toString(); +} + diff --git a/src/Core/Scripts/Runtime/Misc.js b/src/Core/Scripts/Runtime/Misc.js new file mode 100644 index 000000000..9275e4d8b --- /dev/null +++ b/src/Core/Scripts/Runtime/Misc.js @@ -0,0 +1,131 @@ +// Various Helpers/Utilities + +function _nop() { +} + +function isValue(o) { + return (o !== null) && (o !== undefined); +} + +function _value(args) { + for (var i = 2, l = args.length; i < l; i++) { + if (isValue(args[i])) { + return args[i]; + } + } + return null; +} +function value(a, b) { + return isValue(a) ? a : isValue(b) ? b : _value(arguments); +} + +function extend(o, items) { + for (var n in items) { + o[n] = items[n]; + } + return o; +} + +function parseBoolean(s) { + return (s.toLowerCase() == 'true'); +} + +function parseRegExp(s) { + if (s[0] == '/') { + var endSlashIndex = s.lastIndexOf('/'); + if (endSlashIndex > 1) { + var expression = s.substring(1, endSlashIndex); + var flags = s.substr(endSlashIndex + 1); + return new RegExp(expression, flags); + } + } + + return null; +} + +function parseNumber(s) { + if (!s || !s.length) { + return 0; + } + if ((s.indexOf('.') >= 0) || (s.indexOf('e') >= 0) || + endsWith(s, 'f') || endsWith(s, 'F')) { + return parseFloat(s); + } + return parseInt(s, 10); +} + +function parseDate(s) { + var t = Date.parse(s); + return isNaN(t) ? undefined : new Date(t); +} + +function truncate(n) { + return (n >= 0) ? Math.floor(n) : Math.ceil(n); +} + +function now() { + return new Date(); +} + +function today() { + var d = new Date(); + return new Date(d.getFullYear(), d.getMonth(), d.getDate()); +} + +function compareDates(d1, d2) { + return (d1 === d2) ? true : ((isValue(d1) && isValue(d2)) ? (d1.getTime() == d2.getTime()) : false); +} + +function _popStackFrame(e) { + if (!isValue(e.stack) || + !isValue(e.fileName) || + !isValue(e.lineNumber)) { + return; + } + + var stackFrames = e.stack.split('\n'); + var currentFrame = stackFrames[0]; + var pattern = e.fileName + ':' + e.lineNumber; + while (isValue(currentFrame) && currentFrame.indexOf(pattern) === -1) { + stackFrames.shift(); + currentFrame = stackFrames[0]; + } + + var nextFrame = stackFrames[1]; + if (!isValue(nextFrame)) { + return; + } + + var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/); + if (!isValue(nextFrameParts)) { + return; + } + + stackFrames.shift(); + e.stack = stackFrames.join('\n'); + e.fileName = nextFrameParts[1]; + e.lineNumber = parseInt(nextFrameParts[2], 10); +} + +function error(message, errorInfo, innerException) { + var e = new Error(message); + if (errorInfo) { + for (var v in errorInfo) { + e[v] = errorInfo[v]; + } + } + if (innerException) { + e.innerException = innerException; + } + + _popStackFrame(e); + return e; +} + +function fail(message) { + console.assert(false, message); + if (global.navigator) { + eval('debugger;'); + } +} + diff --git a/src/Core/Scripts/Runtime/Observable.js b/src/Core/Scripts/Runtime/Observable.js new file mode 100644 index 000000000..b6737399b --- /dev/null +++ b/src/Core/Scripts/Runtime/Observable.js @@ -0,0 +1,122 @@ +// Observable + +var _observerStack = []; +var _observerRegistration = { + dispose: function() { + _observerStack.pop(); + } +} +function _captureObservers(observers) { + var registeredObservers = _observerStack; + var observerCount = registeredObservers.length; + + if (observerCount) { + observers = observers || []; + for (var i = 0; i < observerCount; i++) { + var observer = registeredObservers[i]; + if (observers.indexOf(observer) < 0) { + observers.push(observer); + } + } + return observers; + } + return null; +} +function _invalidateObservers(observers) { + for (var i = 0, len = observers.length; i < len; i++) { + observers[i].invalidateObserver(); + } +} + +function Observable(v) { + this._v = v; + this._observers = null; +} +var Observable$ = { + + getValue: function() { + this._observers = _captureObservers(this._observers); + return this._v; + }, + setValue: function(v) { + if (this._v !== v) { + this._v = v; + + var observers = this._observers; + if (observers) { + this._observers = null; + _invalidateObservers(observers); + } + } + } +}; +Observable.registerObserver = function(o) { + _observerStack.push(o); + return _observerRegistration; +} + + +function ObservableCollection(items) { + this._items = items || []; + this._observers = null; +} +var ObservableCollection$ = { + + get_item: function (index) { + this._observers = _captureObservers(this._observers); + return this._items[index]; + }, + set_item: function(index, item) { + this._items[index] = item; + this._updated(); + }, + get_length: function() { + this._observers = _captureObservers(this._observers); + return this._items.length; + }, + add: function(item) { + this._items.push(item); + this._updated(); + }, + clear: function() { + this._items.clear(); + this._updated(); + }, + contains: function(item) { + return this._items.indexOf(item) >= 0; + }, + getEnumerator: function() { + this._observers = _captureObservers(this._observers); + // TODO: Change this + return this._items.getEnumerator(); + }, + indexOf: function(item) { + return this._items.indexOf(item); + }, + insert: function(index, item) { + this._items.insert(index, item); + this._updated(); + }, + remove: function(item) { + if (this._items.remove(item)) { + this._updated(); + return true; + } + return false; + }, + removeAt: function(index) { + this._items.splice(index, 1); + this._updated(); + }, + toArray: function() { + return this._items; + }, + _updated: function() { + var observers = this._observers; + if (observers) { + this._observers = null; + _invalidateObservers(observers); + } + } +} + diff --git a/src/Core/Scripts/Runtime/String.js b/src/Core/Scripts/Runtime/String.js new file mode 100644 index 000000000..6b864a922 --- /dev/null +++ b/src/Core/Scripts/Runtime/String.js @@ -0,0 +1,119 @@ +// String + +function string(arg1, arg2) { + if (typeof arg2 == 'number') { + return arg2 > 1 ? new Array(arg2 + 1).join(arg1) : arg1; + } + return Array.prototype.join.call(arguments, ''); +} + +function emptyString(s) { + return !s || !s.length; +} + +function whitespace(s) { + return emptyString(s) || !s.replace(/^\s*/, '').length; +} + +function compareStrings(s1, s2, ignoreCase) { + s1 = s1 || '', s2 = s2 || ''; + ignoreCase ? (s1 = s1.toUpperCase(), s2 = s2.toUpperCase()) : 0; + return (s1 === s2) ? 0 : (s1 < s2) ? -1 : 1; +} + +var _formatPlaceHolderRE = /(\{[^\}^\{]+\})/g; +var _formatters = {}; + +function format(cultureOrFormat) { + var culture = neutralCulture; + var format = cultureOrFormat; + var values = Array.prototype.slice.call(arguments, 1); + + if (cultureOrFormat.constructor != String) { + culture = cultureOrFormat; + format = values[0]; + values = values.slice(1); + } + + return format.replace(_formatPlaceHolderRE, + function(str, match) { + var index = parseInt(match.substr(1), 10); + var value = values[index]; + if (!isValue(value)) { + return ''; + } + + var formatter = _formatters[typeName(value)]; + if (formatter) { + var formatSpec = ''; + var formatIndex = match.indexOf(':'); + if (formatIndex > 0) { + formatSpec = match.substring(formatIndex + 1, match.length - 1); + } + if (formatSpec && (formatSpec != 'i')) { + return formatter(value, formatSpec, culture); + } + } + return culture == neutralCulture ? value.toString() : value.toLocaleString(); + }); +} + +function trim(s, tc) { + if (tc || !String.prototype.trim) { + tc = tc ? tc.join('') : null; + var r = tc ? new RegExp('^[' + tc + ']+|[' + tc + ']+$', 'g') : /^\s+|\s+$/g; + return s.replace(r, ''); + } + return s.trim(); +} +function trimStart(s, tc) { + var r = tc ? new RegExp('^[' + tc.join('') + ']+') : /^\s+/; + return s.replace(r, ''); +} +function trimEnd(s, tc) { + var r = tc ? new RegExp('[' + tc.join('') + ']+$') : /\s+$/; + return s.replace(r, ''); +} +function startsWith(s, prefix) { + if (emptyString(prefix)) { + return true; + } + if (emptyString(s) || (prefix.length > s.length)) { + return false; + } + return s.substr(0, prefix.length) == prefix; +} +function endsWith(s, suffix) { + if (emptyString(suffix)) { + return true; + } + if (emptyString(s) || (suffix.length > s.length)) { + return false; + } + return s.substr(-suffix.length) == suffix; +} +function padLeft(s, totalWidth, ch) { + return (s.length < totalWidth) ? string(ch || ' ', totalWidth - s.length) + s : s; +} +function padRight(s, totalWidth, ch) { + return (s.length < totalWidth) ? s + string(ch || ' ', totalWidth - s.length) : s; +} +function removeString(s, index, count) { + if (!count || ((index + count) > s.length)) { + return s.substr(0, index); + } + return s.substr(0, index) + s.substr(index + count); +} +function insertString(s, index, value) { + if (!value) { + return s; + } + if (!index) { + return value + s; + } + return s.substr(0, index) + value + s.substr(index); +} +function replaceString(s, oldValue, newValue) { + return s.split(oldValue).join(newValue || ''); +} + diff --git a/src/Core/Scripts/Runtime/StringBuilder.js b/src/Core/Scripts/Runtime/StringBuilder.js new file mode 100644 index 000000000..afd0c42ed --- /dev/null +++ b/src/Core/Scripts/Runtime/StringBuilder.js @@ -0,0 +1,32 @@ +// StringBuilder + +function StringBuilder(s) { + this._parts = isValue(s) && s !== '' ? [s] : []; + this.isEmpty = this._parts.length == 0; +} +var StringBuilder$ = { + append: function(s) { + if (isValue(s) && s !== '') { + this._parts.push(s); + this.isEmpty = false; + } + return this; + }, + + appendLine: function(s) { + this.append(s); + this.append('\r\n'); + this.isEmpty = false; + return this; + }, + + clear: function() { + this._parts = []; + this.isEmpty = true; + }, + + toString: function(s) { + return this._parts.join(s || ''); + } +}; + diff --git a/src/Core/CoreScript/BCL/Task.js b/src/Core/Scripts/Runtime/Task.js similarity index 51% rename from src/Core/CoreScript/BCL/Task.js rename to src/Core/Scripts/Runtime/Task.js index 1b4c136e0..40dd9f3b3 100644 --- a/src/Core/CoreScript/BCL/Task.js +++ b/src/Core/Scripts/Runtime/Task.js @@ -1,17 +1,33 @@ -/////////////////////////////////////////////////////////////////////////////// // Task -ss.Task = function(result) { - this._continuations = ss.isValue(result) ? +function Task(result) { + this._continuations = result !== undefined ? (this.status = 'done', null) : (this.status = 'pending', []); this.result = result; this.error = null; } -ss.Task.prototype = { +var Task$ = { get_completed: function() { return this.status != 'pending'; }, + changeWith: function(continuation) { + var task = new Task(); + this.continueWith(function(t) { + var error = t.error; + var result; + if (!error) { + try { + result = continuation(t); + } + catch (e) { + error = e; + } + } + _updateTask(task, result, error); + }); + return task; + }, continueWith: function(continuation) { if (this._continuations) { this._continuations.push(continuation); @@ -40,32 +56,31 @@ ss.Task.prototype = { return this.continueWith(function(t) { t.status == 'done' ? doneCallback(t.result) : failCallback(t.error); }); - }, - _update: function(result, error) { - if (this.status == 'pending') { - if (error) { - this.error = error; - this.status = 'failed'; - } - else { - this.result = result; - this.status = 'done'; - } + } +}; + +function _updateTask(task, result, error) { + if (task.status == 'pending') { + if (error) { + task.error = error; + task.status = 'failed'; + } + else { + task.result = result; + task.status = 'done'; + } - var continuations = this._continuations; - this._continuations = null; + var continuations = task._continuations; + task._continuations = null; - for (var i = 0, c = continuations.length; i < c; i++) { - continuations[i](this); - } + for (var i = 0, c = continuations.length; i < c; i++) { + continuations[i](task); } } -}; -ss.Task._join = function(tasks, any) { - tasks = Array.toArray(tasks); -#if DEBUG - console.assert(tasks.length > 1); -#endif // DEBUG +} + +function _joinTasks(tasks, any) { + tasks = toArray(tasks); var count = tasks.length; @@ -75,18 +90,22 @@ ss.Task._join = function(tasks, any) { tasks = tasks.slice(1); count--; } + if (Array.isArray(tasks[0])) { + tasks = tasks[0]; + count = tasks.length; + } - var joinTask = new ss.Task(); + var joinTask = new Task(); var seen = 0; function continuation(t) { if (joinTask.status == 'pending') { seen++; if (any) { - joinTask._update(t); + _updateTask(joinTask, t); } else if (seen == count) { - joinTask._update(true); + _updateTask(joinTask, true); } } } @@ -94,10 +113,10 @@ ss.Task._join = function(tasks, any) { function timeout() { if (joinTask.status == 'pending') { if (any) { - joinTask._update(null); + _updateTask(joinTask, null); } else { - joinTask._update(false); + _updateTask(joinTask, false); } } } @@ -112,34 +131,33 @@ ss.Task._join = function(tasks, any) { return joinTask; } -ss.Task.all = function() { - return ss.Task._join(arguments, false); +Task.all = function() { + return _joinTasks(arguments, false); } -ss.Task.any = function() { - return ss.Task._join(arguments, true); +Task.any = function() { + return _joinTasks(arguments, true); } -ss.Task.delay = function(timeout) { - var timerTask = new ss.Task(); +Task.delay = function(timeout) { + var timerTask = new Task(); setTimeout(function() { - timerTask._update(true); + _updateTask(timerTask, true); }, timeout); return timerTask; } +function deferred(result) { + var task = new Task(result); -ss.Deferred = function(result) { - this.task = new ss.Task(result); + return { + task: task, + resolve: function(result) { + _updateTask(task, result); + }, + reject: function(error) { + _updateTask(task, null, (error || new Error())); + } + }; } -ss.Deferred.prototype = { - resolve: function(result) { - this.task._update(result); - }, - reject: function(error) { - this.task._update(null, error || new Error()); - } -}; -ss.Deferred.registerClass('Deferred'); -ss.Task.registerClass('Task'); diff --git a/src/Core/Scripts/Runtime/TypeSystem.js b/src/Core/Scripts/Runtime/TypeSystem.js new file mode 100644 index 000000000..5bf79bcfc --- /dev/null +++ b/src/Core/Scripts/Runtime/TypeSystem.js @@ -0,0 +1,174 @@ +// Type System + +var _modules = {}; + +var _classMarker = 'class'; +var _interfaceMarker = 'interface'; + +function createType(typeName, typeInfo, typeRegistry) { + // The typeInfo is either an array of information representing + // classes and interfaces, or an object representing enums and resources + // or a function, representing a record factory. + + if (Array.isArray(typeInfo)) { + var type = typeInfo[0]; + + // A class is minimally the class type and an object representing + // its prototype members, and optionally the base type, and references + // to interfaces implemented by the class. + if (typeInfo.length >= 2) { + var baseType = typeInfo[2]; + if (baseType) { + // Chain the prototype of the base type (using an anonymous type + // in case the base class is not creatable, or has side-effects). + var anonymous = function() {}; + anonymous.prototype = baseType.prototype; + type.prototype = new anonymous(); + type.prototype.constructor = type; + } + + // Add the type's prototype members if there are any + typeInfo[1] && extend(type.prototype, typeInfo[1]); + + type.$base = baseType || Object; + type.$interfaces = typeInfo.slice(3); + type.$type = _classMarker; + } + else { + type.$type = _interfaceMarker; + } + + type.$name = typeName; + return typeRegistry[typeName] = type; + } + + return typeInfo; +} + +function isClass(fn) { + return fn.$type == _classMarker; +} + +function isInterface(fn) { + return fn.$type == _interfaceMarker; +} + +function typeOf(instance) { + var ctor; + + // NOTE: We have to catch exceptions because the constructor + // cannot be looked up on native COM objects + try { + ctor = instance.constructor; + } + catch (ex) { + } + return ctor || Object; +} + +function type(s) { + var nsIndex = s.indexOf('.'); + var ns = nsIndex > 0 ? _modules[s.substr(0, nsIndex)] : global; + var name = nsIndex > 0 ? s.substr(nsIndex + 1) : s; + + return ns ? ns[name] : null; +} + +var _typeNames = [ + Number, 'Number', + String, 'String', + Boolean, 'Boolean', + Array, 'Array', + Date, 'Date', + RegExp, 'RegExp', + Function, 'Function' +]; +function typeName(type) { + if (!(type instanceof Function)) { + type = type.constructor; + } + if (type.$name) { + return type.$name; + } + if (type.name) { + return type.name; + } + for (var i = 0, len = _typeNames.length; i < len; i += 2) { + if (type == _typeNames[i]) { + return _typeNames[i + 1]; + } + } + return 'Object'; +} + +function canAssign(type, otherType) { + // Checks if the specified type is equal to otherType, + // or is a parent of otherType + + if ((type == Object) || (type == otherType)) { + return true; + } + if (type.$type == _classMarker) { + var baseType = otherType.$base; + while (baseType) { + if (type == baseType) { + return true; + } + baseType = baseType.$base; + } + } + else if (type.$type == _interfaceMarker) { + var baseType = otherType; + while (baseType) { + var interfaces = baseType.$interfaces; + if (interfaces && (interfaces.indexOf(type) >= 0)) { + return true; + } + baseType = baseType.$base; + } + } + return false; +} + +function instanceOf(type, instance) { + // Checks if the specified instance is of the specified type + + if (!isValue(instance)) { + return false; + } + + if ((type == Object) || (instance instanceof type)) { + return true; + } + + var instanceType = typeOf(instance); + return canAssign(type, instanceType); +} + +function canCast(instance, type) { + return instanceOf(type, instance); +} + +function safeCast(instance, type) { + return instanceOf(type, instance) ? instance : null; +} + +function module(name, implementation, exports) { + var registry = _modules[name] = { $name: name }; + + if (implementation) { + for (var typeName in implementation) { + createType(typeName, implementation[typeName], registry); + } + } + + var api = {}; + if (exports) { + for (var typeName in exports) { + api[typeName] = createType(typeName, exports[typeName], registry); + } + } + + return api; +} + diff --git a/src/Core/Scripts/Scripts.csproj b/src/Core/Scripts/Scripts.csproj new file mode 100644 index 000000000..a9323d886 --- /dev/null +++ b/src/Core/Scripts/Scripts.csproj @@ -0,0 +1,50 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {8780581F-7C26-4B64-9236-BA1C458DF36E} + ..\..\..\tools\bin + + + ..\..\..\bin\Debug\ + + + ..\..\..\bin\Release\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Knockout/BindingContext.cs b/src/Libraries/Knockout/BindingContext.cs index 9b9fa8715..463b1e734 100644 --- a/src/Libraries/Knockout/BindingContext.cs +++ b/src/Libraries/Knockout/BindingContext.cs @@ -1,44 +1,44 @@ -// BindingContext.cs -// Script#/Libraries/Knockout -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace KnockoutApi { - - [Imported] - [IgnoreNamespace] - public class BindingContext { - - [IntrinsicProperty] - [ScriptName("$data")] - public T Data { - get; - set; - } - - [IntrinsicProperty] - [ScriptName("$parent")] - public TParent Parent { - get; - set; - } - - [IntrinsicProperty] - [ScriptName("$parents")] - public TParent[] Parents { - get; - set; - } - - [IntrinsicProperty] - [ScriptName("$root")] - public TRoot[] Root { - get; - set; - } - } -} +// BindingContext.cs +// Script#/Libraries/Knockout +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace KnockoutApi { + + [ScriptImport] + [ScriptIgnoreNamespace] + public class BindingContext { + + [ScriptField] + [ScriptName("$data")] + public T Data { + get; + set; + } + + [ScriptField] + [ScriptName("$parent")] + public TParent Parent { + get; + set; + } + + [ScriptField] + [ScriptName("$parents")] + public TParent[] Parents { + get; + set; + } + + [ScriptField] + [ScriptName("$root")] + public TRoot[] Root { + get; + set; + } + } +} diff --git a/src/Libraries/Knockout/BindingHandler.cs b/src/Libraries/Knockout/BindingHandler.cs index 38eb182e3..79ba1b829 100644 --- a/src/Libraries/Knockout/BindingHandler.cs +++ b/src/Libraries/Knockout/BindingHandler.cs @@ -13,8 +13,8 @@ namespace KnockoutApi { /// /// Represents a custom binding handler in Knockout. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public abstract class BindingHandler { diff --git a/src/Libraries/Knockout/CompareResult.cs b/src/Libraries/Knockout/CompareResult.cs index 308c08552..796b9dd1c 100644 --- a/src/Libraries/Knockout/CompareResult.cs +++ b/src/Libraries/Knockout/CompareResult.cs @@ -8,17 +8,17 @@ namespace KnockoutApi { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public class CompareResult { - [IntrinsicProperty] + [ScriptField] public CompareResultStatus Status { get; set; } - [IntrinsicProperty] + [ScriptField] public T Value { get; set; diff --git a/src/Libraries/Knockout/CompareResultStatus.cs b/src/Libraries/Knockout/CompareResultStatus.cs index aa1c8f3ac..7094942ac 100644 --- a/src/Libraries/Knockout/CompareResultStatus.cs +++ b/src/Libraries/Knockout/CompareResultStatus.cs @@ -8,9 +8,9 @@ namespace System { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants] public enum CompareResultStatus { Added, diff --git a/src/Libraries/Knockout/DependentObservable.cs b/src/Libraries/Knockout/ComputedObservable.cs similarity index 76% rename from src/Libraries/Knockout/DependentObservable.cs rename to src/Libraries/Knockout/ComputedObservable.cs index deb586c9d..14b879aac 100644 --- a/src/Libraries/Knockout/DependentObservable.cs +++ b/src/Libraries/Knockout/ComputedObservable.cs @@ -1,82 +1,82 @@ -// DependentObservable.cs -// Script#/Libraries/Knockout -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Runtime.CompilerServices; - -namespace KnockoutApi { - - /// - /// Represents an object containing a value dependent on other observable values. - /// - /// The type of the contained value. - [Imported] - [IgnoreNamespace] - public sealed class DependentObservable { - - private DependentObservable() { - } - - /// - /// Gets the current computed value. - /// - /// The current value. - [ScriptName("")] - public T GetValue() { - return default(T); - } - - /// - /// Disposes this Subscribable - /// - public void Dispose() { - } - - /// - /// For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies - /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate - /// For writable targets (observables, or writable dependent observables), we throttle *writes* - /// so the target cannot change value synchronously or faster than a certain rate - /// - /// - /// Extend is Chainable - public DependentObservable Extend(Dictionary options) { - return null; - } - - /// - /// Get Dependencies Count - /// - /// Returns the Number of Dependencies - public int GetDependenciesCount() { - return 0; - } - - /// - /// Sets the Value and Notifies all of the Subscribers - /// - /// The Value to be Set - public void NotifySubscribers(T value) { - } - - /// - /// Sets the Value and Notifies all of the Subscribers for the Specified Event - /// - /// The Value to be Set - /// [Optional] Event Name - public void NotifySubscribers(T value, string eventName) { - } - - /// - /// Subscribes to change notifications raised when the value changes. - /// - /// The callback to invoke. - /// A subscription cookie that can be disposed to unsubscribe. - public IDisposable Subscribe(Action changeCallback) { - return null; - } - } -} +// ComputedObservable.cs +// Script#/Libraries/Knockout +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace KnockoutApi { + + /// + /// Represents an object containing a computed value based on other observable values. + /// + /// The type of the contained value. + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ComputedObservable { + + private ComputedObservable() { + } + + /// + /// Gets the current computed value. + /// + /// The current value. + [ScriptName("")] + public T GetValue() { + return default(T); + } + + /// + /// Disposes this Subscribable + /// + public void Dispose() { + } + + /// + /// For computed observables, we throttle *evaluations* so that, no matter how fast its dependencies + /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate + /// For writable targets (observables, or writable dependent observables), we throttle *writes* + /// so the target cannot change value synchronously or faster than a certain rate + /// + /// + /// The current instance. + public ComputedObservable Extend(Dictionary options) { + return null; + } + + /// + /// Get Dependencies Count + /// + /// Returns the Number of Dependencies + public int GetDependenciesCount() { + return 0; + } + + /// + /// Sets the Value and Notifies all of the Subscribers + /// + /// The Value to be Set + public void NotifySubscribers(T value) { + } + + /// + /// Sets the Value and Notifies all of the Subscribers for the Specified Event + /// + /// The Value to be Set + /// [Optional] Event Name + public void NotifySubscribers(T value, string eventName) { + } + + /// + /// Subscribes to change notifications raised when the value changes. + /// + /// The callback to invoke. + /// A subscription cookie that can be disposed to unsubscribe. + public IDisposable Subscribe(Action changeCallback) { + return null; + } + } +} diff --git a/src/Libraries/Knockout/DependentObservableOptions.cs b/src/Libraries/Knockout/ComputedObservableOptions.cs similarity index 76% rename from src/Libraries/Knockout/DependentObservableOptions.cs rename to src/Libraries/Knockout/ComputedObservableOptions.cs index f440c10ce..3552a0f3f 100644 --- a/src/Libraries/Knockout/DependentObservableOptions.cs +++ b/src/Libraries/Knockout/ComputedObservableOptions.cs @@ -1,89 +1,96 @@ -// DependentObservableOptions.cs -// Script#/Libraries/Knockout -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Runtime.CompilerServices; - -namespace KnockoutApi { - - /// - /// Provides advanced options for defining a dependent observable. - /// - /// The type of the observable value. - [Imported] - [IgnoreNamespace] - [ScriptName("Object")] - public sealed class DependentObservableOptions { - - /// - /// Gets or sets whether the evaluation should be deferred, i.e. not - /// performed when the observable is first created. - /// - [IntrinsicProperty] - public bool DeferEvaluation { - get; - set; - } - - /// - /// Pass in a function that evaluates when the Dependency can be disposed - /// - [IntrinsicProperty] - public Func DisposeWhen { - get; - set; - } - - /// - /// "disposeWhenNodeIsRemoved" option both proactively disposes as soon as the node is removed using ko.removeNode(), - /// plus adds a "disposeWhen" callback that, on each evaluation, disposes if the node was removed by some other means. - /// - [IntrinsicProperty] - public object DisposeWhenNodeIsRemoved { - get; - set; - } - - /// - /// Gets or sets the function to compute the value. - /// - [ScriptName("read")] - [IntrinsicProperty] - public Func GetValueFunction { - get; - set; - } - - /// - /// Gets or sets the function to write the value. - /// - [ScriptName("write")] - [IntrinsicProperty] - public Action SetValueFunction { - get; - set; - } - - /// - /// Gets or sets the function to write the value. - /// - [ScriptName("write")] - [IntrinsicProperty] - public Action SetArrayValueFunction { - get; - set; - } - - /// - /// Gets the model instance which acts as 'this' in the get value function. - /// - [ScriptName("owner")] - [IntrinsicProperty] - public object Model { - get; - set; - } - } -} +// ComputedObservableOptions.cs +// Script#/Libraries/Knockout +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace KnockoutApi { + + /// + /// Provides advanced options for defining a dependent observable. + /// + /// The type of the observable value. + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class ComputedObservableOptions { + + public ComputedObservableOptions() { + } + + public ComputedObservableOptions(params object[] nameValuePairs) { + } + + /// + /// Gets or sets whether the evaluation should be deferred, i.e. not + /// performed when the observable is first created. + /// + [ScriptField] + public bool DeferEvaluation { + get; + set; + } + + /// + /// Pass in a function that evaluates when the Dependency can be disposed + /// + [ScriptField] + public Func DisposeWhen { + get; + set; + } + + /// + /// "disposeWhenNodeIsRemoved" option both proactively disposes as soon as the node is removed using ko.removeNode(), + /// plus adds a "disposeWhen" callback that, on each evaluation, disposes if the node was removed by some other means. + /// + [ScriptField] + public object DisposeWhenNodeIsRemoved { + get; + set; + } + + /// + /// Gets or sets the function to compute the value. + /// + [ScriptName("read")] + [ScriptField] + public Func GetValueFunction { + get; + set; + } + + /// + /// Gets or sets the function to write the value. + /// + [ScriptName("write")] + [ScriptField] + public Action SetValueFunction { + get; + set; + } + + /// + /// Gets or sets the function to write the value. + /// + [ScriptName("write")] + [ScriptField] + public Action SetArrayValueFunction { + get; + set; + } + + /// + /// Gets the model instance which acts as 'this' in the get value function. + /// + [ScriptName("owner")] + [ScriptField] + public object Model { + get; + set; + } + } +} diff --git a/src/Libraries/Knockout/Knockout.cs b/src/Libraries/Knockout/Knockout.cs index d979bf3ed..da49e5c31 100644 --- a/src/Libraries/Knockout/Knockout.cs +++ b/src/Libraries/Knockout/Knockout.cs @@ -14,15 +14,15 @@ namespace KnockoutApi { /// /// Provides Knockout functionality. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("ko")] public static class Knockout { /// /// Provides access to the currently registered binding handlers. /// - [IntrinsicProperty] + [ScriptField] public static Dictionary BindingHandlers { get { return null; @@ -33,7 +33,7 @@ public static Dictionary BindingHandlers { /// Gets the mapping plugin which allows converting models to plain /// objects and JSON and vice-versa. /// - [IntrinsicProperty] + [ScriptField] public static KnockoutMapping Mapping { get { return null; @@ -45,7 +45,7 @@ public static KnockoutMapping Mapping { /// /// The object represented by 'this' within a handler. [ScriptAlias("this")] - [IntrinsicProperty] + [ScriptField] public static object Model { get { return null; @@ -104,38 +104,38 @@ public static void CleanNode(Element rootElement) { } /// - /// Returns the entire binding context associated with the DOM element + /// Creates an observable with a value computed from one or more other values. /// - /// - public static BindingContext ContextFor(Element node) { + /// The type of the observable value. + /// A function to compute the value. + /// A new computed observable instance. + public static ComputedObservable Computed(Func function) { return null; } /// - /// Returns the data item associated with a particular DOM element + /// Creates an observable with a value computed from one or more other values. /// - /// - public static T DataFor(Element node) { - return default(T); + /// The type of the observable value. + /// Options for the computed observable. + public static ComputedObservable Computed(ComputedObservableOptions options) { + return null; } /// - /// Creates an observable with a value computed from one or more other values. + /// Returns the entire binding context associated with the DOM element /// - /// The type of the observable value. - /// A function to compute the value. - /// A new dependent observable instance. - public static DependentObservable DependentObservable(Func function) { + /// + public static BindingContext ContextFor(Element node) { return null; } /// - /// Creates an observable with a value computed from one or more other values. + /// Returns the data item associated with a particular DOM element /// - /// The type of the observable value. - /// Options for the dependent observable. - public static DependentObservable DependentObservable(DependentObservableOptions options) { - return null; + /// + public static T DataFor(Element node) { + return default(T); } /// diff --git a/src/Libraries/Knockout/Knockout.csproj b/src/Libraries/Knockout/Knockout.csproj index 97e030537..540dd9195 100644 --- a/src/Libraries/Knockout/Knockout.csproj +++ b/src/Libraries/Knockout/Knockout.csproj @@ -42,20 +42,20 @@ true + + - - diff --git a/src/Libraries/Knockout/KnockoutMapping.cs b/src/Libraries/Knockout/KnockoutMapping.cs index be855b40c..416947c67 100644 --- a/src/Libraries/Knockout/KnockoutMapping.cs +++ b/src/Libraries/Knockout/KnockoutMapping.cs @@ -12,8 +12,8 @@ namespace KnockoutApi { /// Provides functionality for mapping between knockout models and JSON or /// vanilla script objects. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class KnockoutMapping { private KnockoutMapping() { diff --git a/src/Libraries/Knockout/KnockoutMappingArrayCreateOptions.cs b/src/Libraries/Knockout/KnockoutMappingArrayCreateOptions.cs index ae6ae9969..1fe84e562 100644 --- a/src/Libraries/Knockout/KnockoutMappingArrayCreateOptions.cs +++ b/src/Libraries/Knockout/KnockoutMappingArrayCreateOptions.cs @@ -8,26 +8,26 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingArrayCreateOptions { - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; } } - [IntrinsicProperty] + [ScriptField] public object Parent { get { return null; } } - [IntrinsicProperty] + [ScriptField] public object Skip { get { return null; diff --git a/src/Libraries/Knockout/KnockoutMappingArraySpecification.cs b/src/Libraries/Knockout/KnockoutMappingArraySpecification.cs index c16c519a9..d8f1624a1 100644 --- a/src/Libraries/Knockout/KnockoutMappingArraySpecification.cs +++ b/src/Libraries/Knockout/KnockoutMappingArraySpecification.cs @@ -8,8 +8,8 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public abstract class KnockoutMappingArraySpecification { @@ -17,12 +17,12 @@ internal KnockoutMappingArraySpecification() { } } - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingArraySpecification : KnockoutMappingArraySpecification { - [IntrinsicProperty] + [ScriptField] public Func Create { get { return null; @@ -31,7 +31,7 @@ public Func Create { } } - [IntrinsicProperty] + [ScriptField] public Func Key { get { return null; diff --git a/src/Libraries/Knockout/KnockoutMappingCreateOptions.cs b/src/Libraries/Knockout/KnockoutMappingCreateOptions.cs index d93323374..6748eec07 100644 --- a/src/Libraries/Knockout/KnockoutMappingCreateOptions.cs +++ b/src/Libraries/Knockout/KnockoutMappingCreateOptions.cs @@ -8,12 +8,12 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingCreateOptions { - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; @@ -22,7 +22,7 @@ public object Data { } } - [IntrinsicProperty] + [ScriptField] public object Parent { get { return null; diff --git a/src/Libraries/Knockout/KnockoutMappingPropertySpecification.cs b/src/Libraries/Knockout/KnockoutMappingPropertySpecification.cs index bb50a5568..a12eae78e 100644 --- a/src/Libraries/Knockout/KnockoutMappingPropertySpecification.cs +++ b/src/Libraries/Knockout/KnockoutMappingPropertySpecification.cs @@ -8,8 +8,8 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public abstract class KnockoutMappingPropertySpecification { @@ -17,12 +17,12 @@ protected KnockoutMappingPropertySpecification() { } } - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingPropertySpecification : KnockoutMappingPropertySpecification { - [IntrinsicProperty] + [ScriptField] public Func Create { get { return null; @@ -31,7 +31,7 @@ public Func Create { } } - [IntrinsicProperty] + [ScriptField] public Func Update { get { return null; diff --git a/src/Libraries/Knockout/KnockoutMappingSpecification.cs b/src/Libraries/Knockout/KnockoutMappingSpecification.cs index 1ea8146a8..4d7b4800d 100644 --- a/src/Libraries/Knockout/KnockoutMappingSpecification.cs +++ b/src/Libraries/Knockout/KnockoutMappingSpecification.cs @@ -8,12 +8,12 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingSpecification { - [IntrinsicProperty] + [ScriptField] public string[] Copy { get { return null; @@ -22,7 +22,7 @@ public string[] Copy { } } - [IntrinsicProperty] + [ScriptField] public string[] Ignore { get { return null; @@ -31,7 +31,7 @@ public string[] Ignore { } } - [IntrinsicProperty] + [ScriptField] public string[] Include { get { return null; @@ -40,7 +40,7 @@ public string[] Include { } } - [IntrinsicProperty] + [ScriptField] public KnockoutMappingPropertySpecification this[string propertyName] { get { return null; diff --git a/src/Libraries/Knockout/KnockoutMappingUpdateOptions.cs b/src/Libraries/Knockout/KnockoutMappingUpdateOptions.cs index 24f415c3a..8ac5ea239 100644 --- a/src/Libraries/Knockout/KnockoutMappingUpdateOptions.cs +++ b/src/Libraries/Knockout/KnockoutMappingUpdateOptions.cs @@ -8,12 +8,12 @@ namespace KnockoutApi { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class KnockoutMappingUpdateOptions { - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; @@ -22,7 +22,7 @@ public object Data { } } - [IntrinsicProperty] + [ScriptField] public object Observable { get { return null; @@ -31,7 +31,7 @@ public object Observable { } } - [IntrinsicProperty] + [ScriptField] public object Parent { get { return null; diff --git a/src/Libraries/Knockout/KnockoutUtils.cs b/src/Libraries/Knockout/KnockoutUtils.cs index c2d0e02f6..dc8649c51 100644 --- a/src/Libraries/Knockout/KnockoutUtils.cs +++ b/src/Libraries/Knockout/KnockoutUtils.cs @@ -11,8 +11,8 @@ namespace KnockoutApi { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("ko.utils")] public static class KnockoutUtils { @@ -100,7 +100,7 @@ public static Element[] GetFormFields(Element form, string fieldName) { /// /// Finds the Matching Field Elements (input) in the given Form Element and the given regular expression /// - public static Element[] GetFormFields(Element form, RegularExpression match) { + public static Element[] GetFormFields(Element form, RegExp match) { return null; } diff --git a/src/Libraries/Knockout/Observable.cs b/src/Libraries/Knockout/Observable.cs index 32cf972b7..4c4569e41 100644 --- a/src/Libraries/Knockout/Observable.cs +++ b/src/Libraries/Knockout/Observable.cs @@ -13,8 +13,8 @@ namespace KnockoutApi { /// Represents an object containing an observable value. /// /// The type of the contained value. - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public class Observable : Subscribable { internal Observable() { @@ -56,7 +56,7 @@ public void ValueWillMutate() { /// For complex types a supplied function can be assigned to improve /// change (mutation) detection /// - [IntrinsicProperty] + [ScriptField] public Func EqualityComparer { get; set; diff --git a/src/Libraries/Knockout/ObservableArray.cs b/src/Libraries/Knockout/ObservableArray.cs index 011d743ef..659d0c273 100644 --- a/src/Libraries/Knockout/ObservableArray.cs +++ b/src/Libraries/Knockout/ObservableArray.cs @@ -1,203 +1,203 @@ -// ObservableArray.cs -// Script#/Libraries/Knockout -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace KnockoutApi { - - /// - /// Represents an array of items that can be observed for changes to the set of - /// contained items. - /// - /// The type of the contained values. - [Imported] - [IgnoreNamespace] - public sealed class ObservableArray : Observable { - - private ObservableArray() { - } - - /// - /// Marks all values that match the given parameter as deleted. - /// - /// The value to mark as deleted. - public void Destroy(T value) { - } - - /// - /// Marks all values that satisfy the predicate as deleted. - /// - /// The predicate. - public void Destroy(Func predicate) { - } - - /// - /// Marks all values that satisfy the given parameters as deleted. - /// - /// An array of items to destroy. - public void DestroyAll(params T[] values) { - } - - /// - /// Gets the underlying items within the observable array. - /// This is a Copy of the Values in the Observable - /// - /// The collection of items. - [ScriptName("")] - public T[] GetItems() { - return null; - } - - /// - /// Sets the underlying items within the observable array. - /// - [ScriptName("")] - public void SetItems(T[] values) { - } - - /// - /// Returns the index of the first array item that equals the value. - /// - /// The value to check. - /// The index of the matching item; -1 if there is no match. - public int IndexOf(T value) { - return 0; - } - - /// - /// Removes the last value from the array and returns it. - /// - /// The last value. - public T Pop() { - return default(T); - } - - /// - /// Adds the value and notifies observers. - /// - /// The value to add. - public void Push(T value) { - } - - /// - /// Replaces the Specified Item with the NewItem - /// - public void Replace(T oldItem, T newItem) { - } - - /// - /// Removes all values that match the given parameter and returns them. - /// - /// The value to remove. - /// The removed values. - public T[] Remove(T value) { - return null; - } - - /// - /// Removes all values that satisfy the predicate and returns them. - /// - /// The removal predicate. - /// The removed values. - public T[] Remove(Func predicate) { - return null; - } - - /// - /// Removes all values from the array. - /// - /// The removed values - public T[] RemoveAll() { - return null; - } - - /// - /// Removes all values that satisfy the given parameters and returns them. - /// - /// An array of items to remove. - /// The removed values. - public T[] RemoveAll(params T[] values) { - return null; - } - - /// - /// Reverses the order of the array. - /// - public void Reverse() { - } - - /// - /// Removes the first value from the array and returns it - /// - /// The removed value. - public T Shift() { - return default(T); - } - - /// - /// Native Javascript Splice Function - /// Modifies the Existing Sequence - /// - /// Required. An integer that specifies at what position to add/remove elements - /// Required. The number of elements to be removed. If set to 0, no elements will be removed - /// Optional. The new element(s) to be added to the array - public void Splice(int index, int howmany, params T[] args) { - } - - /// - /// Returns elements from start index to the end of the array. - /// - /// Starting point of the sequence, if negative then it starts from the end. - /// The matched items. - public T[] Slice(int start) { - return null; - } - - /// - /// Returns elements from start index to end index. - /// - /// Starting point of the sequence, if negative then it starts from the end. - /// End point of the sequence. - /// The matched items. - public T[] Slice(int start, int end) { - return null; - } - - /// - /// Performs a default alphanumeric sort on the elements of the array. - /// - public void Sort() { - } - - /// - /// Performs a sort using the comparator function. - /// - /// The comparing function. - public void Sort(Func comparator) { - } - - /// - /// Inserts the value at the beginning of the array. - /// - /// The value to insert. - public void Unshift(T value) { - } - - /// - /// For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies - /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate - /// For writable targets (observables, or writable dependent observables), we throttle *writes* - /// so the target cannot change value synchronously or faster than a certain rate - /// - /// - /// Extend is Chainable - public new ObservableArray Extend(Dictionary options) { - return null; - } - } -} +// ObservableArray.cs +// Script#/Libraries/Knockout +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace KnockoutApi { + + /// + /// Represents an array of items that can be observed for changes to the set of + /// contained items. + /// + /// The type of the contained values. + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ObservableArray : Observable { + + private ObservableArray() { + } + + /// + /// Marks all values that match the given parameter as deleted. + /// + /// The value to mark as deleted. + public void Destroy(T value) { + } + + /// + /// Marks all values that satisfy the predicate as deleted. + /// + /// The predicate. + public void Destroy(Func predicate) { + } + + /// + /// Marks all values that satisfy the given parameters as deleted. + /// + /// An array of items to destroy. + public void DestroyAll(params T[] values) { + } + + /// + /// Gets the underlying items within the observable array. + /// This is a Copy of the Values in the Observable + /// + /// The collection of items. + [ScriptName("")] + public T[] GetItems() { + return null; + } + + /// + /// Sets the underlying items within the observable array. + /// + [ScriptName("")] + public void SetItems(T[] values) { + } + + /// + /// Returns the index of the first array item that equals the value. + /// + /// The value to check. + /// The index of the matching item; -1 if there is no match. + public int IndexOf(T value) { + return 0; + } + + /// + /// Removes the last value from the array and returns it. + /// + /// The last value. + public T Pop() { + return default(T); + } + + /// + /// Adds the value and notifies observers. + /// + /// The value to add. + public void Push(T value) { + } + + /// + /// Replaces the Specified Item with the NewItem + /// + public void Replace(T oldItem, T newItem) { + } + + /// + /// Removes all values that match the given parameter and returns them. + /// + /// The value to remove. + /// The removed values. + public T[] Remove(T value) { + return null; + } + + /// + /// Removes all values that satisfy the predicate and returns them. + /// + /// The removal predicate. + /// The removed values. + public T[] Remove(Func predicate) { + return null; + } + + /// + /// Removes all values from the array. + /// + /// The removed values + public T[] RemoveAll() { + return null; + } + + /// + /// Removes all values that satisfy the given parameters and returns them. + /// + /// An array of items to remove. + /// The removed values. + public T[] RemoveAll(params T[] values) { + return null; + } + + /// + /// Reverses the order of the array. + /// + public void Reverse() { + } + + /// + /// Removes the first value from the array and returns it + /// + /// The removed value. + public T Shift() { + return default(T); + } + + /// + /// Native Javascript Splice Function + /// Modifies the Existing Sequence + /// + /// Required. An integer that specifies at what position to add/remove elements + /// Required. The number of elements to be removed. If set to 0, no elements will be removed + /// Optional. The new element(s) to be added to the array + public void Splice(int index, int howmany, params T[] args) { + } + + /// + /// Returns elements from start index to the end of the array. + /// + /// Starting point of the sequence, if negative then it starts from the end. + /// The matched items. + public T[] Slice(int start) { + return null; + } + + /// + /// Returns elements from start index to end index. + /// + /// Starting point of the sequence, if negative then it starts from the end. + /// End point of the sequence. + /// The matched items. + public T[] Slice(int start, int end) { + return null; + } + + /// + /// Performs a default alphanumeric sort on the elements of the array. + /// + public void Sort() { + } + + /// + /// Performs a sort using the comparator function. + /// + /// The comparing function. + public void Sort(Func comparator) { + } + + /// + /// Inserts the value at the beginning of the array. + /// + /// The value to insert. + public void Unshift(T value) { + } + + /// + /// For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies + /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate + /// For writable targets (observables, or writable dependent observables), we throttle *writes* + /// so the target cannot change value synchronously or faster than a certain rate + /// + /// + /// Extend is Chainable + public new ObservableArray Extend(Dictionary options) { + return null; + } + } +} diff --git a/src/Libraries/Knockout/Properties/AssemblyInfo.cs b/src/Libraries/Knockout/Properties/AssemblyInfo.cs index 0c27441c8..3f1ced635 100644 --- a/src/Libraries/Knockout/Properties/AssemblyInfo.cs +++ b/src/Libraries/Knockout/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.Knockout")] [assembly: AssemblyDescription("Script# Knockout API")] -[assembly: ScriptAssembly("Knockout")] +[assembly: ScriptAssembly("knockout", Identifier = "ko")] diff --git a/src/Libraries/Knockout/Subscribable.cs b/src/Libraries/Knockout/Subscribable.cs index 084aef072..ec91587d8 100644 --- a/src/Libraries/Knockout/Subscribable.cs +++ b/src/Libraries/Knockout/Subscribable.cs @@ -1,94 +1,94 @@ -// BindingHandler.cs -// Script#/Libraries/Knockout -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections; -using System.Runtime.CompilerServices; - -namespace KnockoutApi { - - /// - /// Represents an object containing an subscribable value. - /// - /// The type of the contained value. - [Imported] - [IgnoreNamespace] - public abstract class Subscribable : IDisposable { - - internal Subscribable() { - } - - /// - /// Disposes this Subscribable - /// - public void Dispose() { - } - - /// - /// For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies - /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate - /// For writable targets (observables, or writable dependent observables), we throttle *writes* - /// so the target cannot change value synchronously or faster than a certain rate - /// - /// - /// Extend is Chainable - public Subscribable Extend(Dictionary options) { - return null; - } - - /// - /// Get Subscription Count - /// - /// Returns the Number of Subscribers - public int GetSubscriptionsCount() { - return 0; - } - - /// - /// Sets the Value and Notifies all of the Subscribers - /// - /// The Value to be Set - public void NotifySubscribers(T value) { - } - - /// - /// Sets the Value and Notifies all of the Subscribers for the Specified Event - /// - /// The Value to be Set - /// [Optional] Event Name - public void NotifySubscribers(T value, string eventName) { - } - - /// - /// Subscribes to change notifications raised when the value changes. - /// - /// The callback to invoke. - /// A subscription cookie that can be disposed to unsubscribe. - public IDisposable Subscribe(Action changeCallback) { - return null; - } - - /// - /// Subscribes to change notifications raised when the value changes. - /// - /// The callback to invoke. - /// callback target - /// A subscription cookie that can be disposed to unsubscribe. - public IDisposable Subscribe(Action changeCallback, object callBackTarget) { - return null; - } - - /// - /// Subscribes to change notifications raised when the value changes. - /// - /// The callback to invoke. - /// callback target - /// event registration - /// A subscription cookie that can be disposed to unsubscribe. - public IDisposable Subscribe(Action changeCallback, object callBackTarget, string eventName) { - return null; - } - } -} +// BindingHandler.cs +// Script#/Libraries/Knockout +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace KnockoutApi { + + /// + /// Represents an object containing an subscribable value. + /// + /// The type of the contained value. + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class Subscribable : IDisposable { + + internal Subscribable() { + } + + /// + /// Disposes this Subscribable + /// + public void Dispose() { + } + + /// + /// For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies + /// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate + /// For writable targets (observables, or writable dependent observables), we throttle *writes* + /// so the target cannot change value synchronously or faster than a certain rate + /// + /// + /// Extend is Chainable + public Subscribable Extend(Dictionary options) { + return null; + } + + /// + /// Get Subscription Count + /// + /// Returns the Number of Subscribers + public int GetSubscriptionsCount() { + return 0; + } + + /// + /// Sets the Value and Notifies all of the Subscribers + /// + /// The Value to be Set + public void NotifySubscribers(T value) { + } + + /// + /// Sets the Value and Notifies all of the Subscribers for the Specified Event + /// + /// The Value to be Set + /// [Optional] Event Name + public void NotifySubscribers(T value, string eventName) { + } + + /// + /// Subscribes to change notifications raised when the value changes. + /// + /// The callback to invoke. + /// A subscription cookie that can be disposed to unsubscribe. + public IDisposable Subscribe(Action changeCallback) { + return null; + } + + /// + /// Subscribes to change notifications raised when the value changes. + /// + /// The callback to invoke. + /// callback target + /// A subscription cookie that can be disposed to unsubscribe. + public IDisposable Subscribe(Action changeCallback, object callBackTarget) { + return null; + } + + /// + /// Subscribes to change notifications raised when the value changes. + /// + /// The callback to invoke. + /// callback target + /// event registration + /// A subscription cookie that can be disposed to unsubscribe. + public IDisposable Subscribe(Action changeCallback, object callBackTarget, string eventName) { + return null; + } + } +} diff --git a/src/Libraries/Microsoft/BingMaps/Location/GeoLocation.cs b/src/Libraries/Microsoft/BingMaps/Location/GeoLocation.cs index 94942320a..201187699 100644 --- a/src/Libraries/Microsoft/BingMaps/Location/GeoLocation.cs +++ b/src/Libraries/Microsoft/BingMaps/Location/GeoLocation.cs @@ -9,21 +9,21 @@ namespace Microsoft.Maps.Location { - [Imported] + [ScriptImport] [ScriptName("Object")] public sealed class GeoLocation { private GeoLocation() { } - [IntrinsicProperty] + [ScriptField] public MapLocation Center { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("position.coords")] public GeoCoordinates Coordinates { get { @@ -31,7 +31,7 @@ public GeoCoordinates Coordinates { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("position.timestamp")] public string Timestamp { get { diff --git a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationCircleOptions.cs b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationCircleOptions.cs index 7bdced484..f1f930591 100644 --- a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationCircleOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationCircleOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps.Location { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class GeoLocationCircleOptions { diff --git a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationError.cs b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationError.cs index d7bc97f1c..e6937fa78 100644 --- a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationError.cs +++ b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationError.cs @@ -8,21 +8,21 @@ namespace Microsoft.Maps.Location { - [Imported] + [ScriptImport] [ScriptName("Object")] public sealed class GeoLocationError { private GeoLocationError() { } - [IntrinsicProperty] + [ScriptField] public int ErrorCode { get { return 0; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("internalError.code")] public int InternalCode { get { @@ -30,7 +30,7 @@ public int InternalCode { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("internalError.message")] public string Message { get { diff --git a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationOptions.cs b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationOptions.cs index bf8f0cf8a..e0f4fc48d 100644 --- a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps.Location { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class GeoLocationOptions { diff --git a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationProvider.cs b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationProvider.cs index 567aa4062..d2c6c9e2b 100644 --- a/src/Libraries/Microsoft/BingMaps/Location/GeoLocationProvider.cs +++ b/src/Libraries/Microsoft/BingMaps/Location/GeoLocationProvider.cs @@ -8,8 +8,7 @@ namespace Microsoft.Maps.Location { - [Imported] - [ScriptNamespace("Microsoft.Maps")] + [ScriptImport] public sealed class GeoLocationProvider { public GeoLocationProvider(Map map) { diff --git a/src/Libraries/Microsoft/BingMaps/Map.cs b/src/Libraries/Microsoft/BingMaps/Map.cs index a9a7d404f..db7e60faa 100644 --- a/src/Libraries/Microsoft/BingMaps/Map.cs +++ b/src/Libraries/Microsoft/BingMaps/Map.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] public sealed class Map { public Map(Element element) { @@ -19,7 +19,7 @@ public Map(Element element) { public Map(Element element, MapOptions options) { } - [IntrinsicProperty] + [ScriptField] public MapEntityCollection Entities { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/MapAltitudeMode.cs b/src/Libraries/Microsoft/BingMaps/MapAltitudeMode.cs index 11dbfb7a4..3c7ac0c33 100644 --- a/src/Libraries/Microsoft/BingMaps/MapAltitudeMode.cs +++ b/src/Libraries/Microsoft/BingMaps/MapAltitudeMode.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("AltitudeReference")] public enum MapAltitudeMode { diff --git a/src/Libraries/Microsoft/BingMaps/MapAnimationVisibility.cs b/src/Libraries/Microsoft/BingMaps/MapAnimationVisibility.cs index be15f848a..6ae568697 100644 --- a/src/Libraries/Microsoft/BingMaps/MapAnimationVisibility.cs +++ b/src/Libraries/Microsoft/BingMaps/MapAnimationVisibility.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("AnimationVisibility")] public enum MapAnimationVisibility { diff --git a/src/Libraries/Microsoft/BingMaps/MapBounds.cs b/src/Libraries/Microsoft/BingMaps/MapBounds.cs index a7895a8ea..79f33e0ae 100644 --- a/src/Libraries/Microsoft/BingMaps/MapBounds.cs +++ b/src/Libraries/Microsoft/BingMaps/MapBounds.cs @@ -8,28 +8,28 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("LocationRect")] public sealed class MapBounds { public MapBounds(MapLocation center, double width, double height) { } - [IntrinsicProperty] + [ScriptField] public MapLocation Center { get { return null; } } - [IntrinsicProperty] + [ScriptField] public double Height { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Width { get { return 0; diff --git a/src/Libraries/Microsoft/BingMaps/MapColor.cs b/src/Libraries/Microsoft/BingMaps/MapColor.cs index 133cbfea0..94c12e46d 100644 --- a/src/Libraries/Microsoft/BingMaps/MapColor.cs +++ b/src/Libraries/Microsoft/BingMaps/MapColor.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Members - [Imported] + [ScriptImport] [ScriptName("Color")] public sealed class MapColor { diff --git a/src/Libraries/Microsoft/BingMaps/MapEntity.cs b/src/Libraries/Microsoft/BingMaps/MapEntity.cs index 5cf2efc15..fb05bf3be 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEntity.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEntity.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] public abstract class MapEntity { public object Data; diff --git a/src/Libraries/Microsoft/BingMaps/MapEntityCollection.cs b/src/Libraries/Microsoft/BingMaps/MapEntityCollection.cs index 924678547..5373ba471 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEntityCollection.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEntityCollection.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("EntityCollection")] public sealed class MapEntityCollection { diff --git a/src/Libraries/Microsoft/BingMaps/MapEntityCollectionEventArgs.cs b/src/Libraries/Microsoft/BingMaps/MapEntityCollectionEventArgs.cs index d0dd6f96f..62c8f0925 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEntityCollectionEventArgs.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEntityCollectionEventArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class MapEntityCollectionEventArgs : MapEventArgs { private MapEntityCollectionEventArgs() { diff --git a/src/Libraries/Microsoft/BingMaps/MapEntityCollectionOptions.cs b/src/Libraries/Microsoft/BingMaps/MapEntityCollectionOptions.cs index 85d5cd229..e62c2b870 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEntityCollectionOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEntityCollectionOptions.cs @@ -8,18 +8,18 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("Object")] - [IgnoreNamespace] + [ScriptIgnoreNamespace] public sealed class MapEntityCollectionOptions { - [IntrinsicProperty] + [ScriptField] public bool Visible { get; set; } - [IntrinsicProperty] + [ScriptField] public int ZIndex { get; set; diff --git a/src/Libraries/Microsoft/BingMaps/MapEntityEventArgs.cs b/src/Libraries/Microsoft/BingMaps/MapEntityEventArgs.cs index 41e8b8d40..ed6c65755 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEntityEventArgs.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEntityEventArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class MapEntityEventArgs : MapEventArgs { private MapEntityEventArgs() { diff --git a/src/Libraries/Microsoft/BingMaps/MapEventArgs.cs b/src/Libraries/Microsoft/BingMaps/MapEventArgs.cs index a5aa5ea8c..fd3a25605 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEventArgs.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEventArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public class MapEventArgs : EventArgs { internal MapEventArgs() { diff --git a/src/Libraries/Microsoft/BingMaps/MapEventTarget.cs b/src/Libraries/Microsoft/BingMaps/MapEventTarget.cs index a801f9b5a..59cda490f 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEventTarget.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEventTarget.cs @@ -12,9 +12,9 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum MapEventTarget { Map = 0, diff --git a/src/Libraries/Microsoft/BingMaps/MapEvents.cs b/src/Libraries/Microsoft/BingMaps/MapEvents.cs index 8b87a7fcd..c2d04a415 100644 --- a/src/Libraries/Microsoft/BingMaps/MapEvents.cs +++ b/src/Libraries/Microsoft/BingMaps/MapEvents.cs @@ -12,7 +12,7 @@ namespace Microsoft.Maps { public delegate void MapEventHandler(MapEventArgs e); - [Imported] + [ScriptImport] [ScriptName("Events")] public static class MapEvents { diff --git a/src/Libraries/Microsoft/BingMaps/MapInfobox.cs b/src/Libraries/Microsoft/BingMaps/MapInfobox.cs index 4acaa83a6..20fcd83d7 100644 --- a/src/Libraries/Microsoft/BingMaps/MapInfobox.cs +++ b/src/Libraries/Microsoft/BingMaps/MapInfobox.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("Infobox")] public sealed class MapInfobox : MapEntity { diff --git a/src/Libraries/Microsoft/BingMaps/MapInfoboxAction.cs b/src/Libraries/Microsoft/BingMaps/MapInfoboxAction.cs index 9c532f146..a780e24b2 100644 --- a/src/Libraries/Microsoft/BingMaps/MapInfoboxAction.cs +++ b/src/Libraries/Microsoft/BingMaps/MapInfoboxAction.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapInfoBoxAction { diff --git a/src/Libraries/Microsoft/BingMaps/MapInfoboxOptions.cs b/src/Libraries/Microsoft/BingMaps/MapInfoboxOptions.cs index e667f3acb..80fb29f57 100644 --- a/src/Libraries/Microsoft/BingMaps/MapInfoboxOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapInfoboxOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapInfoboxOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapKeyEventArgs.cs b/src/Libraries/Microsoft/BingMaps/MapKeyEventArgs.cs index 854bbd9a7..602baec0c 100644 --- a/src/Libraries/Microsoft/BingMaps/MapKeyEventArgs.cs +++ b/src/Libraries/Microsoft/BingMaps/MapKeyEventArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class MapKeyEventArgs : MapEventArgs { private MapKeyEventArgs() { diff --git a/src/Libraries/Microsoft/BingMaps/MapLabelOverlay.cs b/src/Libraries/Microsoft/BingMaps/MapLabelOverlay.cs index 346284ba7..4b8341cd8 100644 --- a/src/Libraries/Microsoft/BingMaps/MapLabelOverlay.cs +++ b/src/Libraries/Microsoft/BingMaps/MapLabelOverlay.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] + [ScriptImport] [ScriptName("LabelOverlay")] public enum MapLabelOverlay { diff --git a/src/Libraries/Microsoft/BingMaps/MapLocation.cs b/src/Libraries/Microsoft/BingMaps/MapLocation.cs index ea56a3316..4542b5a12 100644 --- a/src/Libraries/Microsoft/BingMaps/MapLocation.cs +++ b/src/Libraries/Microsoft/BingMaps/MapLocation.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("Location")] public sealed class MapLocation { @@ -18,28 +18,28 @@ public MapLocation(double latitude, double longitude) { public MapLocation(double latitude, double longitude, double altitude, MapAltitudeMode altitudeMode) { } - [IntrinsicProperty] + [ScriptField] public double Altitude { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public MapAltitudeMode AltitudeMode { get { return MapAltitudeMode.Ground; } } - [IntrinsicProperty] + [ScriptField] public double Latitude { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Longitude { get { return 0; diff --git a/src/Libraries/Microsoft/BingMaps/MapModule.cs b/src/Libraries/Microsoft/BingMaps/MapModule.cs index 030d4d4e2..d5bd5d22e 100644 --- a/src/Libraries/Microsoft/BingMaps/MapModule.cs +++ b/src/Libraries/Microsoft/BingMaps/MapModule.cs @@ -8,9 +8,9 @@ namespace Microsoft.Maps { - [Imported] - [NamedValues] - [IgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] + [ScriptIgnoreNamespace] public enum MapModule { [ScriptName("Microsoft.Maps.Directions")] diff --git a/src/Libraries/Microsoft/BingMaps/MapModuleOptions.cs b/src/Libraries/Microsoft/BingMaps/MapModuleOptions.cs index ad9eb7eb1..73980bbb3 100644 --- a/src/Libraries/Microsoft/BingMaps/MapModuleOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapModuleOptions.cs @@ -8,8 +8,8 @@ namespace Microsoft.Maps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapModuleOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapMouseEventArgs.cs b/src/Libraries/Microsoft/BingMaps/MapMouseEventArgs.cs index c829cca9b..b31bb5ea6 100644 --- a/src/Libraries/Microsoft/BingMaps/MapMouseEventArgs.cs +++ b/src/Libraries/Microsoft/BingMaps/MapMouseEventArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class MapMouseEventArgs : MapEventArgs { private MapMouseEventArgs() { diff --git a/src/Libraries/Microsoft/BingMaps/MapOptions.cs b/src/Libraries/Microsoft/BingMaps/MapOptions.cs index 82c769499..b0b21417c 100644 --- a/src/Libraries/Microsoft/BingMaps/MapOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapOptions.cs @@ -10,9 +10,9 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] + [ScriptImport] [ScriptName("Object")] - [IgnoreNamespace] + [ScriptIgnoreNamespace] public sealed class MapOptions { public MapColor BackgroundColor; diff --git a/src/Libraries/Microsoft/BingMaps/MapPoint.cs b/src/Libraries/Microsoft/BingMaps/MapPoint.cs index 80452f074..a384cf324 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPoint.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPoint.cs @@ -8,21 +8,21 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("Point")] public sealed class MapPoint { public MapPoint(double x, double y) { } - [IntrinsicProperty] + [ScriptField] public double X { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Y { get { return 0; diff --git a/src/Libraries/Microsoft/BingMaps/MapPointReference.cs b/src/Libraries/Microsoft/BingMaps/MapPointReference.cs index 89d54ab5b..45ff1fa94 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPointReference.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPointReference.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("PixelReference")] public enum MapPointReference { diff --git a/src/Libraries/Microsoft/BingMaps/MapPolygon.cs b/src/Libraries/Microsoft/BingMaps/MapPolygon.cs index 5d677d12c..f547180c9 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPolygon.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPolygon.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("Polygon")] public sealed class MapPolygon : MapShape { diff --git a/src/Libraries/Microsoft/BingMaps/MapPolygonOptions.cs b/src/Libraries/Microsoft/BingMaps/MapPolygonOptions.cs index 39790294d..5fc325d33 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPolygonOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPolygonOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapPolygonOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapPolyline.cs b/src/Libraries/Microsoft/BingMaps/MapPolyline.cs index 3ab412c06..a2cb99fae 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPolyline.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPolyline.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("Polyline")] public sealed class MapPolyline : MapShape { diff --git a/src/Libraries/Microsoft/BingMaps/MapPolylineOptions.cs b/src/Libraries/Microsoft/BingMaps/MapPolylineOptions.cs index ce1c4b8a1..d5b74bbc8 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPolylineOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPolylineOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapPolylineOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapPushpin.cs b/src/Libraries/Microsoft/BingMaps/MapPushpin.cs index 55bce03a1..3c03ccb30 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPushpin.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPushpin.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("Pushpin")] public sealed class MapPushpin : MapEntity { diff --git a/src/Libraries/Microsoft/BingMaps/MapPushpinOptions.cs b/src/Libraries/Microsoft/BingMaps/MapPushpinOptions.cs index b1c4109a6..97c29d89e 100644 --- a/src/Libraries/Microsoft/BingMaps/MapPushpinOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapPushpinOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapPushpinOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapShape.cs b/src/Libraries/Microsoft/BingMaps/MapShape.cs index 33cf3db16..460d48a80 100644 --- a/src/Libraries/Microsoft/BingMaps/MapShape.cs +++ b/src/Libraries/Microsoft/BingMaps/MapShape.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] public abstract class MapShape : MapEntity { public MapLocation[] GetLocations() { diff --git a/src/Libraries/Microsoft/BingMaps/MapTile.cs b/src/Libraries/Microsoft/BingMaps/MapTile.cs index de3bcd2d2..cdbebd407 100644 --- a/src/Libraries/Microsoft/BingMaps/MapTile.cs +++ b/src/Libraries/Microsoft/BingMaps/MapTile.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapTile { diff --git a/src/Libraries/Microsoft/BingMaps/MapTileLayer.cs b/src/Libraries/Microsoft/BingMaps/MapTileLayer.cs index 7071c9d7b..9ceb578dc 100644 --- a/src/Libraries/Microsoft/BingMaps/MapTileLayer.cs +++ b/src/Libraries/Microsoft/BingMaps/MapTileLayer.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("TileLayer")] public class MapTileLayer : MapEntity { diff --git a/src/Libraries/Microsoft/BingMaps/MapTileLayerOptions.cs b/src/Libraries/Microsoft/BingMaps/MapTileLayerOptions.cs index ba752b7bb..4cf2da615 100644 --- a/src/Libraries/Microsoft/BingMaps/MapTileLayerOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapTileLayerOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapTileLayerOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapTileSource.cs b/src/Libraries/Microsoft/BingMaps/MapTileSource.cs index 30ca37d26..496c978f6 100644 --- a/src/Libraries/Microsoft/BingMaps/MapTileSource.cs +++ b/src/Libraries/Microsoft/BingMaps/MapTileSource.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maps { // TODO: Other members - [Imported] + [ScriptImport] [ScriptName("TileSource")] public class MapTileSource { diff --git a/src/Libraries/Microsoft/BingMaps/MapTileSourceOptions.cs b/src/Libraries/Microsoft/BingMaps/MapTileSourceOptions.cs index 9ae9e57ea..16abc936c 100644 --- a/src/Libraries/Microsoft/BingMaps/MapTileSourceOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapTileSourceOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class MapTileSourceOptions { diff --git a/src/Libraries/Microsoft/BingMaps/MapType.cs b/src/Libraries/Microsoft/BingMaps/MapType.cs index e350cdbb6..a17ab359e 100644 --- a/src/Libraries/Microsoft/BingMaps/MapType.cs +++ b/src/Libraries/Microsoft/BingMaps/MapType.cs @@ -8,7 +8,7 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("MapTypeId")] public enum MapType { diff --git a/src/Libraries/Microsoft/BingMaps/MapViewOptions.cs b/src/Libraries/Microsoft/BingMaps/MapViewOptions.cs index 6a7a9df41..16367c722 100644 --- a/src/Libraries/Microsoft/BingMaps/MapViewOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/MapViewOptions.cs @@ -10,9 +10,9 @@ namespace Microsoft.Maps { // TODO: Make properties - [Imported] + [ScriptImport] [ScriptName("Object")] - [IgnoreNamespace] + [ScriptIgnoreNamespace] public sealed class MapViewOptions { [ScriptName("mapTypeId")] diff --git a/src/Libraries/Microsoft/BingMaps/MapZoomRange.cs b/src/Libraries/Microsoft/BingMaps/MapZoomRange.cs index cb102ff33..8bb54db5e 100644 --- a/src/Libraries/Microsoft/BingMaps/MapZoomRange.cs +++ b/src/Libraries/Microsoft/BingMaps/MapZoomRange.cs @@ -8,18 +8,18 @@ namespace Microsoft.Maps { - [Imported] + [ScriptImport] [ScriptName("Object")] - [IgnoreNamespace] + [ScriptIgnoreNamespace] public sealed class MapZoomRange { - [IntrinsicProperty] + [ScriptField] public int Min { get; set; } - [IntrinsicProperty] + [ScriptField] public int Max { get; set; diff --git a/src/Libraries/Microsoft/BingMaps/Properties/AssemblyInfo.cs b/src/Libraries/Microsoft/BingMaps/Properties/AssemblyInfo.cs index 448629185..1b93d4547 100644 --- a/src/Libraries/Microsoft/BingMaps/Properties/AssemblyInfo.cs +++ b/src/Libraries/Microsoft/BingMaps/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.Microsoft.BingMaps")] [assembly: AssemblyDescription("Script# Bing Maps API")] -[assembly: ScriptAssembly("bingMaps")] +[assembly: ScriptAssembly("vemaps")] diff --git a/src/Libraries/Microsoft/BingMaps/Traffic/TrafficLayer.cs b/src/Libraries/Microsoft/BingMaps/Traffic/TrafficLayer.cs index cc6ac220e..1c2fcfe58 100644 --- a/src/Libraries/Microsoft/BingMaps/Traffic/TrafficLayer.cs +++ b/src/Libraries/Microsoft/BingMaps/Traffic/TrafficLayer.cs @@ -8,7 +8,8 @@ namespace Microsoft.Maps.Traffic { - [Imported] + [ScriptImport] + [ScriptName("Traffic.TrafficLayer")] public sealed class TrafficLayer { public TrafficLayer(Map map) { diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/Venue.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/Venue.cs index 88be94e94..d008c7f96 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/Venue.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/Venue.cs @@ -8,22 +8,22 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class Venue { private Venue() { } - [IntrinsicProperty] + [ScriptField] public double Distance { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public VenueMetadata Metadata { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntity.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntity.cs index c572144b3..02bc33525 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntity.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntity.cs @@ -8,15 +8,15 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueEntity { private VenueEntity() { } - [IntrinsicProperty] + [ScriptField] public MapBounds Bounds { get { return null; @@ -24,42 +24,42 @@ public MapBounds Bounds { } [ScriptName("categoryName")] - [IntrinsicProperty] + [ScriptField] public string Category { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapLocation Center { get { return null; } } - [IntrinsicProperty] + [ScriptField] public VenueFloor Floor { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string ID { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapLocation[] Locations { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntityPolygon.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntityPolygon.cs index ad4d8de21..ceeb88edf 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntityPolygon.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueEntityPolygon.cs @@ -8,29 +8,29 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueEntityPolygon { private VenueEntityPolygon() { } - [IntrinsicProperty] + [ScriptField] public MapBounds Bounds { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapLocation Center { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapLocation[] Locations { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFloor.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFloor.cs index e3a019067..89552ab4f 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFloor.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFloor.cs @@ -8,8 +8,8 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueFloor { @@ -17,21 +17,21 @@ private VenueFloor() { } [ScriptName("primitives")] - [IntrinsicProperty] + [ScriptField] public VenueEntity[] Entities { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int[] ZoomRange { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFootprint.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFootprint.cs index d00df0b00..a685fefe8 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFootprint.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueFootprint.cs @@ -8,22 +8,22 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueFootprint { private VenueFootprint() { } - [IntrinsicProperty] + [ScriptField] public VenueEntityPolygon[] Polygons { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int[] ZoomRange { get { return null; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMap.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMap.cs index 6d64e411c..40ca8235d 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMap.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMap.cs @@ -8,83 +8,83 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] + [ScriptImport] public sealed class VenueMap { private VenueMap() { } - [IntrinsicProperty] + [ScriptField] public string Address { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapViewOptions BestMapView { get { return null; } } - [IntrinsicProperty] + [ScriptField] public MapLocation Center { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string DefaultFloor { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string FloorHeader { get { return null; } } - [IntrinsicProperty] + [ScriptField] public VenueFloor[] Floors { get { return null; } } - [IntrinsicProperty] + [ScriptField] public VenueFootprint Footprint { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string ID { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string PhoneNumber { get { return null; } } - [IntrinsicProperty] + [ScriptField] public VenueType Type { get { return VenueType.Mall; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapFactory.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapFactory.cs index 97dfa229b..dea075600 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapFactory.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapFactory.cs @@ -8,7 +8,8 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] + [ScriptImport] + [ScriptName("VenueMaps.VenueMapFactory")] public sealed class VenueMapFactory { public VenueMapFactory(Map map) { diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapOptions.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapOptions.cs index 119e42bc8..191308798 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps.VenueMaps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueMapOptions { diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapSearchOptions.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapSearchOptions.cs index 42926a1c8..c999ff5b9 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapSearchOptions.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMapSearchOptions.cs @@ -10,8 +10,8 @@ namespace Microsoft.Maps.VenueMaps { // TODO: Make properties - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueMapSearchOptions { diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMetadata.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMetadata.cs index f0aa8985a..1df5251d9 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMetadata.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueMetadata.cs @@ -8,40 +8,40 @@ namespace Microsoft.Maps.VenueMaps { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class VenueMetadata { private VenueMetadata() { } - [PreserveCase] - [IntrinsicProperty] + [ScriptName(PreserveCase = true)] + [ScriptField] public string DefaultFloor { get { return null; } } - [PreserveCase] - [IntrinsicProperty] + [ScriptName(PreserveCase = true)] + [ScriptField] public string FloorHeader { get { return null; } } - [PreserveCase] - [IntrinsicProperty] + [ScriptName(PreserveCase = true)] + [ScriptField] public VenueFloor[] Floors { get { return null; } } - [PreserveCase] - [IntrinsicProperty] + [ScriptName(PreserveCase = true)] + [ScriptField] public VenueFootprint Footprint { get { return null; @@ -49,7 +49,7 @@ public VenueFootprint Footprint { } [ScriptName("MapId")] - [IntrinsicProperty] + [ScriptField] public string ID { get { return null; @@ -57,7 +57,7 @@ public string ID { } [ScriptName("CenterLat")] - [IntrinsicProperty] + [ScriptField] public double Latitude { get { return 0; @@ -65,15 +65,15 @@ public double Latitude { } [ScriptName("CenterLong")] - [IntrinsicProperty] + [ScriptField] public double Longitude { get { return 0; } } - [PreserveCase] - [IntrinsicProperty] + [ScriptName(PreserveCase = true)] + [ScriptField] public string Name { get { return null; @@ -81,7 +81,7 @@ public string Name { } [ScriptName("MapType")] - [IntrinsicProperty] + [ScriptField] public VenueType Type { get { return VenueType.Mall; diff --git a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueType.cs b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueType.cs index 323d3c1e6..7f8cdf33d 100644 --- a/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueType.cs +++ b/src/Libraries/Microsoft/BingMaps/VenueMaps/VenueType.cs @@ -8,8 +8,8 @@ namespace Microsoft.Maps { - [Imported] - [NamedValues] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum VenueType { Mall diff --git a/src/Libraries/Node/Node.Azure/Azure.cs b/src/Libraries/Node/Node.Azure/Azure.cs new file mode 100644 index 000000000..7b6a58b4d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Azure.cs @@ -0,0 +1,53 @@ +// Azure.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.WindowsAzure.Runtime; +using NodeApi.WindowsAzure.Storage; + +namespace NodeApi.WindowsAzure { + + /// + /// The root Azure services API. + /// + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure")] + public static class Azure { + + [ScriptField] + [ScriptName(PreserveCase = true)] + public static RoleEnvironment RoleEnvironment { + get { + return null; + } + } + + public static CloudBlobService CreateBlobService() { + return null; + } + + public static CloudBlobService CreateBlobService(string storageAccount, string accessKey) { + return null; + } + + public static CloudQueueService CreateQueueService() { + return null; + } + + public static CloudQueueService CreateQueueService(string storageAccount, string accessKey) { + return null; + } + + public static CloudTableService CreateTableService() { + return null; + } + + public static CloudTableService CreateTableService(string storageAccount, string accessKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Node.Azure.csproj b/src/Libraries/Node/Node.Azure/Node.Azure.csproj new file mode 100644 index 000000000..a9296cadd --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Node.Azure.csproj @@ -0,0 +1,88 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} + Library + Properties + NodeApi.WindowsAzure + Script.Node.Azure + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..653672513 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node.Azure")] +[assembly: AssemblyDescription("Script# NodeJS Azure Module API")] +[assembly: ScriptAssembly("azure")] diff --git a/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt new file mode 100644 index 000000000..a0e3513f9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Azure Module +=============================================================================== + +This assembly provides access to Azure Cloud APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against Azure APIs. + +More information is on http://www.windowsazure.com/en-us/develop/nodejs/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Azure/Runtime/Role.cs b/src/Libraries/Node/Node.Azure/Runtime/Role.cs new file mode 100644 index 000000000..2841fc2c5 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/Role.cs @@ -0,0 +1,18 @@ +// Role.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Role { + + private Role() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs new file mode 100644 index 000000000..87e1320c8 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs @@ -0,0 +1,63 @@ +// RoleEnvironment.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEnvironment { + + private RoleEnvironment() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Changed { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Changing { + add { + } + remove { + } + } + + public void ClearStatus(AsyncCallback callback) { + } + + public void GetConfigurationSettings(AsyncResultCallback> callback) { + } + + public void GetCurrentRoleInstance(AsyncResultCallback callback) { + } + + [ScriptName("getDeploymentId")] + public void GetDeploymentID(AsyncResultCallback callback) { + } + + public void GetRoles(AsyncResultCallback callback) { + } + + public void IsAvailable(AsyncResultCallback callback) { + } + + public void IsEmulated(AsyncResultCallback callback) { + } + + public void RequestRecycle(AsyncCallback callback) { + } + + public void SetStatus(RoleStatus status, Date expirationDate, AsyncCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs new file mode 100644 index 000000000..ac2834823 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs @@ -0,0 +1,32 @@ +// RoleEvent.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEvent { + + private RoleEvent() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + + [ScriptField] + public RoleEventType Type { + get { + return RoleEventType.ConfigurationSettingChange; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs new file mode 100644 index 000000000..e7403960e --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs @@ -0,0 +1,20 @@ +// RoleEventType.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleEventType { + + TopologyChange = 0, + + ConfigurationSettingChange = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs new file mode 100644 index 000000000..272d094e9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs @@ -0,0 +1,18 @@ +// RoleInstance.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleInstance { + + private RoleInstance() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs new file mode 100644 index 000000000..47f37368d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs @@ -0,0 +1,20 @@ +// RoleStatus.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleStatus { + + Busy = 0, + + Ready = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs new file mode 100644 index 000000000..35caef469 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs @@ -0,0 +1,26 @@ +// CloudBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlob { + + internal CloudBlob() { + } + + [ScriptField] + [ScriptName("blob")] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs new file mode 100644 index 000000000..374a1cd31 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs @@ -0,0 +1,25 @@ +// CloudBlobContainer.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainer { + + private CloudBlobContainer() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs new file mode 100644 index 000000000..3bec7f8c9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobContainerListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainerListContinuation { + + private CloudBlobContainerListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs new file mode 100644 index 000000000..725507961 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs @@ -0,0 +1,25 @@ +// CloudBlobLease.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlobLease { + + internal CloudBlobLease() { + } + + [ScriptField] + public string ID { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs new file mode 100644 index 000000000..31065d9db --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobListContinuation { + + private CloudBlobListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs new file mode 100644 index 000000000..04ad65b8b --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs @@ -0,0 +1,145 @@ +// CloudBlobService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: ACLs + // TODO: Page blobs + // TODO: Shared access signatures + // TODO: Metadata/properties + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobService { + + private CloudBlobService() { + } + + public void AcquireLease(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void AcquireLease(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void CreateContainer(string containerName, AsyncCallback callback) { + } + + public void CreateContainer(string containerName, object options, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, object options, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, object options, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, object options, AsyncCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, object options, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListContainers(AsyncResultCallback> callback) { + } + + public void ListContainers(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ListContainers(object options, AsyncResultCallback> callback) { + } + + public void ListContainers(object options, AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs new file mode 100644 index 000000000..b7457ae05 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs @@ -0,0 +1,18 @@ +// CloudBlockBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlockBlob : CloudBlob { + + private CloudBlockBlob() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs new file mode 100644 index 000000000..949eede12 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs @@ -0,0 +1,26 @@ +// CloudQueue.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueue { + + private CloudQueue() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs new file mode 100644 index 000000000..2d32e5418 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs @@ -0,0 +1,33 @@ +// CloudQueueListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueListContinuation { + + private CloudQueueListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudQueueListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs new file mode 100644 index 000000000..42d075201 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs @@ -0,0 +1,42 @@ +// CloudQueueMessage.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueMessage { + + private CloudQueueMessage() { + } + + [ScriptField] + [ScriptName("messageid")] + public string MessageID { + get { + return null; + } + } + + [ScriptField] + [ScriptName("messagetext")] + public string MessageText { + get { + return null; + } + } + + [ScriptField] + [ScriptName("popreceipt")] + public string PopReceipt { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs new file mode 100644 index 000000000..f3826a8d3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs @@ -0,0 +1,82 @@ +// CloudQueueService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueService { + + private CloudQueueService() { + } + + public void ClearMessages(string queueName, AsyncCallback callback) { + } + + public void ClearMessages(string queueName, object options, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, object options, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, object options, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, object options, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, object options, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, object options, AsyncCallback callback) { + } + + public void GetMessages(string queueName, AsyncResultCallback> callback) { + } + + public void GetMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void ListQueues(AsyncResultCallback> callback) { + } + + public void ListQueues(object options, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, AsyncResultCallback callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs new file mode 100644 index 000000000..0c83c1f85 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs @@ -0,0 +1,26 @@ +// CloudTable.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTable { + + private CloudTable() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string TableName { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs new file mode 100644 index 000000000..536c61764 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs @@ -0,0 +1,60 @@ +// CloudTableEntity.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class CloudTableEntity { + + public CloudTableEntity() { + } + + public CloudTableEntity(params object[] nameValuePairs) { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string PartitionKey { + get { + return null; + } + set { + } + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string RowKey { + get { + return null; + } + set { + } + } + + [ScriptField] + public object this[string key] { + get { + return null; + } + set { + } + } + + public static implicit operator Dictionary(CloudTableEntity entity) { + return null; + } + + public static implicit operator CloudTableEntity(Dictionary data) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs new file mode 100644 index 000000000..10214c048 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs @@ -0,0 +1,33 @@ +// CloudTableListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableListContinuation { + + private CloudTableListContinuation() { + } + + [ScriptField] + public string NextTableName { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs new file mode 100644 index 000000000..a54c06903 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs @@ -0,0 +1,57 @@ +// CloudTableQuery.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure.TableQuery")] + public sealed class CloudTableQuery { + + public CloudTableQuery And(string filter, object[] values) { + return null; + } + + public CloudTableQuery From(string tableName) { + return null; + } + + public CloudTableQuery Or(string filter, object[] values) { + return null; + } + + public CloudTableQuery Select() { + return null; + } + + public CloudTableQuery Select(string[] fields) { + return null; + } + + public CloudTableQuery Top(int count) { + return null; + } + + public CloudTableQuery Where(string filter, string value) { + return null; + } + + public CloudTableQuery Where(string filter, object[] values) { + return null; + } + + public CloudTableQuery WhereKeys(string partitionKey, string rowKey) { + return null; + } + + public CloudTableQuery WhereNextKeys(string partitionKey, string rowKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs new file mode 100644 index 000000000..9c613bac3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs @@ -0,0 +1,40 @@ +// CloudTableQueryContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableQueryContinuation { + + private CloudTableQueryContinuation() { + } + + [ScriptField] + public string NextPartitionKey { + get { + return null; + } + } + + [ScriptField] + public string NextRowKey { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs new file mode 100644 index 000000000..1360191c6 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs @@ -0,0 +1,130 @@ +// CloudTableService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableService { + + private CloudTableService() { + } + + public void BeginBatch() { + } + + public void CommitBatch(AsyncCallback callback) { + } + + public void CommitBatch(object options, AsyncCallback callback) { + } + + public void CreateTable(string tableName, AsyncCallback callback) { + } + + public void CreateTable(string tableName, object options, AsyncCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, AsyncResultCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, object options, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, object options, AsyncResultCallback callback) { + } + + public bool HasOperations() { + return false; + } + + public void InsertEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public bool IsInBatch() { + return false; + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, AsyncResultCallback callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, object options, AsyncResultCallback callback) { + } + + public void Rollback() { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/AsyncCallback.cs b/src/Libraries/Node/Node.Core/AsyncCallback.cs new file mode 100644 index 000000000..e475cb881 --- /dev/null +++ b/src/Libraries/Node/Node.Core/AsyncCallback.cs @@ -0,0 +1,23 @@ +// AsyncCallback.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.Compute; + +namespace NodeApi { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void AsyncCallback(Exception error); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void AsyncResultCallback(Exception error, TResult result); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void AsyncResultCallback(Exception error, TResult1 result1, TResult2 result2); +} diff --git a/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs b/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs new file mode 100644 index 000000000..6d7d02672 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs @@ -0,0 +1,93 @@ +// Process.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("child_process")] + [ScriptName("child_process")] + public sealed class ChildProcess : IEventEmitter { + + private ChildProcess() { + } + + [ScriptName("pid")] + [ScriptField] + public int ProcessID { + get { + return 0; + } + } + + [ScriptName("stderr")] + [ScriptField] + public ReadableStream StandardError { + get { + return null; + } + } + + [ScriptName("stdin")] + [ScriptField] + public WritableStream StandardInput { + get { + return null; + } + } + + [ScriptName("stdout")] + [ScriptField] + public ReadableStream StandardOutput { + get { + return null; + } + } + + public void Disconnect() { + } + + public static ChildProcess Exec(string command, AsyncResultCallback callback) { + return null; + } + + public static ChildProcess Exec(string command, object options, AsyncResultCallback callback) { + return null; + } + + public static ChildProcess ExecFile(string command, string[] args, object options, AsyncResultCallback callback) { + return null; + } + + public void Kill() { + } + + public void Kill(string signal) { + } + + public static ChildProcess Fork(string command, string[] args, object options) { + return null; + } + + public void Send(object message) { + } + + public static ChildProcess Spawn(string command) { + return null; + } + + public static ChildProcess Spawn(string command, string[] args) { + return null; + } + + public static ChildProcess Spawn(string command, string[] args, object options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/OS.cs b/src/Libraries/Node/Node.Core/Compute/OS.cs new file mode 100644 index 000000000..7aaa40b57 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/OS.cs @@ -0,0 +1,80 @@ +// Process.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("os")] + [ScriptName("os")] + public static class OS { + + [ScriptName("EOL")] + public static int EndOfLine = 0; + + [ScriptName("arch")] + public static string GetArchitecture() { + return null; + } + + [ScriptName("loadavg")] + public static int[] GetAverageLoad() { + return null; + } + + [ScriptName("cpus")] + public static object[] GetCPUs() { + return null; + } + + [ScriptName("freemem")] + public static int GetFreeMemory() { + return 0; + } + + [ScriptName("hostname")] + public static string GetHostName() { + return null; + } + + [ScriptName("type")] + public static string GetName() { + return null; + } + + [ScriptName("networkInterfaces")] + public static object[] GetNetworkInterfaces() { + return null; + } + + [ScriptName("platform")] + public static string GetPlatform() { + return null; + } + + [ScriptName("release")] + public static string GetRelease() { + return null; + } + + [ScriptName("tmpDir")] + public static string GetTempDirectory() { + return null; + } + + [ScriptName("totalmem")] + public static int GetTotalMemory() { + return 0; + } + + [ScriptName("uptime")] + public static int GetUptime() { + return 0; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/Process.cs b/src/Libraries/Node/Node.Core/Compute/Process.cs new file mode 100644 index 000000000..c91b335a0 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/Process.cs @@ -0,0 +1,157 @@ +// Process.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Process : IEventEmitter { + + private Process() { + } + + [ScriptField] + [ScriptName("arch")] + public string Architecture { + get { + return String.Empty; + } + } + + [ScriptField] + [ScriptName("argv")] + public string[] Arguments { + get { + return null; + } + } + + [ScriptField] + [ScriptName("env")] + public Dictionary Environment { + get { + return null; + } + } + + [ScriptField] + public string ExecPath { + get { + return null; + } + } + + [ScriptField] + public string Platform { + get { + return String.Empty; + } + } + + [ScriptField] + [ScriptName("pid")] + public int ProcessID { + get { + return 0; + } + } + + [ScriptField] + [ScriptName("stderr")] + public WritableStream StandardError { + get { + return null; + } + } + + [ScriptField] + [ScriptName("stdin")] + public ReadableStream StandardInput { + get { + return null; + } + } + + [ScriptField] + [ScriptName("stdout")] + public WritableStream StandardOutput { + get { + return null; + } + } + + [ScriptField] + public string Title { + get { + return String.Empty; + } + } + + [ScriptField] + public string Version { + get { + return null; + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Exit { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Message { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action UncaughtException { + add { + } + remove { + } + } + + [ScriptName("chdir")] + public void ChangeDirectory(string directory) { + } + + public void Abort() { + } + + public void Disconnect() { + } + + [ScriptName("exit")] + public void ExitProcess() { + } + + [ScriptName("exit")] + public void ExitProcess(int code) { + } + + [ScriptName("cwd")] + public string GetCurrentDirectory() { + return null; + } + + public void Kill(int pid) { + } + + public void NextTick(Action callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs b/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs new file mode 100644 index 000000000..df8c9d871 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs @@ -0,0 +1,18 @@ +// ScriptContext.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ScriptContext { + + private ScriptContext() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs b/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs new file mode 100644 index 000000000..d0fc344c6 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs @@ -0,0 +1,61 @@ +// ScriptEngine.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("vm")] + [ScriptName("vm")] + public static class ScriptEngine { + + public static ScriptContext CreateContext() { + return null; + } + + public static ScriptContext CreateContext(object global) { + return null; + } + + public static ScriptInstance CreateScript(string code) { + return null; + } + + public static ScriptInstance CreateScript(string code, string fileName) { + return null; + } + + public static object RunInContext(string code, ScriptContext context) { + return null; + } + + public static object RunInContext(string code, ScriptContext context, string fileName) { + return null; + } + + public static object RunInNewContext(string code) { + return null; + } + + public static object RunInNewContext(string code, object global) { + return null; + } + + public static object RunInNewContext(string code, object global, string fileName) { + return null; + } + + public static object RunInThisContext(string code) { + return null; + } + + public static object RunInThisContext(string code, string fileName) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs b/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs new file mode 100644 index 000000000..8a228105a --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs @@ -0,0 +1,30 @@ +// ScriptInstance.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ScriptInstance { + + private ScriptInstance() { + } + + public object RunInNewContext() { + return null; + } + + public object RunInNewContext(object global) { + return null; + } + + public object RunInThisContext() { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IEventEmitter.cs b/src/Libraries/Node/Node.Core/IEventEmitter.cs new file mode 100644 index 000000000..0335ca42a --- /dev/null +++ b/src/Libraries/Node/Node.Core/IEventEmitter.cs @@ -0,0 +1,15 @@ +// IEventEmitter.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi { + + [ScriptImport] + [ScriptIgnoreNamespace] + public interface IEventEmitter { + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Buffer.cs b/src/Libraries/Node/Node.Core/IO/Buffer.cs new file mode 100644 index 000000000..3b8c1de6a --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Buffer.cs @@ -0,0 +1,231 @@ +// Buffer.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Buffer { + + public Buffer(int size) { + } + + public Buffer(int[] data) { + } + + public Buffer(string data) { + } + + public Buffer(string data, Encoding encoding) { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + public int this[int index] { + get { + return 0; + } + set { + } + } + + public static Buffer Concat(Buffer[] buffers) { + return null; + } + + public static Buffer Concat(Buffer[] buffers, int count) { + return null; + } + + public void Copy(Buffer targetBuffer) { + } + + public void Copy(Buffer targetBuffer, int targetStart) { + } + + public void Copy(Buffer targetBuffer, int targetStart, int sourceStart) { + } + + public void Copy(Buffer targetBuffer, int targetStart, int sourceStart, int sourceLength) { + } + + public void Fill(int i) { + } + + public void Fill(int i, int offset) { + } + + public void Fill(int i, int offset, int end) { + } + + [ScriptName("byteLength")] + public static int GetByteLength(string s) { + return 0; + } + + [ScriptName("byteLength")] + public static int GetByteLength(string s, Encoding encoding) { + return 0; + } + + public static bool IsBuffer(object o) { + return false; + } + + [ScriptName("readInt8")] + public byte ReadByte(int offset) { + return 0; + } + + public double ReadDoubleBE(int offset) { + return 0; + } + + public double ReadDoubleLE(int offset) { + return 0; + } + + [ScriptName("readFloatBE")] + public float ReadSingleBE(int offset) { + return 0; + } + + [ScriptName("readFloatLE")] + public float ReadSingleLE(int offset) { + return 0; + } + + [ScriptName("readUInt8")] + public byte ReadUByte(int offset) { + return 0; + } + + public short ReadInt16BE(int offset) { + return 0; + } + + public short ReadInt16LE(int offset) { + return 0; + } + + public int ReadInt32BE(int offset) { + return 0; + } + + public int ReadInt32LE(int offset) { + return 0; + } + + public short ReadUInt16BE(int offset) { + return 0; + } + + public short ReadUInt16LE(int offset) { + return 0; + } + + public int ReadUInt32BE(int offset) { + return 0; + } + + public int ReadUInt32LE(int offset) { + return 0; + } + + public Buffer Slice() { + return null; + } + + public Buffer Slice(int start) { + return null; + } + + public Buffer Slice(int start, int end) { + return null; + } + + public string ToString(Encoding encoding) { + return null; + } + + public string ToString(Encoding encoding, int start) { + return null; + } + + public string ToString(Encoding encoding, int start, int end) { + return null; + } + + public int Write(string s) { + return 0; + } + + public int Write(string s, int offset) { + return 0; + } + + public int Write(string s, int offset, int length) { + return 0; + } + + public int Write(string s, int offset, int length, Encoding encoding) { + return 0; + } + + [ScriptName("writeInt8")] + public void WriteByte(byte b, int offset) { + } + + public void WriteDoubleBE(double value, int offset) { + } + + public void WriteDoubleLE(double value, int offset) { + } + + public void WriteInt16BE(short value, int offset) { + } + + public void WriteInt16LE(short value, int offset) { + } + + public void WriteInt32BE(int value, int offset) { + } + + public void WriteInt32LE(int value, int offset) { + } + + [ScriptName("writeFloatBE")] + public void WriteSingleBE(float value, int offset) { + } + + [ScriptName("writeFloatLE")] + public void WriteSingleLE(float value, int offset) { + } + + [ScriptName("writeUInt8")] + public void WriteUByte(byte b, int offset) { + } + + public void WriteUInt16BE(short value, int offset) { + } + + public void WriteUInt16LE(short value, int offset) { + } + + public void WriteUInt32BE(int value, int offset) { + } + + public void WriteUInt32LE(int value, int offset) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Console.cs b/src/Libraries/Node/Node.Core/IO/Console.cs new file mode 100644 index 000000000..ba2737a25 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Console.cs @@ -0,0 +1,47 @@ +// Console.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("console")] + public static class Console { + + public static void Error(string message) { + } + + public static void Error(string messageFormat, params object[] args) { + } + + public static void Log(string message) { + } + + [ScriptName("dir")] + public static void Log(string messageFormat, params object[] args) { + } + + [ScriptName("dir")] + public static void LogObject(object o) { + } + + [ScriptName("timeEnd")] + public static void LogTimeEnd(string label) { + } + + [ScriptName("time")] + public static void LogTimeStart(string label) { + } + + public static void Warn(string message) { + } + + public static void Warn(string messageFormat, params object[] args) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Encoding.cs b/src/Libraries/Node/Node.Core/IO/Encoding.cs new file mode 100644 index 000000000..2a103af97 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Encoding.cs @@ -0,0 +1,31 @@ +// Buffer.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum Encoding { + + [ScriptName("ascii")] + Ascii, + + [ScriptName("base64")] + Base64, + + [ScriptName("hex")] + Hex, + + [ScriptName("utf16le")] + UTF16, + + [ScriptName("utf8")] + UTF8 + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileAccess.cs b/src/Libraries/Node/Node.Core/IO/FileAccess.cs new file mode 100644 index 000000000..e9ecb561d --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileAccess.cs @@ -0,0 +1,52 @@ +// Buffer.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum FileAccess { + + [ScriptName("r")] + Read, + + [ScriptName("r+")] + ReadWrite, + + [ScriptName("rs")] + ReadSynchronous, + + [ScriptName("rs+")] + ReadWriteSynchronous, + + [ScriptName("w")] + Write, + + [ScriptName("wx")] + WriteExclusive, + + [ScriptName("w+")] + ReadWriteCreate, + + [ScriptName("wx+")] + ReadWriteCreateExclusive, + + [ScriptName("a")] + AppendCreate, + + [ScriptName("ax")] + AppendCreateExclusive, + + [ScriptName("a+")] + ReadAppendCreate, + + [ScriptName("ax+")] + ReadAppendCreateExclusive + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileDescriptor.cs b/src/Libraries/Node/Node.Core/IO/FileDescriptor.cs new file mode 100644 index 000000000..c45c02f10 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileDescriptor.cs @@ -0,0 +1,18 @@ +// FileDescriptor.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class FileDescriptor { + + private FileDescriptor() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileStats.cs b/src/Libraries/Node/Node.Core/IO/FileStats.cs new file mode 100644 index 000000000..f90199958 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileStats.cs @@ -0,0 +1,18 @@ +// FileStats.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class FileStats { + + private FileStats() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileSystem.cs b/src/Libraries/Node/Node.Core/IO/FileSystem.cs new file mode 100644 index 000000000..ec90c58a7 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileSystem.cs @@ -0,0 +1,228 @@ +// FileSystem.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("fs")] + [ScriptName("fs")] + public static class FileSystem { + + public static void AppendFile(string fileName, string data) { + } + + public static void AppendFile(string fileName, string data, Encoding encoding) { + } + + public static void AppendFile(string fileName, string data, AsyncCallback callback) { + } + + public static void AppendFile(string fileName, string data, Encoding encoding, AsyncCallback callback) { + } + + public static void AppendFile(string fileName, Buffer data) { + } + + public static void AppendFile(string fileName, Buffer data, AsyncCallback callback) { + } + + public static void AppendFileSync(string fileName, string data) { + } + + public static void AppendFileSync(string fileName, string data, Encoding encoding) { + } + + public static void AppendFileSync(string fileName, Buffer data) { + } + + public static void Close(FileDescriptor fd) { + } + + public static void Close(FileDescriptor fd, AsyncCallback callback) { + } + + public static void CloseSync(FileDescriptor fd) { + } + + public static ReadStream CreateReadStream(string path) { + return null; + } + + public static ReadStream CreateReadStream(string path, ReadStreamOptions options) { + return null; + } + + public static WriteStream CreateWriteStream(string path) { + return null; + } + + public static WriteStream CreateWriteStream(string path, WriteStreamOptions options) { + return null; + } + + public static void Exists(string path, Action callback) { + } + + public static bool ExistsSync(string path) { + return false; + } + + [ScriptName("mkdir")] + public static void MakeDirectory(string path) { + } + + [ScriptName("mkdir")] + public static void MakeDirectory(string path, AsyncCallback callback) { + } + + [ScriptName("mkdirSync")] + public static void MakeDirectorySync(string path) { + } + + public static void Open(string path, FileAccess flags, AsyncResultCallback callback) { + } + + public static void Open(string path, FileAccess flags, int mode, AsyncResultCallback callback) { + } + + public static FileDescriptor OpenSync(string path, string flags) { + return null; + } + + public static FileDescriptor OpenSync(string path, string flags, string mode) { + return null; + } + + public static void Read(FileDescriptor fd, Buffer buffer, int offset, int length, object position, AsyncResultCallback callback) { + } + + public static int ReadSync(FileDescriptor fd, Buffer buffer, int offset, int length, object position) { + return 0; + } + + [ScriptName("readdir")] + public static void ReadDirectory(string path, AsyncResultCallback callback) { + } + + [ScriptName("readdirSync")] + public static string[] ReadDirectorySync(string path) { + return null; + } + + public static void ReadFile(string fileName, AsyncResultCallback callback) { + } + + [ScriptName("readFile")] + public static void ReadFileText(string fileName, Encoding encoding, AsyncResultCallback callback) { + } + + public static Buffer ReadFileSync(string fileName) { + return null; + } + + [ScriptName("readFileSync")] + public static string ReadFileTextSync(string fileName, Encoding encoding) { + return null; + } + + [ScriptName("rmdir")] + public static void RemoveDirectory(string path) { + } + + [ScriptName("rmdir")] + public static void RemoveDirectory(string path, AsyncCallback callback) { + } + + [ScriptName("rmdirSync")] + public static void RemoveDirectorySync(string path) { + } + + public static void Rename(string oldPath, string newPath) { + } + + public static void Rename(string oldPath, string newPath, AsyncCallback callback) { + } + + public static void RenameSync(string oldPath, string newPath) { + } + + public static void Stat(string path, AsyncResultCallback callback) { + } + + public static FileStats StatSync(string path) { + return null; + } + + public static void Truncate(FileDescriptor fd, int length) { + } + + public static void Truncate(FileDescriptor fd, int length, AsyncCallback callback) { + } + + public static void TruncateSync(FileDescriptor fd, int length) { + } + + public static FileSystemWatcher UnwatchFile(string fileName) { + return null; + } + + public static FileSystemWatcher UnwatchFile(string fileName, FileSystemListener listener) { + return null; + } + + public static FileSystemWatcher Watch(string fileName) { + return null; + } + + public static FileSystemWatcher Watch(string fileName, FileSystemListener listener) { + return null; + } + + public static FileSystemWatcher Watch(string fileName, FileSystemWatchOptions options, FileSystemListener listener) { + return null; + } + + public static void Write(FileDescriptor fd, Buffer buffer, int offset, int length, object position) { + } + + public static void Write(FileDescriptor fd, Buffer buffer, int offset, int length, object position, AsyncResultCallback callback) { + } + + public static int WriteSync(FileDescriptor fd, Buffer buffer, int offset, int length, object position) { + return 0; + } + + public static void WriteFile(string fileName, string data) { + } + + public static void WriteFile(string fileName, string data, Encoding encoding) { + } + + public static void WriteFile(string fileName, string data, AsyncCallback callback) { + } + + public static void WriteFile(string fileName, string data, Encoding encoding, AsyncCallback callback) { + } + + public static void WriteFile(string fileName, Buffer data) { + } + + public static void WriteFile(string fileName, Buffer data, AsyncCallback callback) { + } + + public static void WriteFileSync(string fileName, string data) { + } + + public static void WriteFileSync(string fileName, string data, Encoding encoding) { + } + + public static void WriteFileSync(string fileName, Buffer data) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileSystemChange.cs b/src/Libraries/Node/Node.Core/IO/FileSystemChange.cs new file mode 100644 index 000000000..c4f09f3a8 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileSystemChange.cs @@ -0,0 +1,20 @@ +// FileSystemChange.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum FileSystemChange { + + Change, + + Rename + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileSystemListener.cs b/src/Libraries/Node/Node.Core/IO/FileSystemListener.cs new file mode 100644 index 000000000..3278d192f --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileSystemListener.cs @@ -0,0 +1,14 @@ +// FileSystemListener.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void FileSystemListener(FileSystemChange change, string filePath); +} diff --git a/src/Libraries/Node/Node.Core/IO/FileSystemWatchOptions.cs b/src/Libraries/Node/Node.Core/IO/FileSystemWatchOptions.cs new file mode 100644 index 000000000..5f024a201 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileSystemWatchOptions.cs @@ -0,0 +1,22 @@ +// FileSystemWatchOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class FileSystemWatchOptions { + + [ScriptField] + public bool Persistent { + get; + set; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/FileSystemWatcher.cs b/src/Libraries/Node/Node.Core/IO/FileSystemWatcher.cs new file mode 100644 index 000000000..eb97dee7e --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/FileSystemWatcher.cs @@ -0,0 +1,29 @@ +// FileSystemWatcher.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class FileSystemWatcher : IEventEmitter { + + private FileSystemWatcher() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Change { + add { + } + remove { + } + } + + public void Close() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/LineReader.cs b/src/Libraries/Node/Node.Core/IO/LineReader.cs new file mode 100644 index 000000000..afff778fb --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/LineReader.cs @@ -0,0 +1,91 @@ +// LineReader.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("readline")] + public sealed class LineReader : IEventEmitter { + + private LineReader() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Close { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + [ScriptName("SIGINT")] + public event Action Interrupt { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Line { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Pause { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Resume { + add { + } + remove { + } + } + + public static LineReader CreateInterface(LineReaderOptions options) { + return null; + } + + [ScriptName("close")] + public void CloseReader() { + } + + [ScriptName("pause")] + public void PauseReader() { + } + + public void Prompt() { + } + + public void Prompt(bool preserveCursor) { + } + + [ScriptName("resume")] + public void ResumeReader() { + } + + public void Question(string query, Action callback) { + } + + public void SetPrompt(string prompt, int length) { + } + + public void Write(string data) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs b/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs new file mode 100644 index 000000000..3cb578e0a --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs @@ -0,0 +1,40 @@ +// LineReaderOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class LineReaderOptions { + + public LineReaderOptions() { + } + + public LineReaderOptions(params object[] nameValuePairs) { + } + + [ScriptField] + public ReadableStream Input { + get { + return null; + } + set { + } + } + + [ScriptField] + public WritableStream Output { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Path.cs b/src/Libraries/Node/Node.Core/IO/Path.cs new file mode 100644 index 000000000..725e7052b --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Path.cs @@ -0,0 +1,57 @@ +// Path.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("path")] + [ScriptName("path")] + public static class Path { + + [ScriptName("sep")] + public static string PathSeparator = null; + + [ScriptName("dirname")] + public static string GetDirectoryName(string path) { + return null; + } + + [ScriptName("extname")] + public static string GetExtension(string path) { + return null; + } + + [ScriptName("basename")] + public static string GetName(string path) { + return null; + } + + [ScriptName("basename")] + public static string GetName(string path, string extensionToStrip) { + return null; + } + + public static string Join(params string[] pathParts) { + return null; + } + + [ScriptName("relative")] + public static string MakeRelative(string from, string to) { + return null; + } + + public static string Normalize(string path) { + return null; + } + + public static string Resolve(string from, string to) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/REPL.cs b/src/Libraries/Node/Node.Core/IO/REPL.cs new file mode 100644 index 000000000..b46d7a79b --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPL.cs @@ -0,0 +1,32 @@ +// REPL.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("repl")] + [ScriptName("repl")] + public sealed class REPL { + + private REPL() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Exit { + add { + } + remove { + } + } + + public static REPL Start(object options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs b/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs new file mode 100644 index 000000000..a8ca7f0c5 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs @@ -0,0 +1,14 @@ +// REPLEvaluator.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void REPLEvaluator(string command, object context, string fileName, AsyncResultCallback callback); +} diff --git a/src/Libraries/Node/Node.Core/IO/REPLOptions.cs b/src/Libraries/Node/Node.Core/IO/REPLOptions.cs new file mode 100644 index 000000000..8724a572c --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPLOptions.cs @@ -0,0 +1,58 @@ +// REPLOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class REPLOptions { + + public REPLOptions() { + } + + public REPLOptions(params object[] nameValuePairs) { + } + + [ScriptField] + public REPLEvaluator Eval { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Prompt { + get { + return null; + } + set { + } + } + + [ScriptField] + public ReadableStream Input { + get { + return null; + } + set { + } + } + + [ScriptField] + public WritableStream Output { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/ReadStream.cs b/src/Libraries/Node/Node.Core/IO/ReadStream.cs new file mode 100644 index 000000000..c720c3824 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/ReadStream.cs @@ -0,0 +1,26 @@ +// ReadStream.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ReadStream : ReadableStream { + + private ReadStream() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Open { + add { + } + remove { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/ReadStreamOptions.cs b/src/Libraries/Node/Node.Core/IO/ReadStreamOptions.cs new file mode 100644 index 000000000..9a69fa1f9 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/ReadStreamOptions.cs @@ -0,0 +1,47 @@ +// ReadStreamOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class ReadStreamOptions { + + [ScriptField] + public int BufferSize { + get; + set; + } + + [ScriptField] + public Encoding Encoding { + get; + set; + } + + [ScriptField] + [ScriptName("fd")] + public FileDescriptor FileDescriptor { + get; + set; + } + + [ScriptField] + public string Flags { + get; + set; + } + + [ScriptField] + public int Mode { + get; + set; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/ReadableStream.cs b/src/Libraries/Node/Node.Core/IO/ReadableStream.cs new file mode 100644 index 000000000..ed2df96f2 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/ReadableStream.cs @@ -0,0 +1,86 @@ +// ReadableStream.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class ReadableStream : IEventEmitter { + + [ScriptField] + public bool Readable { + get { + return false; + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Close { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Data { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + [ScriptName("data")] + public event Action DataBuffer { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action End { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Error { + add { + } + remove { + } + } + + public void Destroy() { + } + + public void SetEncoding() { + } + + public void SetEncoding(Encoding encoding) { + } + + public void Pause() { + } + + public WritableStream Pipe(WritableStream destination) { + return null; + } + + public WritableStream Pipe(WritableStream destination, object options) { + return null; + } + + public void Resume() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/WritableStream.cs b/src/Libraries/Node/Node.Core/IO/WritableStream.cs new file mode 100644 index 000000000..3ca5797a2 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/WritableStream.cs @@ -0,0 +1,84 @@ +// WritableStream.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class WritableStream : IEventEmitter { + + [ScriptField] + public bool Writable { + get { + return false; + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Close { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Drain { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Error { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Pipe { + add { + } + remove { + } + } + + public void Destroy() { + } + + public void DestroySoon() { + } + + public void End() { + } + + public void End(string data) { + } + + public void End(string data, Encoding encoding) { + } + + public void End(Buffer data) { + } + + public bool Write(string content) { + return false; + } + + public bool Write(string content, Encoding encoding) { + return false; + } + + public bool Write(Buffer buffer) { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/WriteStream.cs b/src/Libraries/Node/Node.Core/IO/WriteStream.cs new file mode 100644 index 000000000..d7074d94c --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/WriteStream.cs @@ -0,0 +1,32 @@ +// WriteStream.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class WriteStream : WritableStream { + + private WriteStream() { + } + + [ScriptField] + public int BytesWritten { + get; + set; + } + + [ScriptEvent("on", "removeListener")] + public event Action Open { + add { + } + remove { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/WriteStreamOptions.cs b/src/Libraries/Node/Node.Core/IO/WriteStreamOptions.cs new file mode 100644 index 000000000..057b04ecf --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/WriteStreamOptions.cs @@ -0,0 +1,34 @@ +// WriteStreamOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class WriteStreamOptions { + + [ScriptField] + public Encoding Encoding { + get; + set; + } + + [ScriptField] + public string Flags { + get; + set; + } + + [ScriptField] + public int Mode { + get; + set; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/Http.cs b/src/Libraries/Node/Node.Core/Network/Http.cs new file mode 100644 index 000000000..d3bc8a037 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/Http.cs @@ -0,0 +1,50 @@ +// Http.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("http")] + [ScriptName("http")] + public static class Http { + + [ScriptField] + [ScriptName("STATUS_CODES")] + public static HttpStatus StatusCodes { + get { + return null; + } + } + + public static HttpServer CreateServer() { + return null; + } + + public static HttpServer CreateServer(HttpListener listener) { + return null; + } + + public static HttpClientRequest Get(string url, Action responseCallback) { + return null; + } + + public static HttpClientRequest Get(HttpClientOptions options, Action responseCallback) { + return null; + } + + public static HttpClientRequest Request(string url, Action responseCallback) { + return null; + } + + public static HttpClientRequest Request(HttpClientOptions options, Action responseCallback) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs b/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs new file mode 100644 index 000000000..d19d94068 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs @@ -0,0 +1,79 @@ +// HttpClientOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class HttpClientOptions { + + public HttpClientOptions() { + } + + public HttpClientOptions(object[] nameValuePairs) { + } + + [ScriptField] + [ScriptName("auth")] + public string Credentials { + get { + return null; + } + set { + } + } + + [ScriptField] + public Dictionary Headers { + get { + return null; + } + set { + } + } + + [ScriptField] + [ScriptName("hostname")] + public string HostName { + get { + return null; + } + set { + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + set { + } + } + + [ScriptField] + public string Path { + get { + return null; + } + set { + } + } + + [ScriptField] + public int Port { + get { + return 0; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpClientRequest.cs b/src/Libraries/Node/Node.Core/Network/HttpClientRequest.cs new file mode 100644 index 000000000..e2fbd854a --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpClientRequest.cs @@ -0,0 +1,91 @@ +// HttpClientRequest.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpClientRequest : WritableStream { + + private HttpClientRequest() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Response { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Connect { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Continue { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Socket { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Timeout { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Upgrade { + add { + } + remove { + } + } + + public void Abort() { + } + + public void SetTimeout(int timeout) { + } + + public void SetNoDelay() { + } + + public void SetNoDelay(bool noDelay) { + } + + public void SetSocketKeepAlive() { + } + + public void SetSocketKeepAlive(bool enable) { + } + + public void SetSocketKeepAlive(bool enable, int initialDelay) { + } + + public void SetTimeout(int timeout, Action timeoutCallback) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpClientResponse.cs b/src/Libraries/Node/Node.Core/Network/HttpClientResponse.cs new file mode 100644 index 000000000..05159aa12 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpClientResponse.cs @@ -0,0 +1,48 @@ +// HttpClientResponse.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpClientResponse : ReadableStream { + + private HttpClientResponse() { + } + + [ScriptField] + public Dictionary Headers { + get { + return null; + } + } + + [ScriptField] + public string HttpVersion { + get { + return null; + } + } + + [ScriptField] + public HttpStatusCode StatusCode { + get { + return HttpStatusCode.Unknown; + } + } + + [ScriptField] + public Dictionary Trailers { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpListener.cs b/src/Libraries/Node/Node.Core/Network/HttpListener.cs new file mode 100644 index 000000000..2c62efd74 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpListener.cs @@ -0,0 +1,14 @@ +// HttpListener.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void HttpListener(HttpServerRequest request, HttpServerResponse response); +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpServer.cs b/src/Libraries/Node/Node.Core/Network/HttpServer.cs new file mode 100644 index 000000000..6240eb9a3 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpServer.cs @@ -0,0 +1,98 @@ +// HttpServer.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpServer : IEventEmitter { + + private HttpServer() { + } + + [ScriptField] + public int MaxHeaderCount { + get; + set; + } + + [ScriptEvent("on", "removeListener")] + public event Action CheckContinue { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action ClientError { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Close { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Connect { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Connection { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Listening { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Request { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Upgrade { + add { + } + remove { + } + } + + public void Listen(int port) { + } + + public void Listen(int port, string hostName) { + } + + public void Listen(int port, string hostName, int backlog) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpServerRequest.cs b/src/Libraries/Node/Node.Core/Network/HttpServerRequest.cs new file mode 100644 index 000000000..22ead043e --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpServerRequest.cs @@ -0,0 +1,61 @@ +// HttpServerRequest.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpServerRequest : ReadableStream, IEventEmitter { + + private HttpServerRequest() { + } + + [ScriptField] + public Socket Connection { + get { + return null; + } + } + + [ScriptField] + public object Headers { + get { + return null; + } + } + + [ScriptField] + public string HttpVersion { + get { + return null; + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + } + + [ScriptField] + public object Trailers { + get { + return null; + } + } + + [ScriptField] + public string Url { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpServerResponse.cs b/src/Libraries/Node/Node.Core/Network/HttpServerResponse.cs new file mode 100644 index 000000000..f8d9355d7 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpServerResponse.cs @@ -0,0 +1,57 @@ +// HttpServerResponse.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpServerResponse : WritableStream, IEventEmitter { + + private HttpServerResponse() { + } + + [ScriptField] + public int StatusCode { + get; + set; + } + + public void AddTrailers(Dictionary headers) { + } + + public string GetHeader(string name) { + return null; + } + + public void RemoveHeader(string name) { + } + + public void SendDate() { + } + + public void SetHeader(string name, string value) { + } + + public void WriteContinue() { + } + + public void WriteHead(HttpStatusCode statusCode) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase) { + } + + public void WriteHead(HttpStatusCode statusCode, Dictionary headers) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase, Dictionary headers) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpStatus.cs b/src/Libraries/Node/Node.Core/Network/HttpStatus.cs new file mode 100644 index 000000000..b10497ade --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpStatus.cs @@ -0,0 +1,24 @@ +// HttpStatus.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class HttpStatus { + + private HttpStatus() { + } + + public string this[int statusCode] { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpStatusCode.cs b/src/Libraries/Node/Node.Core/Network/HttpStatusCode.cs new file mode 100644 index 000000000..b56ea4b0d --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpStatusCode.cs @@ -0,0 +1,59 @@ +// HttpStatusCode.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants] + public enum HttpStatusCode { + + Unknown = 0, + Continue = 100, + SwitchingProtocols = 101, + OK = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + Ambiguous = 300, + MovedPermanently = 301, + Redirect = 302, + RedirectMethod = 303, + NotModified = 304, + UseProxy = 305, + TemporaryRedirect = 307, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + RequestEntityTooLarge = 413, + RequestUriTooLong = 414, + UnsupportedMediaType = 415, + RequestedRangeNotSatisfiable = 416, + ExpectationFailed = 417, + UpgradeRequired = 426, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505 + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpVerb.cs b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs new file mode 100644 index 000000000..b7d9c3a44 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs @@ -0,0 +1,30 @@ +// IPAddressType.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum HttpVerb { + + GET, + + PUT, + + POST, + + DELETE, + + HEAD, + + OPTIONS, + + PATCH + } +} diff --git a/src/Libraries/Node/Node.Core/Network/Https.cs b/src/Libraries/Node/Node.Core/Network/Https.cs new file mode 100644 index 000000000..41c823950 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/Https.cs @@ -0,0 +1,41 @@ +// Http.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("https")] + [ScriptName("https")] + public static class Https { + + public static HttpServer CreateServer() { + return null; + } + + public static HttpServer CreateServer(HttpListener listener) { + return null; + } + + public static HttpClientRequest Get(string url, Action responseCallback) { + return null; + } + + public static HttpClientRequest Get(HttpClientOptions options, Action responseCallback) { + return null; + } + + public static HttpClientRequest Request(string url, Action responseCallback) { + return null; + } + + public static HttpClientRequest Request(HttpClientOptions options, Action responseCallback) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/IPAddressType.cs b/src/Libraries/Node/Node.Core/Network/IPAddressType.cs new file mode 100644 index 000000000..a519c589f --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/IPAddressType.cs @@ -0,0 +1,22 @@ +// IPAddressType.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants] + public enum IPAddressType { + + Invalid = 0, + + IPv4 = 4, + + IPv6 = 6 + } +} diff --git a/src/Libraries/Node/Node.Core/Network/Net.cs b/src/Libraries/Node/Node.Core/Network/Net.cs new file mode 100644 index 000000000..6a1913ce0 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/Net.cs @@ -0,0 +1,31 @@ +// Socket.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("net")] + public static class Net { + + [ScriptName("isIP")] + public static IPAddressType IsIP(string input) { + return 0; + } + + [ScriptName("isIPv4")] + public static bool IsIPv4(string input) { + return false; + } + + [ScriptName("isIPv6")] + public static bool IsIPv6(string input) { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/QueryString.cs b/src/Libraries/Node/Node.Core/Network/QueryString.cs new file mode 100644 index 000000000..3814554fb --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/QueryString.cs @@ -0,0 +1,58 @@ +// Url.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("querystring")] + [ScriptName("querystring")] + public static class QueryString { + + [ScriptField] + public static Func Escape { + get; + set; + } + + [ScriptField] + public static Func Unescape { + get; + set; + } + + public static Dictionary Parse(string s) { + return null; + } + + public static Dictionary Parse(string s, string separator) { + return null; + } + + public static Dictionary Parse(string s, string separator, string equals) { + return null; + } + + public static Dictionary Parse(string s, string separator, string equals, object options) { + return null; + } + + public static string Stringify(Dictionary obj) { + return null; + } + + public static string Stringify(Dictionary obj, string separator) { + return null; + } + + public static string Stringify(Dictionary obj, string separator, string equals) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/Socket.cs b/src/Libraries/Node/Node.Core/Network/Socket.cs new file mode 100644 index 000000000..1fb2efb9b --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/Socket.cs @@ -0,0 +1,15 @@ +// Socket.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptDependency("net")] + public sealed class Socket { + } +} diff --git a/src/Libraries/Node/Node.Core/Network/Url.cs b/src/Libraries/Node/Node.Core/Network/Url.cs new file mode 100644 index 000000000..42e005363 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/Url.cs @@ -0,0 +1,37 @@ +// Url.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("url")] + [ScriptName("url")] + public static class Url { + + public static string Format(UrlData urlData) { + return null; + } + + public static UrlData Parse(string url) { + return null; + } + + public static UrlData Parse(string url, bool parseQueryString) { + return null; + } + + public static UrlData Parse(string url, bool parseQueryString, bool slashesDenoteHost) { + return null; + } + + public static string Resolve(string from, string to) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/UrlData.cs b/src/Libraries/Node/Node.Core/Network/UrlData.cs new file mode 100644 index 000000000..f2c03902e --- /dev/null +++ b/src/Libraries/Node/Node.Core/Network/UrlData.cs @@ -0,0 +1,98 @@ +// Url.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Network { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class UrlData { + + public UrlData() { + } + + public UrlData(params object[] nameValuePairs) { + } + + [ScriptField] + public string Auth { + get; + set; + } + + [ScriptField] + public string Hash { + get; + set; + } + + [ScriptField] + public string Host { + get; + set; + } + + [ScriptField] + [ScriptName("hostname")] + public string HostName { + get; + set; + } + + [ScriptField] + public string Href { + get; + set; + } + + [ScriptField] + public string Path { + get; + set; + } + + [ScriptField] + [ScriptName("pathname")] + public string PathName { + get; + set; + } + + [ScriptField] + public string Port { + get; + set; + } + + [ScriptField] + public string Protocol { + get; + set; + } + + [ScriptField] + public Dictionary Query { + get; + set; + } + + [ScriptField] + [ScriptName("query")] + public string QueryString { + get; + set; + } + + [ScriptField] + public string Search { + get; + set; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Node.Core.csproj b/src/Libraries/Node/Node.Core/Node.Core.csproj new file mode 100644 index 000000000..a564e9590 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Node.Core.csproj @@ -0,0 +1,110 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} + Library + Properties + NodeApi + Script.Node + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Core/Node.cs b/src/Libraries/Node/Node.Core/Node.cs new file mode 100644 index 000000000..c6f38fb58 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Node.cs @@ -0,0 +1,27 @@ +// Node.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.Compute; + +namespace NodeApi { + + /// + /// The global Node object. + /// + [ScriptImport] + [ScriptIgnoreNamespace] + public static class Node { + + [ScriptField] + [ScriptAlias("process")] + public static Process Process { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Core/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..75d070b8a --- /dev/null +++ b/src/Libraries/Node/Node.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node")] +[assembly: AssemblyDescription("Script# NodeJS Core API")] +[assembly: ScriptAssembly("")] diff --git a/src/Libraries/Node/Node.Core/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Core/Properties/ScriptInfo.txt new file mode 100644 index 000000000..6091d1d03 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Core +=============================================================================== + +This assembly provides access to NodeJS APIs. This is only meant for use at +development time, so you can reference and compile your c# code against node +APIs. + +More information is on http://nodejs.org. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Express/Express.cs b/src/Libraries/Node/Node.Express/Express.cs new file mode 100644 index 000000000..720b95845 --- /dev/null +++ b/src/Libraries/Node/Node.Express/Express.cs @@ -0,0 +1,97 @@ +// Express.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("express")] + public static class Express { + + [ScriptAlias("express")] + public static ExpressApplication Application() { + return null; + } + + public static ExpressMiddleware BasicAuth(string userName, string password) { + return null; + } + + public static ExpressMiddleware BasicAuth(Func verificationCallback) { + return null; + } + + public static ExpressMiddleware BasicAuth(Func> verificationCallback) { + return null; + } + + public static ExpressMiddleware BodyParser() { + return null; + } + + public static ExpressMiddleware Compress() { + return null; + } + + public static ExpressMiddleware CookieParser() { + return null; + } + + public static ExpressMiddleware CookieParser(string secret) { + return null; + } + + public static ExpressMiddleware CookieSession() { + return null; + } + + [ScriptName("csrf")] + public static ExpressMiddleware CSRF() { + return null; + } + + public static ExpressMiddleware Directory() { + return null; + } + + public static ExpressMiddleware Directory(string path) { + return null; + } + + public static ExpressMiddleware ErrorHandler() { + return null; + } + + [ScriptName("json")] + public static ExpressMiddleware JSON() { + return null; + } + + public static ExpressMiddleware Logger() { + return null; + } + + [ScriptName("multipart")] + public static ExpressMiddleware MultiPart() { + return null; + } + + public static ExpressMiddleware Static(string path) { + return null; + } + + public static ExpressMiddleware Static(string path, object options) { + return null; + } + + [ScriptName("urlencoded")] + public static ExpressMiddleware UrlEncoded() { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressApplication.cs b/src/Libraries/Node/Node.Express/ExpressApplication.cs new file mode 100644 index 000000000..344246405 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressApplication.cs @@ -0,0 +1,261 @@ +// ExpressApplication.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("express")] + public sealed class ExpressApplication { + + private ExpressApplication() { + } + + [ScriptField] + public Dictionary Locals { + get { + return null; + } + } + + [ScriptField] + public Dictionary> Routes { + get { + return null; + } + } + + [ScriptName("locals")] + public void AddLocals(Dictionary values) { + } + + public ExpressApplication All(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication All(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication All(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication All(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Configure(Action callback) { + return null; + } + + public ExpressApplication Configure(string environmentName, Action callback) { + return null; + } + + public ExpressApplication Delete(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Delete(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Delete(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Delete(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + [ScriptName("disable")] + public ExpressApplication DisableSetting(string name) { + return null; + } + + [ScriptName("disable")] + public ExpressApplication DisableSetting(ExpressSettings name) { + return null; + } + + [ScriptName("enable")] + public ExpressApplication EnableSetting(string name) { + return null; + } + + [ScriptName("enable")] + public ExpressApplication EnableSetting(ExpressSettings name) { + return null; + } + + public ExpressApplication Engine(string extension, ExpressTemplateEngine engine) { + return null; + } + + public ExpressApplication Error(ExpressErrorHandler handler) { + return null; + } + + public ExpressApplication Error(ExpressChainedErrorHandler chainedHandler) { + return null; + } + + public ExpressApplication Get(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Get(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Get(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Get(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + [ScriptName("get")] + public string GetSetting(string name) { + return null; + } + + [ScriptName("get")] + public string GetSetting(ExpressSettings name) { + return null; + } + + public ExpressApplication Head(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Head(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Head(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Head(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + [ScriptName("disabled")] + public bool IsSeSettingDisabled(string name) { + return false; + } + + [ScriptName("disabled")] + public bool IsSeSettingDisabled(ExpressSettings name) { + return false; + } + + [ScriptName("enabled")] + public bool IsSeSettingEnabled(string name) { + return false; + } + + [ScriptName("enabled")] + public bool IsSeSettingEnabled(ExpressSettings name) { + return false; + } + + public void Listen(int port) { + } + + public void Listen(int port, string hostName) { + } + + public void Listen(int port, string hostName, int backlog) { + } + + public ExpressApplication Param(string parameter, ExpressParameterHandler handler) { + return null; + } + + public ExpressApplication Options(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Options(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Options(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Options(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Post(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Post(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Post(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Post(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Put(string path, ExpressHandler handler) { + return null; + } + + public ExpressApplication Put(string path, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public ExpressApplication Put(RegExp pathPattern, ExpressHandler handler) { + return null; + } + + public ExpressApplication Put(RegExp pathPattern, ExpressChainedHandler[] chainedHandlers, ExpressHandler handler) { + return null; + } + + public void Render(string viewName, AsyncResultCallback callback) { + } + + public void Render(string viewName, Dictionary data, AsyncResultCallback callback) { + } + + [ScriptName("set")] + public void SetSetting(string name, string value) { + } + + [ScriptName("set")] + public void SetSetting(ExpressSettings name, string value) { + } + + [ScriptSkip] + public HttpListener ToHttpListener() { + return null; + } + + public ExpressApplication Use(ExpressMiddleware middleware) { + return null; + } + + public ExpressApplication Use(string path, ExpressMiddleware middleware) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressChain.cs b/src/Libraries/Node/Node.Express/ExpressChain.cs new file mode 100644 index 000000000..07701f4eb --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressChain.cs @@ -0,0 +1,28 @@ +// ExpressChain.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + // TODO: Fix this... + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ExpressChain { + + private ExpressChain() { + } + + [ScriptSkip] + public void Continue() { + } + + [ScriptSkip] + public void Error(Exception error) { + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressCookieOptions.cs b/src/Libraries/Node/Node.Express/ExpressCookieOptions.cs new file mode 100644 index 000000000..51ddc290e --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressCookieOptions.cs @@ -0,0 +1,85 @@ +// ExpressCookieOptions.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class ExpressCookieOptions { + + public ExpressCookieOptions() { + } + + public ExpressCookieOptions(params object[] nameValuePairs) { + } + + [ScriptField] + public string Domain { + get { + return null; + } + set { + } + } + + [ScriptField] + public Date Expires { + get { + return null; + } + set { + } + } + + [ScriptField] + public bool HttpOnly { + get { + return false; + } + set { + } + } + + [ScriptField] + public long MaxAge { + get { + return 0; + } + set { + } + } + + [ScriptField] + public string Path { + get { + return null; + } + set { + } + } + + [ScriptField] + public bool Secure { + get { + return false; + } + set { + } + } + + [ScriptField] + public bool Signed { + get { + return false; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressErrorHandler.cs b/src/Libraries/Node/Node.Express/ExpressErrorHandler.cs new file mode 100644 index 000000000..39b7c45ca --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressErrorHandler.cs @@ -0,0 +1,18 @@ +// ExpressErrorHandler.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressErrorHandler(Exception error, ExpressServerRequest request, ExpressServerResponse response); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressChainedErrorHandler(Exception error, ExpressServerRequest request, ExpressServerResponse response, ExpressChain next); +} diff --git a/src/Libraries/Node/Node.Express/ExpressHandler.cs b/src/Libraries/Node/Node.Express/ExpressHandler.cs new file mode 100644 index 000000000..c6dc0a48f --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressHandler.cs @@ -0,0 +1,18 @@ +// ExpressHandler.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressHandler(ExpressServerRequest request, ExpressServerResponse response); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressChainedHandler(ExpressServerRequest request, ExpressServerResponse response, ExpressChain next); +} diff --git a/src/Libraries/Node/Node.Express/ExpressMiddleware.cs b/src/Libraries/Node/Node.Express/ExpressMiddleware.cs new file mode 100644 index 000000000..16130d369 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressMiddleware.cs @@ -0,0 +1,16 @@ +// ExpressMiddleware.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + // TODO: Fix this... + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressMiddleware(); +} diff --git a/src/Libraries/Node/Node.Express/ExpressParameterHandler.cs b/src/Libraries/Node/Node.Express/ExpressParameterHandler.cs new file mode 100644 index 000000000..9173aa5a4 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressParameterHandler.cs @@ -0,0 +1,16 @@ +// ExpressParameterHandler.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + // TODO: Fix this... + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressParameterHandler(object request, object response, ExpressChain next, string value); +} diff --git a/src/Libraries/Node/Node.Express/ExpressRoute.cs b/src/Libraries/Node/Node.Express/ExpressRoute.cs new file mode 100644 index 000000000..8c672b55b --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressRoute.cs @@ -0,0 +1,54 @@ +// ExpressRoute.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class ExpressRoute { + + private ExpressRoute() { + } + + [ScriptField] + public object[] Callbacks { + get { + return null; + } + } + + [ScriptField] + public object[] Keys { + get { + return null; + } + } + + [ScriptField] + public string Method { + get { + return null; + } + } + + [ScriptField] + public string Path { + get { + return null; + } + } + + [ScriptField] + public RegExp RegExp { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressServerRequest.cs b/src/Libraries/Node/Node.Express/ExpressServerRequest.cs new file mode 100644 index 000000000..18e62b008 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressServerRequest.cs @@ -0,0 +1,192 @@ +// ExpressServerRequest.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ExpressServerRequest { + + private ExpressServerRequest() { + } + + [ScriptField] + public string[] AcceptedCharsets { + get { + return null; + } + } + + [ScriptField] + public string[] AcceptedLanguages { + get { + return null; + } + } + + [ScriptField] + public Dictionary Body { + get { + return null; + } + } + + [ScriptField] + public Dictionary Cookies { + get { + return null; + } + } + + [ScriptField] + public string Host { + get { + return null; + } + } + + [ScriptField] + [ScriptName("ip")] + public string IPAddress { + get { + return null; + } + } + + [ScriptField] + [ScriptName("fresh")] + public bool IsFresh { + get { + return false; + } + } + + [ScriptField] + [ScriptName("stale")] + public bool IsStale { + get { + return false; + } + } + + [ScriptField] + [ScriptName("secure")] + public bool IsSecure { + get { + return false; + } + } + + [ScriptField] + [ScriptName("params")] + public Dictionary Parameters { + get { + return null; + } + } + + [ScriptField] + public string Path { + get { + return null; + } + } + + [ScriptField] + public string Protocol { + get { + return null; + } + } + + [ScriptField] + public string OriginalUrl { + get { + return null; + } + } + + [ScriptField] + public Dictionary Query { + get { + return null; + } + } + + [ScriptField] + public ExpressRoute Route { + get { + return null; + } + } + + [ScriptField] + public object Session { + get { + return null; + } + set { + } + } + + [ScriptField] + public Dictionary SignedCookies { + get { + return null; + } + } + + [ScriptField] + public string[] Subdomains { + get { + return null; + } + } + + [ScriptField] + public object User { + get { + return null; + } + } + + public bool AcceptsCharset(string charset) { + return false; + } + + [ScriptName("accepts")] + public string AcceptsContentType(string type) { + return null; + } + + [ScriptName("accepts")] + public string AcceptsContentType(string[] types) { + return null; + } + + public bool AcceptsLanguage(string language) { + return false; + } + + [ScriptName("get")] + public string GetHeader(string name) { + return null; + } + + [ScriptName("param")] + public string GetParameter(string name) { + return null; + } + + [ScriptName("is")] + public string IsContentType(string type) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressServerResponse.cs b/src/Libraries/Node/Node.Express/ExpressServerResponse.cs new file mode 100644 index 000000000..0b513c427 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressServerResponse.cs @@ -0,0 +1,156 @@ +// ExpressServerResponse.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ExpressServerResponse { + + private ExpressServerResponse() { + } + + [ScriptField] + public string Charset { + get { + return null; + } + set { + } + } + + [ScriptField] + public Dictionary Locals { + get { + return null; + } + } + + [ScriptName("locals")] + public void AddLocals(Dictionary values) { + } + + public ExpressServerResponse ClearCookie(string header) { + return null; + } + + public ExpressServerResponse ClearCookie(string header, object options) { + return null; + } + + [ScriptName("get")] + public string GetHeader(string header) { + return null; + } + + public void Redirect(string url) { + } + + public void Redirect(HttpStatusCode statusCode, string url) { + } + + public void Render(string viewName, AsyncResultCallback callback) { + } + + public void Render(string viewName, Dictionary data, AsyncResultCallback callback) { + } + + public void Send(object data) { + } + + public void Send(HttpStatusCode statusCode) { + } + + public void Send(HttpStatusCode statusCode, object data) { + } + + public void SendFile(string path) { + } + + public void SendFile(string path, object options) { + } + + public void SendFile(string path, object options, AsyncCallback callback) { + } + + [ScriptName("download")] + public void SendFileAttachment(string path) { + } + + [ScriptName("download")] + public void SendFileAttachment(string path, string fileName) { + } + + [ScriptName("download")] + public void SendFileAttachment(string path, string fileName, AsyncCallback callback) { + } + + [ScriptName("json")] + public void SendJson(object data) { + } + + [ScriptName("json")] + public void SendJson(HttpStatusCode statusCode, object data) { + } + + [ScriptName("jsonp")] + public void SendJsonP(object data) { + } + + [ScriptName("jsonp")] + public void SendJsonP(HttpStatusCode statusCode, object data) { + } + + [ScriptName("attachment")] + public ExpressServerResponse SetAttachment() { + return null; + } + + [ScriptName("attachment")] + public ExpressServerResponse SetAttachment(string fileName) { + return null; + } + + [ScriptName("cookie")] + public ExpressServerResponse SetCookie(string header, string value) { + return null; + } + + [ScriptName("cookie")] + public ExpressServerResponse SetCookie(string header, string value, ExpressCookieOptions options) { + return null; + } + + [ScriptName("set")] + public ExpressServerResponse SetHeader(string header, string value) { + return null; + } + + [ScriptName("set")] + public ExpressServerResponse SetHeaders(Dictionary headers) { + return null; + } + + [ScriptName("links")] + public ExpressServerResponse SetLinks(Dictionary links) { + return null; + } + + [ScriptName("status")] + public ExpressServerResponse SetStatus(HttpStatusCode code) { + return null; + } + + [ScriptName("type")] + public ExpressServerResponse SetType(string type) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressSettings.cs b/src/Libraries/Node/Node.Express/ExpressSettings.cs new file mode 100644 index 000000000..ce23d4786 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressSettings.cs @@ -0,0 +1,46 @@ +// ExpressSettings.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum ExpressSettings { + + [ScriptName("env")] + Environment, + + [ScriptName("trust proxy")] + ReverseProxy, + + [ScriptName("jsonp callback name")] + JsonpCallbackName, + + [ScriptName("json replacer")] + JsonReplacerCallback, + + [ScriptName("json spaces")] + JsonSpaces, + + [ScriptName("case sensitive routing")] + CaseSensitiveRouting, + + [ScriptName("strict routing")] + StrictRouting, + + [ScriptName("view cache")] + ViewCaching, + + [ScriptName("view engine")] + ViewEngine, + + [ScriptName("views")] + ViewsPath + } +} diff --git a/src/Libraries/Node/Node.Express/ExpressTemplateEngine.cs b/src/Libraries/Node/Node.Express/ExpressTemplateEngine.cs new file mode 100644 index 000000000..c639ffb29 --- /dev/null +++ b/src/Libraries/Node/Node.Express/ExpressTemplateEngine.cs @@ -0,0 +1,14 @@ +// ExpressTemplateEngine.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.ExpressJS { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void ExpressTemplateEngine(string path, object locals, AsyncResultCallback callback); +} diff --git a/src/Libraries/Node/Node.Express/Node.Express.csproj b/src/Libraries/Node/Node.Express/Node.Express.csproj new file mode 100644 index 000000000..b9a700feb --- /dev/null +++ b/src/Libraries/Node/Node.Express/Node.Express.csproj @@ -0,0 +1,77 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} + Library + Properties + NodeApi.ExpressJS + Script.Node.Express + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Express.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Express.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Express/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Express/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..a7d9a0571 --- /dev/null +++ b/src/Libraries/Node/Node.Express/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Express +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node.Express")] +[assembly: AssemblyDescription("Script# NodeJS Express Module API")] +[assembly: ScriptAssembly("express")] diff --git a/src/Libraries/Node/Node.Express/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Express/Properties/ScriptInfo.txt new file mode 100644 index 000000000..e2b079f4c --- /dev/null +++ b/src/Libraries/Node/Node.Express/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Express Module +=============================================================================== + +This assembly provides access to Express Module APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against express APIs. + +More information is on http://expressjs.com. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Mongo/MongoClient.cs b/src/Libraries/Node/Node.Mongo/MongoClient.cs new file mode 100644 index 000000000..01fc0a9a9 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoClient.cs @@ -0,0 +1,37 @@ +// MongoClient.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + public sealed class MongoClient { + + public MongoClient(MongoServer server) { + } + + public void Close() { + } + + public void Close(AsyncCallback callback) { + } + + public static void Connect(string url, AsyncResultCallback callback) { + } + + public static void Connect(string url, object options, AsyncResultCallback callback) { + } + + [ScriptName("db")] + public MongoDatabase GetDatabase(string name) { + return null; + } + + public void Open(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoCollection.cs b/src/Libraries/Node/Node.Mongo/MongoCollection.cs new file mode 100644 index 000000000..1a99c7615 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoCollection.cs @@ -0,0 +1,106 @@ +// MongoCollection.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Collection")] + public sealed class MongoCollection { + + public MongoCollection(MongoDatabase database, string name) { + } + + public MongoCollection(MongoDatabase database, string name, object options) { + } + + public void Count(AsyncResultCallback callback) { + } + + public void Count(object query, AsyncResultCallback callback) { + } + + public void Count(object query, object options, AsyncResultCallback callback) { + } + + public void Distinct(string key, AsyncResultCallback callback) { + } + + public void Distinct(string key, object query, AsyncResultCallback callback) { + } + + public void Distinct(string key, object query, object options, AsyncResultCallback callback) { + } + + public void Drop(AsyncCallback callback) { + } + + public MongoCursor Find(object query) { + return null; + } + + public MongoCursor Find(object query, object options) { + return null; + } + + public void FindAndModify(object query, object[] sort, object document, AsyncResultCallback callback) { + } + + public void FindAndModify(object query, object[] sort, object document, object options, AsyncResultCallback callback) { + } + + public void FindAndRemove(object query, object[] sort, AsyncResultCallback callback) { + } + + public void FindAndRemove(object query, object[] sort, object options, AsyncResultCallback callback) { + } + + public MongoCursor FindOne(object query, AsyncResultCallback callback) { + return null; + } + + public MongoCursor FindOne(object query, object options, AsyncResultCallback callback) { + return null; + } + + public void Insert(object[] documents) { + } + + public void Insert(object[] documents, object options) { + } + + public void Insert(object[] documents, object options, AsyncCallback callback) { + } + + public void Remove() { + } + + public void Remove(AsyncCallback callback) { + } + + public void Remove(object selector) { + } + + public void Remove(object selector, AsyncCallback callback) { + } + + public void Remove(object selector, object options, AsyncCallback callback) { + } + + public void Rename(string newName, AsyncCallback callback) { + } + + public void Update(object selector, object document) { + } + + public void Update(object selector, object document, AsyncCallback callback) { + } + + public void Update(object selector, object document, object options, AsyncCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoConnector.cs b/src/Libraries/Node/Node.Mongo/MongoConnector.cs new file mode 100644 index 000000000..18bd3ef23 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoConnector.cs @@ -0,0 +1,24 @@ +// MongoConnector.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Db")] + public sealed class MongoConnector { + + public MongoConnector(string name, MongoServer server) { + } + + public MongoConnector(string name, MongoServer server, object options) { + } + + public void Open(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoCursor.cs b/src/Libraries/Node/Node.Mongo/MongoCursor.cs new file mode 100644 index 000000000..74688636b --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoCursor.cs @@ -0,0 +1,64 @@ +// MongoCursor.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Cursor")] + public sealed class MongoCursor { + + public MongoCursor(MongoDatabase database, MongoCollection collection, object query, object fields) { + } + + public MongoCursor(MongoDatabase database, MongoCollection collection, object query, object fields, object options) { + } + + public MongoCursor BatchSize(int size) { + return null; + } + + public void Close(AsyncCallback callback) { + } + + public void Count(AsyncResultCallback callback) { + } + + public void Each(AsyncResultCallback callback) { + } + + public bool IsClosed() { + return false; + } + + public MongoCursor Limit(int limit) { + return null; + } + + public void NextObject(AsyncResultCallback callback) { + } + + public MongoCursor Rewind() { + return null; + } + + public MongoCursor Skip(int skip) { + return null; + } + + public MongoCursor Sort(string field, string direction) { + return null; + } + + public MongoCursor Sort(object[] fields) { + return null; + } + + public void ToArray(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoDatabase.cs b/src/Libraries/Node/Node.Mongo/MongoDatabase.cs new file mode 100644 index 000000000..7a4f0a74a --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoDatabase.cs @@ -0,0 +1,84 @@ +// MongoDatabase.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Db")] + public sealed class MongoDatabase { + + public MongoDatabase(string name, MongoServer server) { + } + + public MongoDatabase(string name, MongoServer server, object options) { + } + + public void Authenticate(string userName, string password, AsyncResultCallback successCallback) { + } + + public void Close() { + } + + public void Close(AsyncCallback callback) { + } + + public void Close(bool forceClose, AsyncCallback callback) { + } + + public static void Connection(string url, AsyncResultCallback callback) { + } + + public void CreateCollection(string name, AsyncResultCallback callback) { + } + + public void CreateCollection(string name, object options, AsyncResultCallback callback) { + } + + public void DropCollection(string name, AsyncCallback callback) { + } + + [ScriptName("admin")] + public void GetAdminDatabase(AsyncResultCallback callback) { + } + + [ScriptName("collection")] + public void GetCollection(string name, AsyncResultCallback callback) { + } + + [ScriptName("collection")] + public void GetCollection(string name, object options, AsyncResultCallback callback) { + } + + [ScriptName("collectionsInfo")] + public void GetCollectionInfo(string name, AsyncResultCallback callback) { + } + + [ScriptName("collectionNames")] + public void GetCollectionNames(AsyncResultCallback callback) { + } + + [ScriptName("collectionNames")] + public void GetCollectionNames(string name, AsyncResultCallback callback) { + } + + [ScriptName("collectionNames")] + public void GetCollectionNames(string name, object options, AsyncResultCallback callback) { + } + + [ScriptName("db")] + public MongoDatabase GetDatabase(string name) { + return null; + } + + public void Open(AsyncResultCallback callback) { + } + + public void RemoveCollection(string fromName, string toName, AsyncCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoServer.cs b/src/Libraries/Node/Node.Mongo/MongoServer.cs new file mode 100644 index 000000000..5fe94064d --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoServer.cs @@ -0,0 +1,21 @@ +// MongoServer.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Server")] + public sealed class MongoServer { + + public MongoServer(string host, int port) { + } + + public MongoServer(string host, int port, object options) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj b/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj new file mode 100644 index 000000000..3cb4428b9 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj @@ -0,0 +1,70 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} + Library + Properties + NodeApi.MongoDB + Script.Node.Mongo + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Mongo.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Mongo.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Mongo/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Mongo/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..7fd31d249 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node.Mongo")] +[assembly: AssemblyDescription("Script# NodeJS MongoDB Module API")] +[assembly: ScriptAssembly("mongodb")] diff --git a/src/Libraries/Node/Node.Mongo/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Mongo/Properties/ScriptInfo.txt new file mode 100644 index 000000000..21c19f4c8 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node MongoDB Module +=============================================================================== + +This assembly provides access to Express Module APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against express APIs. + +More information is on https://github.com/mongodb/node-mongodb-native. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs b/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs new file mode 100644 index 000000000..291d43934 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs @@ -0,0 +1,186 @@ +// GraphDatabase.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j graph database. Start here. + /// + [ScriptImport] + public class GraphDatabase { + + /// + /// Construct a new client for the Neo4j graph database available at the given (root) URL. + /// + /// The root URL where the Neo4j graph database is available, e.g. 'http://localhost:7474/'. This URL should include HTTP Basic Authentication info if needed, e.g. 'http://user:password@example.com/'. + /// Graph db = new Graph("http://localhost:7474"); + public GraphDatabase(string url) { + } + + /// + /// Construct a new client for the Neo4j graph database available at the given (root) URL. + /// + /// + /// url: The root URL where the Neo4j graph database is available, e.g. 'http://localhost:7474/'. This URL should include HTTP Basic Authentication info if needed, e.g. 'http://user:password@example.com/'. + /// proxy: An optional proxy URL for all requests. + /// + /// Graph db = new Graph(new Dictionary("url", "http://localhost:7474")); + public GraphDatabase(Dictionary opts) { + } + + /// + /// Create and immediately return a new, unsaved node with the given properties. + /// Note: This node will not be persisted to the database until and unless its save() method is called. + /// + /// The properties this new node should have. + /// Node + public GraphNode CreateNode(Dictionary data) { + return null; + } + + /// + /// Execute and "return" (via callback) the results of the given Gremlin script, optionally passing along the given script parameters + /// (recommended to avoid Gremlin injection security vulnerabilities). Any values in the returned results that represent nodes, relationships + /// or paths are returned as , or instances. + /// + /// The Gremlin script. Can be multi-line. + /// A map of parameters for the Gremlin script. + /// Returns List<object> + /// + /// + /// var script = "g.v(userId).out('likes')"; + /// + /// var params = { + /// userId: currentUser.id + /// }; + /// + /// db.execute(script, params, function (err, likes) { + /// if (err) throw err; + /// likes.forEach(function (node) { + /// // ... + /// }); + /// }); + /// + /// + public void Execute(string script, Dictionary parameters, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the node indexed under the given property and value in the given index. If none exists, returns undefined. + /// Note: With this method, at most one node is returned. See for returning multiple nodes. + /// + /// The name of the index, e.g. 'node_auto_index'. + /// The name of the property, e.g. 'username'. + /// The value of the property, e.g. 'aseemk'. + /// Returns Node + public void GetIndexedNode(string index, string property, object value, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes indexed under the given property and value in the given index. If no such nodes exist, an empty array is returned. + /// Note: This method will return multiple nodes if there are multiple hits. See #getIndexedNode for returning at most one node. + /// + /// The name of the index, e.g. 'node_auto_index'. + /// The name of the property, e.g. 'platform'. + /// The value of the property, e.g. 'xbox'. + /// Returns List<Node> + public void GetIndexedNodes(string index, string property, object value, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the relationship indexed under the given property and value in the given index. If none exists, returns undefined. + /// Note: With this method, at most one relationship is returned. See for returning multiple relationships. + /// + /// The name of the index, e.g. 'relationship_auto_index'. + /// The name of the property, e.g. 'created'. + /// The value of the property, e.g. 1346713658393. + /// Returns Relationship + public void GetIndexedRelationship(string index, string property, object value, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships indexed under the given property and value in the given index. If no such + /// relationships exist, an empty array is returned. + /// Note: This method will return multiple relationships if there are multiple hits. See for returning at most one relationship. + /// + /// The name of the index, e.g. 'relationship_auto_index'. + /// The name of the property, e.g. 'favorite'. + /// The value of the property, e.g. true. + /// Returns List<Relationship> + public void GetIndexedRelationships(string index, string property, object value, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the node with the given Neo4j ID. + /// + /// The integer ID of the node: 1234 + /// Returns Node + /// If no node exists with this ID. + public void GetNodeById(int id, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationship with the given Neo4j ID. + /// + /// The integer ID of the relationship, e.g. 1234. + /// Returns Relationship + public void GetRelationshipById(int id, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the Neo4j version as a float. + /// + /// Returns Number + public void GetVersion(AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the results of the given Cypher query, optionally passing along the given query parameters + /// (recommended to avoid Cypher injection security vulnerabilities). The returned results are an array of "rows" (matches), + /// where each row is a map from key name (as given in the query) to value. Any values that represent nodes, relationships or + /// paths are returned as , or instances. + /// + /// The Cypher query. Can be multi-line. + /// A map of parameters for the Cypher query. + /// Returns List<object> + /// + /// + /// var query = [ + /// 'START user=node({userId})', + /// 'MATCH (user) -[:likes]-> (other)', + /// 'RETURN other' + /// ].join('\n'); + /// + /// var params = { + /// userId: currentUser.id + /// }; + /// + /// db.query(query, params, function (err, results) { + /// if (err) throw err; + /// var likes = results.map(function (result) { + /// return result['other']; + /// }); + /// // ... + /// }); + /// + /// + public void Query(string query, Dictionary parameters, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes matching the given query (in Lucene syntax) from the given index. If no such nodes exist, an empty array is returned. + /// + /// The name of the index, e.g. node_auto_index. + /// The Lucene query, e.g. foo:bar AND hello:world. + /// Returns List<Node> + public void QueryNodeIndex(string index, string query, AsyncResultCallback> callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphNode.cs b/src/Libraries/Node/Node.Neo4j/GraphNode.cs new file mode 100644 index 000000000..b07764906 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphNode.cs @@ -0,0 +1,125 @@ +// GraphNode.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j node. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Node")] + public sealed class GraphNode : GraphPropertyContainer { + + private GraphNode() { + } + + /// + /// Persist or update this node in the database. + /// + /// Returns (via callback) this same Node instance after the save. + public void Save(AsyncResultCallback callback) { + } + + /// + /// Delete this node from the database. This will throw an error if this node has any relationships on it, unless the + /// force flag is passed in, in which case those relationships are also deleted. + /// + /// + /// If this node has any relationships on it, whether those relationships should be deleted as well. Note: For safety, it's recommended to not pass the force flag and instead manually and explicitly delete known relationships beforehand. + public void Delete(AsyncResultCallback callback, bool force) { + } + + /// + /// Add this node to the given index under the given key-value pair. + /// + /// The name of the index, e.g. 'users'. + /// The key to index under, e.g. 'username' + /// The value to index under, e.g. 'aseemk'. + /// + public void Index(string index, string key, object value, AsyncResultCallback callback) { + } + + /// + /// Create and "return" (via callback) a relationship of the given type and with the given properties from this node to another node. + /// + /// Node to create a relationship to + /// Type of relationship + /// The properties this relationship should have. + /// Returns a Relationship + public void CreateRelationshipTo(GraphNode otherNode, string type, Dictionary data, AsyncResultCallback callback) { + } + + /// + /// Create and "return" (via callback) a relationship of the given type and with the given properties from another node to this node. + /// + /// Node to create a relationship to + /// Type of relationship + /// The properties this relationship should have. + /// Returns a Relationship + /// + public void CreateRelationshipFrom(GraphNode otherNode, string type, Dictionary data, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships of the given type or types from or to this node. + /// + /// The types of Relationships to return + /// Returns a list of Relationships + /// + public void GetRelationships(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships of the given type or types from this node. + /// + /// The types of outgoing Relationships + /// Returns a list of Relationships + /// + public void Outgoing(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the Relationships of the given type or types to this node. + /// + /// The types of incoming Relationships + /// Returns a list of Relationships + /// + public void Incoming(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the Relationships of the given type or types from or to this node. + /// + /// The types of incoming or outgoing Relationships + /// Returns a list of Relationships + public void All(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes adjacent to this one following only relationships of the given type(s) and/or direction(s). + /// + /// It can be an array of string types, e.g. ['likes', 'loves']. + /// Returns a list of Nodes + public void GetRelationshipNodes(List rels, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the shortest path, if there is one, from this node to the given node. Returns null if no path exists. + /// + /// Destination node to find the shortest path to + /// The type of relationship to follow. + /// One of 'in', 'out', or 'all'. + /// The maximum number of relationships to follow when searching for paths. The default is 1. + /// This needs to be 'shortestPath' for now. + /// Returns a + public void Path(GraphNode to, string type, string direction, Int32 maxDepth, string algorithm, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphPath.cs b/src/Libraries/Node/Node.Neo4j/GraphPath.cs new file mode 100644 index 000000000..45aa7b1d6 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphPath.cs @@ -0,0 +1,73 @@ +// GraphPath.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j path. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Path")] + public sealed class GraphPath { + + private GraphPath() { + } + + /// + /// The node that this path ends at. + /// + [ScriptField] + public GraphNode End { + get { + return null; + } + } + + /// + /// The length of this path + /// + [ScriptField] + public int Length { + get { + return -1; + } + } + + /// + /// The nodes that make up this path. + /// + [ScriptField] + public List Nodes { + get { + return null; + } + } + + /// + /// The relationships that make up this path. + /// + [ScriptField] + public List Relationships { + get { + return null; + } + } + + /// + /// The node that this path starts at. + /// + [ScriptField] + public GraphNode Start { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs b/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs new file mode 100644 index 000000000..b6e10a3b0 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs @@ -0,0 +1,80 @@ +// GraphPropertyContainer.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The abstract class corresponding to a Neo4j property container. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("PropertyContainer")] + public abstract class GraphPropertyContainer { + + internal GraphPropertyContainer() { + } + + /// + /// Whether this property container exists in (has been persisted to) the Neo4j database. + /// + [ScriptField] + public bool Exists { + get { + return false; + } + } + + /// + /// This property container's properties. This is a map of key-value pairs. + /// + [ScriptField] + public Dictionary Data { + get { + return null; + } + } + + /// + /// If this property container exists, its Neo4j integer ID. + /// + [ScriptField] + public int Id { + get { + return -1; + } + } + + /// + /// The URL of this property container. + /// + [ScriptField] + public string Self { + get { + return string.Empty; + } + } + + /// + /// Delete this property container from the database. + /// + /// Callback function to execute when the delete operation is complete + [ScriptName("del")] + public void Delete(AsyncResultCallback callback) { + } + + /// + /// Test whether the given object represents the same property container as this one. They can be separate instances with separate data. + /// + /// Object to compare for equality + /// True if equal + public bool Equals(object other) { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs b/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs new file mode 100644 index 000000000..92fa57af3 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs @@ -0,0 +1,69 @@ +// GraphRelationship.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j relationship. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Relationship")] + public sealed class GraphRelationship : GraphPropertyContainer { + + private GraphRelationship() { + } + + /// + /// The node this relationship goes to. + /// + [ScriptField] + public GraphNode End { + get { + return null; + } + } + + /// + /// The node this relationship goes from. + /// + [ScriptField] + public GraphNode Start { + get { + return null; + } + } + + /// + /// This relationship's type. + /// + [ScriptField] + public string Type { + get { + return String.Empty; + } + } + + /// + /// Add this relationship to the given relationship index under the given property key and value. + /// + /// The name of the index, e.g. 'likes'. + /// The property key to index under, e.g. 'created'. + /// The property value to index under, e.g. 1346713658393. + /// + public void Index(string index, string key, object value, AsyncResultCallback callback) { + } + + /// + /// Persist or update this relationship in the database. "Returns" (via callback) this same instance after the save. + /// + /// Returns a Relationship + public void Save(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj b/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj new file mode 100644 index 000000000..100c4afe5 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj @@ -0,0 +1,64 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {232445FF-22AA-46F7-BA12-4590C670F2B1} + Library + 512 + Properties + Node.Neo4j + Script.Node.Neo4j + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + DEBUG + prompt + 4 + 1591, 0661, 0660, 1684 + ..\..\..\..\bin\Debug\Script.Node.Neo4j.xml + + + ..\..\..\..\bin\Release\ + + + prompt + 4 + 1591, 0661, 0660, 1684 + ..\..\..\..\bin\Release\Script.Node.Neo4j.xml + + + + + Properties\ScriptSharp.cs + + + + + + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..29314fa45 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Script.Node.Neo4J")] +[assembly: AssemblyDescription("Script# NodeJS Neo4j Client Library API")] +[assembly: ScriptAssembly("neo4j")] diff --git a/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt new file mode 100644 index 000000000..e55f8bc14 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt @@ -0,0 +1,14 @@ +Node-Neo4J Client Library +=============================================================================== + +This assembly provides access to the Neo4j Graph Database APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against the Node-Neo4j APIs. + +You must install the neo4j package for runtime functionality and install the Neo4j database. + +More info on Node-Neo4j is on https://github.com/thingdom/node-neo4j + +More info on Neo4j is on http://www.neo4j.org/ + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Restify/Node.Restify.csproj b/src/Libraries/Node/Node.Restify/Node.Restify.csproj new file mode 100644 index 000000000..fbfbea917 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Node.Restify.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} + Library + Properties + NodeApi.Restify + Script.Node.Restify + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + + {36d4b098-a21c-4725-acd3-400922885f38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d1497e2e9 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Script.Node.Restify")] +[assembly: AssemblyDescription("Script# NodeJS Restify Module API")] +[assembly: ScriptAssembly("restify")] diff --git a/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt new file mode 100644 index 000000000..afd792f38 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Restify Module +=============================================================================== + +This assembly provides access to Restify Module APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against restify APIs. + +More information is on http://mcavage.github.com/node-restify/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Restify/RestifyApplication.cs b/src/Libraries/Node/Node.Restify/RestifyApplication.cs new file mode 100644 index 000000000..101757d08 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyApplication.cs @@ -0,0 +1,80 @@ +// Restify.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("restify")] + public static class RestifyApplication { + + public static RestifyChainedHandler[] AcceptParser(string[] serverAcceptable) { + return null; + } + + public static RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public static RestifyChainedHandler[] BodyParser() { + return null; + } + + public static RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public static RestifyHttpClient CreateHttpClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient(RestifyJsonClientOptions options) { + return null; + } + + public static RestifyServer CreateServer() { + return null; + } + + public static RestifyServer CreateServer(RestifyServerOptions rs) { + return null; + } + + public static RestifyStringClient CreateStringClient() { + return null; + } + + public static RestifyChainedHandler[] DateParser() { + return null; + } + + public static RestifyChainedHandler[] GZipResponse() { + return null; + } + + public static RestifyChainedHandler[] JsonBodyParser() { + return null; + } + + public static RestifyChainedHandler[] Jsonp() { + return null; + } + + public static RestifyChainedHandler QueryParser() { + return null; + } + + public static RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyCallback.cs b/src/Libraries/Node/Node.Restify/RestifyCallback.cs new file mode 100644 index 000000000..5bc17aadd --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyCallback.cs @@ -0,0 +1,9 @@ +// RestifyCallback.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +namespace NodeApi.Restify { + + public delegate void RestifyCallback(RestifyError error, RestifyRequest request, RestifyResponse response, object content); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyChain.cs b/src/Libraries/Node/Node.Restify/RestifyChain.cs new file mode 100644 index 000000000..0c61351ad --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyChain.cs @@ -0,0 +1,26 @@ +// RestifyChain.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyChain { + + private RestifyChain() { + } + + [ScriptSkip] + public void Continue() { + } + + [ScriptSkip] + public void Error(Exception error) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyError.cs b/src/Libraries/Node/Node.Restify/RestifyError.cs new file mode 100644 index 000000000..6d5f6cec5 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyError.cs @@ -0,0 +1,17 @@ +// RestifyError.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyError { + + internal RestifyError() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHandler.cs b/src/Libraries/Node/Node.Restify/RestifyHandler.cs new file mode 100644 index 000000000..111182019 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHandler.cs @@ -0,0 +1,18 @@ +// RestifyHandler.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void RestifyHandler(RestifyRequest request, RestifyResponse response); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate RestifyChainedHandler RestifyChainedHandler(RestifyRequest request, RestifyResponse response, Func next); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs new file mode 100644 index 000000000..6e71a5b40 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs @@ -0,0 +1,17 @@ +// RestifyHttpClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyHttpClient : RestifyStringClient { + + private RestifyHttpClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs new file mode 100644 index 000000000..f97c0f957 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs @@ -0,0 +1,21 @@ +// RestifyJsonClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + /// + /// sends and expects application/json + /// + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyJsonClient : RestifyStringClient { + + private RestifyJsonClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs new file mode 100644 index 000000000..082f1e5ba --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs @@ -0,0 +1,78 @@ +// RestifyJsonClientOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyJsonClientOptions { + + public RestifyJsonClientOptions() { + } + + public RestifyJsonClientOptions(params object[] nameValuePairs) { + } + + /// + /// Accept header to send + /// + public string Accept; + + /// + /// Amount of time to wait for a socket + /// + public int ConnectTimeout; + + /// + /// node-dtrace-provider handle + /// + [ScriptName("dtrace")] + public object DTrace; + + /// + /// Will compress data when sent using content-encoding: gzip + /// + public object Gzip; + + /// + /// HTTP headers to set in all requests + /// + public object Headers; + + /// + /// bunyan instance + /// + public object Log; + + /// + /// options to provide to node-retry; defaults to 3 retries + /// + public object Retry; + + /// + /// synchronous callback for interposing headers before request is sent + /// + public Action SignRequest; + + /// + /// Fully-qualified URL to connect to + /// + public string Url; + + /// + /// user-agent string to use; restify inserts one, but you can override it + /// + public string UserAgent; + + /// + /// semver string to set the accept-version + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyLogger.cs b/src/Libraries/Node/Node.Restify/RestifyLogger.cs new file mode 100644 index 000000000..f98dc8245 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyLogger.cs @@ -0,0 +1,23 @@ +// BunyanLogger.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyLogger { + + private RestifyLogger() { + } + + public void Debug(object options, string format, params string[] formatArguments) { + } + } +} \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/RestifyRequest.cs b/src/Libraries/Node/Node.Restify/RestifyRequest.cs new file mode 100644 index 000000000..a982abe2f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRequest.cs @@ -0,0 +1,210 @@ +// RestifyRequest.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRequest { + + private RestifyRequest() { + } + + [ScriptField] + public Socket Connection { + get { + return null; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + [ScriptField] + public object Headers { + get { + return null; + } + } + + /// + /// url.parse(req.url) href + /// + [ScriptField] + public string Href { + get { + return String.Empty; + } + } + + [ScriptField] + public string HttpVersion { + get { + return null; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + /// + /// bunyan logger you can piggyback on + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + } + + [ScriptField] + [ScriptName("params")] + public Dictionary Parameters { + get { + return null; + } + } + + /// + /// cleaned up URL path + /// + [ScriptField] + public string Path { + get { + return String.Empty; + } + } + + /// + /// the query string only + /// + [ScriptField] + public string Query { + get { + return String.Empty; + } + } + + /// + /// Whether this was an SSL request + /// + [ScriptField] + public bool Secure { + get { + return true; + } + } + + /// + /// the time when this request arrived (ms since epoch) + /// + [ScriptField] + [ScriptName("time")] + public int TimeInMilliseconds { + get { + return 0; + } + } + + [ScriptField] + public object Trailers { + get { + return null; + } + } + + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// Check if the Accept header is present, and includes the given type. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string type) { + return true; + } + + /// + /// Check if the Accept header is present, and includes the given types. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string[] types) { + return true; + } + + [ScriptName("header")] + public string GetHeader(string name) { + return String.Empty; + } + + [ScriptName("header")] + public string GetHeader(string key, string defaultValue) { + return String.Empty; + } + + /// + /// Shorthand to grab a new bunyan instance that is a child component of the one restify has: + /// + /// + /// + public RestifyLogger GetLogger(string name) { + return null; + } + + /// + /// Check if the incoming request contains the Content-Type header field, and it contains the give mime type. + /// + /// + /// + [ScriptName("is")] + public bool IsContentType(string type) { + return true; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyResponse.cs b/src/Libraries/Node/Node.Restify/RestifyResponse.cs new file mode 100644 index 000000000..ddb2bb85b --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyResponse.cs @@ -0,0 +1,159 @@ +// RestifyResponse.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyResponse { + + private RestifyResponse() { + } + + /// + /// In conjunction with contentType, you can explicitly set the charSet to be written in the content-type header + /// + [ScriptField] + public string CharSet { + get { + return String.Empty; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + /// + /// response headers + /// + [ScriptField] + public Dictionary Headers { + get { + return null; + } + } + + /// + /// HTTP status code + /// + [ScriptName("code")] + [ScriptField] + public int HttpStatusCode { + get { + return 0; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + [ScriptField] + public int StatusCode { + get; + set; + } + + public void AddTrailers(Dictionary headers) { + } + + public string GetHeader(string name) { + return null; + } + + /// + /// Short-hand for: + /// res.contentType = 'json'; + /// res.send({hello: 'world'}); + /// + /// Status code + /// content + public void Json(HttpStatusCode code, object body) { + } + + public void RemoveHeader(string name) { + } + + + public void Send(object message) { + } + + public void Send(int errorCode, RestifyError message) { + } + + public void SendDate() { + } + + /// + /// Sets the cache-control header. + /// + /// type defaults to _public_ + /// options currently only takes maxAge. + public void SetCache(string type, Dictionary options) { + } + + public void SetHeader(string name, string value) { + } + + /// + /// Sets the response statusCode. + /// + /// Status code + public void Status(HttpStatusCode code) { + } + + /// + /// You can use send() to wrap up all the usual writeHead(), write(), end() calls on the HTTP API of node. + /// When you call send(), restify figures out how to format the response (see content-negotiation, above), and does that. + /// + /// Status Code + /// body can be an Object, a Buffer, or an Error. + public void Status(HttpStatusCode code, object body) { + } + + public void WriteContinue() { + } + + public void WriteHead(HttpStatusCode statusCode) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase) { + } + + public void WriteHead(HttpStatusCode statusCode, Dictionary headers) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase, Dictionary headers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyRoute.cs b/src/Libraries/Node/Node.Restify/RestifyRoute.cs new file mode 100644 index 000000000..7b28b1e03 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRoute.cs @@ -0,0 +1,17 @@ +// RestifyRoute.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRoute { + + private RestifyRoute() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServer.cs b/src/Libraries/Node/Node.Restify/RestifyServer.cs new file mode 100644 index 000000000..f7043678f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServer.cs @@ -0,0 +1,315 @@ + // RestifyServer.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyServer { + + private RestifyServer() { + } + + /// + /// list of content-types this server can respond with + /// + [ScriptField] + public String[] Acceptable { + get { + return null; + } + } + + /// + /// bunyan instance + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + /// + /// name of the server + /// + [ScriptField] + public string Name { + get { + return null; + } + } + + /// + /// Once listen() is called, this will be filled in with where the server is running + /// + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// default version to use in all routes + /// + [ScriptField] + public string Version { + get { + return null; + } + } + + /// + /// Emitted after a route has finished all the handlers you registered. + /// You can use this to write audit logs, etc. The route parameter will be the Route object that ran. + /// Note that when you are using the default 404/405/BadVersion handlers, this event will still be fired, + /// but route will be null. If you have registered your own listeners for those, this event will not be fired + /// unless you invoke the cb argument that is provided with them. + /// + [ScriptEvent("on", "removeListener")] + public event Action After { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does exist, but you have not registered a route for that HTTP verb, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 405 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("MethodNotAllowed")] + public event Action MethodNotAllowed { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does not exist, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 404 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("NotFound")] + public event Action NotFound { + add { + } + remove { + } + } + + /// + /// Emitted when some handler throws an uncaughtException somewhere in the chain. + /// The default behavior is to just call res.send(error), and let the built-ins in restify handle transforming, + /// but you can override to whatever you want here. + /// + [ScriptEvent("on", "removeListener")] + public event Action UncaughtException { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exist, but has a content-type mismatch, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 415 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("UnsupportedMediaType")] + public event Action UnsupportedMediaType { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exists, but does not match the version(s) on those routes, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 400 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("VersionNotAllowed")] + public event Action VersionNotAllowed { + add { + } + remove { + } + } + + public RestifyChainedHandler[] AcceptParser(string[] acceptable) { + return null; + } + + public Dictionary Address() { + return null; + } + + public RestifyChainedHandler[] AuditLogger(object options) { + return null; + } + + public RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public RestifyChainedHandler[] BodyParser() { + return null; + } + + public void Close(Action callback) { + } + + public RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public RestifyServer CreateServer() { + return null; + } + + public RestifyServer CreateServer(object options) { + return null; + } + + public RestifyServer CreateServer(RestifyServerOptions options) { + return null; + } + + public RestifyChainedHandler[] DateParser() { + return null; + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler[] handlers) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(string path, RestifyChainedHandler handler) { + } + + public void Get(string path, RestifyChainedHandler[] handlers) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler handler) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler[] handlers) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(object options, RestifyChainedHandler handler) { + } + + public void Get(object options, RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] GzipResponse() { + return null; + } + + public void Head(string path, RestifyChainedHandler handler) { + } + + public void Head(string path, RestifyChainedHandler[] handlers) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Listen(int port, Action callback) { + } + + public void Listen(object handle, Action callback) { + } + + public void Listen(string path, Action callback) { + } + + public void Post(string path, RestifyChainedHandler handler) { + } + + public void Post(string path, RestifyChainedHandler[] handlers) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Pre(RestifyChainedHandler handler) { + } + + public void Pre(RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] QueryParser() { + return null; + } + + public RestifyChainedHandler[] RequestLogger() { + return null; + } + + public RestifyChainedHandler[] RequestLogger(object options) { + return null; + } + + public RestifyChainedHandler[] ServeStatic(object options) { + return null; + } + + public RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + + public RestifyChainedHandler[] Throttle(Dictionary options) { + return null; + } + + /// + /// Restify runs handlers in the order they are registered on a server, + /// so if you want some common handlers to run before any of your routes, + /// issue calls to use() before defining routes. + /// + public void Use(RestifyChainedHandler handlers) { + } + + public void Use(RestifyChainedHandler[] handlers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs new file mode 100644 index 000000000..70f4edbf2 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs @@ -0,0 +1,26 @@ +// RestifyServerGetOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyServerGetOptions { + + public RestifyServerGetOptions() { + } + + public RestifyServerGetOptions(params object[] nameValuePairs) { + } + + public string Path; + + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs new file mode 100644 index 000000000..e25086916 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs @@ -0,0 +1,79 @@ +// RestifyServerOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyServerOptions { + + public RestifyServerOptions() { + } + + public RestifyServerOptions(params object[] nameValuePairs) { + } + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Certificate; + + /// + /// Custom response formatters for res.send() + /// + public object Formatters; + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Key; + + /// + /// You can optionally pass in a bunyan (https://github.com/trentm/node-bunyan) instance; not required + /// + public object Log; + + /// + /// By default, this will be set in the Server response header, default is restify + /// + public string Name; + + /// + /// Any options accepted by node-spdy (https://github.com/indutny/node-spdy) + /// + public string Spdy; + + /// + /// Allows you to apply formatting to the value of the header. + /// The duration is passed as an argument in number of milliseconds to execute. + /// + /// + /// + /// app = module.exports = restify.createServer({ + /// name: 'restify', + /// version: '1.0.0', + /// responseTimeHeader: 'X-Runtime', + /// responseTimeFormatter: function(durationInMilliseconds) { + /// return durationInMilliseconds / 1000; + /// } + /// }); + /// + public Func ResponseTimeFormatter; + + /// + /// By default, this will be X-Response-Time + /// + public string ResponseTimeHeader; + + /// + /// A default version to set for all routes + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyStringClient.cs b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs new file mode 100644 index 000000000..94c687b64 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs @@ -0,0 +1,57 @@ +// RestifyStringClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public class RestifyStringClient { + + protected RestifyStringClient() { + } + + public void BasicAuth(string login, string password) { + } + + /// + /// del doesn't take content, since you know, it should't: + /// + public void Del(string path, object content, RestifyCallback callback) { + } + + /// + /// Performs an HTTP get; if no payload was returned, obj defaults to {} for you (so you don't get a bunch of null pointer errors). + /// + /// + /// + public void Get(string path, RestifyCallback callback) { + } + + /// + /// Just like get, but without obj: + /// + /// + /// + public void Head(string path, RestifyCallback callback) { + } + + /// + /// Takes a complete object to serialize and send to the server. + /// + /// + /// + /// + public void Post(string path, object content, RestifyCallback callback) { + } + + /// + /// Just like post: + /// + public void Put(string path, object content, RestifyCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs new file mode 100644 index 000000000..5d312cb7c --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs @@ -0,0 +1,91 @@ +// RestifyThrottleOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyThrottleOptions { + + public RestifyThrottleOptions() { + } + + public RestifyThrottleOptions(params object[] nameValuePairs) { + } + + /// + /// If available, the amount of requests to burst to + /// + [ScriptField] + public int Burst { + set { + } + } + + /// + /// Do throttling on a /32 (source IP) + /// + [ScriptField] + public bool Ip { + set { + } + } + + /// + /// If using the built-in storage table, the maximum distinct throttling keys to allow at a time + /// + [ScriptField] + public int MaxKeys { + set { + } + } + + /// + /// Per "key" overrides + /// + [ScriptField] + public object Overrides { + set { + } + } + + [ScriptField] + public int Rate { + set { + } + } + + /// + /// Storage engine; must support put/get + /// + [ScriptField] + public object TokensTable { + set { + } + } + + /// + /// Do throttling on req.username + /// + [ScriptField] + public bool Username { + set { + } + } + + /// + /// Do throttling on a /32 (X-Forwarded-For) + /// + [ScriptField] + public bool Xff { + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/ActiveXObject.cs b/src/Libraries/Web/Html/ActiveXObject.cs index 733779f37..b4dda32e7 100644 --- a/src/Libraries/Web/Html/ActiveXObject.cs +++ b/src/Libraries/Web/Html/ActiveXObject.cs @@ -7,8 +7,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ActiveXObject { public ActiveXObject(string progID) { diff --git a/src/Libraries/Web/Html/AnchorElement.cs b/src/Libraries/Web/Html/AnchorElement.cs index b92eca441..c1629ce35 100644 --- a/src/Libraries/Web/Html/AnchorElement.cs +++ b/src/Libraries/Web/Html/AnchorElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class AnchorElement : Element { private AnchorElement() { } - [IntrinsicProperty] + [ScriptField] public string Href { get { return null; @@ -24,7 +24,7 @@ public string Href { } } - [IntrinsicProperty] + [ScriptField] public string Rel { get { return null; @@ -33,7 +33,7 @@ public string Rel { } } - [IntrinsicProperty] + [ScriptField] public string Target { get { return null; @@ -42,7 +42,7 @@ public string Target { } } - [IntrinsicProperty] + [ScriptField] public string Download { get { return null; diff --git a/src/Libraries/Web/Html/AreaElement.cs b/src/Libraries/Web/Html/AreaElement.cs index a4ca40fe8..aeaa63766 100644 --- a/src/Libraries/Web/Html/AreaElement.cs +++ b/src/Libraries/Web/Html/AreaElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class AreaElement : Element { private AreaElement() { } - [IntrinsicProperty] + [ScriptField] public string Shape { get { return null; @@ -24,7 +24,7 @@ public string Shape { } } - [IntrinsicProperty] + [ScriptField] public string Coords { get { return null; @@ -33,7 +33,7 @@ public string Coords { } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; @@ -42,7 +42,7 @@ public string Name { } } - [IntrinsicProperty] + [ScriptField] public string Alt { get { return null; @@ -51,7 +51,7 @@ public string Alt { } } - [IntrinsicProperty] + [ScriptField] public string Href { get { return null; @@ -60,7 +60,7 @@ public string Href { } } - [IntrinsicProperty] + [ScriptField] public string NoHref { get { return null; diff --git a/src/Libraries/Web/Html/AudioElement.cs b/src/Libraries/Web/Html/AudioElement.cs index be987f655..40a1e520b 100644 --- a/src/Libraries/Web/Html/AudioElement.cs +++ b/src/Libraries/Web/Html/AudioElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class AudioElement : Element { private AudioElement() { } - [IntrinsicProperty] + [ScriptField] public double CurrentTime { get { return 0; @@ -24,28 +24,28 @@ public double CurrentTime { } } - [IntrinsicProperty] + [ScriptField] public double Duration { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public bool Ended { get { return false; } } - [IntrinsicProperty] + [ScriptField] public bool Paused { get { return false; } } - [IntrinsicProperty] + [ScriptField] public string Src { get { return ""; @@ -54,7 +54,7 @@ public string Src { } } - [IntrinsicProperty] + [ScriptField] public float Volume { get { return 0; diff --git a/src/Libraries/Web/Html/CanvasElement.cs b/src/Libraries/Web/Html/CanvasElement.cs index 1b18d1cf0..8a85e988e 100644 --- a/src/Libraries/Web/Html/CanvasElement.cs +++ b/src/Libraries/Web/Html/CanvasElement.cs @@ -9,14 +9,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class CanvasElement : Element { private CanvasElement() { } - [IntrinsicProperty] + [ScriptField] public int Height { get { return 0; @@ -25,7 +25,7 @@ public int Height { } } - [IntrinsicProperty] + [ScriptField] public int Width { get { return 0; diff --git a/src/Libraries/Web/Html/CheckBoxElement.cs b/src/Libraries/Web/Html/CheckBoxElement.cs index 37e2f9c20..651601cd1 100644 --- a/src/Libraries/Web/Html/CheckBoxElement.cs +++ b/src/Libraries/Web/Html/CheckBoxElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class CheckBoxElement : InputElement { internal CheckBoxElement() { } - [IntrinsicProperty] + [ScriptField] public bool Checked { get { return false; @@ -24,7 +24,7 @@ public bool Checked { } } - [IntrinsicProperty] + [ScriptField] public bool DefaultChecked { get { return false; diff --git a/src/Libraries/Web/Html/ClientRect.cs b/src/Libraries/Web/Html/ClientRect.cs index 5584b0baf..0fa7e2fc4 100644 --- a/src/Libraries/Web/Html/ClientRect.cs +++ b/src/Libraries/Web/Html/ClientRect.cs @@ -9,35 +9,35 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ClientRect { private ClientRect() { } - [IntrinsicProperty] + [ScriptField] public double Bottom { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Left { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Right { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Top { get { return 0; diff --git a/src/Libraries/Web/Html/ClientRectList.cs b/src/Libraries/Web/Html/ClientRectList.cs index 59b95ec54..12c529c2c 100644 --- a/src/Libraries/Web/Html/ClientRectList.cs +++ b/src/Libraries/Web/Html/ClientRectList.cs @@ -9,21 +9,21 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ClientRectList { private ClientRectList() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public ClientRect this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/CustomEvent.cs b/src/Libraries/Web/Html/CustomEvent.cs index 8c1b0355d..e9eb750e2 100644 --- a/src/Libraries/Web/Html/CustomEvent.cs +++ b/src/Libraries/Web/Html/CustomEvent.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class CustomEvent : ElementEvent { internal CustomEvent() { } - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; diff --git a/src/Libraries/Web/Html/Data/ApplicationCache.cs b/src/Libraries/Web/Html/Data/ApplicationCache.cs index 1a7fd8cbe..3d492eb31 100644 --- a/src/Libraries/Web/Html/Data/ApplicationCache.cs +++ b/src/Libraries/Web/Html/Data/ApplicationCache.cs @@ -8,8 +8,8 @@ namespace System.Html.Data { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ApplicationCache { private ApplicationCache() { @@ -18,7 +18,7 @@ private ApplicationCache() { /// /// Gets the current status of the application cache. /// - [IntrinsicProperty] + [ScriptField] public ApplicationCacheStatus Status { get { return ApplicationCacheStatus.Uncached; diff --git a/src/Libraries/Web/Html/Data/ApplicationCacheEvent.cs b/src/Libraries/Web/Html/Data/ApplicationCacheEvent.cs index b15576328..f8d3989bb 100644 --- a/src/Libraries/Web/Html/Data/ApplicationCacheEvent.cs +++ b/src/Libraries/Web/Html/Data/ApplicationCacheEvent.cs @@ -11,9 +11,9 @@ namespace System.Html.Data { /// /// Represents an event raised by the Application Cache. /// - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum ApplicationCacheEvent { /// diff --git a/src/Libraries/Web/Html/Data/ApplicationCacheStatus.cs b/src/Libraries/Web/Html/Data/ApplicationCacheStatus.cs index dfffb7a94..d88bbf2cf 100644 --- a/src/Libraries/Web/Html/Data/ApplicationCacheStatus.cs +++ b/src/Libraries/Web/Html/Data/ApplicationCacheStatus.cs @@ -11,9 +11,9 @@ namespace System.Html.Data { /// /// Indicates the status of the application cache. /// - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum ApplicationCacheStatus { /// diff --git a/src/Libraries/Web/Html/Data/Files/Blob.cs b/src/Libraries/Web/Html/Data/Files/Blob.cs new file mode 100644 index 000000000..36fa5ed9d --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/Blob.cs @@ -0,0 +1,54 @@ +// Blob.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class Blob { + + public Blob() { + } + + public Blob(object blobParts) { + } + + public Blob(object blobParts, object options) { + } + + [CLSCompliant(false)] + [ScriptField] + public ulong Size { + get { + return 0; + } + } + + [ScriptField] + public string Type { + get { + return String.Empty; + } + } + + public Blob Slice() { + return null; + } + + public Blob Slice(long start) { + return null; + } + + public Blob Slice(long start, long end) { + return null; + } + + public Blob Slice(long start, long end, string contentType) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/File.cs b/src/Libraries/Web/Html/Data/Files/File.cs new file mode 100644 index 000000000..2814a2da2 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/File.cs @@ -0,0 +1,31 @@ +// File.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class File : Blob { + + private File() { + } + + [ScriptField] + public Date LastModifiedDate { + get { + return Date.Now; + } + } + + [ScriptField] + public String Name { + get { + return String.Empty; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileError.cs b/src/Libraries/Web/Html/Data/Files/FileError.cs new file mode 100644 index 000000000..02537c9d3 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileError.cs @@ -0,0 +1,24 @@ +// FileError.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileError { + + private FileError() { + } + + [ScriptField] + public string Name { + get { + return String.Empty; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileList.cs b/src/Libraries/Web/Html/Data/Files/FileList.cs new file mode 100644 index 000000000..0e0915c49 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileList.cs @@ -0,0 +1,31 @@ +// FileList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileList { + + private FileList() { + } + + [ScriptField] + public long Length { + get { + return 0; + } + } + + [ScriptField] + public File this[int index] { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs b/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs new file mode 100644 index 000000000..3a66b2e59 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs @@ -0,0 +1,28 @@ +// FileProgressEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileProgressEvent : ElementEvent { + + private FileProgressEvent() { + } + + public bool Bubbles; + public bool Cancelable; + public bool DefaultPrevented; + public bool LengthComputable; + + public int EventPhase; + public int Loaded; + public int Total; + + public object ClipboardData; + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReader.cs b/src/Libraries/Web/Html/Data/Files/FileReader.cs new file mode 100644 index 000000000..c012d073c --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReader.cs @@ -0,0 +1,151 @@ +// FileReader.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileReader { + + [ScriptField] + public FileError Error { + get { + return null; + } + } + + /// + /// Indicates the state of the FileReader. This will be one of the State constants. Read only. + /// + [ScriptField] + public int ReadyState { + get { + return (int)FileReadyState.Empty; + } + } + + // File or Blob data + [ScriptField] + public object Result { + get { + return null; + } + } + + [ScriptName("onabort")] + public Action OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + public Action OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onload")] + public Action OnLoad { + get { + return null; + } + set { + } + } + + [ScriptName("onloadend")] + public Action OnLoadEnd { + get { + return null; + } + set { + } + } + + [ScriptName("onloadstart")] + public Action OnLoadStart { + get { + return null; + } + set { + } + } + + [ScriptName("onprogress")] + public Action OnProgress { + get { + return null; + } + set { + } + } + + public void Abort() { + } + + /// + /// Adds a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The listener to be invoked in response to the event. + /// Whether the listener wants to initiate capturing the event. + public void AddEventListener(string eventName, ElementEventListener listener, bool useCapture) { + } + + /// + /// Adds a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The handler to be invoked in response to the event. + /// Whether the handler wants to initiate capturing the event. + public void AddEventListener(string eventName, IElementEventHandler handler, bool useCapture) { + } + + public bool DispatchEvent(MutableEvent eventObject) { + return false; + } + + public void ReadAsArrayBuffer(Blob blob) { + } + + public void ReadAsBinaryString(Blob blob) { + } + + public void ReadAsDataURL(Blob blob) { + } + + public void ReadAsText(Blob blob) { + } + + public void ReadAsText(Blob blob, string encoding) { + } + + /// + /// Removes a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The listener to be invoked in response to the event. + /// Whether the listener wants to initiate capturing the event. + public void RemoveEventListener(string eventName, ElementEventListener listener, bool useCapture) { + } + + /// + /// Removes a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The handler to be invoked in response to the event. + /// Whether the handler wants to initiate capturing the event. + public void RemoveEventListener(string eventName, IElementEventHandler handler, bool useCapture) { + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs b/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs new file mode 100644 index 000000000..51620d6ba --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs @@ -0,0 +1,30 @@ +// FileReader.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileReaderSync { + + public object ReadAsArrayBuffer(Blob blob) { + return null; + } + + public string ReadAsDataURL(Blob blob) { + return null; + } + + public string ReadAsText(Blob blob) { + return null; + } + + public string ReadAsText(Blob blob, string encoding) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReadyState.cs b/src/Libraries/Web/Html/Data/Files/FileReadyState.cs new file mode 100644 index 000000000..d8cbf97a1 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReadyState.cs @@ -0,0 +1,21 @@ +// FileReadyState.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] + public enum FileReadyState { + + Empty = 0, + + Loading = 1, + + Done = 2 + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs new file mode 100644 index 000000000..e42200aa6 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs @@ -0,0 +1,63 @@ +// DBCursor.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBCursor { + + internal DBCursor() { + } + + [ScriptField] + public string Direction { + get { + return null; + } + } + + [ScriptField] + public object Key { + get { + return null; + } + } + + [ScriptField] + public object PrimaryKey { + get { + return null; + } + } + + [ScriptField] + public object Source { + get { + return null; + } + } + + public void Advance(long count) { + } + + public void Continue() { + } + + public void Continue(object key) { + } + + public DBRequest Delete(object value) { + return null; + } + + public DBRequest Update(object value) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs new file mode 100644 index 000000000..1f7620c7e --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs @@ -0,0 +1,25 @@ +// DBCursorWithValue.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBCursorWithValue : DBCursor { + + private DBCursorWithValue() { + } + + [ScriptField] + public object Value { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs new file mode 100644 index 000000000..bbdd4bcb9 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs @@ -0,0 +1,99 @@ +// DBDatabase.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBDatabase : DBEventTarget { + + private DBDatabase() { + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public string[] ObjectStoreNames { + get { + return default(string[]); + } + } + + [ScriptName("onabort")] + [ScriptField] + public DBDatabaseCallback OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBDatabaseCallback OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onversionchange")] + [ScriptField] + public DBDatabaseVersionChangeCallback OnVersionChange { + get { + return null; + } + set { + } + } + + [ScriptField] + public long Version { + get { + return default(long); + } + } + + public void Close() { + } + + public DBObjectStore CreateObjectStore(string name) { + return default(DBObjectStore); + } + + public DBObjectStore CreateObjectStore(string name, DBObjectStoreParameters optionalParameters) { + return default(DBObjectStore); + } + + public void DeleteObjectStore(string name) { + } + + public DBTransaction Transaction(string[] storenames) { + return default(DBTransaction); + } + + public DBTransaction Transaction(string[] storenames, string mode) { + return default(DBTransaction); + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBDatabaseCallback(DBEvent e); + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBDatabaseVersionChangeCallback(DBVersionChangeEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs new file mode 100644 index 000000000..f329cba0d --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs @@ -0,0 +1,32 @@ +// DBEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBEvent { + + internal DBEvent() { + } + + [ScriptField] + public T Target { + get { + return default(T); + } + } + + [ScriptField] + public string Type { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs new file mode 100644 index 000000000..de2ad05e2 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs @@ -0,0 +1,30 @@ +// DBEventTarget.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public abstract class DBEventTarget { + + internal DBEventTarget() { + } + + public void AddEventListener(string type, Action listener) { + } + + public void AddEventListener(string type, Action listener, bool useCapture) { + } + + public void RemoveEventListener(string type, Action listener) { + } + + public void RemoveEventListener(string type, Action listener, bool useCapture) { + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs new file mode 100644 index 000000000..84ce1c6f3 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs @@ -0,0 +1,35 @@ +// DBFactory.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBFactory { + + private DBFactory() { + } + + [ScriptName("cmp")] + public int Compare(object first, object last) { + return default(short); + } + + public DBOpenDBRequest DeleteDatabase(string name) { + return null; + } + + public DBOpenDBRequest Open(string name) { + return null; + } + + public DBOpenDBRequest Open(string name, long version) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs new file mode 100644 index 000000000..f26854ce5 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs @@ -0,0 +1,93 @@ +// DBIndex.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBIndex { + + private DBIndex() { + } + + [ScriptField] + public string KeyPath { + get { + return default(string); + } + } + + [ScriptField] + public bool MultiEntry { + get { + return default(bool); + } + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public DBObjectStore ObjectStore { + get { + return default(DBObjectStore); + } + } + + [ScriptField] + public bool Unique { + get { + return default(bool); + } + } + + public DBRequest Count() { + return null; + } + + public DBRequest Count(object key) { + return null; + } + + public DBRequest Get(object key) { + return null; + } + + public DBRequest GetKey(object key) { + return null; + } + + public DBRequest OpenCursor() { + return null; + } + + public DBRequest OpenCursor(object range) { + return null; + } + + public DBRequest OpenCursor(object range, string direction) { + return null; + } + + public DBRequest OpenKeyCursor() { + return null; + } + + public DBRequest OpenKeyCursor(object range) { + return null; + } + + public DBRequest OpenKeyCursor(object range, string direction) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs new file mode 100644 index 000000000..799c652ce --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs @@ -0,0 +1,34 @@ +// DBIndexParameters.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class DBIndexParameters { + + [ScriptField] + public bool MultiEntry { + get { + return false; + } + set { + } + } + + [ScriptField] + public bool Unique { + get { + return false; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs new file mode 100644 index 000000000..abca44cc5 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs @@ -0,0 +1,116 @@ +// DBObjectStore.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBObjectStore { + + private DBObjectStore() { + } + + [ScriptField] + public bool AutoIncremenent { + get { + return default(bool); + } + } + + [ScriptField] + public string[] IndexNames { + get { + return default(string[]); + } + } + + [ScriptField] + public string KeyPath { + get { + return default(string); + } + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public DBTransaction Transaction { + get { + return default(DBTransaction); + } + } + + public DBRequest Add(object value) { + return null; + } + + public DBRequest Add(object value, object key) { + return null; + } + + public DBRequest Clear() { + return null; + } + + public DBRequest Count() { + return null; + } + + public DBRequest Count(object key) { + return null; + } + + public DBIndex CreateIndex(string name, object keyPath) { + return default(DBIndex); + } + + public DBIndex CreateIndex(string name, object keyPath, DBIndexParameters optionalParameters) { + return default(DBIndex); + } + + public DBRequest Delete(object key) { + return null; + } + + public void DeleteIndex(string indexName) { + } + + public DBRequest Get(object key) { + return null; + } + + public DBIndex Index(string name) { + return default(DBIndex); + } + + public DBRequest OpenCursor() { + return null; + } + + public DBRequest OpenCursor(object range) { + return null; + } + + public DBRequest OpenCursor(object range, string direction) { + return null; + } + + public DBRequest Put(object value) { + return null; + } + + public DBRequest Put(object value, object key) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs new file mode 100644 index 000000000..5f5cb5259 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs @@ -0,0 +1,35 @@ +// DBObjectStoreParameters.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class DBObjectStoreParameters { + + [ScriptField] + public bool AutoIncrement { + get { + return false; + } + set { + } + } + + [ScriptField] + public string KeyPath { + get { + return null; + } + set { + } + } + } +} + diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs new file mode 100644 index 000000000..6adc6b78b --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs @@ -0,0 +1,46 @@ +// DBOpenDBRequest.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBOpenDBRequest : DBRequest { + + private DBOpenDBRequest() { + } + + [ScriptName("onblocked")] + [ScriptField] + public DBOpenDBRequestCallback OnBlocked { + get { + return null; + } + set { + } + } + + [ScriptName("onupgradeneeded")] + [ScriptField] + public DBOpenDBRequestVersionChangeCallback OnUpgradeNeeded { + get { + return null; + } + set { + } + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBOpenDBRequestCallback(DBEvent e); + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBOpenDBRequestVersionChangeCallback(DBVersionChangeEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs new file mode 100644 index 000000000..0743ee701 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs @@ -0,0 +1,77 @@ +// DBRequest.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBRequest : DBEventTarget { + + internal DBRequest() { + } + + [ScriptField] + public object Error { + get { + return null; + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBRequestCallback OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onsuccess")] + [ScriptField] + public DBRequestCallback OnSuccess { + get { + return null; + } + set { + } + } + + [ScriptField] + public string ReadyState { + get { + return null; + } + } + + [ScriptField] + public object Result { + get { + return null; + } + } + + [ScriptField] + public object Source { + get { + return null; + } + } + + [ScriptField] + public DBTransaction Transaction { + get { + return null; + } + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBRequestCallback(DBEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs new file mode 100644 index 000000000..5d393bcc6 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs @@ -0,0 +1,81 @@ +// DBTransaction.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBTransaction : DBEventTarget { + + private DBTransaction() { + } + + [ScriptField] + [ScriptName("db")] + public DBDatabase Database { + get { + return null; + } + } + + [ScriptField] + public object Error { + get { + return null; + } + } + + [ScriptField] + public string Mode { + get { + return null; + } + } + + [ScriptName("onabort")] + [ScriptField] + public DBTransactionCallback OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("oncomplete")] + [ScriptField] + public DBTransactionCallback OnComplete { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBTransactionCallback OnError { + get { + return null; + } + set { + } + } + + public void Abort() { + } + + public DBObjectStore ObjectStore(string name) { + return null; + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBTransactionCallback(DBEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs new file mode 100644 index 000000000..2ba7e578f --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs @@ -0,0 +1,32 @@ +// DBVersionChangeEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBVersionChangeEvent : DBEvent { + + private DBVersionChangeEvent() { + } + + [ScriptField] + public long NewVersion { + get { + return default(long); + } + } + + [ScriptField] + public long OldVersion { + get { + return default(long); + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/SqlDatabase.cs b/src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs similarity index 89% rename from src/Libraries/Web/Html/Data/SqlDatabase.cs rename to src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs index a0649cb5c..c5c57b276 100644 --- a/src/Libraries/Web/Html/Data/SqlDatabase.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs @@ -6,18 +6,16 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - public delegate bool SqlDatabaseCallback(SqlDatabase db); - - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlDatabase { private SqlDatabase() { } - [IntrinsicProperty] + [ScriptField] public string Version { get { return null; @@ -33,4 +31,6 @@ public void ReadTransaction(SqlTransactionCallback callback, SqlErrorCallback er public void Transaction(SqlTransactionCallback callback, SqlErrorCallback errorCallback, Action successCallback) { } } + + public delegate bool SqlDatabaseCallback(SqlDatabase db); } diff --git a/src/Libraries/Web/Html/Data/SqlError.cs b/src/Libraries/Web/Html/Data/Sql/SqlError.cs similarity index 81% rename from src/Libraries/Web/Html/Data/SqlError.cs rename to src/Libraries/Web/Html/Data/Sql/SqlError.cs index dc21ad409..88ecef06d 100644 --- a/src/Libraries/Web/Html/Data/SqlError.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlError.cs @@ -6,29 +6,29 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - public delegate bool SqlErrorCallback(SqlError error); - - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlError { private SqlError() { } - [IntrinsicProperty] + [ScriptField] public int Code { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string Message { get { return null; } } } + + public delegate bool SqlErrorCallback(SqlError error); } diff --git a/src/Libraries/Web/Html/Data/SqlResultSet.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs similarity index 80% rename from src/Libraries/Web/Html/Data/SqlResultSet.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs index 6af8a6cb3..c4e713c87 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSet.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs @@ -7,30 +7,30 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlResultSet { private SqlResultSet() { } - [IntrinsicProperty] + [ScriptField] public int InsertId { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public SqlResultSetRowList Rows { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int RowsAffected { get { return 0; diff --git a/src/Libraries/Web/Html/Data/SqlResultSetRow.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs similarity index 80% rename from src/Libraries/Web/Html/Data/SqlResultSetRow.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs index e88dde25b..dff90378c 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSetRow.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs @@ -7,16 +7,16 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlResultSetRow { private SqlResultSetRow() { } - [IntrinsicProperty] + [ScriptField] public object this[string name] { get { return null; diff --git a/src/Libraries/Web/Html/Data/SqlResultSetRowList.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs similarity index 83% rename from src/Libraries/Web/Html/Data/SqlResultSetRowList.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs index 3de885cea..017d4d11a 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSetRowList.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs @@ -7,16 +7,16 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlResultSetRowList { private SqlResultSetRowList() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; diff --git a/src/Libraries/Web/Html/Data/SqlTransaction.cs b/src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs similarity index 89% rename from src/Libraries/Web/Html/Data/SqlTransaction.cs rename to src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs index 38168fd6d..ebbb66240 100644 --- a/src/Libraries/Web/Html/Data/SqlTransaction.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs @@ -6,16 +6,10 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { +namespace System.Html.Data.Sql { - public delegate bool SqlTransactionCallback(SqlTransaction transaction); - - public delegate bool SqlStatementCallback(SqlTransaction transaction, SqlResultSet resultSet); - - public delegate bool SqlStatementErrorCallback(SqlTransaction transaction, SqlError error); - - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SqlTransaction { private SqlTransaction() { @@ -24,4 +18,10 @@ private SqlTransaction() { public void ExecuteSql(string sql, object[] arguments, SqlStatementCallback callback, SqlStatementErrorCallback errorCallback) { } } + + public delegate bool SqlTransactionCallback(SqlTransaction transaction); + + public delegate bool SqlStatementCallback(SqlTransaction transaction, SqlResultSet resultSet); + + public delegate bool SqlStatementErrorCallback(SqlTransaction transaction, SqlError error); } diff --git a/src/Libraries/Web/Html/Data/Storage.cs b/src/Libraries/Web/Html/Data/Storage.cs index 77b7b5bd0..ed4af7d0b 100644 --- a/src/Libraries/Web/Html/Data/Storage.cs +++ b/src/Libraries/Web/Html/Data/Storage.cs @@ -8,21 +8,21 @@ namespace System.Html.Data { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Storage { private Storage() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public object this[string key] { get { return null; diff --git a/src/Libraries/Web/Html/DataFormat.cs b/src/Libraries/Web/Html/DataFormat.cs index bca0e55d9..28e0fe8a1 100644 --- a/src/Libraries/Web/Html/DataFormat.cs +++ b/src/Libraries/Web/Html/DataFormat.cs @@ -8,9 +8,9 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum DataFormat { Text = 0, diff --git a/src/Libraries/Web/Html/DataTransfer.cs b/src/Libraries/Web/Html/DataTransfer.cs index a7368b552..ffe60cbd7 100644 --- a/src/Libraries/Web/Html/DataTransfer.cs +++ b/src/Libraries/Web/Html/DataTransfer.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DataTransfer { private DataTransfer() { } - [IntrinsicProperty] + [ScriptField] public DropEffect DropEffect { get { return DropEffect.None; @@ -24,7 +24,7 @@ public DropEffect DropEffect { } } - [IntrinsicProperty] + [ScriptField] public DropEffects EffectAllowed { get { return DropEffects.None; diff --git a/src/Libraries/Web/Html/DivElement.cs b/src/Libraries/Web/Html/DivElement.cs index dff49f26d..847842af8 100644 --- a/src/Libraries/Web/Html/DivElement.cs +++ b/src/Libraries/Web/Html/DivElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DivElement : Element { private DivElement() { } - [IntrinsicProperty] + [ScriptField] public string Align { get { return null; @@ -24,7 +24,7 @@ public string Align { } } - [IntrinsicProperty] + [ScriptField] public bool NoWrap { get { return false; diff --git a/src/Libraries/Web/Html/Document.cs b/src/Libraries/Web/Html/Document.cs index 81c274ae3..957266017 100644 --- a/src/Libraries/Web/Html/Document.cs +++ b/src/Libraries/Web/Html/Document.cs @@ -5,30 +5,31 @@ using System; using System.Runtime.CompilerServices; +using System.Html.StyleSheets; using System.Html.Editing; namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("document")] public static class Document { - [IntrinsicProperty] + [ScriptField] public static Element ActiveElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Element Body { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static string Cookie { get { return null; @@ -37,21 +38,21 @@ public static string Cookie { } } - [IntrinsicProperty] + [ScriptField] public static string Doctype { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Element DocumentElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static string DesignMode { get { return null; @@ -60,7 +61,7 @@ public static string DesignMode { } } - [IntrinsicProperty] + [ScriptField] public static string Domain { get { return null; @@ -69,42 +70,49 @@ public static string Domain { } } - [IntrinsicProperty] + [ScriptField] public static DocumentImplementation Implementation { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance ParentWindow { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static string ReadyState { get { return null; } } - - [IntrinsicProperty] + + [ScriptField] public static string Referrer { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Selection Selection { get { return null; } } - [IntrinsicProperty] + [ScriptField] + public static StyleSheetList StyleSheets { + get { + return null; + } + } + + [ScriptField] public static string Title { get { return null; @@ -113,7 +121,7 @@ public static string Title { } } - [IntrinsicProperty] + [ScriptField] public static string URL { get { return null; @@ -140,18 +148,53 @@ public static void AddEventListener(string eventName, ElementEventListener liste public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Creates an Attr of the given name. Note that the Attr instance can then be set on an + /// Element using the setAttributeNode method. To create an attribute with a qualified name + /// and namespace URI, use the CreateAttributeNS method. + /// + /// The name of the attribute. + /// A new Attr object with the nodeName attribute set to name, and localName, prefix, + /// and namespaceURI set to null. The value of the attribute is the empty string. public static ElementAttribute CreateAttribute(string name) { return null; } + /// + /// Creates an attribute of the given qualified name and namespace URI. + /// + /// The namespace URI of the attribute to create. + /// The qualified name of the attribute to instantiate. + /// A new Attr object with the given namespace and qualified name. + public static ElementAttribute CreateAttributeNS(string namespaceURI, string qualifiedName) { + return null; + } + public static DocumentFragment CreateDocumentFragment() { return null; } + /// + /// Creates an element of the type specified. + /// To create an element with a qualified name and namespace URI, use the CreateElementNS method. + /// + /// The name of the element type to instantiate. + /// A new Element object with the nodeName attribute set to tagName, and localName, + /// prefix, and namespaceURI set to null. public static Element CreateElement(string tagName) { return null; } + /// + /// Creates an element of the given qualified name and namespace URI. + /// + /// The namespace URI of the element to create. + /// The qualified name of the element type to instantiate. + /// A new Element object with the given namespace and qualified name. + public static Element CreateElementNS(string namespaceURI, string qualifiedName) { + return null; + } + public static MutableEvent CreateEvent(string eventType) { return null; } @@ -160,6 +203,10 @@ public static Element CreateTextNode(string data) { return null; } + public static Element ImportNode(Element imporedNode, bool deep) { + return null; + } + public static void DetachEvent(string eventName, ElementEventHandler handler) { } @@ -198,6 +245,16 @@ public static ElementCollection GetElementsByTagName(string tagName) { return null; } + /// + /// Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. + /// + /// The namespace URI of the elements to match on. The special value "*" matches all namespaces. + /// The local name of the elements to match on. The special value "*" matches all local names. + /// A new NodeList object containing all the matched Elements. + public static ElementCollection GetElementsByTagNameNS(string namespaceURI, string localName) { + return null; + } + public static bool HasFocus() { return false; } diff --git a/src/Libraries/Web/Html/DocumentFragment.cs b/src/Libraries/Web/Html/DocumentFragment.cs index 585dbc8d0..cdb5d7543 100644 --- a/src/Libraries/Web/Html/DocumentFragment.cs +++ b/src/Libraries/Web/Html/DocumentFragment.cs @@ -8,84 +8,84 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class DocumentFragment { protected internal DocumentFragment() { } - [IntrinsicProperty] + [ScriptField] public ElementAttributeCollection Attributes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection ChildNodes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element FirstChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element LastChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element NextSibling { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string NodeName { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int NodeType { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string NodeValue { get { return null; } } - [IntrinsicProperty] + [ScriptField] public DocumentInstance OwnerDocument { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element ParentNode { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element PreviousSibling { get { return null; diff --git a/src/Libraries/Web/Html/DocumentImplementation.cs b/src/Libraries/Web/Html/DocumentImplementation.cs index f89c15abe..cadcca39d 100644 --- a/src/Libraries/Web/Html/DocumentImplementation.cs +++ b/src/Libraries/Web/Html/DocumentImplementation.cs @@ -8,8 +8,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DocumentImplementation { internal DocumentImplementation() { diff --git a/src/Libraries/Web/Html/DocumentInstance.cs b/src/Libraries/Web/Html/DocumentInstance.cs index 2feab949f..3ad21d3b9 100644 --- a/src/Libraries/Web/Html/DocumentInstance.cs +++ b/src/Libraries/Web/Html/DocumentInstance.cs @@ -9,28 +9,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class DocumentInstance { private DocumentInstance() { } - [IntrinsicProperty] + [ScriptField] public Element ActiveElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element Body { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Cookie { get { return null; @@ -39,7 +39,7 @@ public string Cookie { } } - [IntrinsicProperty] + [ScriptField] public string DesignMode { get { return null; @@ -48,21 +48,21 @@ public string DesignMode { } } - [IntrinsicProperty] + [ScriptField] public string Doctype { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element DocumentElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Domain { get { return null; @@ -71,42 +71,42 @@ public string Domain { } } - [IntrinsicProperty] + [ScriptField] public DocumentImplementation Implementation { get { return null; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance ParentWindow { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string ReadyState { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Referrer { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Selection Selection { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Title { get { return null; @@ -115,7 +115,7 @@ public string Title { } } - [IntrinsicProperty] + [ScriptField] public string URL { get { return null; diff --git a/src/Libraries/Web/Html/DropEffect.cs b/src/Libraries/Web/Html/DropEffect.cs index 0f1ea9e94..a17be3152 100644 --- a/src/Libraries/Web/Html/DropEffect.cs +++ b/src/Libraries/Web/Html/DropEffect.cs @@ -8,9 +8,9 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum DropEffect { Copy = 0, diff --git a/src/Libraries/Web/Html/DropEffects.cs b/src/Libraries/Web/Html/DropEffects.cs index a75b4ed09..7e2e44643 100644 --- a/src/Libraries/Web/Html/DropEffects.cs +++ b/src/Libraries/Web/Html/DropEffects.cs @@ -8,9 +8,9 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum DropEffects { Copy = 0, diff --git a/src/Libraries/Web/Html/Editing/ControlRange.cs b/src/Libraries/Web/Html/Editing/ControlRange.cs index 50418f934..fcf0f2585 100644 --- a/src/Libraries/Web/Html/Editing/ControlRange.cs +++ b/src/Libraries/Web/Html/Editing/ControlRange.cs @@ -9,21 +9,21 @@ namespace System.Html.Editing { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ControlRange : Range { private ControlRange() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Element this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/Editing/Range.cs b/src/Libraries/Web/Html/Editing/Range.cs index 8db1c2504..9f9ac2fd9 100644 --- a/src/Libraries/Web/Html/Editing/Range.cs +++ b/src/Libraries/Web/Html/Editing/Range.cs @@ -8,8 +8,8 @@ namespace System.Html.Editing { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public abstract class Range { internal Range() { diff --git a/src/Libraries/Web/Html/Editing/Selection.cs b/src/Libraries/Web/Html/Editing/Selection.cs index d21483a97..78b8c1b2f 100644 --- a/src/Libraries/Web/Html/Editing/Selection.cs +++ b/src/Libraries/Web/Html/Editing/Selection.cs @@ -13,14 +13,14 @@ namespace System.Html.Editing { /// Represents the active selection, which is a highlighted block of text, and/or other elements in the document on which a user or a script /// can carry out some action. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Selection { private Selection() { } - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; diff --git a/src/Libraries/Web/Html/Editing/TextRange.cs b/src/Libraries/Web/Html/Editing/TextRange.cs index 908843e82..b527a44d7 100644 --- a/src/Libraries/Web/Html/Editing/TextRange.cs +++ b/src/Libraries/Web/Html/Editing/TextRange.cs @@ -9,63 +9,63 @@ namespace System.Html.Editing { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TextRange : Range { private TextRange() { } - [IntrinsicProperty] + [ScriptField] public int BoundingHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int BoundingLeft { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int BoundingTop { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int BoundingWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string HTMLText { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int OffsetLeft { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int OffsetTop { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string Text { get { return null; diff --git a/src/Libraries/Web/Html/Element.cs b/src/Libraries/Web/Html/Element.cs index 953721916..e1379a913 100644 --- a/src/Libraries/Web/Html/Element.cs +++ b/src/Libraries/Web/Html/Element.cs @@ -9,15 +9,15 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public class Element { protected internal Element() { } - [IntrinsicProperty] + [ScriptField] public string AccessKey { get { return null; @@ -26,28 +26,28 @@ public string AccessKey { } } - [IntrinsicProperty] + [ScriptField] public ElementAttributeCollection Attributes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection ChildNodes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection Children { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string ClassName { get { return null; @@ -56,49 +56,49 @@ public string ClassName { } } - [IntrinsicProperty] + [ScriptField] public TokenList ClassList { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int ClientHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ClientLeft { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ClientTop { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ClientWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Style CurrentStyle { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Dir { get { return null; @@ -108,7 +108,7 @@ public string Dir { } // TODO: Is this on Element or just some types of elements? - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -117,21 +117,21 @@ public bool Disabled { } } - [IntrinsicProperty] + [ScriptField] public VisualFilterCollection Filters { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element FirstChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string ID { get { return null; @@ -140,7 +140,7 @@ public string ID { } } - [IntrinsicProperty] + [ScriptField] public string InnerHTML { get { return null; @@ -149,7 +149,7 @@ public string InnerHTML { } } - [IntrinsicProperty] + [ScriptField] public string InnerText { get { return null; @@ -158,112 +158,112 @@ public string InnerText { } } - [IntrinsicProperty] + [ScriptField] public Element LastChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element NextSibling { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string NodeName { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementType NodeType { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string NodeValue { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int OffsetHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int OffsetLeft { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Element OffsetParent { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int OffsetTop { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int OffsetWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public DocumentInstance OwnerDocument { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element ParentNode { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element PreviousSibling { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Style RuntimeStyle { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int ScrollHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ScrollLeft { get { return 0; @@ -272,7 +272,7 @@ public int ScrollLeft { } } - [IntrinsicProperty] + [ScriptField] public int ScrollTop { get { return 0; @@ -281,21 +281,21 @@ public int ScrollTop { } } - [IntrinsicProperty] + [ScriptField] public int ScrollWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Style Style { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int TabIndex { get { return 0; @@ -304,14 +304,14 @@ public int TabIndex { } } - [IntrinsicProperty] + [ScriptField] public string TagName { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string TextContent { get { return null; @@ -320,7 +320,7 @@ public string TextContent { } } - [IntrinsicProperty] + [ScriptField] public string Title { get { return null; diff --git a/src/Libraries/Web/Html/ElementAttribute.cs b/src/Libraries/Web/Html/ElementAttribute.cs index 25ebd979b..b0d8ad748 100644 --- a/src/Libraries/Web/Html/ElementAttribute.cs +++ b/src/Libraries/Web/Html/ElementAttribute.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ElementAttribute { internal ElementAttribute() { } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool Specified { get { return false; } } - [IntrinsicProperty] + [ScriptField] public string Value { get { return null; diff --git a/src/Libraries/Web/Html/ElementAttributeCollection.cs b/src/Libraries/Web/Html/ElementAttributeCollection.cs index e9d05d024..eb44bc18e 100644 --- a/src/Libraries/Web/Html/ElementAttributeCollection.cs +++ b/src/Libraries/Web/Html/ElementAttributeCollection.cs @@ -8,20 +8,27 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ElementAttributeCollection { internal ElementAttributeCollection() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } + [ScriptField] + public ElementAttribute this[int index] { + get { + return null; + } + } + public ElementAttribute GetNamedItem(string name) { return null; } diff --git a/src/Libraries/Web/Html/ElementAttributeName.cs b/src/Libraries/Web/Html/ElementAttributeName.cs index a5fc87c76..9cbc891ca 100644 --- a/src/Libraries/Web/Html/ElementAttributeName.cs +++ b/src/Libraries/Web/Html/ElementAttributeName.cs @@ -10,9 +10,9 @@ namespace System.Html { // TODO: Complete this enumeration - [IgnoreNamespace] - [NamedValues] - [Imported] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + [ScriptImport] public enum ElementAttributeName { Autocomplete = 0, diff --git a/src/Libraries/Web/Html/ElementCollection.cs b/src/Libraries/Web/Html/ElementCollection.cs index 9f3c5f176..c9c4cf189 100644 --- a/src/Libraries/Web/Html/ElementCollection.cs +++ b/src/Libraries/Web/Html/ElementCollection.cs @@ -8,21 +8,21 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ElementCollection { internal ElementCollection() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Element this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/ElementEvent.cs b/src/Libraries/Web/Html/ElementEvent.cs index b66d9dfa3..71bcf9384 100644 --- a/src/Libraries/Web/Html/ElementEvent.cs +++ b/src/Libraries/Web/Html/ElementEvent.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class ElementEvent { internal ElementEvent() { } - [IntrinsicProperty] + [ScriptField] public bool AltKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public int Button { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public bool CancelBubble { get { return false; @@ -38,70 +38,98 @@ public bool CancelBubble { } } - [IntrinsicProperty] + [ScriptField] + public int ClientX { + get { + return 0; + } + } + + [ScriptField] + public int ClientY { + get { + return 0; + } + } + + [ScriptField] public bool CtrlKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public Element CurrentTarget { get { return null; } } - [IntrinsicProperty] + [ScriptField] public DataTransfer DataTransfer { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Detail { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element FromElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int KeyCode { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public bool MetaKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public int OffsetX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int OffsetY { get { return 0; } } - [IntrinsicProperty] + [ScriptField] + public int PageX { + get { + return 0; + } + } + + [ScriptField] + public int PageY { + get { + return 0; + } + } + + [ScriptField] public bool ReturnValue { get { return false; @@ -110,42 +138,56 @@ public bool ReturnValue { } } - [IntrinsicProperty] + [ScriptField] + public int ScreenX { + get { + return 0; + } + } + + [ScriptField] + public int ScreenY { + get { + return 0; + } + } + + [ScriptField] public bool ShiftKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public Element SrcElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element Target { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Date TimeStamp { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element ToElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; diff --git a/src/Libraries/Web/Html/ElementEventHandler.cs b/src/Libraries/Web/Html/ElementEventHandler.cs index 8e0b12898..1a4b78bd8 100644 --- a/src/Libraries/Web/Html/ElementEventHandler.cs +++ b/src/Libraries/Web/Html/ElementEventHandler.cs @@ -8,7 +8,7 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ElementEventHandler(); } diff --git a/src/Libraries/Web/Html/ElementEventListener.cs b/src/Libraries/Web/Html/ElementEventListener.cs index a3fcbc22e..ca464e677 100644 --- a/src/Libraries/Web/Html/ElementEventListener.cs +++ b/src/Libraries/Web/Html/ElementEventListener.cs @@ -8,7 +8,7 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ElementEventListener(ElementEvent e); } diff --git a/src/Libraries/Web/Html/ElementType.cs b/src/Libraries/Web/Html/ElementType.cs index d887f8077..6b4f78677 100644 --- a/src/Libraries/Web/Html/ElementType.cs +++ b/src/Libraries/Web/Html/ElementType.cs @@ -8,9 +8,9 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum ElementType { Element = 1, diff --git a/src/Libraries/Web/Html/ErrorHandler.cs b/src/Libraries/Web/Html/ErrorHandler.cs index dd223e9ae..45f920b65 100644 --- a/src/Libraries/Web/Html/ErrorHandler.cs +++ b/src/Libraries/Web/Html/ErrorHandler.cs @@ -15,7 +15,7 @@ namespace System.Html { /// The URL of the script where the error occurred. /// The line number where the error occurred. /// true if the error was handled; false otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ErrorHandler(string message, string url, int line); } diff --git a/src/Libraries/Web/Html/FileInputElement.cs b/src/Libraries/Web/Html/FileInputElement.cs new file mode 100644 index 000000000..9ae1a4b1a --- /dev/null +++ b/src/Libraries/Web/Html/FileInputElement.cs @@ -0,0 +1,25 @@ +// FileInputElement.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Html.Data.Files; +using System.Runtime.CompilerServices; + +namespace System.Html { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileInputElement : InputElement { + + private FileInputElement() { + } + + [ScriptField] + public FileList Files { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/FormElement.cs b/src/Libraries/Web/Html/FormElement.cs index ad484637b..3b75d555e 100644 --- a/src/Libraries/Web/Html/FormElement.cs +++ b/src/Libraries/Web/Html/FormElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class FormElement : Element { internal FormElement() { } - [IntrinsicProperty] + [ScriptField] public string AcceptCharset { get { return null; @@ -24,7 +24,7 @@ public string AcceptCharset { } } - [IntrinsicProperty] + [ScriptField] public string Action { get { return null; @@ -33,7 +33,7 @@ public string Action { } } - [IntrinsicProperty] + [ScriptField] public Element[] Elements { get { return null; @@ -42,7 +42,7 @@ public Element[] Elements { } } - [IntrinsicProperty] + [ScriptField] public string EncType { get { return null; @@ -51,7 +51,7 @@ public string EncType { } } - [IntrinsicProperty] + [ScriptField] public string Encoding { get { return null; @@ -60,14 +60,14 @@ public string Encoding { } } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; @@ -76,7 +76,7 @@ public string Name { } } - [IntrinsicProperty] + [ScriptField] public string Method { get { return null; @@ -85,7 +85,7 @@ public string Method { } } - [IntrinsicProperty] + [ScriptField] public string Target { get { return null; diff --git a/src/Libraries/Web/Html/GestureEvent.cs b/src/Libraries/Web/Html/GestureEvent.cs index 0371e6525..77aa6ce0e 100644 --- a/src/Libraries/Web/Html/GestureEvent.cs +++ b/src/Libraries/Web/Html/GestureEvent.cs @@ -8,21 +8,21 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class GestureEvent : ElementEvent { internal GestureEvent() { } - [IntrinsicProperty] + [ScriptField] public double Rotation { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public double Scale { get { return 0; diff --git a/src/Libraries/Web/Html/History.cs b/src/Libraries/Web/Html/History.cs index 610c8d61b..f03439d32 100644 --- a/src/Libraries/Web/Html/History.cs +++ b/src/Libraries/Web/Html/History.cs @@ -8,8 +8,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class History { private History() { @@ -18,7 +18,7 @@ private History() { /// /// Retrieves the number of elements in the history list. /// - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; @@ -28,7 +28,7 @@ public int Length { /// /// Retrieves the current state object. /// - [IntrinsicProperty] + [ScriptField] public object State { get { return null; diff --git a/src/Libraries/Web/Html/IFrameElement.cs b/src/Libraries/Web/Html/IFrameElement.cs index 9d7ed4a78..0d1665399 100644 --- a/src/Libraries/Web/Html/IFrameElement.cs +++ b/src/Libraries/Web/Html/IFrameElement.cs @@ -8,21 +8,21 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class IFrameElement : Element { private IFrameElement() { } - [IntrinsicProperty] + [ScriptField] public WindowInstance ContentWindow { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string FrameBorder { get { return null; @@ -31,7 +31,7 @@ public string FrameBorder { } } - [IntrinsicProperty] + [ScriptField] public string Scrolling { get { return null; @@ -40,7 +40,7 @@ public string Scrolling { } } - [IntrinsicProperty] + [ScriptField] public string Src { get { return null; diff --git a/src/Libraries/Web/Html/ImageElement.cs b/src/Libraries/Web/Html/ImageElement.cs index 822996d46..3e46da8e7 100644 --- a/src/Libraries/Web/Html/ImageElement.cs +++ b/src/Libraries/Web/Html/ImageElement.cs @@ -8,8 +8,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Image")] public sealed class ImageElement : Element { @@ -22,7 +22,7 @@ public ImageElement(int width) { public ImageElement(int width, int height) { } - [IntrinsicProperty] + [ScriptField] public string Alt { get { return null; @@ -31,14 +31,14 @@ public string Alt { } } - [IntrinsicProperty] + [ScriptField] public bool Complete { get { return false; } } - [IntrinsicProperty] + [ScriptField] public string Src { get { return null; @@ -47,7 +47,7 @@ public string Src { } } - [IntrinsicProperty] + [ScriptField] public int Height { get { return 0; @@ -56,7 +56,7 @@ public int Height { } } - [IntrinsicProperty] + [ScriptField] public int NaturalHeight { get { return 0; @@ -65,7 +65,7 @@ public int NaturalHeight { } } - [IntrinsicProperty] + [ScriptField] public int NaturalWidth { get { return 0; @@ -74,7 +74,7 @@ public int NaturalWidth { } } - [IntrinsicProperty] + [ScriptField] public int Width { get { return 0; diff --git a/src/Libraries/Web/Html/InputElement.cs b/src/Libraries/Web/Html/InputElement.cs index b221dd9e2..a7574e233 100644 --- a/src/Libraries/Web/Html/InputElement.cs +++ b/src/Libraries/Web/Html/InputElement.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class InputElement : Element { protected internal InputElement() { } - [IntrinsicProperty] + [ScriptField] public string DefaultValue { get { return null; } } - [IntrinsicProperty] + [ScriptField] public FormElement Form { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; @@ -38,7 +38,7 @@ public string Name { } } - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; @@ -47,7 +47,7 @@ public string Type { } } - [IntrinsicProperty] + [ScriptField] public string Value { get { return null; diff --git a/src/Libraries/Web/Html/LinkElement.cs b/src/Libraries/Web/Html/LinkElement.cs new file mode 100644 index 000000000..8f6d20d75 --- /dev/null +++ b/src/Libraries/Web/Html/LinkElement.cs @@ -0,0 +1,45 @@ +// LinkElement.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class LinkElement : Element { + + private LinkElement() { + } + + [ScriptField] + public string Href { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Media { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Rel { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/Location.cs b/src/Libraries/Web/Html/Location.cs index da007c77b..1b2060109 100644 --- a/src/Libraries/Web/Html/Location.cs +++ b/src/Libraries/Web/Html/Location.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Location { private Location() { } - [IntrinsicProperty] + [ScriptField] public string Hash { get { return null; @@ -24,14 +24,14 @@ public string Hash { } } - [IntrinsicProperty] + [ScriptField] public string Hostname { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("host")] public string HostnameAndPort { get { @@ -39,7 +39,7 @@ public string HostnameAndPort { } } - [IntrinsicProperty] + [ScriptField] public string Href { get { return null; @@ -48,28 +48,28 @@ public string Href { } } - [IntrinsicProperty] + [ScriptField] public string Pathname { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Port { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Protocol { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Search { get { return null; diff --git a/src/Libraries/Web/Html/MapElement.cs b/src/Libraries/Web/Html/MapElement.cs index 7033a3e2c..02ed5abe5 100644 --- a/src/Libraries/Web/Html/MapElement.cs +++ b/src/Libraries/Web/Html/MapElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class MapElement : Element { private MapElement() { } - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; diff --git a/src/Libraries/Web/Html/Media/Filters/VisualFilter.cs b/src/Libraries/Web/Html/Media/Filters/VisualFilter.cs index bd2e9d4b6..a9f4031ae 100644 --- a/src/Libraries/Web/Html/Media/Filters/VisualFilter.cs +++ b/src/Libraries/Web/Html/Media/Filters/VisualFilter.cs @@ -8,14 +8,14 @@ namespace System.Html.Media.Filters { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class VisualFilter { internal VisualFilter() { } - [IntrinsicProperty] + [ScriptField] public bool Enabled { get { return false; diff --git a/src/Libraries/Web/Html/Media/Filters/VisualFilterCollection.cs b/src/Libraries/Web/Html/Media/Filters/VisualFilterCollection.cs index 15f3daa4c..7069e2453 100644 --- a/src/Libraries/Web/Html/Media/Filters/VisualFilterCollection.cs +++ b/src/Libraries/Web/Html/Media/Filters/VisualFilterCollection.cs @@ -8,21 +8,21 @@ namespace System.Html.Media.Filters { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class VisualFilterCollection { private VisualFilterCollection() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public VisualFilter this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/Media/Filters/VisualTransition.cs b/src/Libraries/Web/Html/Media/Filters/VisualTransition.cs index b61b17f38..24f63e53c 100644 --- a/src/Libraries/Web/Html/Media/Filters/VisualTransition.cs +++ b/src/Libraries/Web/Html/Media/Filters/VisualTransition.cs @@ -8,14 +8,14 @@ namespace System.Html.Media.Filters { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class VisualTransition : VisualFilter { private VisualTransition() { } - [IntrinsicProperty] + [ScriptField] public double Duration { get { return 0f; @@ -24,14 +24,14 @@ public double Duration { } } - [IntrinsicProperty] + [ScriptField] public int Percent { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public VisualTransitionState Status { get { return VisualTransitionState.Stopped; diff --git a/src/Libraries/Web/Html/Media/Filters/VisualTransitionState.cs b/src/Libraries/Web/Html/Media/Filters/VisualTransitionState.cs index b6b854d33..8f6530324 100644 --- a/src/Libraries/Web/Html/Media/Filters/VisualTransitionState.cs +++ b/src/Libraries/Web/Html/Media/Filters/VisualTransitionState.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Filters { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum VisualTransitionState { Stopped = 0, diff --git a/src/Libraries/Web/Html/Media/Graphics/CanvasContext.cs b/src/Libraries/Web/Html/Media/Graphics/CanvasContext.cs index a53d7515c..6d2a042c9 100644 --- a/src/Libraries/Web/Html/Media/Graphics/CanvasContext.cs +++ b/src/Libraries/Web/Html/Media/Graphics/CanvasContext.cs @@ -8,8 +8,8 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public abstract class CanvasContext { internal CanvasContext() { diff --git a/src/Libraries/Web/Html/Media/Graphics/CanvasContext2D.cs b/src/Libraries/Web/Html/Media/Graphics/CanvasContext2D.cs index 9914ca8aa..4c3343a59 100644 --- a/src/Libraries/Web/Html/Media/Graphics/CanvasContext2D.cs +++ b/src/Libraries/Web/Html/Media/Graphics/CanvasContext2D.cs @@ -9,100 +9,100 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class CanvasContext2D : CanvasContext { private CanvasContext2D() { } [ScriptName("globalAlpha")] - [IntrinsicProperty] + [ScriptField] public double Alpha { get; set; } [ScriptName("globalCompositeOperation")] - [IntrinsicProperty] + [ScriptField] public CompositeOperation CompositeOperation { get; set; } - [IntrinsicProperty] + [ScriptField] public object FillStyle { get; set; } - [IntrinsicProperty] + [ScriptField] public string Font { get; set; } - [IntrinsicProperty] + [ScriptField] public LineCap LineCap { get; set; } - [IntrinsicProperty] + [ScriptField] public LineJoin LineJoin { get; set; } - [IntrinsicProperty] + [ScriptField] public double LineWidth { get; set; } - [IntrinsicProperty] + [ScriptField] public int MiterLimit { get; set; } - [IntrinsicProperty] + [ScriptField] public double ShadowBlur { get; set; } - [IntrinsicProperty] + [ScriptField] public string ShadowColor { get; set; } - [IntrinsicProperty] + [ScriptField] public double ShadowOffsetX { get; set; } - [IntrinsicProperty] + [ScriptField] public double ShadowOffsetY { get; set; } - [IntrinsicProperty] + [ScriptField] public object StrokeStyle { get; set; } - [IntrinsicProperty] + [ScriptField] public TextAlign TextAlign { get; set; } - [IntrinsicProperty] + [ScriptField] public TextBaseline TextBaseline { get; set; diff --git a/src/Libraries/Web/Html/Media/Graphics/CompositeOperation.cs b/src/Libraries/Web/Html/Media/Graphics/CompositeOperation.cs index 4f1de8ae9..a60e2e08f 100644 --- a/src/Libraries/Web/Html/Media/Graphics/CompositeOperation.cs +++ b/src/Libraries/Web/Html/Media/Graphics/CompositeOperation.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum CompositeOperation { /// diff --git a/src/Libraries/Web/Html/Media/Graphics/Gradient.cs b/src/Libraries/Web/Html/Media/Graphics/Gradient.cs index f8c174900..51150f274 100644 --- a/src/Libraries/Web/Html/Media/Graphics/Gradient.cs +++ b/src/Libraries/Web/Html/Media/Graphics/Gradient.cs @@ -8,8 +8,8 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Gradient { private Gradient() { diff --git a/src/Libraries/Web/Html/Media/Graphics/ImageData.cs b/src/Libraries/Web/Html/Media/Graphics/ImageData.cs index a91f1d8ee..df6570ea4 100644 --- a/src/Libraries/Web/Html/Media/Graphics/ImageData.cs +++ b/src/Libraries/Web/Html/Media/Graphics/ImageData.cs @@ -8,28 +8,28 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ImageData { private ImageData() { } - [IntrinsicProperty] + [ScriptField] public PixelArray Data { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int Height { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int Width { get { return 0; diff --git a/src/Libraries/Web/Html/Media/Graphics/LineCap.cs b/src/Libraries/Web/Html/Media/Graphics/LineCap.cs index 03c866bed..b1be52279 100644 --- a/src/Libraries/Web/Html/Media/Graphics/LineCap.cs +++ b/src/Libraries/Web/Html/Media/Graphics/LineCap.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum LineCap { Butt = 0, diff --git a/src/Libraries/Web/Html/Media/Graphics/LineJoin.cs b/src/Libraries/Web/Html/Media/Graphics/LineJoin.cs index 93957508e..3dcf78ae2 100644 --- a/src/Libraries/Web/Html/Media/Graphics/LineJoin.cs +++ b/src/Libraries/Web/Html/Media/Graphics/LineJoin.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum LineJoin { Miter = 0, diff --git a/src/Libraries/Web/Html/Media/Graphics/Pattern.cs b/src/Libraries/Web/Html/Media/Graphics/Pattern.cs index 39b7dce78..4a0c30561 100644 --- a/src/Libraries/Web/Html/Media/Graphics/Pattern.cs +++ b/src/Libraries/Web/Html/Media/Graphics/Pattern.cs @@ -8,8 +8,8 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Pattern { private Pattern() { diff --git a/src/Libraries/Web/Html/Media/Graphics/PixelArray.cs b/src/Libraries/Web/Html/Media/Graphics/PixelArray.cs index e03ea812b..6d0250ab5 100644 --- a/src/Libraries/Web/Html/Media/Graphics/PixelArray.cs +++ b/src/Libraries/Web/Html/Media/Graphics/PixelArray.cs @@ -8,21 +8,21 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class PixelArray { private PixelArray() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public object this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/Media/Graphics/Rendering.cs b/src/Libraries/Web/Html/Media/Graphics/Rendering.cs index bc1335223..42fc5fc02 100644 --- a/src/Libraries/Web/Html/Media/Graphics/Rendering.cs +++ b/src/Libraries/Web/Html/Media/Graphics/Rendering.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum Rendering { [ScriptName("2d")] diff --git a/src/Libraries/Web/Html/Media/Graphics/TextAlign.cs b/src/Libraries/Web/Html/Media/Graphics/TextAlign.cs index ebdaf9af2..dcf31e7cc 100644 --- a/src/Libraries/Web/Html/Media/Graphics/TextAlign.cs +++ b/src/Libraries/Web/Html/Media/Graphics/TextAlign.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum TextAlign { Start = 0, diff --git a/src/Libraries/Web/Html/Media/Graphics/TextBaseline.cs b/src/Libraries/Web/Html/Media/Graphics/TextBaseline.cs index ac4b583ba..e3f7bec42 100644 --- a/src/Libraries/Web/Html/Media/Graphics/TextBaseline.cs +++ b/src/Libraries/Web/Html/Media/Graphics/TextBaseline.cs @@ -8,9 +8,9 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum TextBaseline { Top = 0, diff --git a/src/Libraries/Web/Html/Media/Graphics/TextMetrics.cs b/src/Libraries/Web/Html/Media/Graphics/TextMetrics.cs index 8123960e0..a5dbf087d 100644 --- a/src/Libraries/Web/Html/Media/Graphics/TextMetrics.cs +++ b/src/Libraries/Web/Html/Media/Graphics/TextMetrics.cs @@ -8,14 +8,14 @@ namespace System.Html.Media.Graphics { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TextMetrics { private TextMetrics() { } - [IntrinsicProperty] + [ScriptField] public double Width { get { return 0f; diff --git a/src/Libraries/Web/Html/messageevent.cs b/src/Libraries/Web/Html/MessageEvent.cs similarity index 84% rename from src/Libraries/Web/Html/messageevent.cs rename to src/Libraries/Web/Html/MessageEvent.cs index afdec00cf..7dc6aa371 100644 --- a/src/Libraries/Web/Html/messageevent.cs +++ b/src/Libraries/Web/Html/MessageEvent.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class MessageEvent : ElementEvent { internal MessageEvent() { } - [IntrinsicProperty] + [ScriptField] public string Data { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Origin { get { return null; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance Source { get { return null; diff --git a/src/Libraries/Web/Html/MutableEvent.cs b/src/Libraries/Web/Html/MutableEvent.cs index 79f54607a..b565a0eec 100644 --- a/src/Libraries/Web/Html/MutableEvent.cs +++ b/src/Libraries/Web/Html/MutableEvent.cs @@ -8,8 +8,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class MutableEvent { internal MutableEvent() { diff --git a/src/Libraries/Web/Html/Navigator.cs b/src/Libraries/Web/Html/Navigator.cs index 6ba1c6294..0d9fa0b23 100644 --- a/src/Libraries/Web/Html/Navigator.cs +++ b/src/Libraries/Web/Html/Navigator.cs @@ -9,8 +9,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Navigator { private Navigator() { @@ -19,7 +19,7 @@ private Navigator() { /// /// Returns the name of the browser. /// - [IntrinsicProperty] + [ScriptField] public string AppName { get { return null; @@ -29,7 +29,7 @@ public string AppName { /// /// Returns the version of the browser. /// - [IntrinsicProperty] + [ScriptField] public string AppVersion { get { return null; @@ -39,14 +39,14 @@ public string AppVersion { /// /// Retrieves the current language (applies to IE and Opera). /// - [IntrinsicProperty] + [ScriptField] public string BrowserLanguage { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool CookieEnabled { get { return false; @@ -56,7 +56,7 @@ public bool CookieEnabled { /// /// Returns a string representing the language of the browser (applies to Gecko, Opera, and WebKit). /// - [IntrinsicProperty] + [ScriptField] public string Language { get { return null; @@ -66,7 +66,7 @@ public string Language { /// /// Retrieves the default language used by the operating system (applies to IE). /// - [IntrinsicProperty] + [ScriptField] public string SystemLanguage { get { return null; @@ -76,21 +76,21 @@ public string SystemLanguage { /// /// Retrieves the operating system's natural language setting (applies to IE and Opera). /// - [IntrinsicProperty] + [ScriptField] public string UserLanguage { get { return null; } } - [IntrinsicProperty] + [ScriptField] public GeolocationService Geolocation { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool OnLine { get { return false; @@ -100,7 +100,7 @@ public bool OnLine { /// /// Returns the name of the platform. /// - [IntrinsicProperty] + [ScriptField] public string Platform { get { return null; @@ -110,14 +110,14 @@ public string Platform { /// /// Returns a PluginArray object, listing the plugins installed in the application. /// - [IntrinsicProperty] + [ScriptField] public PluginArray Plugins { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool Standalone { get { return false; @@ -127,7 +127,7 @@ public bool Standalone { /// /// Returns the complete User-Agent header. /// - [IntrinsicProperty] + [ScriptField] public string UserAgent { get { return null; diff --git a/src/Libraries/Web/Html/OptionElement.cs b/src/Libraries/Web/Html/OptionElement.cs index c1477f019..5f92367f8 100644 --- a/src/Libraries/Web/Html/OptionElement.cs +++ b/src/Libraries/Web/Html/OptionElement.cs @@ -8,21 +8,21 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class OptionElement : Element { private OptionElement() { } - [IntrinsicProperty] + [ScriptField] public FormElement Form { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool Selected { get { return false; @@ -31,7 +31,7 @@ public bool Selected { } } - [IntrinsicProperty] + [ScriptField] public string Text { get { return null; @@ -40,7 +40,7 @@ public string Text { } } - [IntrinsicProperty] + [ScriptField] public string Value { get { return null; diff --git a/src/Libraries/Web/Html/Orientation.cs b/src/Libraries/Web/Html/Orientation.cs index 700c472ce..d0e7717e2 100644 --- a/src/Libraries/Web/Html/Orientation.cs +++ b/src/Libraries/Web/Html/Orientation.cs @@ -8,9 +8,9 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum Orientation { Portrait = 0, diff --git a/src/Libraries/Web/Html/Plugin.cs b/src/Libraries/Web/Html/Plugin.cs index 4242dafa8..dc409f277 100644 --- a/src/Libraries/Web/Html/Plugin.cs +++ b/src/Libraries/Web/Html/Plugin.cs @@ -9,8 +9,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class Plugin { @@ -20,7 +20,7 @@ private Plugin() { /// /// A human readable description of the plugin. /// - [IntrinsicProperty] + [ScriptField] public string Description { get { return null; @@ -30,7 +30,7 @@ public string Description { /// /// The filename of the plugin file. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("filename")] public string FileName { get { @@ -41,7 +41,7 @@ public string FileName { /// /// The name of the plugin. /// - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; @@ -51,7 +51,7 @@ public string Name { /// /// The plugin's version number string. /// - [IntrinsicProperty] + [ScriptField] public string Version { get { return null; diff --git a/src/Libraries/Web/Html/PluginArray.cs b/src/Libraries/Web/Html/PluginArray.cs index 75a5a64b8..15423b0b5 100644 --- a/src/Libraries/Web/Html/PluginArray.cs +++ b/src/Libraries/Web/Html/PluginArray.cs @@ -9,8 +9,8 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class PluginArray { private PluginArray() { @@ -19,7 +19,7 @@ private PluginArray() { /// /// The number of plugins in the array. /// - [IntrinsicProperty] + [ScriptField] public long Length { get { return 0; @@ -29,7 +29,7 @@ public long Length { /// /// Returns the Plugin at the specified index into the array. /// - [IntrinsicProperty] + [ScriptField] public Plugin this[int index] { get { return null; @@ -41,7 +41,7 @@ public Plugin this[int index] { /// /// /// - [IntrinsicProperty] + [ScriptField] public Plugin this[string name] { get { return null; diff --git a/src/Libraries/Web/Html/Screen.cs b/src/Libraries/Web/Html/Screen.cs index 7653f0ba0..1c5379ae7 100644 --- a/src/Libraries/Web/Html/Screen.cs +++ b/src/Libraries/Web/Html/Screen.cs @@ -11,39 +11,39 @@ namespace System.Html { /// /// The screen object represents information about the current desktop. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class Screen { - [IntrinsicProperty] + [ScriptField] public int AvailHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int AvailWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ColorDepth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int Height { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int Width { get { return 0; diff --git a/src/Libraries/Web/Html/ScriptElement.cs b/src/Libraries/Web/Html/ScriptElement.cs index df7ac8840..a5d3a7861 100644 --- a/src/Libraries/Web/Html/ScriptElement.cs +++ b/src/Libraries/Web/Html/ScriptElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class ScriptElement : Element { private ScriptElement() { } - [IntrinsicProperty] + [ScriptField] public string Src { get { return null; @@ -24,7 +24,7 @@ public string Src { } } - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; @@ -33,7 +33,7 @@ public string Type { } } - [IntrinsicProperty] + [ScriptField] public string ReadyState { get { return null; diff --git a/src/Libraries/Web/Html/SelectElement.cs b/src/Libraries/Web/Html/SelectElement.cs index 061a6d29b..c6a82af83 100644 --- a/src/Libraries/Web/Html/SelectElement.cs +++ b/src/Libraries/Web/Html/SelectElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class SelectElement : InputElement { private SelectElement() { } - [IntrinsicProperty] + [ScriptField] public bool Multiple { get { return false; @@ -24,14 +24,14 @@ public bool Multiple { } } - [IntrinsicProperty] + [ScriptField] public ElementCollection Options { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int SelectedIndex { get { return 0; @@ -40,7 +40,7 @@ public int SelectedIndex { } } - [IntrinsicProperty] + [ScriptField] public int Size { get { return 0; diff --git a/src/Libraries/Web/Html/Services/GeoCoordinates.cs b/src/Libraries/Web/Html/Services/GeoCoordinates.cs index 83e94f0f9..e9f503f79 100644 --- a/src/Libraries/Web/Html/Services/GeoCoordinates.cs +++ b/src/Libraries/Web/Html/Services/GeoCoordinates.cs @@ -8,56 +8,56 @@ namespace System.Html.Services { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class GeoCoordinates { private GeoCoordinates() { } - [IntrinsicProperty] + [ScriptField] public double Accuracy { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double Altitude { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double AltitudeAccuracy { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double Heading { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double Latitude { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double Longitude { get { return 0.0; } } - [IntrinsicProperty] + [ScriptField] public double Speed { get { return 0.0; diff --git a/src/Libraries/Web/Html/Services/Geolocation.cs b/src/Libraries/Web/Html/Services/Geolocation.cs index df48f0a97..ef252131d 100644 --- a/src/Libraries/Web/Html/Services/Geolocation.cs +++ b/src/Libraries/Web/Html/Services/Geolocation.cs @@ -8,14 +8,14 @@ namespace System.Html.Services { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Geolocation { private Geolocation() { } - [IntrinsicProperty] + [ScriptField] [ScriptName("coords")] public GeoCoordinates Coordinates { get { @@ -23,7 +23,7 @@ public GeoCoordinates Coordinates { } } - [IntrinsicProperty] + [ScriptField] public int Timestamp { get { return 0; diff --git a/src/Libraries/Web/Html/Services/GeolocationError.cs b/src/Libraries/Web/Html/Services/GeolocationError.cs index ec35ccbaa..c017a0265 100644 --- a/src/Libraries/Web/Html/Services/GeolocationError.cs +++ b/src/Libraries/Web/Html/Services/GeolocationError.cs @@ -8,21 +8,21 @@ namespace System.Html.Services { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class GeolocationError { private GeolocationError() { } - [IntrinsicProperty] + [ScriptField] public GeolocationErrorCode Code { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string Message { get { return null; diff --git a/src/Libraries/Web/Html/Services/GeolocationErrorCode.cs b/src/Libraries/Web/Html/Services/GeolocationErrorCode.cs index 0db67d3af..5663adc9c 100644 --- a/src/Libraries/Web/Html/Services/GeolocationErrorCode.cs +++ b/src/Libraries/Web/Html/Services/GeolocationErrorCode.cs @@ -8,9 +8,9 @@ namespace System.Html.Services { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum GeolocationErrorCode { PermissionDenied = 1, diff --git a/src/Libraries/Web/Html/Services/GeolocationOptions.cs b/src/Libraries/Web/Html/Services/GeolocationOptions.cs index 93842d31a..ce84cbdc2 100644 --- a/src/Libraries/Web/Html/Services/GeolocationOptions.cs +++ b/src/Libraries/Web/Html/Services/GeolocationOptions.cs @@ -8,15 +8,15 @@ namespace System.Html.Services { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("Object")] public sealed class GeolocationOptions { public GeolocationOptions(params object[] nameValuePairs) { } - [IntrinsicProperty] + [ScriptField] public bool EnableHighAccuracy { get { return false; @@ -25,7 +25,7 @@ public bool EnableHighAccuracy { } } - [IntrinsicProperty] + [ScriptField] public int MaximumAge { get { return 0; @@ -34,7 +34,7 @@ public int MaximumAge { } } - [IntrinsicProperty] + [ScriptField] public int Timeout { get { return 0; diff --git a/src/Libraries/Web/Html/Services/GeolocationService.cs b/src/Libraries/Web/Html/Services/GeolocationService.cs index 5d94554f5..6a37fb544 100644 --- a/src/Libraries/Web/Html/Services/GeolocationService.cs +++ b/src/Libraries/Web/Html/Services/GeolocationService.cs @@ -12,8 +12,8 @@ namespace System.Html.Services { public delegate void GeolocationErrorCallback(GeolocationError error); - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class GeolocationService { private GeolocationService() { diff --git a/src/Libraries/Web/Html/Style.cs b/src/Libraries/Web/Html/Style.cs index 880e1bb5a..3c1ce4523 100644 --- a/src/Libraries/Web/Html/Style.cs +++ b/src/Libraries/Web/Html/Style.cs @@ -8,15 +8,15 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class Style { private Style() { } /// Whether the object contains an accelerator key. - [IntrinsicProperty] + [ScriptField] public bool Accelerator { get { return false; @@ -26,7 +26,7 @@ public bool Accelerator { } /// The background properties of an object. - [IntrinsicProperty] + [ScriptField] public string Background { get { return null; @@ -36,7 +36,7 @@ public string Background { } /// How the background image is attached to the object within the document. - [IntrinsicProperty] + [ScriptField] public string BackgroundAttachment { get { return null; @@ -46,7 +46,7 @@ public string BackgroundAttachment { } /// The color behind the content of the object. - [IntrinsicProperty] + [ScriptField] public string BackgroundColor { get { return null; @@ -56,7 +56,7 @@ public string BackgroundColor { } /// The background image of the object. - [IntrinsicProperty] + [ScriptField] public string BackgroundImage { get { return null; @@ -66,7 +66,7 @@ public string BackgroundImage { } /// The position of the background of the object. - [IntrinsicProperty] + [ScriptField] public string BackgroundPosition { get { return null; @@ -76,7 +76,7 @@ public string BackgroundPosition { } /// The x-coordinate of the backgroundPosition property. - [IntrinsicProperty] + [ScriptField] public string BackgroundPositionX { get { return null; @@ -86,7 +86,7 @@ public string BackgroundPositionX { } /// The y-coordinate of the backgroundPosition property. - [IntrinsicProperty] + [ScriptField] public string BackgroundPositionY { get { return null; @@ -96,7 +96,7 @@ public string BackgroundPositionY { } /// How the background of the object is tiled. - [IntrinsicProperty] + [ScriptField] public string BackgroundRepeat { get { return null; @@ -106,7 +106,7 @@ public string BackgroundRepeat { } /// The properties to draw a border around the object. - [IntrinsicProperty] + [ScriptField] public string Border { get { return null; @@ -116,7 +116,7 @@ public string Border { } /// The properties of the bottom border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderBottom { get { return null; @@ -126,7 +126,7 @@ public string BorderBottom { } /// The color of the bottom border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderBottomColor { get { return null; @@ -136,7 +136,7 @@ public string BorderBottomColor { } /// The style of the bottom border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderBottomStyle { get { return null; @@ -146,7 +146,7 @@ public string BorderBottomStyle { } /// The width of the bottom border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderBottomWidth { get { return null; @@ -156,7 +156,7 @@ public string BorderBottomWidth { } /// Whether the row and cell borders of a table are joined in a single border or detached. - [IntrinsicProperty] + [ScriptField] public string BorderCollapse { get { return null; @@ -166,7 +166,7 @@ public string BorderCollapse { } /// The border color of the object. - [IntrinsicProperty] + [ScriptField] public string BorderColor { get { return null; @@ -176,7 +176,7 @@ public string BorderColor { } /// The properties of the left border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderLeft { get { return null; @@ -186,7 +186,7 @@ public string BorderLeft { } /// The color of the left border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderLeftColor { get { return null; @@ -196,7 +196,7 @@ public string BorderLeftColor { } /// The style of the left border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderLeftStyle { get { return null; @@ -206,7 +206,7 @@ public string BorderLeftStyle { } /// The width of the left border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderLeftWidth { get { return null; @@ -216,7 +216,7 @@ public string BorderLeftWidth { } /// The properties of the right border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderRight { get { return null; @@ -226,7 +226,7 @@ public string BorderRight { } /// The color of the right border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderRightColor { get { return null; @@ -236,7 +236,7 @@ public string BorderRightColor { } /// The style of the right border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderRightStyle { get { return null; @@ -246,7 +246,7 @@ public string BorderRightStyle { } /// The width of the right border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderRightWidth { get { return null; @@ -256,7 +256,7 @@ public string BorderRightWidth { } /// The style of the borders of the object. - [IntrinsicProperty] + [ScriptField] public string BorderStyle { get { return null; @@ -266,7 +266,7 @@ public string BorderStyle { } /// The properties of the top border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderTop { get { return null; @@ -276,7 +276,7 @@ public string BorderTop { } /// The color of the top border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderTopColor { get { return null; @@ -286,7 +286,7 @@ public string BorderTopColor { } /// The style of the top border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderTopStyle { get { return null; @@ -296,7 +296,7 @@ public string BorderTopStyle { } /// The width of the top border of the object. - [IntrinsicProperty] + [ScriptField] public string BorderTopWidth { get { return null; @@ -306,7 +306,7 @@ public string BorderTopWidth { } /// The width of the borders of the object. - [IntrinsicProperty] + [ScriptField] public string BorderWidth { get { return null; @@ -316,7 +316,7 @@ public string BorderWidth { } /// The bottom position of the object in relation to the bottom of the next positioned object. - [IntrinsicProperty] + [ScriptField] public string Bottom { get { return null; @@ -326,7 +326,7 @@ public string Bottom { } /// Whether the object allows floating objects on its left side, right side, or both, so that the next text displays past the floating objects. - [IntrinsicProperty] + [ScriptField] public string Clear { get { return null; @@ -336,7 +336,7 @@ public string Clear { } /// Which part of a positioned object is visible. - [IntrinsicProperty] + [ScriptField] public string Clip { get { return null; @@ -346,7 +346,7 @@ public string Clip { } /// The color of the text of the object. - [IntrinsicProperty] + [ScriptField] public string Color { get { return null; @@ -356,7 +356,7 @@ public string Color { } /// The side of the object the text will flow. - [IntrinsicProperty] + [ScriptField] public string CssFloat { get { return null; @@ -366,7 +366,7 @@ public string CssFloat { } /// The persisted representation of this style. - [IntrinsicProperty] + [ScriptField] public string CssText { get { return null; @@ -376,7 +376,7 @@ public string CssText { } /// The type of cursor to display as the mouse pointer moves over the object. - [IntrinsicProperty] + [ScriptField] public string Cursor { get { return null; @@ -386,7 +386,7 @@ public string Cursor { } /// The reading order of content within the object. - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -396,7 +396,7 @@ public string Direction { } /// Whether the object is rendered. - [IntrinsicProperty] + [ScriptField] public string Display { get { return null; @@ -406,7 +406,7 @@ public string Display { } /// The collection of filters applied to an object. (Specific to Internet Explorer) - [IntrinsicProperty] + [ScriptField] public string Filter { get { return null; @@ -416,7 +416,7 @@ public string Filter { } /// The font properties of the object or one or more of six user-preference fonts. - [IntrinsicProperty] + [ScriptField] public string Font { get { return null; @@ -426,7 +426,7 @@ public string Font { } /// The name of the font used for text in the object. - [IntrinsicProperty] + [ScriptField] public string FontFamily { get { return null; @@ -436,7 +436,7 @@ public string FontFamily { } /// The font size used for text in the object. - [IntrinsicProperty] + [ScriptField] public string FontSize { get { return null; @@ -446,7 +446,7 @@ public string FontSize { } /// The font style of the object as italic, normal, or oblique. - [IntrinsicProperty] + [ScriptField] public string FontStyle { get { return null; @@ -456,7 +456,7 @@ public string FontStyle { } /// Whether the text of the object is in small capital letters. - [IntrinsicProperty] + [ScriptField] public string FontVariant { get { return null; @@ -466,7 +466,7 @@ public string FontVariant { } /// The weight of the font of the object. - [IntrinsicProperty] + [ScriptField] public string FontWeight { get { return null; @@ -476,7 +476,7 @@ public string FontWeight { } /// The height of the object. - [IntrinsicProperty] + [ScriptField] public string Height { get { return null; @@ -486,7 +486,7 @@ public string Height { } /// The position of the object relative to the left edge of the next positioned object in the document hierarchy. - [IntrinsicProperty] + [ScriptField] public string Left { get { return null; @@ -496,7 +496,7 @@ public string Left { } /// The amount of additional space between letters in the object. - [IntrinsicProperty] + [ScriptField] public string LetterSpacing { get { return null; @@ -506,7 +506,7 @@ public string LetterSpacing { } /// The distance between lines in the object. - [IntrinsicProperty] + [ScriptField] public string LineHeight { get { return null; @@ -516,7 +516,7 @@ public string LineHeight { } /// The listStyle properties of the object. - [IntrinsicProperty] + [ScriptField] public string ListStyle { get { return null; @@ -526,7 +526,7 @@ public string ListStyle { } /// The image to use as a list-item marker for the object. - [IntrinsicProperty] + [ScriptField] public string ListStyleImage { get { return null; @@ -536,7 +536,7 @@ public string ListStyleImage { } /// SHow the list-item marker is drawn relative to the content of the object. - [IntrinsicProperty] + [ScriptField] public string ListStylePosition { get { return null; @@ -546,7 +546,7 @@ public string ListStylePosition { } /// The type of the list-item marker for the object. - [IntrinsicProperty] + [ScriptField] public string ListStyleType { get { return null; @@ -556,7 +556,7 @@ public string ListStyleType { } /// The width of the top, right, bottom, and left margins of the object. - [IntrinsicProperty] + [ScriptField] public string Margin { get { return null; @@ -566,7 +566,7 @@ public string Margin { } /// The height of the bottom margin of the object. - [IntrinsicProperty] + [ScriptField] public string MarginBottom { get { return null; @@ -576,7 +576,7 @@ public string MarginBottom { } /// The width of the left margin of the object. - [IntrinsicProperty] + [ScriptField] public string MarginLeft { get { return null; @@ -586,7 +586,7 @@ public string MarginLeft { } /// The width of the right margin of the object. - [IntrinsicProperty] + [ScriptField] public string MarginRight { get { return null; @@ -596,7 +596,7 @@ public string MarginRight { } /// The height of the top margin of the object. - [IntrinsicProperty] + [ScriptField] public string MarginTop { get { return null; @@ -606,7 +606,7 @@ public string MarginTop { } /// The maximum height for displayable block level elements. - [IntrinsicProperty] + [ScriptField] public string MaxHeight { get { return null; @@ -616,7 +616,7 @@ public string MaxHeight { } /// The maximum width for displayable block level elements. - [IntrinsicProperty] + [ScriptField] public string MaxWidth { get { return null; @@ -626,7 +626,7 @@ public string MaxWidth { } /// The minimum height for an element. - [IntrinsicProperty] + [ScriptField] public string MinHeight { get { return null; @@ -636,7 +636,7 @@ public string MinHeight { } /// The minimum width for displayable block level element. - [IntrinsicProperty] + [ScriptField] public string MinWidth { get { return null; @@ -646,7 +646,7 @@ public string MinWidth { } /// The interpolation (resampling) method used to stretch images. (Specific to Internet Explorer) - [IntrinsicProperty] + [ScriptField] public string MsInterpolationMode { get { return null; @@ -656,7 +656,7 @@ public string MsInterpolationMode { } /// How to blend the object into the rendering. - [IntrinsicProperty] + [ScriptField] public string Opacity { get { return null; @@ -666,7 +666,7 @@ public string Opacity { } /// How to manage the content of the object when the content exceeds the height or width of the object. - [IntrinsicProperty] + [ScriptField] public string Overflow { get { return null; @@ -676,7 +676,7 @@ public string Overflow { } /// How to manage the content of the object when the content exceeds the width of the object. - [IntrinsicProperty] + [ScriptField] public string OverflowX { get { return null; @@ -686,7 +686,7 @@ public string OverflowX { } /// How to manage the content of the object when the content exceeds the height of the object. - [IntrinsicProperty] + [ScriptField] public string OverflowY { get { return null; @@ -696,7 +696,7 @@ public string OverflowY { } /// The amount of space to insert between the object and its margin or, if there is a border, between the object and its border. - [IntrinsicProperty] + [ScriptField] public string Padding { get { return null; @@ -706,7 +706,7 @@ public string Padding { } /// The amount of space to insert between the bottom border of the object and the content. - [IntrinsicProperty] + [ScriptField] public string PaddingBottom { get { return null; @@ -716,7 +716,7 @@ public string PaddingBottom { } /// The amount of space to insert between the left border of the object and the content. - [IntrinsicProperty] + [ScriptField] public string PaddingLeft { get { return null; @@ -726,7 +726,7 @@ public string PaddingLeft { } /// The amount of space to insert between the right border of the object and the content. - [IntrinsicProperty] + [ScriptField] public string PaddingRight { get { return null; @@ -736,7 +736,7 @@ public string PaddingRight { } /// The amount of space to insert between the top border of the object and the content. - [IntrinsicProperty] + [ScriptField] public string PaddingTop { get { return null; @@ -746,7 +746,7 @@ public string PaddingTop { } /// Whether a page break occurs after the object. - [IntrinsicProperty] + [ScriptField] public string PageBreakAfter { get { return null; @@ -756,7 +756,7 @@ public string PageBreakAfter { } /// Whether a page break occurs before the object. - [IntrinsicProperty] + [ScriptField] public string PageBreakBefore { get { return null; @@ -766,7 +766,7 @@ public string PageBreakBefore { } /// The bottom position of the object. - [IntrinsicProperty] + [ScriptField] public int PixelBottom { get { return 0; @@ -776,7 +776,7 @@ public int PixelBottom { } /// The height of the object. - [IntrinsicProperty] + [ScriptField] public int PixelHeight { get { return 0; @@ -786,7 +786,7 @@ public int PixelHeight { } /// The left position of the object. - [IntrinsicProperty] + [ScriptField] public int PixelLeft { get { return 0; @@ -796,7 +796,7 @@ public int PixelLeft { } /// The right position of the object. - [IntrinsicProperty] + [ScriptField] public int PixelRight { get { return 0; @@ -806,7 +806,7 @@ public int PixelRight { } /// The top position of the object. - [IntrinsicProperty] + [ScriptField] public int PixelTop { get { return 0; @@ -816,7 +816,7 @@ public int PixelTop { } /// The width of the object. - [IntrinsicProperty] + [ScriptField] public int PixelWidth { get { return 0; @@ -826,7 +826,7 @@ public int PixelWidth { } /// The bottom position of the object in the units specified by the bottom attribute. - [IntrinsicProperty] + [ScriptField] public int PosBottom { get { return 0; @@ -836,7 +836,7 @@ public int PosBottom { } /// The height of the object in the units specified by the height attribute. - [IntrinsicProperty] + [ScriptField] public int PosHeight { get { return 0; @@ -846,7 +846,7 @@ public int PosHeight { } /// The type of positioning used for the object. - [IntrinsicProperty] + [ScriptField] public string Position { get { return null; @@ -856,7 +856,7 @@ public string Position { } /// The left position of the object in the units specified by the left attribute. - [IntrinsicProperty] + [ScriptField] public int PosLeft { get { return 0; @@ -866,7 +866,7 @@ public int PosLeft { } /// The right position of the object in the units specified by the right attribute. - [IntrinsicProperty] + [ScriptField] public int PosRight { get { return 0; @@ -876,7 +876,7 @@ public int PosRight { } /// The top position of the object in the units specified by the top attribute. - [IntrinsicProperty] + [ScriptField] public int PosTop { get { return 0; @@ -886,7 +886,7 @@ public int PosTop { } /// The width of the object in the units specified by the width attribute. - [IntrinsicProperty] + [ScriptField] public int PosWidth { get { return 0; @@ -896,7 +896,7 @@ public int PosWidth { } /// The position of the object relative to the right edge of the next positioned object in the document hierarchy. - [IntrinsicProperty] + [ScriptField] public string Right { get { return null; @@ -906,7 +906,7 @@ public string Right { } /// The side of the object the text will flow. - [IntrinsicProperty] + [ScriptField] public string StyleFloat { get { return null; @@ -916,7 +916,7 @@ public string StyleFloat { } /// Whether the table layout is fixed. - [IntrinsicProperty] + [ScriptField] public string TableLayout { get { return null; @@ -926,7 +926,7 @@ public string TableLayout { } /// Whether The text in the object is left-aligned, right-aligned, centered, or justified. - [IntrinsicProperty] + [ScriptField] public string TextAlign { get { return null; @@ -936,7 +936,7 @@ public string TextAlign { } /// Indicates whether the text in the object has blink, line-through, overline, or underline decorations. - [IntrinsicProperty] + [ScriptField] public string TextDecoration { get { return null; @@ -946,7 +946,7 @@ public string TextDecoration { } /// Whether the object's text "blinks." - [IntrinsicProperty] + [ScriptField] public string TextDecorationBlink { get { return null; @@ -956,7 +956,7 @@ public string TextDecorationBlink { } /// Whether the text in the object has a line drawn through it. - [IntrinsicProperty] + [ScriptField] public string TextDecorationLineThrough { get { return null; @@ -966,7 +966,7 @@ public string TextDecorationLineThrough { } /// Whether the textDecoration property for the object has been set to none. - [IntrinsicProperty] + [ScriptField] public string TextDecorationNone { get { return null; @@ -976,7 +976,7 @@ public string TextDecorationNone { } /// Whether the text in the object has a line drawn over it. - [IntrinsicProperty] + [ScriptField] public string TextDecorationOverline { get { return null; @@ -986,7 +986,7 @@ public string TextDecorationOverline { } /// Whether the text in the object is underlined. - [IntrinsicProperty] + [ScriptField] public string TextDecorationUnderline { get { return null; @@ -996,7 +996,7 @@ public string TextDecorationUnderline { } /// The indentation of the first line of text in the object. - [IntrinsicProperty] + [ScriptField] public string TextIndent { get { return null; @@ -1006,7 +1006,7 @@ public string TextIndent { } /// The type of alignment used to justify text in the object. - [IntrinsicProperty] + [ScriptField] public string TextJustify { get { return null; @@ -1016,7 +1016,7 @@ public string TextJustify { } /// Indicates whether to render ellipses(...) to indicate text overflow. - [IntrinsicProperty] + [ScriptField] public string TextOverflow { get { return null; @@ -1026,7 +1026,7 @@ public string TextOverflow { } /// The rendering of the text in the object. - [IntrinsicProperty] + [ScriptField] public string TextTransform { get { return null; @@ -1035,7 +1035,7 @@ public string TextTransform { } } - [IntrinsicProperty] + [ScriptField] public string this[string name] { get { return null; @@ -1045,7 +1045,7 @@ public string this[string name] { } /// The position of the object relative to the top of the next positioned object in the document hierarchy. - [IntrinsicProperty] + [ScriptField] public string Top { get { return null; @@ -1055,7 +1055,7 @@ public string Top { } /// The vertical alignment of the object. - [IntrinsicProperty] + [ScriptField] public string VerticalAlign { get { return null; @@ -1065,7 +1065,7 @@ public string VerticalAlign { } /// Whether the content of the object is displayed. - [IntrinsicProperty] + [ScriptField] public string Visibility { get { return null; @@ -1075,7 +1075,7 @@ public string Visibility { } /// Indicates whether lines are automatically broken inside the object. - [IntrinsicProperty] + [ScriptField] public string WhiteSpace { get { return null; @@ -1085,7 +1085,7 @@ public string WhiteSpace { } /// The width of the object. - [IntrinsicProperty] + [ScriptField] public string Width { get { return null; @@ -1095,7 +1095,7 @@ public string Width { } /// The amount of additional space between words in the object. - [IntrinsicProperty] + [ScriptField] public string WordSpacing { get { return null; @@ -1105,7 +1105,7 @@ public string WordSpacing { } /// Whether to break words when the content exceeds the boundaries of its container. - [IntrinsicProperty] + [ScriptField] public string WordWrap { get { return null; @@ -1115,7 +1115,7 @@ public string WordWrap { } /// The direction and flow of the content in the object. - [IntrinsicProperty] + [ScriptField] public string WritingMode { get { return null; @@ -1125,7 +1125,7 @@ public string WritingMode { } /// The stacking order of positioned objects. - [IntrinsicProperty] + [ScriptField] public short ZIndex { get { return 0; @@ -1135,7 +1135,7 @@ public short ZIndex { } /// The magnification scale of the object. - [IntrinsicProperty] + [ScriptField] public string Zoom { get { return null; diff --git a/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs new file mode 100644 index 000000000..70e1a841e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs @@ -0,0 +1,34 @@ +// StyleCSSRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleCSSRule : StyleRule { + + private StyleCSSRule() { + } + + [ScriptField] + public string SelectorText { + get { + return null; + } + set { + } + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs new file mode 100644 index 000000000..d7a2bf944 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs @@ -0,0 +1,27 @@ +// StyleCharsetRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleCharsetRule : StyleRule { + + private StyleCharsetRule() { + } + + [ScriptField] + public string Encoding { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs new file mode 100644 index 000000000..a78dba32e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs @@ -0,0 +1,25 @@ +// StyleFontFaceRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleFontFaceRule : StyleRule { + + private StyleFontFaceRule() { + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs new file mode 100644 index 000000000..b3c89b8b9 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs @@ -0,0 +1,39 @@ +// StyleImportRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleImportRule : StyleRule { + + private StyleImportRule() { + } + + [ScriptField] + public string Href { + get { + return null; + } + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + public StyleSheet StyleSheet { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs b/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs new file mode 100644 index 000000000..3fb660a0e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs @@ -0,0 +1,55 @@ +// StyleMediaList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleMediaList : IEnumerable { + + private StyleMediaList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public string MediaText { + get { + return null; + } + set { + } + } + + [ScriptField] + public string this[int index] { + get { + return null; + } + } + + public void AppendMedium(string newMedium) { + } + + public void DeleteMedium(string oldMedium) { + } + + public static implicit operator string[](StyleMediaList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs new file mode 100644 index 000000000..ad49c96a5 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs @@ -0,0 +1,40 @@ +// StyleMediaRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleMediaRule : StyleRule { + + private StyleMediaRule() { + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + [ScriptName("cssRules")] + public StyleRuleList StyleRules { + get { + return null; + } + } + + public void DeleteRule(int index) { + } + + public int InsertRule(string rule, int index) { + return 0; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs b/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs new file mode 100644 index 000000000..383e966ed --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs @@ -0,0 +1,34 @@ +// StylePageRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StylePageRule : StyleRule { + + private StylePageRule() { + } + + [ScriptField] + public string SelectorText { + get { + return null; + } + set { + } + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleRule.cs new file mode 100644 index 000000000..20a3e0240 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRule.cs @@ -0,0 +1,49 @@ +// StyleRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public abstract class StyleRule { + + internal StyleRule() { + } + + [ScriptField] + [ScriptName("cssText")] + public string CSSText { + get { + return null; + } + set { + } + } + + [ScriptField] + public StyleRule ParentRule { + get { + return null; + } + } + + [ScriptField] + public StyleSheet ParentStyleSheet { + get { + return null; + } + } + + [ScriptField] + public StyleRuleType Type { + get { + return StyleRuleType.Unknown; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs b/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs new file mode 100644 index 000000000..9193048ae --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs @@ -0,0 +1,40 @@ +// StyleRuleList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleRuleList : IEnumerable { + + private StyleRuleList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public StyleRule this[int index] { + get { + return null; + } + } + + public static implicit operator StyleRule[](StyleRuleList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs b/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs new file mode 100644 index 000000000..f7c4186b1 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs @@ -0,0 +1,31 @@ +// StyleRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] + public enum StyleRuleType { + + Unknown = 0, + + Style = 1, + + Charset = 2, + + Import = 3, + + Media = 4, + + FontFace = 5, + + Page = 6, + + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs b/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs new file mode 100644 index 000000000..68bff5112 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs @@ -0,0 +1,102 @@ +// StyleSheet.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleSheet { + + private StyleSheet() { + } + + [ScriptField] + [ScriptName("cssRules")] + public StyleRuleList StyleRules { + get { + return null; + } + } + + [ScriptField] + public bool Disabled { + get { + return false; + } + set { + } + } + + [ScriptField] + public string Href { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Id { + get { + return null; + } + set { + } + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + public Element OwnerNode { + get { + return null; + } + } + + [ScriptField] + public StyleRule OwnerRule { + get { + return null; + } + } + + [ScriptField] + public StyleSheet ParentStyleSheet { + get { + return null; + } + } + + [ScriptField] + public string Title { + get { + return null; + } + } + + [ScriptField] + public string Type { + get { + return null; + } + } + + public void DeleteRule(int index) { + } + + public int InsertRule(string rule, int index) { + return 0; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs b/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs new file mode 100644 index 000000000..4286fa8a6 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs @@ -0,0 +1,40 @@ +// StyleSheetList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleSheetList : IEnumerable { + + private StyleSheetList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public StyleSheet this[int index] { + get { + return null; + } + } + + public static implicit operator StyleSheet[](StyleSheetList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/TableCellElement.cs b/src/Libraries/Web/Html/TableCellElement.cs index 0b47b4e74..2a7053f2b 100644 --- a/src/Libraries/Web/Html/TableCellElement.cs +++ b/src/Libraries/Web/Html/TableCellElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TableCellElement : Element { private TableCellElement() { } - [IntrinsicProperty] + [ScriptField] public int ColSpan { get { return 0; @@ -24,7 +24,7 @@ public int ColSpan { } } - [IntrinsicProperty] + [ScriptField] public bool NoWrap { get { return false; @@ -33,7 +33,7 @@ public bool NoWrap { } } - [IntrinsicProperty] + [ScriptField] public int RowSpan { get { return 0; diff --git a/src/Libraries/Web/Html/TableElement.cs b/src/Libraries/Web/Html/TableElement.cs index 9bb5d2ba1..6e29b9610 100644 --- a/src/Libraries/Web/Html/TableElement.cs +++ b/src/Libraries/Web/Html/TableElement.cs @@ -8,42 +8,42 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TableElement : Element { private TableElement() { } - [IntrinsicProperty] + [ScriptField] public ElementCollection Cells { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection Rows { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection tBodies { get { return null; } } - [IntrinsicProperty] + [ScriptField] public Element tFoot { get { return null; } } - [IntrinsicProperty] + [ScriptField] public ElementCollection tHead { get { return null; diff --git a/src/Libraries/Web/Html/TableRowElement.cs b/src/Libraries/Web/Html/TableRowElement.cs index 20c8d0fbf..4cd09d99d 100644 --- a/src/Libraries/Web/Html/TableRowElement.cs +++ b/src/Libraries/Web/Html/TableRowElement.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TableRowElement : Element { private TableRowElement() { } - [IntrinsicProperty] + [ScriptField] public ElementCollection Cells { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int RowIndex { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int SectionRowIndex { get { return 0; diff --git a/src/Libraries/Web/Html/TableSectionElement.cs b/src/Libraries/Web/Html/TableSectionElement.cs index c4f853279..e8eaa763a 100644 --- a/src/Libraries/Web/Html/TableSectionElement.cs +++ b/src/Libraries/Web/Html/TableSectionElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TableSectionElement : Element { private TableSectionElement() { } - [IntrinsicProperty] + [ScriptField] public ElementCollection Rows { get { return null; diff --git a/src/Libraries/Web/Html/TextAreaElement.cs b/src/Libraries/Web/Html/TextAreaElement.cs index 7d93acaad..d222bf0c1 100644 --- a/src/Libraries/Web/Html/TextAreaElement.cs +++ b/src/Libraries/Web/Html/TextAreaElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TextAreaElement : InputElement { private TextAreaElement() { } - [IntrinsicProperty] + [ScriptField] public int Cols { get { return 0; @@ -24,7 +24,7 @@ public int Cols { } } - [IntrinsicProperty] + [ScriptField] public bool ReadOnly { get { return false; @@ -33,7 +33,7 @@ public bool ReadOnly { } } - [IntrinsicProperty] + [ScriptField] public int Rows { get { return 0; diff --git a/src/Libraries/Web/Html/TextElement.cs b/src/Libraries/Web/Html/TextElement.cs index a2f59e072..e0280f4b0 100644 --- a/src/Libraries/Web/Html/TextElement.cs +++ b/src/Libraries/Web/Html/TextElement.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class TextElement : InputElement { internal TextElement() { } - [IntrinsicProperty] + [ScriptField] public int MaxLength { get { return 0; @@ -24,7 +24,7 @@ public int MaxLength { } } - [IntrinsicProperty] + [ScriptField] public bool ReadOnly { get { return false; diff --git a/src/Libraries/Web/Html/TokenList.cs b/src/Libraries/Web/Html/TokenList.cs index e1169fe9f..7687a50af 100644 --- a/src/Libraries/Web/Html/TokenList.cs +++ b/src/Libraries/Web/Html/TokenList.cs @@ -8,14 +8,14 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TokenList { private TokenList() { } - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] public int Count { get { @@ -23,7 +23,7 @@ public int Count { } } - [IntrinsicProperty] + [ScriptField] public string this[int index] { get { return null; diff --git a/src/Libraries/Web/Html/TouchEvent.cs b/src/Libraries/Web/Html/TouchEvent.cs index 9faa3bd26..6f697bc49 100644 --- a/src/Libraries/Web/Html/TouchEvent.cs +++ b/src/Libraries/Web/Html/TouchEvent.cs @@ -8,28 +8,28 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TouchEvent : ElementEvent { internal TouchEvent() { } - [IntrinsicProperty] + [ScriptField] public TouchInfo[] ChangedTouches { get { return null; } } - [IntrinsicProperty] + [ScriptField] public TouchInfo[] TargetTouches { get { return null; } } - [IntrinsicProperty] + [ScriptField] public TouchInfo[] Touches { get { return null; diff --git a/src/Libraries/Web/Html/TouchInfo.cs b/src/Libraries/Web/Html/TouchInfo.cs index f1f2d57f3..c0273a578 100644 --- a/src/Libraries/Web/Html/TouchInfo.cs +++ b/src/Libraries/Web/Html/TouchInfo.cs @@ -8,63 +8,63 @@ namespace System.Html { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class TouchInfo { internal TouchInfo() { } - [IntrinsicProperty] + [ScriptField] public int ClientX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ClientY { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int Identifier { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int PageX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int PageY { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ScreenX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public long ScreenY { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Element Target { get { return null; diff --git a/src/Libraries/Web/Html/Window.cs b/src/Libraries/Web/Html/Window.cs index 70fba18a2..6fab1367e 100644 --- a/src/Libraries/Web/Html/Window.cs +++ b/src/Libraries/Web/Html/Window.cs @@ -5,6 +5,9 @@ using System; using System.Html.Data; +using System.Html.Data.Files; +using System.Html.Data.IndexedDB; +using System.Html.Data.Sql; using System.Runtime.CompilerServices; namespace System.Html { @@ -13,39 +16,46 @@ namespace System.Html { /// The window object represents the current browser window, and is the top-level /// scripting object. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("window")] public sealed class Window { private Window() { } - [IntrinsicProperty] + [ScriptField] public static ApplicationCache ApplicationCache { get { return null; } } + [ScriptField] + public static Blob Blob { + get { + return null; + } + } + /// /// IE only. /// - [IntrinsicProperty] + [ScriptField] public static DataTransfer ClipboardData { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static bool Closed { get { return false; } } - [IntrinsicProperty] + [ScriptField] public static string DefaultStatus { get { return null; @@ -54,14 +64,14 @@ public static string DefaultStatus { } } - [IntrinsicProperty] + [ScriptField] public static object DialogArguments { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static DocumentInstance Document { get { return null; @@ -71,70 +81,91 @@ public static DocumentInstance Document { /// /// Provides information about the current event being handled. /// - [IntrinsicProperty] + [ScriptField] public static ElementEvent Event { get { return null; } } - [IntrinsicProperty] + [ScriptField] + public static File File { + get { + return null; + } + } + + [ScriptField] + public static FileList FileList { + get { + return null; + } + } + + [ScriptField] + public static FileReader FileReader { + get { + return null; + } + } + + [ScriptField] public static IFrameElement FrameElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static History History { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static int InnerHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static int InnerWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static Storage LocalStorage { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Location Location { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Navigator Navigator { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance Parent { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static ErrorHandler Onerror { get { return null; @@ -143,70 +174,70 @@ public static ErrorHandler Onerror { } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance Opener { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Orientation Orientation { get { return Orientation.Portrait; } } - [IntrinsicProperty] + [ScriptField] public static int OuterHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static int OuterWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static int PageXOffset { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static int PageYOffset { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static Screen Screen { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance Self { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static Storage SessionStorage { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static string Status { get { return null; @@ -215,14 +246,14 @@ public static string Status { } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance Top { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static WindowInstance[] Frames { get { return null; @@ -293,6 +324,28 @@ public static void Alert(object o) { public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Decodes a string of data which has been encoded using base-64 encoding. + /// For use with Unicode or UTF-8 strings. + /// + /// Base64 encoded string + /// String of Binary data + [ScriptName("atob")] + public static string Base64ToBinary(string base64EncodedData) { + return null; + } + + /// + /// Creates a base-64 encoded ASCII string from a "string" of binary data. + /// Please note that this is not suitable for raw Unicode strings! + /// + /// String of binary data + /// Base64 string + [ScriptName("btoa")] + public static string BinaryToBase64(string stringToEncode) { + return null; + } + public static void Close() { } @@ -373,6 +426,18 @@ public static void RemoveEventListener(string eventName, ElementEventListener li public static void RemoveEventListener(string eventName, ElementEventListener listener, bool useCapture) { } + [ScriptAlias("require")] + public static void Require(string[] names, Action callback) { + } + + [ScriptAlias("require")] + public static void Require(string name, Action callback) { + } + + [ScriptAlias("require")] + public static void Require(string name, Action callback) { + } + public static void Scroll(int x, int y) { } @@ -398,6 +463,14 @@ public static SqlDatabase OpenDatabase(string name, string version, string displ return null; } + [ScriptField] + public static DBFactory IndexedDB { + get { + return null; + } + } + + public static void PostMessage(string message, string targetOrigin) { } diff --git a/src/Libraries/Web/Html/WindowInstance.cs b/src/Libraries/Web/Html/WindowInstance.cs index 6789b0f25..65e07b4df 100644 --- a/src/Libraries/Web/Html/WindowInstance.cs +++ b/src/Libraries/Web/Html/WindowInstance.cs @@ -12,21 +12,21 @@ namespace System.Html { /// The window object represents the current browser window, and is the top-level /// scripting object. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class WindowInstance { private WindowInstance() { } - [IntrinsicProperty] + [ScriptField] public bool Closed { get { return false; } } - [IntrinsicProperty] + [ScriptField] public string DefaultStatus { get { return null; @@ -35,91 +35,91 @@ public string DefaultStatus { } } - [IntrinsicProperty] + [ScriptField] public DocumentInstance Document { get { return null; } } - [IntrinsicProperty] + [ScriptField] public IFrameElement FrameElement { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int InnerHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int InnerWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public Location Location { get { return null; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance Parent { get { return null; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance Opener { get { return null; } } - [IntrinsicProperty] + [ScriptField] public static int OuterHeight { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public static int OuterWidth { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int PageXOffset { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int PageYOffset { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance Self { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Status { get { return null; @@ -128,14 +128,14 @@ public string Status { } } - [IntrinsicProperty] + [ScriptField] public WindowInstance Top { get { return null; } } - [IntrinsicProperty] + [ScriptField] public WindowInstance[] Frames { get { return null; diff --git a/src/Libraries/Web/Loader.cs b/src/Libraries/Web/Loader.cs deleted file mode 100644 index 267beede8..000000000 --- a/src/Libraries/Web/Loader.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Loader.cs -// Script#/Libraries/Web -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System.Runtime.CompilerServices; - -namespace System { - - [IgnoreNamespace] - [Imported] - [ScriptName("loader")] - public static class Loader { - - /// - /// Loads the specified scripts. - /// - /// The names of scripts that are required and must be loaded. - public static void LoadScripts(string[] scriptNames) { - } - - /// - /// Loads the specified scripts and invokes the specified callback once they have been - /// loaded. - /// - /// The names of scripts that are required and must be loaded. - /// A callback to be invoked once the scripts have been loaded. - public static void LoadScripts(string[] scriptNames, Action callback) { - } - - /// - /// Loads the specified scripts and invokes the specified callback once they have been - /// loaded. - /// - /// The names of scripts that are required and must be loaded. - /// A callback to be invoked once the scripts have been loaded. - /// The object to be passed in into the callback. - /// The type of the context object. - public static void LoadScripts(string[] scriptNames, Action callback, TContext context) { - } - - /// - /// Registers the specified callback to be invoked when the DOM is ready, - /// and before any script loading has begun. - /// - /// The callback to invoke. - [ScriptName("init")] - public static void OnInit(Action callback) { - } - - /// - /// Registers a callback to be invoked once any necessary scripts - /// have been loaded. - /// - /// The callback to be invoked. - [ScriptName("ready")] - public static void OnReady(Action callback) { - } - - /// - /// Registers information about a script. - /// - /// The information about a script. - public static void RegisterScript(ScriptInfo scriptInfo) { - } - } -} diff --git a/src/Libraries/Web/Net/HttpVerb.cs b/src/Libraries/Web/Net/HttpVerb.cs index 27f5fed3e..fe63a74db 100644 --- a/src/Libraries/Web/Net/HttpVerb.cs +++ b/src/Libraries/Web/Net/HttpVerb.cs @@ -9,9 +9,9 @@ namespace System.Net { - [IgnoreNamespace] - [Imported] - [NamedValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants(UseNames = true)] public enum HttpVerb { [ScriptName("GET")] diff --git a/src/Libraries/Web/Net/ReadyState.cs b/src/Libraries/Web/Net/ReadyState.cs index 57821b96c..b836c4e20 100644 --- a/src/Libraries/Web/Net/ReadyState.cs +++ b/src/Libraries/Web/Net/ReadyState.cs @@ -9,9 +9,9 @@ namespace System.Net { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum ReadyState { Uninitialized = 0, diff --git a/src/Libraries/Web/Net/XmlHttpRequest.cs b/src/Libraries/Web/Net/XmlHttpRequest.cs index 32a6dc487..40ebd2a52 100644 --- a/src/Libraries/Web/Net/XmlHttpRequest.cs +++ b/src/Libraries/Web/Net/XmlHttpRequest.cs @@ -9,12 +9,12 @@ namespace System.Net { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("XMLHttpRequest")] public sealed class XmlHttpRequest { - [IntrinsicProperty] + [ScriptField] [ScriptName("onreadystatechange")] public Action OnReadyStateChange { get { @@ -24,14 +24,14 @@ public Action OnReadyStateChange { } } - [IntrinsicProperty] + [ScriptField] public ReadyState ReadyState { get { return ReadyState.Uninitialized; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("responseXML")] public XmlDocument ResponseXml { get { @@ -39,21 +39,21 @@ public XmlDocument ResponseXml { } } - [IntrinsicProperty] + [ScriptField] public string ResponseText { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int Status { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string StatusText { get { return null; diff --git a/src/Libraries/Web/ScriptInfo.cs b/src/Libraries/Web/ScriptInfo.cs deleted file mode 100644 index 06a571a06..000000000 --- a/src/Libraries/Web/ScriptInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -// ScriptInfo.cs -// Script#/Libraries/Web -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System.Runtime.CompilerServices; - -namespace System { - - [IgnoreNamespace] - [Imported] - [ScriptName("Object")] - public sealed class ScriptInfo { - - [IntrinsicProperty] - [ScriptName("requires")] - public string[] Dependencies { - get; - set; - } - - [IntrinsicProperty] - public string Name { - get; - set; - } - - [IntrinsicProperty] - [ScriptName("src")] - public string Source { - get; - set; - } - } -} diff --git a/src/Libraries/Web/Web.csproj b/src/Libraries/Web/Web.csproj index 3c1abc55d..792b45c68 100644 --- a/src/Libraries/Web/Web.csproj +++ b/src/Libraries/Web/Web.csproj @@ -48,7 +48,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -56,18 +91,19 @@ + - - - - - - + + + + + + @@ -144,8 +180,7 @@ Properties\ScriptSharp.cs - - + diff --git a/src/Libraries/Web/Xml/XmlAttribute.cs b/src/Libraries/Web/Xml/XmlAttribute.cs index 36611fc2f..9091d1cb0 100644 --- a/src/Libraries/Web/Xml/XmlAttribute.cs +++ b/src/Libraries/Web/Xml/XmlAttribute.cs @@ -7,28 +7,28 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class XmlAttribute : XmlNode { internal XmlAttribute() { } - [IntrinsicProperty] + [ScriptField] public override string Name { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool Specified { get { return false; } } - [IntrinsicProperty] + [ScriptField] public override string Value { get { return null; diff --git a/src/Libraries/Web/Xml/XmlDocument.cs b/src/Libraries/Web/Xml/XmlDocument.cs index 139d90f15..2629072e9 100644 --- a/src/Libraries/Web/Xml/XmlDocument.cs +++ b/src/Libraries/Web/Xml/XmlDocument.cs @@ -10,21 +10,21 @@ namespace System.Xml { /// /// Represents the hierarchy of node objects parsed from XML markup. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class XmlDocument : XmlNode { internal XmlDocument() { } - [IntrinsicProperty] + [ScriptField] public string Doctype { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode DocumentElement { get { return null; @@ -59,5 +59,9 @@ public XmlNode CreateProcessingInstruction(string target, string data) { public XmlText CreateTextNode(string text) { return null; } + + public XmlNode ImportNode(XmlNode externalNode, bool deep) { + return null; + } } } diff --git a/src/Libraries/Web/Xml/XmlDocumentParser.cs b/src/Libraries/Web/Xml/XmlDocumentParser.cs index 2008fa56c..dac01bca5 100644 --- a/src/Libraries/Web/Xml/XmlDocumentParser.cs +++ b/src/Libraries/Web/Xml/XmlDocumentParser.cs @@ -8,8 +8,8 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("DOMParser")] public sealed class XmlDocumentParser { diff --git a/src/Libraries/Web/Xml/XmlNamedNodeMap.cs b/src/Libraries/Web/Xml/XmlNamedNodeMap.cs index 531f96dfe..304f7468d 100644 --- a/src/Libraries/Web/Xml/XmlNamedNodeMap.cs +++ b/src/Libraries/Web/Xml/XmlNamedNodeMap.cs @@ -8,14 +8,14 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class XmlNamedNodeMap : IEnumerable { internal XmlNamedNodeMap() { } - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] public int Count { get { @@ -23,7 +23,7 @@ public int Count { } } - [IntrinsicProperty] + [ScriptField] public XmlNode this[int index] { get { return null; diff --git a/src/Libraries/Web/Xml/XmlNode.cs b/src/Libraries/Web/Xml/XmlNode.cs index 1ab9dc6ab..e1fb1a90e 100644 --- a/src/Libraries/Web/Xml/XmlNode.cs +++ b/src/Libraries/Web/Xml/XmlNode.cs @@ -7,56 +7,56 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class XmlNode { internal XmlNode() { } - [IntrinsicProperty] + [ScriptField] public XmlNamedNodeMap Attributes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string BaseName { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNodeList ChildNodes { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode FirstChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode LastChild { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode NextSibling { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("nodeName")] public virtual string Name { get { @@ -64,14 +64,14 @@ public virtual string Name { } } - [IntrinsicProperty] + [ScriptField] public XmlNodeType NodeType { get { return 0; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("nodeValue")] public virtual string Value { get { @@ -81,35 +81,35 @@ public virtual string Value { } } - [IntrinsicProperty] + [ScriptField] public XmlDocument OwnerDocument { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode ParentNode { get { return null; } } - [IntrinsicProperty] + [ScriptField] public string Prefix { get { return null; } } - [IntrinsicProperty] + [ScriptField] public XmlNode PreviousSibling { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("text")] public string InnerText { get { @@ -117,7 +117,7 @@ public string InnerText { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("xml")] public string OuterXml { get { @@ -137,31 +137,31 @@ public XmlNodeList GetElementsByTagName(string tagName) { return null; } - public bool HasChildNodes() { + public bool HasAttributes() { return false; } - public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { - return null; + public bool HasChildNodes() { + return false; } - public XmlNode RemoveChild(XmlNode child) { + public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { return null; } - public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { + public XmlNode QuerySelector(string selector) { return null; } - public XmlNodeList SelectNodes(string xpath) { + public XmlNodeList QuerySelectorAll(string selector) { return null; } - public XmlNode SelectSingleNode(string xpath) { + public XmlNode RemoveChild(XmlNode child) { return null; } - public string TransformNode(XmlDocument stylesheet) { + public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { return null; } } diff --git a/src/Libraries/Web/Xml/XmlNodeList.cs b/src/Libraries/Web/Xml/XmlNodeList.cs index 90082d83d..52e3addfc 100644 --- a/src/Libraries/Web/Xml/XmlNodeList.cs +++ b/src/Libraries/Web/Xml/XmlNodeList.cs @@ -8,14 +8,14 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class XmlNodeList : IEnumerable { internal XmlNodeList() { } - [IntrinsicProperty] + [ScriptField] [ScriptName("length")] public int Count { get { @@ -23,7 +23,7 @@ public int Count { } } - [IntrinsicProperty] + [ScriptField] public XmlNode this[int index] { get { return null; diff --git a/src/Libraries/Web/Xml/XmlNodeType.cs b/src/Libraries/Web/Xml/XmlNodeType.cs index 6e9b9ac42..3723e48e4 100644 --- a/src/Libraries/Web/Xml/XmlNodeType.cs +++ b/src/Libraries/Web/Xml/XmlNodeType.cs @@ -7,9 +7,9 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum XmlNodeType { Element = 1, diff --git a/src/Libraries/Web/Xml/XmlSerializer.cs b/src/Libraries/Web/Xml/XmlSerializer.cs new file mode 100644 index 000000000..58e2c8178 --- /dev/null +++ b/src/Libraries/Web/Xml/XmlSerializer.cs @@ -0,0 +1,21 @@ +// XmlSerializer.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Xml { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("XMLSerializer")] + public sealed class XmlSerializer { + + [ScriptName("serializeToString")] + public string Serialize(XmlDocument xml) { + return null; + } + } +} diff --git a/src/Libraries/Web/Xml/XmlText.cs b/src/Libraries/Web/Xml/XmlText.cs index 72c0a7c33..e071d2383 100644 --- a/src/Libraries/Web/Xml/XmlText.cs +++ b/src/Libraries/Web/Xml/XmlText.cs @@ -7,21 +7,21 @@ namespace System.Xml { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class XmlText : XmlNode { internal XmlText() { } - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public string Data { get { return null; diff --git a/src/Libraries/jQuery/jQuery.Core/AjaxCallback.cs b/src/Libraries/jQuery/jQuery.Core/AjaxCallback.cs index 363ce9f6a..536ff5306 100644 --- a/src/Libraries/jQuery/jQuery.Core/AjaxCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/AjaxCallback.cs @@ -13,16 +13,16 @@ namespace jQueryApi { /// A callback to be invoked for an Ajax request. /// /// The result of the request. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxCallback(object data); /// /// A callback to be invoked for an Ajax request. /// /// The result of the request. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxCallback(TData data); /// @@ -31,8 +31,8 @@ namespace jQueryApi { /// The result of the request. /// The status of the request. /// The request that was invoked. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxRequestCallback(object data, string textStatus, jQueryXmlHttpRequest request); /// @@ -41,8 +41,8 @@ namespace jQueryApi { /// The result of the request. /// The status of the request. /// The request that was invoked. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxRequestCallback(TData data, string textStatus, jQueryDataHttpRequest request); /// @@ -51,8 +51,8 @@ namespace jQueryApi { /// The request that was invoked. /// The status of the request. /// The error or exception if any. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxErrorCallback(jQueryXmlHttpRequest request, string textStatus, Exception error); /// @@ -61,8 +61,8 @@ namespace jQueryApi { /// The request that was invoked. /// The status of the request. /// The error or exception if any. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxErrorCallback(jQueryDataHttpRequest request, string textStatus, Exception error); /// @@ -70,8 +70,8 @@ namespace jQueryApi { /// /// The request that was invoked. /// The status of the request. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxCompletedCallback(jQueryXmlHttpRequest request, string textStatus); /// @@ -79,24 +79,24 @@ namespace jQueryApi { /// /// The request that was invoked. /// The status of the request. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxCompletedCallback(jQueryDataHttpRequest request, string textStatus); /// /// A callback to be invoked for an Ajax request being sent. /// /// The request that was invoked. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxSendingCallback(jQueryXmlHttpRequest request); /// /// A callback to be invoked for an Ajax request being sent. /// /// The request that was invoked. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void AjaxSendingCallback(jQueryDataHttpRequest request); /// diff --git a/src/Libraries/jQuery/jQuery.Core/ArrayFilterCallback.cs b/src/Libraries/jQuery/jQuery.Core/ArrayFilterCallback.cs index a82c89266..f5eb438cd 100644 --- a/src/Libraries/jQuery/jQuery.Core/ArrayFilterCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ArrayFilterCallback.cs @@ -14,7 +14,7 @@ namespace jQueryApi { /// The item within the array. /// The index of the item. /// True if the value satisfies the filter; false if it doesn't. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ArrayFilterCallback(object item, int index); } diff --git a/src/Libraries/jQuery/jQuery.Core/ArrayIterationCallback.cs b/src/Libraries/jQuery/jQuery.Core/ArrayIterationCallback.cs index 0da73207c..89f8f35c0 100644 --- a/src/Libraries/jQuery/jQuery.Core/ArrayIterationCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ArrayIterationCallback.cs @@ -13,8 +13,8 @@ namespace jQueryApi { /// /// The index of the item. /// The item within the array. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ArrayIterationCallback(int index, object value); /// @@ -22,8 +22,8 @@ namespace jQueryApi { /// /// The index of the item. /// The item within the array. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ArrayIterationCallback(int index, T value); /// @@ -32,8 +32,8 @@ namespace jQueryApi { /// The index of the item. /// The item within the array. /// false if the iteration is to be stopped; true otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ArrayInterruptableIterationCallback(int index, object value); /// @@ -42,7 +42,7 @@ namespace jQueryApi { /// The index of the item. /// The item within the array. /// false if the iteration is to be stopped; true otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ArrayInterruptableIterationCallback(int index, T value); } diff --git a/src/Libraries/jQuery/jQuery.Core/ArrayMapCallback.cs b/src/Libraries/jQuery/jQuery.Core/ArrayMapCallback.cs index 49c21eca1..8764a4c41 100644 --- a/src/Libraries/jQuery/jQuery.Core/ArrayMapCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ArrayMapCallback.cs @@ -14,7 +14,7 @@ namespace jQueryApi { /// The item within the array. /// The index of the item. /// The value that the item was mapped to. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ArrayMapCallback(object item, int index); } diff --git a/src/Libraries/jQuery/jQuery.Core/BooleanFunction.cs b/src/Libraries/jQuery/jQuery.Core/BooleanFunction.cs index 876ab0480..1da552f5a 100644 --- a/src/Libraries/jQuery/jQuery.Core/BooleanFunction.cs +++ b/src/Libraries/jQuery/jQuery.Core/BooleanFunction.cs @@ -12,7 +12,7 @@ namespace jQueryApi { /// A callback that returns a value for the element at the specified index. /// /// The index of the element in the set. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool BooleanFunction(int index); } diff --git a/src/Libraries/jQuery/jQuery.Core/EffectDuration.cs b/src/Libraries/jQuery/jQuery.Core/EffectDuration.cs index 51ed1fc6c..818f3d125 100644 --- a/src/Libraries/jQuery/jQuery.Core/EffectDuration.cs +++ b/src/Libraries/jQuery/jQuery.Core/EffectDuration.cs @@ -11,9 +11,9 @@ namespace jQueryApi { /// /// Stock duration values for effects. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum EffectDuration { Fast, diff --git a/src/Libraries/jQuery/jQuery.Core/EffectEasing.cs b/src/Libraries/jQuery/jQuery.Core/EffectEasing.cs index c772056d8..03d5de868 100644 --- a/src/Libraries/jQuery/jQuery.Core/EffectEasing.cs +++ b/src/Libraries/jQuery/jQuery.Core/EffectEasing.cs @@ -11,9 +11,9 @@ namespace jQueryApi { /// /// Basic effect easing functions. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum EffectEasing { Swing, diff --git a/src/Libraries/jQuery/jQuery.Core/ElementFilterCallback.cs b/src/Libraries/jQuery/jQuery.Core/ElementFilterCallback.cs index d346739ed..bcb753768 100644 --- a/src/Libraries/jQuery/jQuery.Core/ElementFilterCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ElementFilterCallback.cs @@ -13,7 +13,7 @@ namespace jQueryApi { /// /// The index of the element in the matching set. /// true if the element should be included; false otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ElementFilterCallback(int index); } diff --git a/src/Libraries/jQuery/jQuery.Core/ElementIterationCallback.cs b/src/Libraries/jQuery/jQuery.Core/ElementIterationCallback.cs index 7731ab797..4acd6d275 100644 --- a/src/Libraries/jQuery/jQuery.Core/ElementIterationCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ElementIterationCallback.cs @@ -14,8 +14,8 @@ namespace jQueryApi { /// /// The index of the element. /// The element. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ElementIterationCallback(int index, Element element); /// @@ -24,7 +24,7 @@ namespace jQueryApi { /// The index of the element. /// The element. /// false if the iteration is to be stopped; true otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ElementInterruptibleIterationCallback(int index, Element element); } diff --git a/src/Libraries/jQuery/jQuery.Core/ElementMapCallback.cs b/src/Libraries/jQuery/jQuery.Core/ElementMapCallback.cs index 2f0d28fb7..68bd65859 100644 --- a/src/Libraries/jQuery/jQuery.Core/ElementMapCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ElementMapCallback.cs @@ -15,7 +15,7 @@ namespace jQueryApi { /// The index of the element. /// The element. /// The object that the element is mapped to. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ElementMapCallback(int index, Element element); } diff --git a/src/Libraries/jQuery/jQuery.Core/IDeferred.cs b/src/Libraries/jQuery/jQuery.Core/IDeferred.cs index 898c63f65..2485026a5 100644 --- a/src/Libraries/jQuery/jQuery.Core/IDeferred.cs +++ b/src/Libraries/jQuery/jQuery.Core/IDeferred.cs @@ -11,8 +11,8 @@ namespace jQueryApi { /// /// Represents a deferred value. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public interface IDeferred { /// @@ -130,8 +130,8 @@ public interface IDeferred { /// /// Represents a deferred value. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public interface IDeferred { /// diff --git a/src/Libraries/jQuery/jQuery.Core/ObjectIterationCallback.cs b/src/Libraries/jQuery/jQuery.Core/ObjectIterationCallback.cs index 0420b1ece..c9bda72db 100644 --- a/src/Libraries/jQuery/jQuery.Core/ObjectIterationCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ObjectIterationCallback.cs @@ -13,8 +13,8 @@ namespace jQueryApi { /// /// The name of the property. /// The value of the property. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate void ObjectIterationCallback(string name, object value); /// @@ -23,7 +23,7 @@ namespace jQueryApi { /// The name of the property. /// The value of the property. /// false if the iteration is to be stopped; true otherwise. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate bool ObjectInterruptableIterationCallback(string name, object value); } diff --git a/src/Libraries/jQuery/jQuery.Core/ObjectMapCallback.cs b/src/Libraries/jQuery/jQuery.Core/ObjectMapCallback.cs index 60d085d26..f5281bbe4 100644 --- a/src/Libraries/jQuery/jQuery.Core/ObjectMapCallback.cs +++ b/src/Libraries/jQuery/jQuery.Core/ObjectMapCallback.cs @@ -14,7 +14,7 @@ namespace jQueryApi { /// The item within the object. /// The key of the item. /// The value that the item was mapped to. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate object ObjectMapCallback(object item, string key); } diff --git a/src/Libraries/jQuery/jQuery.Core/PositionFunction.cs b/src/Libraries/jQuery/jQuery.Core/PositionFunction.cs index 0b1e17e45..f7448e12e 100644 --- a/src/Libraries/jQuery/jQuery.Core/PositionFunction.cs +++ b/src/Libraries/jQuery/jQuery.Core/PositionFunction.cs @@ -12,8 +12,8 @@ namespace jQueryApi { /// A callback that returns a value for the element at the specified index. /// /// The index of the element in the set. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate jQueryPosition PositionFunction(int index); /// @@ -21,7 +21,7 @@ namespace jQueryApi { /// /// The index of the element in the set. /// The current value. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate jQueryPosition PositionReplaceFunction(int index, jQueryPosition currentValue); } diff --git a/src/Libraries/jQuery/jQuery.Core/Properties/AssemblyInfo.cs b/src/Libraries/jQuery/jQuery.Core/Properties/AssemblyInfo.cs index 4eaeaee8d..e40bb09bf 100644 --- a/src/Libraries/jQuery/jQuery.Core/Properties/AssemblyInfo.cs +++ b/src/Libraries/jQuery/jQuery.Core/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.jQuery")] [assembly: AssemblyDescription("Script# jQuery Core API")] -[assembly: ScriptAssembly("jQuery")] +[assembly: ScriptAssembly("jquery", Identifier = "$")] diff --git a/src/Libraries/jQuery/jQuery.Core/StringFunction.cs b/src/Libraries/jQuery/jQuery.Core/StringFunction.cs index 4626c4b57..d36e7d298 100644 --- a/src/Libraries/jQuery/jQuery.Core/StringFunction.cs +++ b/src/Libraries/jQuery/jQuery.Core/StringFunction.cs @@ -12,8 +12,8 @@ namespace jQueryApi { /// A callback that returns a value for the element at the specified index. /// /// The index of the element in the set. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate string StringFunction(int index); /// @@ -21,7 +21,7 @@ namespace jQueryApi { /// /// The index of the element in the set. /// The current value. - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public delegate string StringReplaceFunction(int index, string currentValue); } diff --git a/src/Libraries/jQuery/jQuery.Core/jQuery.cs b/src/Libraries/jQuery/jQuery.Core/jQuery.cs index 672998cc1..4b4b8925e 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQuery.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQuery.cs @@ -17,8 +17,8 @@ namespace jQueryApi { /// /// The global jQuery object. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] [ScriptName("$")] public sealed class jQuery { @@ -29,7 +29,7 @@ private jQuery() { /// Gets or sets the rate (in milliseconds) at which animations fire. /// [ScriptName("fx.interval")] - [IntrinsicProperty] + [ScriptField] public static int AnimationInterval { get { return 0; @@ -42,7 +42,7 @@ public static int AnimationInterval { /// Gets or sets whether animations are disabled or not. /// [ScriptName("fx.off")] - [IntrinsicProperty] + [ScriptField] public static bool AnimationsDisabled { get { return false; @@ -54,7 +54,7 @@ public static bool AnimationsDisabled { /// /// Gets information about the current browser and its version. /// - [IntrinsicProperty] + [ScriptField] public static jQueryBrowser Browser { get { return null; @@ -66,7 +66,7 @@ public static jQueryBrowser Browser { /// /// The jQueryObject represented by 'this' within a plugin. [ScriptAlias("this")] - [IntrinsicProperty] + [ScriptField] public static jQueryObject Current { get { return null; @@ -77,7 +77,7 @@ public static jQueryObject Current { /// Gets the current document object wrapped into a jQuery object. /// [ScriptAlias("$(document)")] - [IntrinsicProperty] + [ScriptField] public static jQueryObject Document { get { return null; @@ -89,7 +89,7 @@ public static jQueryObject Document { /// /// The element represented by 'this' in a callback. [ScriptAlias("this")] - [IntrinsicProperty] + [ScriptField] public static Element Element { get { return null; @@ -100,7 +100,7 @@ public static Element Element { /// Gets the instance of the global jQuery object. /// [ScriptAlias("jQuery")] - [IntrinsicProperty] + [ScriptField] public static jQuery Instance { get { return null; @@ -110,7 +110,7 @@ public static jQuery Instance { /// /// Gets information about supported features and browser capabilities. /// - [IntrinsicProperty] + [ScriptField] public static jQuerySupport Support { get { return null; @@ -123,7 +123,7 @@ public static jQuerySupport Support { /// /// The jQueryObject for the element represented by 'this' in a callback. [ScriptAlias("$(this)")] - [IntrinsicProperty] + [ScriptField] public static jQueryObject This { get { return null; @@ -134,7 +134,7 @@ public static jQueryObject This { /// Gets the current window object wrapped into a jQuery object. /// [ScriptAlias("$(window)")] - [IntrinsicProperty] + [ScriptField] public static jQueryObject Window { get { return null; @@ -222,7 +222,7 @@ public static TEvent CustomEvent(string eventName) where TEvent : jQuery /// /// Creates a new instance of a deferred object. /// - [PreserveCase] + [ScriptName(PreserveCase = true)] public static jQueryDeferred Deferred() { return null; } @@ -230,7 +230,6 @@ public static jQueryDeferred Deferred() { /// /// Creates a new instance of a deferred object. /// - [PreserveCase] [ScriptName("Deferred")] public static jQueryDeferred DeferredData() { return null; @@ -240,7 +239,7 @@ public static jQueryDeferred DeferredData() { /// Creates a new instance of a deferred object. /// /// An initializer callback to initialize the new deferred object. - [PreserveCase] + [ScriptName(PreserveCase = true)] public static jQueryDeferred Deferred(jQueryDeferredInitializer initializer) { return null; } @@ -249,7 +248,6 @@ public static jQueryDeferred Deferred(jQueryDeferredInitializer initializer) { /// Creates a new instance of a deferred object. /// /// An initializer callback to initialize the new deferred object. - [PreserveCase] [ScriptName("Deferred")] public static jQueryDeferred DeferredData(jQueryDeferredInitializer initializer) { return null; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryAjaxOptions.cs b/src/Libraries/jQuery/jQuery.Core/jQueryAjaxOptions.cs index 5f64eaa73..34c2d7e10 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryAjaxOptions.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryAjaxOptions.cs @@ -13,8 +13,8 @@ namespace jQueryApi { /// /// Represents Ajax request settings or options. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class jQueryAjaxOptions { @@ -35,7 +35,7 @@ public jQueryAjaxOptions(params object[] nameValuePairs) { /// /// Gets or sets the content type sent in the request header that tells the server what kind of response it will accept in return. /// - [IntrinsicProperty] + [ScriptField] public Dictionary Accepts { get { return null; @@ -47,7 +47,7 @@ public Dictionary Accepts { /// /// Gets or sets whether the request is async. /// - [IntrinsicProperty] + [ScriptField] public bool Async { get { return false; @@ -59,7 +59,7 @@ public bool Async { /// /// Gets or sets the callback to invoke before the request is sent. /// - [IntrinsicProperty] + [ScriptField] public AjaxSendingCallback BeforeSend { get { return null; @@ -71,7 +71,7 @@ public AjaxSendingCallback BeforeSend { /// /// Gets or sets whether the request can be cached. /// - [IntrinsicProperty] + [ScriptField] public bool Cache { get { return false; @@ -84,7 +84,7 @@ public bool Cache { /// Gets or sets the callback invoked after the request is completed /// and success or error callbacks have been invoked. /// - [IntrinsicProperty] + [ScriptField] public AjaxCompletedCallback Complete { get { return null; @@ -96,8 +96,8 @@ public AjaxCompletedCallback Complete { /// /// Gets or sets a map of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. /// - [IntrinsicProperty] - public Dictionary Contents { + [ScriptField] + public Dictionary Contents { get { return null; } @@ -108,7 +108,7 @@ public Dictionary Contents { /// /// Gets or sets the content type of the data sent to the server. /// - [IntrinsicProperty] + [ScriptField] public string ContentType { get { return null; @@ -120,7 +120,7 @@ public string ContentType { /// /// Gets or sets the object that will be the context for the request. /// - [IntrinsicProperty] + [ScriptField] public object Context { get { return null; @@ -132,7 +132,7 @@ public object Context { /// /// Gets or sets a map of dataType-to-dataType converters. /// - [IntrinsicProperty] + [ScriptField] public Dictionary> Converters { get { return null; @@ -144,7 +144,7 @@ public Dictionary> Converters { /// /// Gets or sets if you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true /// - [IntrinsicProperty] + [ScriptField] public bool CrossDomain { get { return false; @@ -156,7 +156,7 @@ public bool CrossDomain { /// /// Gets or sets the data to be sent to the server. /// - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; @@ -168,7 +168,7 @@ public object Data { /// /// Gets or sets the data type expected in response from the server. /// - [IntrinsicProperty] + [ScriptField] public string DataType { get { return null; @@ -180,7 +180,7 @@ public string DataType { /// /// Gets or sets the callback to be invoked if the request fails. /// - [IntrinsicProperty] + [ScriptField] public AjaxErrorCallback Error { get { return null; @@ -192,7 +192,7 @@ public AjaxErrorCallback Error { /// /// Gets or sets whether to trigger global event handlers for this Ajax request. /// - [IntrinsicProperty] + [ScriptField] public bool Global { get { return false; @@ -204,7 +204,7 @@ public bool Global { /// /// Gets or sets if a map of additional header key/value pairs to send along with the request. /// - [IntrinsicProperty] + [ScriptField] public Dictionary Headers { get { return null; @@ -217,7 +217,7 @@ public Dictionary Headers { /// Gets or sets whether the request is successful only if its been modified since /// the last request. /// - [IntrinsicProperty] + [ScriptField] public bool IfModified { get { return false; @@ -230,7 +230,7 @@ public bool IfModified { /// Gets or sets whether the current environment should be treated as a local /// environment (eg. when the page is loaded using file:///). /// - [IntrinsicProperty] + [ScriptField] public bool IsLocal { get { return false; @@ -242,7 +242,7 @@ public bool IsLocal { /// /// Gets or sets the callback parameter name to use for JSONP requests. /// - [IntrinsicProperty] + [ScriptField] public string Jsonp { get { return null; @@ -254,7 +254,7 @@ public string Jsonp { /// /// Gets or sets the callback name to use for JSONP requests. /// - [IntrinsicProperty] + [ScriptField] public string JsonpCallback { get { return null; @@ -266,7 +266,7 @@ public string JsonpCallback { /// /// Gets or sets the mime type of the request. /// - [IntrinsicProperty] + [ScriptField] public string MimeType { get { return null; @@ -278,7 +278,7 @@ public string MimeType { /// /// Gets or sets the password to be used for an HTTP authentication request. /// - [IntrinsicProperty] + [ScriptField] public string Password { get { return null; @@ -290,7 +290,7 @@ public string Password { /// /// Gets or sets whether the data passed in will be processed. /// - [IntrinsicProperty] + [ScriptField] public bool ProcessData { get { return false; @@ -302,7 +302,7 @@ public bool ProcessData { /// /// Gets or sets how to handle character sets for script and JSONP requests. /// - [IntrinsicProperty] + [ScriptField] public string ScriptCharset { get { return null; @@ -314,7 +314,7 @@ public string ScriptCharset { /// /// Gets or sets a map of numeric HTTP codes and functions to be called when the response has the corresponding code. /// - [IntrinsicProperty] + [ScriptField] public Dictionary StatusCode { get { return null; @@ -326,7 +326,7 @@ public Dictionary StatusCode { /// /// Gets or sets the function to invoke upon successful completion of the request. /// - [IntrinsicProperty] + [ScriptField] public AjaxRequestCallback Success { get { return null; @@ -338,7 +338,7 @@ public AjaxRequestCallback Success { /// /// Gets or sets the timeout in milliseconds for the request. /// - [IntrinsicProperty] + [ScriptField] public int Timeout { get { return 0; @@ -350,7 +350,7 @@ public int Timeout { /// /// Gets or sets if you want to use traditional parameter serialization. /// - [IntrinsicProperty] + [ScriptField] public bool Traditional { get { return false; @@ -362,7 +362,7 @@ public bool Traditional { /// /// Gets or sets the type or HTTP verb associated with the request. /// - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; @@ -374,7 +374,7 @@ public string Type { /// /// Gets or sets the URL to be requested. /// - [IntrinsicProperty] + [ScriptField] public string Url { get { return null; @@ -386,7 +386,7 @@ public string Url { /// /// Gets or sets the name of the user to use in a HTTP authentication request. /// - [IntrinsicProperty] + [ScriptField] public string Username { get { return null; @@ -398,7 +398,7 @@ public string Username { /// /// Gets or sets the function creating the XmlHttpRequest instance. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("xhr")] public XmlHttpRequestCreator XmlHttpRequestCreator { get { @@ -412,7 +412,7 @@ public XmlHttpRequestCreator XmlHttpRequestCreator { /// Gets or sets a set of additional name/value pairs set of the XmlHttpRequest /// object. /// - [IntrinsicProperty] + [ScriptField] public Dictionary XhrFields { get { return null; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryBrowser.cs b/src/Libraries/jQuery/jQuery.Core/jQueryBrowser.cs index 211a9e622..96224f594 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryBrowser.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryBrowser.cs @@ -11,8 +11,8 @@ namespace jQueryApi { /// /// Provides information about the current browser. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryBrowser { private jQueryBrowser() { @@ -21,7 +21,7 @@ private jQueryBrowser() { /// /// Gets whether the current browser is Opera. /// - [IntrinsicProperty] + [ScriptField] public bool Opera { get { return true; @@ -31,7 +31,7 @@ public bool Opera { /// /// Gets whether the current browser is a Mozilla-based browser. /// - [IntrinsicProperty] + [ScriptField] public bool Mozilla { get { return true; @@ -41,7 +41,7 @@ public bool Mozilla { /// /// Gets whether the current browser is Microsoft Internet Explorer. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("msie")] public bool MSIE { get { @@ -52,7 +52,7 @@ public bool MSIE { /// /// Gets whether the current browser is Safari. /// - [IntrinsicProperty] + [ScriptField] public bool Safari { get { return true; @@ -62,7 +62,7 @@ public bool Safari { /// /// Gets the browser version information. /// - [IntrinsicProperty] + [ScriptField] public string Version { get { return String.Empty; @@ -72,7 +72,7 @@ public string Version { /// /// Gets whether the current browser is WebKit-based. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("webkit")] public bool WebKit { get { diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryDataHttpRequest.cs b/src/Libraries/jQuery/jQuery.Core/jQueryDataHttpRequest.cs index 00b33a8c3..5fd004a2a 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryDataHttpRequest.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryDataHttpRequest.cs @@ -13,8 +13,8 @@ namespace jQueryApi { /// /// Represents an XMLHttpRequest object as a deferred object. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryDataHttpRequest : IDeferred { private jQueryDataHttpRequest() { @@ -23,7 +23,7 @@ private jQueryDataHttpRequest() { /// /// The ready state property of the XmlHttpRequest object. /// - [IntrinsicProperty] + [ScriptField] public ReadyState ReadyState { get { return ReadyState.Uninitialized; @@ -33,7 +33,7 @@ public ReadyState ReadyState { /// /// The XML document for an XML response. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("responseXML")] public XmlDocument ResponseXml { get { @@ -44,7 +44,7 @@ public XmlDocument ResponseXml { /// /// The text of the response. /// - [IntrinsicProperty] + [ScriptField] public string ResponseText { get { return null; @@ -54,7 +54,7 @@ public string ResponseText { /// /// The status code associated with the response. /// - [IntrinsicProperty] + [ScriptField] public int Status { get { return 0; @@ -64,7 +64,7 @@ public int Status { /// /// The status text of the response. /// - [IntrinsicProperty] + [ScriptField] public string StatusText { get { return null; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryDeferred.cs b/src/Libraries/jQuery/jQuery.Core/jQueryDeferred.cs index 5611c91b1..d7695798c 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryDeferred.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryDeferred.cs @@ -11,8 +11,8 @@ namespace jQueryApi { /// /// Represents a deferred value. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryDeferred : IDeferred { private jQueryDeferred() { @@ -252,8 +252,8 @@ IDeferred IDeferred.Then(Callback[] doneCallbacks, Callback[] failCallbacks) { /// /// Represents a deferred value. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryDeferred : IDeferred { private jQueryDeferred() { diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs b/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs index dc3b823f1..ae0d7d431 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs @@ -13,56 +13,56 @@ namespace jQueryApi { /// /// Provides information about the current event. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public class jQueryEvent { protected jQueryEvent() { } - [IntrinsicProperty] + [ScriptField] public bool AltKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public bool Bubbles { get { return false; } } - [IntrinsicProperty] + [ScriptField] public int Button { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public bool Cancelable { get { return false; } } - [IntrinsicProperty] + [ScriptField] public bool CtrlKey { get { return false; } } - [IntrinsicProperty] + [ScriptField] public int ClientX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ClientY { get { return 0; @@ -72,7 +72,7 @@ public int ClientY { /// /// Gets the current DOM element within the event bubbling phase. /// - [IntrinsicProperty] + [ScriptField] public Element CurrentTarget { get { return null; @@ -82,38 +82,55 @@ public Element CurrentTarget { /// /// Gets the event data that was passed in into the Bind method. /// - [IntrinsicProperty] + [ScriptField] public Dictionary Data { get { return null; } } + [ScriptField] + public bool MetaKey { + get { + return false; + } + } + /// /// Gets the namespace specified when the event was triggered. /// - [IntrinsicProperty] + [ScriptField] public string Namespace { get { return null; } } - [IntrinsicProperty] + [ScriptField] public int OffsetX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int OffsetY { get { return 0; } } - [IntrinsicProperty] + /// + /// Gets the original DOM event which spawned this event. + /// + [ScriptField] + public ElementEvent OriginalEvent { + get{ + return null; + } + } + + [ScriptField] public Element OriginalTarget { get { return null; @@ -123,7 +140,7 @@ public Element OriginalTarget { /// /// Gets the mouse position relative to left edge of the document. /// - [IntrinsicProperty] + [ScriptField] public int PageX { get { return 0; @@ -133,21 +150,21 @@ public int PageX { /// /// Gets the mouse position relative to top edge of the document. /// - [IntrinsicProperty] + [ScriptField] public int PageY { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ScreenX { get { return 0; } } - [IntrinsicProperty] + [ScriptField] public int ScreenY { get { return 0; @@ -157,7 +174,7 @@ public int ScreenY { /// /// Gets the other DOM element associated with the event if any. /// - [IntrinsicProperty] + [ScriptField] public Element RelatedTarget { get { return null; @@ -167,14 +184,14 @@ public Element RelatedTarget { /// /// Gets the value returned by the last event handler if any. /// - [IntrinsicProperty] + [ScriptField] public object Result { get { return null; } } - [IntrinsicProperty] + [ScriptField] public bool ShiftKey { get { return false; @@ -184,7 +201,7 @@ public bool ShiftKey { /// /// Gets the DOM element that initiated the event. /// - [IntrinsicProperty] + [ScriptField] public Element Target { get { return null; @@ -195,7 +212,7 @@ public Element Target { /// Gets the number of milliseconds since Jan 1, 1970, when the event /// was triggered. /// - [IntrinsicProperty] + [ScriptField] public long TimeStamp { get { return 0; @@ -205,7 +222,7 @@ public long TimeStamp { /// /// Gets the type or name of the event. /// - [IntrinsicProperty] + [ScriptField] public string Type { get { return null; @@ -215,7 +232,7 @@ public string Type { /// /// Gets the key or button that was pressed. /// - [IntrinsicProperty] + [ScriptField] public int Which { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryEventHandler.cs b/src/Libraries/jQuery/jQuery.Core/jQueryEventHandler.cs index c29d61beb..b86a8804a 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryEventHandler.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryEventHandler.cs @@ -11,7 +11,7 @@ namespace jQueryApi { /// /// Handles a jQuery event. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public delegate void jQueryEventHandler(jQueryEvent e); } diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryNameValuePair.cs b/src/Libraries/jQuery/jQuery.Core/jQueryNameValuePair.cs index 10afe1abc..c57e44375 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryNameValuePair.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryNameValuePair.cs @@ -11,8 +11,8 @@ namespace jQueryApi { /// /// Represents a name and value. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryNameValuePair { private jQueryNameValuePair() { @@ -21,7 +21,7 @@ private jQueryNameValuePair() { /// /// Gets the name. /// - [IntrinsicProperty] + [ScriptField] public string Name { get { return null; @@ -31,7 +31,7 @@ public string Name { /// /// Gets the value. /// - [IntrinsicProperty] + [ScriptField] public object Value { get { return null; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryObject.cs b/src/Libraries/jQuery/jQuery.Core/jQueryObject.cs index a80714367..28a6d62d9 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryObject.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi { /// /// Represents a jQuery result that wraps a set of elements. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public class jQueryObject { /// @@ -28,7 +28,7 @@ protected jQueryObject() { /// Gets the Document or DOM element used as the context to match /// this set of elements. /// - [IntrinsicProperty] + [ScriptField] public object Context { get { return null; @@ -38,7 +38,7 @@ public object Context { /// /// Gets the number of elements in this . /// - [IntrinsicProperty] + [ScriptField] public int Length { get { return 0; @@ -48,7 +48,7 @@ public int Length { /// /// Gets the selector used to match this set of elements. /// - [IntrinsicProperty] + [ScriptField] public string Selector { get { return null; @@ -60,7 +60,7 @@ public string Selector { /// /// The index to lookup. /// The DOM element at the specified index. - [IntrinsicProperty] + [ScriptField] public Element this[int index] { get { return null; @@ -3601,6 +3601,15 @@ public jQueryObject Undelegate([SyntaxValidation("cssSelector")] string selector return null; } + /// + /// Sorts an array of DOM elements, in place, with the duplicates removed. + /// + /// The original list of elements + /// The unique list of elements. + public Element[] Unique(Element[] elements) { + return null; + } + /// /// Attaches a handler to the unload event on each of the matched set of elements. /// diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs b/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs index ccd50ecae..24d084f60 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs @@ -12,31 +12,39 @@ namespace jQueryApi { /// /// Provides information about the position of an element. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] public sealed class jQueryPosition { - private jQueryPosition() { + public jQueryPosition() { + } + + public jQueryPosition(params object[] nameValuePairs) { } /// /// Gets the left coordinate. /// - [IntrinsicProperty] + [ScriptField] public int Left { get { return 0; } + set { + } } /// /// Gets the top coordinate. /// - [IntrinsicProperty] + [ScriptField] public int Top { get { return 0; } + set { + } } public static implicit operator Dictionary(jQueryPosition position) { diff --git a/src/Libraries/jQuery/jQuery.Core/jQuerySupport.cs b/src/Libraries/jQuery/jQuery.Core/jQuerySupport.cs index 7463c1bb4..d0d596c59 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQuerySupport.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQuerySupport.cs @@ -12,8 +12,8 @@ namespace jQueryApi { /// Represents the properties that indicate existence of browser features /// and bugs. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class jQuerySupport { private jQuerySupport() { @@ -23,17 +23,28 @@ private jQuerySupport() { /// This is equal to true if the page and browser are rendered according to the /// W3C CSS Box Model. /// - [IntrinsicProperty] + [ScriptField] public bool BoxModel { get { return false; } } + /// + /// True if the browser supports cross origin requests. + /// + [ScriptField] + [ScriptName("cors")] + public bool CORS { + get { + return false; + } + } + /// /// True if cssFloat is the name of the float CSS property. False if it is styleFloat. /// - [IntrinsicProperty] + [ScriptField] public bool CssFloat { get { return false; @@ -43,7 +54,7 @@ public bool CssFloat { /// /// True if the browser leaves URLs returned from getAttribute("href") intact. /// - [IntrinsicProperty] + [ScriptField] public bool HrefNormalized { get { return false; @@ -53,7 +64,7 @@ public bool HrefNormalized { /// /// True is the browser properly serializes link elements when innerHTML is used. /// - [IntrinsicProperty] + [ScriptField] public bool HtmlSerialize { get { return false; @@ -63,7 +74,7 @@ public bool HtmlSerialize { /// /// True if the browser preserves leading whitespace when innerHTML is used. /// - [IntrinsicProperty] + [ScriptField] public bool LeadingWhitespace { get { return false; @@ -73,7 +84,7 @@ public bool LeadingWhitespace { /// /// True if the browser does not copy over the checked expando when elements are cloned. /// - [IntrinsicProperty] + [ScriptField] public bool NoCloneChecked { get { return false; @@ -83,7 +94,7 @@ public bool NoCloneChecked { /// /// True if the browser does not clone event handlers when elements are cloned. /// - [IntrinsicProperty] + [ScriptField] public bool NoCloneEvent { get { return false; @@ -93,7 +104,7 @@ public bool NoCloneEvent { /// /// True if doing getElementsByTagName('*') on an object element returns all descendant elements. /// - [IntrinsicProperty] + [ScriptField] public bool ObjectAll { get { return false; @@ -103,7 +114,7 @@ public bool ObjectAll { /// /// True if a browser can properly interpret the opacity style property. /// - [IntrinsicProperty] + [ScriptField] public bool Opacity { get { return false; @@ -113,7 +124,7 @@ public bool Opacity { /// /// True if using appendChild/createTextNode to inject inline scripts executes them. /// - [IntrinsicProperty] + [ScriptField] public bool ScriptEval { get { return false; @@ -123,7 +134,7 @@ public bool ScriptEval { /// /// True if getAttribute("style") is able to return the inline style specified by an element. /// - [IntrinsicProperty] + [ScriptField] public bool Style { get { return false; @@ -133,7 +144,7 @@ public bool Style { /// /// True if the browser allows table elements without tbody elements. /// - [IntrinsicProperty] + [ScriptField] public bool Tbody { get { return false; diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryXmlHttpRequest.cs b/src/Libraries/jQuery/jQuery.Core/jQueryXmlHttpRequest.cs index fb0501d22..322622d44 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryXmlHttpRequest.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryXmlHttpRequest.cs @@ -13,8 +13,8 @@ namespace jQueryApi { /// /// Represents an XMLHttpRequest object as a deferred object. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryXmlHttpRequest : IDeferred { private jQueryXmlHttpRequest() { @@ -23,7 +23,7 @@ private jQueryXmlHttpRequest() { /// /// The ready state property of the XmlHttpRequest object. /// - [IntrinsicProperty] + [ScriptField] public ReadyState ReadyState { get { return ReadyState.Uninitialized; @@ -33,7 +33,7 @@ public ReadyState ReadyState { /// /// The XML document for an XML response. /// - [IntrinsicProperty] + [ScriptField] [ScriptName("responseXML")] public XmlDocument ResponseXml { get { @@ -44,7 +44,7 @@ public XmlDocument ResponseXml { /// /// The text of the response. /// - [IntrinsicProperty] + [ScriptField] public string ResponseText { get { return null; @@ -54,7 +54,7 @@ public string ResponseText { /// /// The status code associated with the response. /// - [IntrinsicProperty] + [ScriptField] public int Status { get { return 0; @@ -64,7 +64,7 @@ public int Status { /// /// The status text of the response. /// - [IntrinsicProperty] + [ScriptField] public string StatusText { get { return null; diff --git a/src/Libraries/jQuery/jQuery.History/Properties/AssemblyInfo.cs b/src/Libraries/jQuery/jQuery.History/Properties/AssemblyInfo.cs index 7b02d552c..5ae28f0a4 100644 --- a/src/Libraries/jQuery/jQuery.History/Properties/AssemblyInfo.cs +++ b/src/Libraries/jQuery/jQuery.History/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.jQuery.History")] [assembly: AssemblyDescription("Script# jQuery BBQ/History Plugin")] -[assembly: ScriptAssembly("jQueryBBQ")] +[assembly: ScriptAssembly("jqueryBBQ")] diff --git a/src/Libraries/jQuery/jQuery.History/StateMergeMode.cs b/src/Libraries/jQuery/jQuery.History/StateMergeMode.cs index 358ae016c..75e5042f6 100644 --- a/src/Libraries/jQuery/jQuery.History/StateMergeMode.cs +++ b/src/Libraries/jQuery/jQuery.History/StateMergeMode.cs @@ -11,9 +11,9 @@ namespace jQueryApi.History { /// /// Specifies how new state is merged into the current state. /// - [IgnoreNamespace] - [Imported] - [NumericValues] + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] public enum StateMergeMode { /// diff --git a/src/Libraries/jQuery/jQuery.History/jQueryHistory.cs b/src/Libraries/jQuery/jQuery.History/jQueryHistory.cs index 5a0620838..7219e211d 100644 --- a/src/Libraries/jQuery/jQuery.History/jQueryHistory.cs +++ b/src/Libraries/jQuery/jQuery.History/jQueryHistory.cs @@ -14,8 +14,8 @@ namespace jQueryApi.History { /// /// Provides access to jQuery history and back button management APIs. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class jQueryHistory { /// diff --git a/src/Libraries/jQuery/jQuery.Templating/Properties/AssemblyInfo.cs b/src/Libraries/jQuery/jQuery.Templating/Properties/AssemblyInfo.cs index b7b55b0d7..28d063181 100644 --- a/src/Libraries/jQuery/jQuery.Templating/Properties/AssemblyInfo.cs +++ b/src/Libraries/jQuery/jQuery.Templating/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.jQuery.Templating")] [assembly: AssemblyDescription("Script# jQuery Templates Plugin")] -[assembly: ScriptAssembly("jQueryTmpl")] +[assembly: ScriptAssembly("jqueryTmpl")] diff --git a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplate.cs b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplate.cs index aea785be5..3ac32babe 100644 --- a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplate.cs +++ b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplate.cs @@ -16,8 +16,8 @@ namespace jQueryApi.Templating { /// Represents a jQuery template that has been parsed and can /// be used to generate HTML. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class jQueryTemplate { private jQueryTemplate() { diff --git a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateInstance.cs b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateInstance.cs index d0c3e4946..5a2653d60 100644 --- a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateInstance.cs +++ b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateInstance.cs @@ -15,8 +15,8 @@ namespace jQueryApi.Templating { /// /// Represents an instantiated jQuery template. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class jQueryTemplateInstance { private jQueryTemplateInstance() { @@ -25,7 +25,7 @@ private jQueryTemplateInstance() { /// /// Gets the data that this instance is based on. /// - [IntrinsicProperty] + [ScriptField] public object Data { get { return null; @@ -35,7 +35,7 @@ public object Data { /// /// Gets the elements that this template instance represents. /// - [IntrinsicProperty] + [ScriptField] public Element[] Nodes { get { return null; @@ -45,7 +45,7 @@ public Element[] Nodes { /// /// Gets or sets the template that this instance is based on. /// - [IntrinsicProperty] + [ScriptField] public jQueryTemplate Template { get { return null; diff --git a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateObject.cs b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateObject.cs index f123404c5..c47024d75 100644 --- a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateObject.cs +++ b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplateObject.cs @@ -16,8 +16,8 @@ namespace jQueryApi.Templating { /// Represents a jQuery result that wraps a set of elements, with templating /// APIs added. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class jQueryTemplateObject : jQueryObject { private jQueryTemplateObject() { diff --git a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplating.cs b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplating.cs index fc63d6c10..8aaa2dc60 100644 --- a/src/Libraries/jQuery/jQuery.Templating/jQueryTemplating.cs +++ b/src/Libraries/jQuery/jQuery.Templating/jQueryTemplating.cs @@ -14,8 +14,8 @@ namespace jQueryApi.Templating { /// /// Provides access to jQuery Templating APIs. /// - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public static class jQueryTemplating { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindObject.cs index 78839cd5a..276310f4f 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// The container has overflow:hidden applied, so height changes affect what's visible. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class BlindObject : EffectObject { private BlindObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOption.cs index 639b5d758..15fa27a66 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Blind. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum BlindOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOptions.cs index 5c7dd652c..4fcf4e296 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Blind/BlindOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Blind. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class BlindOptions { @@ -25,7 +25,7 @@ public BlindOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction the blind will be pulled to "hide" the element., or the direction from which the element will be revealed.Possible Values
    up
    down
    left
    right
    vertical
    horizontal
    ///
    - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element by pulling a blind in the direction
    show
    Shows the element by pulling a blind from the direction. This seems inverted from the hide.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceObject.cs index e0ab2a788..b6c505532 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class BounceObject : EffectObject { private BounceObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOption.cs index a8871b4c0..9fd52c5d7 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Bounce. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum BounceOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOptions.cs index 0617fd83e..7405d9ea7 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Bounce/BounceOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Bounce. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class BounceOptions { @@ -25,7 +25,7 @@ public BounceOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction the blind will be pulled to "hide" the element., or the direction from which the element will be revealed.Possible Values
    up
    down
    left
    right
    ///
    - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The distance of the largest "bounce" in pixels /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -61,7 +61,7 @@ public int Distance { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -73,7 +73,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -85,7 +85,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element by pulling a bouncing out the direction and fading out on the last half bounce
    show
    Shows the element by pulling a bouncing in from the direction fading in on the the first half bounce.
    toggle
    Will use hide or show depending on the current visibility of the element
    effect
    Just bounces the element, doesn't hide or show.
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; @@ -97,7 +97,7 @@ public string Mode { /// /// The number of times the element will bounce. When used with hide or show, there is an extra "half" bounce for the fade in/out /// - [IntrinsicProperty] + [ScriptField] public int Times { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipObject.cs index 3499bdd4f..089d848c9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ClipObject : EffectObject { private ClipObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOption.cs index de60f2d3b..c921ff7f4 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Clip. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ClipOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOptions.cs index 1c6e306aa..999005661 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Clip/ClipOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Clip. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ClipOptions { @@ -25,7 +25,7 @@ public ClipOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The plane in which the clip effect will hide or show its elementPossible Values
    vertical
    Uses top & bottom edges
    horizontal
    Uses left & right edges
    ///
    - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropObject.cs index bd0fb7aa5..9147b41d2 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class DropObject : EffectObject { private DropObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOption.cs index ca7d76ea4..7b8f5cc9c 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Drop. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DropOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOptions.cs index 4aba9006e..c81cfc72c 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Drop/DropOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Drop. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DropOptions { @@ -25,7 +25,7 @@ public DropOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction the element will fall to "hide" the element, or the direction from which the element will be revealed.Possible Values
    up
    down
    left
    right
    ///
    - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element by dropping in the direction
    show
    Shows the element by undropping from the direction. This seems inverted from the hide.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectMethod.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectMethod.cs index ad2cb0ad6..85163590d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Operations supported by Effect. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum EffectMethod { AddClass, diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectObject.cs index a319ee9a0..d6452f02b 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Effect/EffectObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public abstract class EffectObject : jQueryUIObject { protected EffectObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeObject.cs index 241db7396..d5ebdc135 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ExplodeObject : EffectObject { private ExplodeObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOption.cs index 5f52d7aa0..727cba951 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Explode. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ExplodeOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOptions.cs index 257369641..41a3c2d02 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Explode/ExplodeOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Explode. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ExplodeOptions { @@ -25,7 +25,7 @@ public ExplodeOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element.
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; @@ -73,7 +73,7 @@ public string Mode { /// /// The number of pieces to explode, should be a perfect square, any other values are rounded to the nearest square. /// - [IntrinsicProperty] + [ScriptField] public int Pieces { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeObject.cs index 4269ef78a..fc09bfa19 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class FadeObject : EffectObject { private FadeObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOption.cs index 74f51a56d..85cb4e25c 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Fade. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum FadeOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOptions.cs index 4f42ad875..367d5cb91 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fade/FadeOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Fade. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class FadeOptions { @@ -25,7 +25,7 @@ public FadeOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element.
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldObject.cs index 8a5d6639e..d747f1be0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class FoldObject : EffectObject { private FoldObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOption.cs index 915cddeee..3116e68cb 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Fold. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum FoldOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOptions.cs index ba5178431..b4233ef11 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Fold/FoldOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Fold. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class FoldOptions { @@ -25,7 +25,7 @@ public FoldOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// If the horizontal direction happens first when hiding. Remember, showing inverts hiding. /// - [IntrinsicProperty] + [ScriptField] public bool HorizFirst { get { return false; @@ -73,7 +73,7 @@ public bool HorizFirst { /// /// UI Effect ModePossible Values:
    hide
    Hides the element.
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; @@ -85,7 +85,7 @@ public string Mode { /// /// The size of the "folded" element, can be a number representing px, or a string containing a percentage I.E. "50%" /// - [IntrinsicProperty] + [ScriptField] public object Size { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightObject.cs index 6a9c0a865..82c5093c6 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class HighlightObject : EffectObject { private HighlightObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOption.cs index d098342d5..98ecf74d0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Highlight. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum HighlightOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOptions.cs index e2db79fab..3a8376301 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Highlight/HighlightOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Highlight. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class HighlightOptions { @@ -25,7 +25,7 @@ public HighlightOptions(params object[] nameValuePairs) { /// /// The background color used during the animation /// - [IntrinsicProperty] + [ScriptField] public string Color { get { return null; @@ -37,7 +37,7 @@ public string Color { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -49,7 +49,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element.
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffObject.cs index 820e90a77..6e09b98aa 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// This is the only effect without a separate file, it shares a file with the scale effect. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class PuffObject : EffectObject { private PuffObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOption.cs index 94266e087..003953823 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Puff. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum PuffOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOptions.cs index 06dc13dd9..a57e9afdb 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Puff/PuffOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Puff. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class PuffOptions { @@ -25,7 +25,7 @@ public PuffOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// The mode of the effect. Can be "show" or "hide" /// - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; @@ -73,7 +73,7 @@ public string Mode { /// /// The percentage to scale to. /// - [IntrinsicProperty] + [ScriptField] public int Percent { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateObject.cs index c9fe25fde..70000f074 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class PulsateObject : EffectObject { private PulsateObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOption.cs index 9a3669a93..8edd2a704 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Pulsate. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum PulsateOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOptions.cs index 78e30ad36..41f881bd9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Pulsate/PulsateOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Pulsate. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class PulsateOptions { @@ -25,7 +25,7 @@ public PulsateOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// UI Effect ModePossible Values:
    hide
    Hides the element.
    show
    Shows the element.
    toggle
    Will use hide or show depending on the current visibility of the element
    effect
    Just pulsates.
    ///
    - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; @@ -73,7 +73,7 @@ public string Mode { /// /// The number of times the element should pulse. An extra half pulse is added for hide/show /// - [IntrinsicProperty] + [ScriptField] public int Times { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleObject.cs index 9d5dc203b..b3203e430 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ScaleObject : EffectObject { private ScaleObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOption.cs index f9ce3614f..dff674f78 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Scale. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ScaleOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOptions.cs index 939f2af49..04f9d8143 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Scale/ScaleOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Scale. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ScaleOptions { @@ -25,7 +25,7 @@ public ScaleOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction of the effect. Can be "both", "vertical" or "horizontal". /// - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// The vanishing point, default for show/hide. /// - [IntrinsicProperty] + [ScriptField] public Array Origin { get { return null; @@ -85,7 +85,7 @@ public Array Origin { /// /// The percentage to scale to. /// - [IntrinsicProperty] + [ScriptField] public int Percent { get { return 0; @@ -97,7 +97,7 @@ public int Percent { /// /// Which areas of the element will be resized: 'both', 'box', 'content' Box resizes the border and padding of the element Content resizes any content inside of the element /// - [IntrinsicProperty] + [ScriptField] public string Scale { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeObject.cs index c1854e56b..3d2d7670a 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ShakeObject : EffectObject { private ShakeObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOption.cs index 6f86aca36..d39bfd75b 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Shake. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ShakeOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOptions.cs index 55fdba022..1d4026226 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Shake/ShakeOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Shake. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ShakeOptions { @@ -25,7 +25,7 @@ public ShakeOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction of the effect. Can be "left", "right", "up", "down". /// - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// Distance to shake. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -61,7 +61,7 @@ public int Distance { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -73,7 +73,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -85,7 +85,7 @@ public string Easing { /// /// Times to shake. /// - [IntrinsicProperty] + [ScriptField] public int Times { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeObject.cs index 3e7b37138..d81b494a9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class SizeObject : EffectObject { private SizeObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOption.cs index f4d96f2af..f53d26924 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Size. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SizeOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOptions.cs index 646783012..159e35ba3 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Size/SizeOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Size. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SizeOptions { @@ -25,7 +25,7 @@ public SizeOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -49,7 +49,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -61,7 +61,7 @@ public string Easing { /// /// The vanishing point, default for show/hide. /// - [IntrinsicProperty] + [ScriptField] public Array Origin { get { return null; @@ -73,7 +73,7 @@ public Array Origin { /// /// Which areas of the element will be resized: 'both', 'box', 'content' Box resizes the border and padding of the element Content resizes any content inside of the element. /// - [IntrinsicProperty] + [ScriptField] public string Scale { get { return null; @@ -85,7 +85,7 @@ public string Scale { /// /// Height and width to resize to.{ height: .., width: .. } /// - [IntrinsicProperty] + [ScriptField] public object To { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideObject.cs index 51682d7bb..4f4865b72 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class SlideObject : EffectObject { private SlideObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOption.cs index 730e719b9..7909a17ee 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Slide. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SlideOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOptions.cs index 1fd5f5c1b..fa89b87b1 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Slide/SlideOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Slide. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SlideOptions { @@ -25,7 +25,7 @@ public SlideOptions(params object[] nameValuePairs) { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -37,7 +37,7 @@ public Action Complete { /// /// The direction of the effect. Can be "left", "right", "up", "down". /// - [IntrinsicProperty] + [ScriptField] public string Direction { get { return null; @@ -49,7 +49,7 @@ public string Direction { /// /// The distance of the effect. Is set to either the height or width of the elemenet depending on the direction option. Can be set to any integer less than the width/height of the element. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -61,7 +61,7 @@ public int Distance { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -73,7 +73,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -85,7 +85,7 @@ public string Easing { /// /// The mode of the effect. Can be "show" or "hide" /// - [IntrinsicProperty] + [ScriptField] public string Mode { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferObject.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferObject.cs index 4158bb95a..f96486b91 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Effects { /// /// Very useful when trying to visualize interaction between two elements.The transfer element iself has the class name "ui-effects-transfer", and needs to be styled by you, for example by adding a background or border. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class TransferObject : EffectObject { private TransferObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOption.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOption.cs index 042058478..e2974db4f 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Effects { /// /// Options for use with Transfer. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum TransferOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOptions.cs b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOptions.cs index 0950da3ed..5de9ba875 100644 --- a/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Effects/Transfer/TransferOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Effects { /// /// Options used to initialize or customize Transfer. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TransferOptions { @@ -25,7 +25,7 @@ public TransferOptions(params object[] nameValuePairs) { /// /// Optional class name the transfer element will receive. /// - [IntrinsicProperty] + [ScriptField] public string ClassName { get { return null; @@ -37,7 +37,7 @@ public string ClassName { /// /// A callback function, executed when the effect completes /// - [IntrinsicProperty] + [ScriptField] public Action Complete { get { return null; @@ -49,7 +49,7 @@ public Action Complete { /// /// The number of ms the animation will run for /// - [IntrinsicProperty] + [ScriptField] public int Duration { get { return 0; @@ -61,7 +61,7 @@ public int Duration { /// /// The easing function to use /// - [IntrinsicProperty] + [ScriptField] public string Easing { get { return null; @@ -73,7 +73,7 @@ public string Easing { /// /// jQuery selector, the element to transfer to. /// - [IntrinsicProperty] + [ScriptField] public string To { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragEvent.cs index 44c63c29d..cf453ccbf 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DragEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -31,7 +31,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStartEvent.cs index 8eb1ab877..709b92213 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DragStartEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -31,7 +31,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStopEvent.cs index 3b8a65fdf..df7dc01dc 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DragStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DragStopEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -31,7 +31,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableEvents.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableEvents.cs index 30a6aac27..5b48edda4 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Events raised by Draggable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DraggableEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableObject.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableObject.cs index b44aee253..72c2fa48d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Interactions { /// /// The jQuery UI Draggable plugin makes selected elements draggable by mouse.Draggable elements gets a class of ui-draggable. During drag the element also gets a class of ui-draggable-dragging. If you want not just drag, but drag-and-drop, see the jQuery UI Droppable plugin, which provides a drop target for draggables. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class DraggableObject : WidgetObject { private DraggableObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOption.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOption.cs index 9b0eab69b..a7b2238c9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Options for use with Draggable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DraggableOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOptions.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOptions.cs index 9bbb3001b..c883cc314 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Draggable/DraggableOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Interactions { /// /// Options used to initialize or customize Draggable. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DraggableOptions { @@ -25,7 +25,7 @@ public DraggableOptions(params object[] nameValuePairs) { /// /// This event is triggered when the draggable is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -37,7 +37,7 @@ public jQueryEventHandler Create { /// /// This event is triggered when the mouse is moved during the dragging. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Drag { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Drag { /// /// This event is triggered when dragging starts. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Start { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Start { /// /// This event is triggered when dragging stops. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Stop { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Stop { /// /// If set to false, will prevent the ui-draggable class from being added. This may be desired as a performance optimization when calling .draggable() init on many hundreds of elements. /// - [IntrinsicProperty] + [ScriptField] public bool AddClasses { get { return false; @@ -85,7 +85,7 @@ public bool AddClasses { /// /// The element passed to or selected by the appendTo option will be used as the draggable helper's container during dragging. By default, the helper is appended to the same container as the draggable. /// - [IntrinsicProperty] + [ScriptField] public object AppendTo { get { return null; @@ -97,7 +97,7 @@ public object AppendTo { /// /// Constrains dragging to either the horizontal (x) or vertical (y) axis. Possible values: 'x', 'y'. /// - [IntrinsicProperty] + [ScriptField] public string Axis { get { return null; @@ -109,7 +109,7 @@ public string Axis { /// /// Prevents dragging from starting on specified elements. /// - [IntrinsicProperty] + [ScriptField] public string Cancel { get { return null; @@ -121,7 +121,7 @@ public string Cancel { /// /// Allows the draggable to be dropped onto the specified sortables. If this option is used (helper must be set to 'clone' in order to work flawlessly), a draggable can be dropped onto a sortable list and then becomes part of it. /// - [IntrinsicProperty] + [ScriptField] public string ConnectToSortable { get { return null; @@ -133,7 +133,7 @@ public string ConnectToSortable { /// /// Constrains dragging to within the bounds of the specified element or region. Possible string values: 'parent', 'document', 'window', [x1, y1, x2, y2]. /// - [IntrinsicProperty] + [ScriptField] public object Containment { get { return null; @@ -145,7 +145,7 @@ public object Containment { /// /// The css cursor during the drag operation. /// - [IntrinsicProperty] + [ScriptField] public string Cursor { get { return null; @@ -157,7 +157,7 @@ public string Cursor { /// /// Sets the offset of the dragging helper relative to the mouse cursor. Coordinates can be given as a hash using a combination of one or two keys: { top, left, right, bottom }. /// - [IntrinsicProperty] + [ScriptField] public object CursorAt { get { return null; @@ -169,7 +169,7 @@ public object CursorAt { /// /// Time in milliseconds after mousedown until dragging should start. This option can be used to prevent unwanted drags when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Delay { get { return 0; @@ -181,7 +181,7 @@ public int Delay { /// /// Disables the draggable if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -193,7 +193,7 @@ public bool Disabled { /// /// Distance in pixels after mousedown the mouse must move before dragging should start. This option can be used to prevent unwanted drags when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -205,7 +205,7 @@ public int Distance { /// /// Snaps the dragging helper to a grid, every x and y pixels. Array values: [x, y] /// - [IntrinsicProperty] + [ScriptField] public Array Grid { get { return null; @@ -217,7 +217,7 @@ public Array Grid { /// /// If specified, restricts drag start click to the specified element(s). /// - [IntrinsicProperty] + [ScriptField] public object Handle { get { return null; @@ -229,7 +229,7 @@ public object Handle { /// /// Allows for a helper element to be used for dragging display. Possible values: 'original', 'clone', Function. If a function is specified, it must return a DOMElement. /// - [IntrinsicProperty] + [ScriptField] public object Helper { get { return null; @@ -241,7 +241,7 @@ public object Helper { /// /// Prevent iframes from capturing the mousemove events during a drag. Useful in combination with cursorAt, or in any case, if the mouse cursor is not over the helper. If set to true, transparent overlays will be placed over all iframes on the page. If a selector is supplied, the matched iframes will have an overlay placed over them. /// - [IntrinsicProperty] + [ScriptField] public object IframeFix { get { return null; @@ -253,7 +253,7 @@ public object IframeFix { /// /// Opacity for the helper while being dragged. /// - [IntrinsicProperty] + [ScriptField] public int Opacity { get { return 0; @@ -265,7 +265,7 @@ public int Opacity { /// /// If set to true, all droppable positions are calculated on every mousemove. Caution: This solves issues on highly dynamic pages, but dramatically decreases performance. /// - [IntrinsicProperty] + [ScriptField] public bool RefreshPositions { get { return false; @@ -277,7 +277,7 @@ public bool RefreshPositions { /// /// If set to true, the element will return to its start position when dragging stops. Possible string values: 'valid', 'invalid'. If set to invalid, revert will only occur if the draggable has not been dropped on a droppable. For valid, it's the other way around. /// - [IntrinsicProperty] + [ScriptField] public object Revert { get { return null; @@ -289,7 +289,7 @@ public object Revert { /// /// The duration of the revert animation, in milliseconds. Ignored if revert is false. /// - [IntrinsicProperty] + [ScriptField] public int RevertDuration { get { return 0; @@ -301,7 +301,7 @@ public int RevertDuration { /// /// Used to group sets of draggable and droppable items, in addition to droppable's accept option. A draggable with the same scope value as a droppable will be accepted by the droppable. /// - [IntrinsicProperty] + [ScriptField] public string Scope { get { return null; @@ -313,7 +313,7 @@ public string Scope { /// /// If set to true, container auto-scrolls while dragging. /// - [IntrinsicProperty] + [ScriptField] public bool Scroll { get { return false; @@ -325,7 +325,7 @@ public bool Scroll { /// /// Distance in pixels from the edge of the viewport after which the viewport should scroll. Distance is relative to pointer, not the draggable. /// - [IntrinsicProperty] + [ScriptField] public int ScrollSensitivity { get { return 0; @@ -337,7 +337,7 @@ public int ScrollSensitivity { /// /// The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance. /// - [IntrinsicProperty] + [ScriptField] public int ScrollSpeed { get { return 0; @@ -349,7 +349,7 @@ public int ScrollSpeed { /// /// If set to a selector or to true (equivalent to '.ui-draggable'), the draggable will snap to the edges of the selected elements when near an edge of the element. /// - [IntrinsicProperty] + [ScriptField] public object Snap { get { return null; @@ -361,7 +361,7 @@ public object Snap { /// /// Determines which edges of snap elements the draggable will snap to. Ignored if snap is false. Possible values: 'inner', 'outer', 'both' /// - [IntrinsicProperty] + [ScriptField] public string SnapMode { get { return null; @@ -373,7 +373,7 @@ public string SnapMode { /// /// The distance in pixels from the snap element edges at which snapping should occur. Ignored if snap is false. /// - [IntrinsicProperty] + [ScriptField] public int SnapTolerance { get { return 0; @@ -385,7 +385,7 @@ public int SnapTolerance { /// /// Controls the z-Index of the set of elements that match the selector, always brings to front the dragged item. Very useful in things like window managers. /// - [IntrinsicProperty] + [ScriptField] public string Stack { get { return null; @@ -397,7 +397,7 @@ public string Stack { /// /// z-index for the helper while being dragged. /// - [IntrinsicProperty] + [ScriptField] public int ZIndex { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropActivateEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropActivateEvent.cs index 925134ef8..a4b8e56be 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropActivateEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropActivateEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DropActivateEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Draggable { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Draggable { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropDeactivateEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropDeactivateEvent.cs index b74c7e65b..8b9060c2f 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropDeactivateEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropDeactivateEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DropDeactivateEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Draggable { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Draggable { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropEvent.cs index e917ccbbc..2d5ab1749 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DropEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Draggable { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Draggable { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropOverEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropOverEvent.cs index 18712f864..93ab8d04a 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropOverEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DropOverEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DropOverEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Draggable { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Draggable { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableEvents.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableEvents.cs index c68b817bc..3df0d07f1 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Events raised by Droppable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DroppableEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableObject.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableObject.cs index 7ca4a36de..da888bbd0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Interactions { /// /// The jQuery UI Droppable plugin makes selected elements droppable (meaning they accept being dropped on by draggables). You can specify which (individually) or which kind of draggables each will accept. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class DroppableObject : WidgetObject { private DroppableObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOption.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOption.cs index 9de79afa6..6761cf275 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Options for use with Droppable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DroppableOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOptions.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOptions.cs index fdb441fac..336366776 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Droppable/DroppableOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Interactions { /// /// Options used to initialize or customize Droppable. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DroppableOptions { @@ -25,7 +25,7 @@ public DroppableOptions(params object[] nameValuePairs) { /// /// This event is triggered any time an accepted draggable starts dragging. This can be useful if you want to make the droppable 'light up' when it can be dropped on. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Activate { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Activate { /// /// This event is triggered when the droppable is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -49,7 +49,7 @@ public jQueryEventHandler Create { /// /// This event is triggered any time an accepted draggable stops dragging. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Deactivate { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Deactivate { /// /// This event is triggered when an accepted draggable is dropped 'over' (within the tolerance of) this droppable. In the callback, $(this) represents the droppable the draggable is dropped on.ui.draggable represents the draggable. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Drop { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Drop { /// /// This event is triggered when an accepted draggable is dragged out (within the tolerance of) this droppable. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Out { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Out { /// /// This event is triggered as an accepted draggable is dragged 'over' (within the tolerance of) this droppable. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Over { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler Over { /// /// All draggables that match the selector will be accepted. If a function is specified, the function will be called for each draggable on the page (passed as the first argument to the function), to provide a custom filter. The function should return true if the draggable should be accepted. /// - [IntrinsicProperty] + [ScriptField] public object Accept { get { return null; @@ -109,7 +109,7 @@ public object Accept { /// /// If specified, the class will be added to the droppable while an acceptable draggable is being dragged. /// - [IntrinsicProperty] + [ScriptField] public string ActiveClass { get { return null; @@ -121,7 +121,7 @@ public string ActiveClass { /// /// If set to false, will prevent the ui-droppable class from being added. This may be desired as a performance optimization when calling .droppable() init on many hundreds of elements. /// - [IntrinsicProperty] + [ScriptField] public bool AddClasses { get { return false; @@ -133,7 +133,7 @@ public bool AddClasses { /// /// Disables the droppable if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -145,7 +145,7 @@ public bool Disabled { /// /// If true, will prevent event propagation on nested droppables. /// - [IntrinsicProperty] + [ScriptField] public bool Greedy { get { return false; @@ -157,7 +157,7 @@ public bool Greedy { /// /// If specified, the class will be added to the droppable while an acceptable draggable is being hovered. /// - [IntrinsicProperty] + [ScriptField] public string HoverClass { get { return null; @@ -169,7 +169,7 @@ public string HoverClass { /// /// Used to group sets of draggable and droppable items, in addition to droppable's accept option. A draggable with the same scope value as a droppable will be accepted. /// - [IntrinsicProperty] + [ScriptField] public string Scope { get { return null; @@ -181,7 +181,7 @@ public string Scope { /// /// Specifies which mode to use for testing whether a draggable is 'over' a droppable. Possible values: 'fit', 'intersect', 'pointer', 'touch'.
    • '''fit''': draggable overlaps the droppable entirely
    • '''intersect''': draggable overlaps the droppable at least 50%
    • '''pointer''': mouse pointer overlaps the droppable
    • '''touch''': draggable overlaps the droppable any amount
    ///
    - [IntrinsicProperty] + [ScriptField] public string Tolerance { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableEvents.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableEvents.cs index 33401d08f..11c9f0293 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Events raised by Resizable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ResizableEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableObject.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableObject.cs index a99740c3c..d78afbe3b 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Interactions { /// /// The jQuery UI Resizable plugin makes selected elements resizable (meaning they have draggable resize handles). You can specify one or more handles as well as min and max width and height.All callbacks (start,stop,resize) receive two arguments: The original browser event and a prepared ui object.This interaction requires some functional CSS, otherwise it won't work. If you build a custom theme, use the interaction's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ResizableObject : WidgetObject { private ResizableObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOption.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOption.cs index db1e67eb3..1d62532c7 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Options for use with Resizable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ResizableOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOptions.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOptions.cs index 12169b340..3f674a4cd 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizableOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Interactions { /// /// Options used to initialize or customize Resizable. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ResizableOptions { @@ -25,7 +25,7 @@ public ResizableOptions(params object[] nameValuePairs) { /// /// This event is triggered when the resizable is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -37,7 +37,7 @@ public jQueryEventHandler Create { /// /// This event is triggered during the resize, on the drag of the resize handler. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Resize { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Resize { /// /// This event is triggered at the start of a resize operation. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Start { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Start { /// /// This event is triggered at the end of a resize operation. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Stop { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Stop { /// /// Resize these elements synchronous when resizing. /// - [IntrinsicProperty] + [ScriptField] public object AlsoResize { get { return null; @@ -85,7 +85,7 @@ public object AlsoResize { /// /// Animates to the final size after resizing. /// - [IntrinsicProperty] + [ScriptField] public bool Animate { get { return false; @@ -97,7 +97,7 @@ public bool Animate { /// /// Duration time for animating, in milliseconds. Other possible values: 'slow', 'normal', 'fast'. /// - [IntrinsicProperty] + [ScriptField] public object AnimateDuration { get { return null; @@ -109,7 +109,7 @@ public object AnimateDuration { /// /// Easing effect for animating. /// - [IntrinsicProperty] + [ScriptField] public string AnimateEasing { get { return null; @@ -121,7 +121,7 @@ public string AnimateEasing { /// /// If set to true, resizing is constrained by the original aspect ratio. Otherwise a custom aspect ratio can be specified, such as 9 / 16, or 0.5. /// - [IntrinsicProperty] + [ScriptField] public object AspectRatio { get { return null; @@ -133,7 +133,7 @@ public object AspectRatio { /// /// If set to true, automatically hides the handles except when the mouse hovers over the element. /// - [IntrinsicProperty] + [ScriptField] public bool AutoHide { get { return false; @@ -145,7 +145,7 @@ public bool AutoHide { /// /// Prevents resizing if you start on elements matching the selector. /// - [IntrinsicProperty] + [ScriptField] public string Cancel { get { return null; @@ -157,7 +157,7 @@ public string Cancel { /// /// Constrains resizing to within the bounds of the specified element. Possible values: 'parent', 'document', a DOMElement, or a Selector. /// - [IntrinsicProperty] + [ScriptField] public object Containment { get { return null; @@ -169,7 +169,7 @@ public object Containment { /// /// Tolerance, in milliseconds, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond duration. This can help prevent unintended resizing when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Delay { get { return 0; @@ -181,7 +181,7 @@ public int Delay { /// /// Disables the resizable if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -193,7 +193,7 @@ public bool Disabled { /// /// Tolerance, in pixels, for when resizing should start. If specified, resizing will not start until after mouse is moved beyond distance. This can help prevent unintended resizing when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -205,7 +205,7 @@ public int Distance { /// /// If set to true, a semi-transparent helper element is shown for resizing. /// - [IntrinsicProperty] + [ScriptField] public bool Ghost { get { return false; @@ -217,7 +217,7 @@ public bool Ghost { /// /// Snaps the resizing element to a grid, every x and y pixels. Array values: [x, y] /// - [IntrinsicProperty] + [ScriptField] public Array Grid { get { return null; @@ -229,7 +229,7 @@ public Array Grid { /// /// If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'. The necessary handles will be auto-generated by the plugin.If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }. The value of any specified should be a jQuery selector matching the child element of the resizable to use as that handle. If the handle is not a child of the resizable, you can pass in the DOMElement or a valid jQuery object directly. /// - [IntrinsicProperty] + [ScriptField] public object Handles { get { return null; @@ -241,7 +241,7 @@ public object Handles { /// /// This is the css class that will be added to a proxy element to outline the resize during the drag of the resize handle. Once the resize is complete, the original element is sized. /// - [IntrinsicProperty] + [ScriptField] public string Helper { get { return null; @@ -253,7 +253,7 @@ public string Helper { /// /// This is the maximum height the resizable should be allowed to resize to. /// - [IntrinsicProperty] + [ScriptField] public int MaxHeight { get { return 0; @@ -265,7 +265,7 @@ public int MaxHeight { /// /// This is the maximum width the resizable should be allowed to resize to. /// - [IntrinsicProperty] + [ScriptField] public int MaxWidth { get { return 0; @@ -277,7 +277,7 @@ public int MaxWidth { /// /// This is the minimum height the resizable should be allowed to resize to. /// - [IntrinsicProperty] + [ScriptField] public int MinHeight { get { return 0; @@ -289,7 +289,7 @@ public int MinHeight { /// /// This is the minimum width the resizable should be allowed to resize to. /// - [IntrinsicProperty] + [ScriptField] public int MinWidth { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeEvent.cs index c0e1eb12b..4746c0df7 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ResizeEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Element { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Element { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalElement { get { return null; @@ -40,7 +40,7 @@ public jQueryObject OriginalElement { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public jQueryObject OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object OriginalSize { get { return null; @@ -58,7 +58,7 @@ public object OriginalSize { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -67,7 +67,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public object Size { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStartEvent.cs index c188ccf48..a3e81cc85 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ResizeStartEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Element { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Element { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalElement { get { return null; @@ -40,7 +40,7 @@ public jQueryObject OriginalElement { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public jQueryObject OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object OriginalSize { get { return null; @@ -58,7 +58,7 @@ public object OriginalSize { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -67,7 +67,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public object Size { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStopEvent.cs index ee0a199a9..62fbeaaf9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Resizable/ResizeStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ResizeStopEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Element { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Element { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalElement { get { return null; @@ -40,7 +40,7 @@ public jQueryObject OriginalElement { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public jQueryObject OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object OriginalSize { get { return null; @@ -58,7 +58,7 @@ public object OriginalSize { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -67,7 +67,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public object Size { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableEvents.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableEvents.cs index 961b78a1b..7c5ee1ad5 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Events raised by Selectable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SelectableEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableMethod.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableMethod.cs index 4d45424bd..297e4d48f 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Operations supported by Selectable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SelectableMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableObject.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableObject.cs index 7afce58af..0972ef545 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Interactions { /// /// The jQuery UI Selectable plugin allows for elements to be selected by dragging a box (sometimes called a lasso) with the mouse over the elements. Also, elements can be selected by click or drag while holding the Ctrl/Meta key, allowing for multiple (non-contiguous) selections.This interaction requires some functional CSS, otherwise it won't work. If you build a custom theme, use the interaction's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class SelectableObject : WidgetObject { private SelectableObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOption.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOption.cs index 794f181ba..9e83b48ad 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Options for use with Selectable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SelectableOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOptions.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOptions.cs index 217baef17..af1d467fb 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Interactions { /// /// Options used to initialize or customize Selectable. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SelectableOptions { @@ -25,7 +25,7 @@ public SelectableOptions(params object[] nameValuePairs) { /// /// This event is triggered when the selectable is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -37,7 +37,7 @@ public jQueryEventHandler Create { /// /// This event is triggered at the end of the select operation, on each element added to the selection. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Selected { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Selected { /// /// This event is triggered during the select operation, on each element added to the selection. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Selecting { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Selecting { /// /// This event is triggered at the beginning of the select operation. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Start { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Start { /// /// This event is triggered at the end of the select operation. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Stop { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Stop { /// /// This event is triggered at the end of the select operation, on each element removed from the selection. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Unselected { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler Unselected { /// /// This event is triggered during the select operation, on each element removed from the selection. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Unselecting { get { return null; @@ -109,7 +109,7 @@ public jQueryUIEventHandler Unselecting { /// /// This determines whether to refresh (recalculate) the position and size of each selectee at the beginning of each select operation. If you have many many items, you may want to set this to false and call the refresh method manually. /// - [IntrinsicProperty] + [ScriptField] public bool AutoRefresh { get { return false; @@ -121,7 +121,7 @@ public bool AutoRefresh { /// /// Prevents selecting if you start on elements matching the selector. /// - [IntrinsicProperty] + [ScriptField] public string Cancel { get { return null; @@ -133,7 +133,7 @@ public string Cancel { /// /// Time in milliseconds to define when the selecting should start. It helps preventing unwanted selections when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Delay { get { return 0; @@ -145,7 +145,7 @@ public int Delay { /// /// Disables the selectable if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -157,7 +157,7 @@ public bool Disabled { /// /// Tolerance, in pixels, for when selecting should start. If specified, selecting will not start until after mouse is dragged beyond distance. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -169,7 +169,7 @@ public int Distance { /// /// The matching child elements will be made selectees (able to be selected). /// - [IntrinsicProperty] + [ScriptField] public string Filter { get { return null; @@ -181,7 +181,7 @@ public string Filter { /// /// Possible values: 'touch', 'fit'.
    • '''fit''': draggable overlaps the droppable entirely
    • '''touch''': draggable overlaps the droppable any amount
    ///
    - [IntrinsicProperty] + [ScriptField] public string Tolerance { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectedEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectedEvent.cs index cd77c659b..44ed63afd 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectedEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectedEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SelectableSelectedEvent { - [IntrinsicProperty] + [ScriptField] public object Selected { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectingEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectingEvent.cs index 59def6556..858d009a1 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectingEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableSelectingEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SelectableSelectingEvent { - [IntrinsicProperty] + [ScriptField] public object Selecting { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectedEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectedEvent.cs index 940ed6236..09d97b678 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectedEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectedEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SelectableUnselectedEvent { - [IntrinsicProperty] + [ScriptField] public object Unselected { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectingEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectingEvent.cs index 73ba526da..80c27a727 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectingEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Selectable/SelectableUnselectingEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SelectableUnselectingEvent { - [IntrinsicProperty] + [ScriptField] public object Unselecting { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortActivateEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortActivateEvent.cs index ab0298253..612a20566 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortActivateEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortActivateEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortActivateEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortBeforeStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortBeforeStopEvent.cs index ef5738ed5..9828c62a0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortBeforeStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortBeforeStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortBeforeStopEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortChangeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortChangeEvent.cs index f37ac5ca6..6838e5fd3 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortChangeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortChangeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortChangeEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortDeactivateEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortDeactivateEvent.cs index 71873522d..7130145f1 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortDeactivateEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortDeactivateEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortDeactivateEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortEvent.cs index f7706298a..fad62d400 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOutEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOutEvent.cs index f67c53f12..fd5f89814 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOutEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOutEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortOutEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOverEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOverEvent.cs index 759a01828..b3a4af376 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOverEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortOverEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortOverEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortReceiveEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortReceiveEvent.cs index 11215b9f3..49c30f707 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortReceiveEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortReceiveEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortReceiveEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortRemoveEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortRemoveEvent.cs index 569866bf3..8a31bf969 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortRemoveEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortRemoveEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortRemoveEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStartEvent.cs index d9f0de87d..ff7add401 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortStartEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStopEvent.cs index cebb98174..8de96d767 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortStopEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortUpdateEvent.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortUpdateEvent.cs index 4ab39c266..d59585a91 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortUpdateEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortUpdateEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Interactions { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortUpdateEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Helper { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Helper { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Item { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Item { } } - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -40,7 +40,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object OriginalPosition { get { return null; @@ -49,7 +49,7 @@ public object OriginalPosition { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -58,7 +58,7 @@ public object Position { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Sender { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableEvents.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableEvents.cs index c1175b4b2..91a146464 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Events raised by Sortable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SortableEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableMethod.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableMethod.cs index a7334f418..abb081e64 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Operations supported by Sortable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SortableMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableObject.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableObject.cs index 5e56ea030..78d024c55 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Interactions { /// /// The jQuery UI Sortable plugin makes selected elements sortable by dragging with the mouse.All callbacks receive two arguments: The original browser event and a prepared ui object. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class SortableObject : WidgetObject { private SortableObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOption.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOption.cs index 40623b574..dd2c3f8da 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Interactions { /// /// Options for use with Sortable. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SortableOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOptions.cs b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOptions.cs index e8101892a..a3efcb13e 100644 --- a/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Interactions/Sortable/SortableOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Interactions { /// /// Options used to initialize or customize Sortable. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SortableOptions { @@ -25,7 +25,7 @@ public SortableOptions(params object[] nameValuePairs) { /// /// This event is triggered when using connected lists, every connected list on drag start receives it. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Activate { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Activate { /// /// This event is triggered when sorting stops, but when the placeholder/helper is still available. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler BeforeStop { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler BeforeStop { /// /// This event is triggered during sorting, but only when the DOM position has changed. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Change { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Change { /// /// This event is triggered when the sortable is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -73,7 +73,7 @@ public jQueryEventHandler Create { /// /// This event is triggered when sorting was stopped, is propagated to all possible connected lists. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Deactivate { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Deactivate { /// /// This event is triggered when a sortable item is moved away from a connected list. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Out { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler Out { /// /// This event is triggered when a sortable item is moved into a connected list. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Over { get { return null; @@ -109,7 +109,7 @@ public jQueryUIEventHandler Over { /// /// This event is triggered when a connected sortable list has received an item from another list. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Receive { get { return null; @@ -121,7 +121,7 @@ public jQueryUIEventHandler Receive { /// /// This event is triggered when a sortable item has been dragged out from the list and into another. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Remove { get { return null; @@ -133,7 +133,7 @@ public jQueryUIEventHandler Remove { /// /// This event is triggered during sorting. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Sort { get { return null; @@ -145,7 +145,7 @@ public jQueryUIEventHandler Sort { /// /// This event is triggered when sorting starts. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Start { get { return null; @@ -157,7 +157,7 @@ public jQueryUIEventHandler Start { /// /// This event is triggered when sorting has stopped. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Stop { get { return null; @@ -169,7 +169,7 @@ public jQueryUIEventHandler Stop { /// /// This event is triggered when the user stopped sorting and the DOM position has changed. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Update { get { return null; @@ -181,7 +181,7 @@ public jQueryUIEventHandler Update { /// /// Defines where the helper that moves with the mouse is being appended to during the drag (for example, to resolve overlap/zIndex issues). /// - [IntrinsicProperty] + [ScriptField] public string AppendTo { get { return null; @@ -193,7 +193,7 @@ public string AppendTo { /// /// If defined, the items can be dragged only horizontally or vertically. Possible values:'x', 'y'. /// - [IntrinsicProperty] + [ScriptField] public string Axis { get { return null; @@ -205,7 +205,7 @@ public string Axis { /// /// Prevents sorting if you start on elements matching the selector. /// - [IntrinsicProperty] + [ScriptField] public string Cancel { get { return null; @@ -217,7 +217,7 @@ public string Cancel { /// /// Takes a jQuery selector with items that also have sortables applied. If used, the sortable is now connected to the other one-way, so you can drag from this sortable to the other. /// - [IntrinsicProperty] + [ScriptField] public string ConnectWith { get { return null; @@ -229,7 +229,7 @@ public string ConnectWith { /// /// Constrains dragging to within the bounds of the specified element - can be a DOM element, 'parent', 'document', 'window', or a jQuery selector.Note: the element specified for containment must have a calculated width and height (though it need not be explicit), so for example, if you have float:left sortable children and specify containment:'parent' be sure to have float:left on the sortable/parent container as well or it will have height: 0, causing undefined behavior. /// - [IntrinsicProperty] + [ScriptField] public object Containment { get { return null; @@ -241,7 +241,7 @@ public object Containment { /// /// Defines the cursor that is being shown while sorting. /// - [IntrinsicProperty] + [ScriptField] public string Cursor { get { return null; @@ -253,7 +253,7 @@ public string Cursor { /// /// Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys: { top, left, right, bottom }. /// - [IntrinsicProperty] + [ScriptField] public object CursorAt { get { return null; @@ -265,7 +265,7 @@ public object CursorAt { /// /// Time in milliseconds to define when the sorting should start. It helps preventing unwanted drags when clicking on an element. /// - [IntrinsicProperty] + [ScriptField] public int Delay { get { return 0; @@ -277,7 +277,7 @@ public int Delay { /// /// Disables the sortable if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -289,7 +289,7 @@ public bool Disabled { /// /// Tolerance, in pixels, for when sorting should start. If specified, sorting will not start until after mouse is dragged beyond distance. Can be used to allow for clicks on elements within a handle. /// - [IntrinsicProperty] + [ScriptField] public int Distance { get { return 0; @@ -301,7 +301,7 @@ public int Distance { /// /// If false items from this sortable can't be dropped to an empty linked sortable. /// - [IntrinsicProperty] + [ScriptField] public bool DropOnEmpty { get { return false; @@ -313,7 +313,7 @@ public bool DropOnEmpty { /// /// If true, forces the helper to have a size. /// - [IntrinsicProperty] + [ScriptField] public bool ForceHelperSize { get { return false; @@ -325,7 +325,7 @@ public bool ForceHelperSize { /// /// If true, forces the placeholder to have a size. /// - [IntrinsicProperty] + [ScriptField] public bool ForcePlaceholderSize { get { return false; @@ -337,7 +337,7 @@ public bool ForcePlaceholderSize { /// /// Snaps the sorting element or helper to a grid, every x and y pixels. Array values: [x, y] /// - [IntrinsicProperty] + [ScriptField] public Array Grid { get { return null; @@ -349,7 +349,7 @@ public Array Grid { /// /// Restricts sort start click to the specified element. /// - [IntrinsicProperty] + [ScriptField] public object Handle { get { return null; @@ -361,7 +361,7 @@ public object Handle { /// /// Allows for a helper element to be used for dragging display. The supplied function receives the event and the element being sorted, and should return a DOMElement to be used as a custom proxy helper. Possible values: 'original', 'clone' /// - [IntrinsicProperty] + [ScriptField] public object Helper { get { return null; @@ -373,7 +373,7 @@ public object Helper { /// /// Specifies which items inside the element should be sortable. /// - [IntrinsicProperty] + [ScriptField] public string Items { get { return null; @@ -385,7 +385,7 @@ public string Items { /// /// Defines the opacity of the helper while sorting. From 0.01 to 1 /// - [IntrinsicProperty] + [ScriptField] public int Opacity { get { return 0; @@ -397,7 +397,7 @@ public int Opacity { /// /// Class that gets applied to the otherwise white space. /// - [IntrinsicProperty] + [ScriptField] public string Placeholder { get { return null; @@ -409,7 +409,7 @@ public string Placeholder { /// /// If set to true, the item will be reverted to its new DOM position with a smooth animation. Optionally, it can also be set to a number that controls the duration of the animation in ms. /// - [IntrinsicProperty] + [ScriptField] public object Revert { get { return null; @@ -421,7 +421,7 @@ public object Revert { /// /// If set to true, the page scrolls when coming to an edge. /// - [IntrinsicProperty] + [ScriptField] public bool Scroll { get { return false; @@ -433,7 +433,7 @@ public bool Scroll { /// /// Defines how near the mouse must be to an edge to start scrolling. /// - [IntrinsicProperty] + [ScriptField] public int ScrollSensitivity { get { return 0; @@ -445,7 +445,7 @@ public int ScrollSensitivity { /// /// The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance. /// - [IntrinsicProperty] + [ScriptField] public int ScrollSpeed { get { return 0; @@ -457,7 +457,7 @@ public int ScrollSpeed { /// /// This is the way the reordering behaves during drag. Possible values: 'intersect', 'pointer'. In some setups, 'pointer' is more natural.
    • '''intersect''': draggable overlaps the droppable at least 50%
    • '''pointer''': mouse pointer overlaps the droppable
    ///
    - [IntrinsicProperty] + [ScriptField] public string Tolerance { get { return null; @@ -469,7 +469,7 @@ public string Tolerance { /// /// Z-index for element/helper while being sorted. /// - [IntrinsicProperty] + [ScriptField] public int ZIndex { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/PositionObject.cs b/src/Libraries/jQuery/jQuery.UI/PositionObject.cs index 34603d0e8..e6787b461 100644 --- a/src/Libraries/jQuery/jQuery.UI/PositionObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/PositionObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI { /// /// Utility script for positioning any widget relative to the window, document, a particular element, or the cursor/mouse.Note: jQuery UI does not support positioning hidden elements.This is a standalone jQuery plugin and has no dependencies on other jQuery UI components.This plugin extends jQuery's built-in position getter method. If you forget to include this plugin, code calling position() won't fail directly, as the method still exists. But it'll just retrieve the position instead of setting it. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class PositionObject : jQueryUIObject { private PositionObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/PositionOption.cs b/src/Libraries/jQuery/jQuery.UI/PositionOption.cs index 7336efa49..d74f21577 100644 --- a/src/Libraries/jQuery/jQuery.UI/PositionOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/PositionOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI { /// /// Options for use with Position. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum PositionOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/PositionOptions.cs b/src/Libraries/jQuery/jQuery.UI/PositionOptions.cs index c3768f737..5cb981127 100644 --- a/src/Libraries/jQuery/jQuery.UI/PositionOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/PositionOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI { /// /// Options used to initialize or customize Position. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class PositionOptions { @@ -25,7 +25,7 @@ public PositionOptions(params object[] nameValuePairs) { /// /// Defines which position on the target element to align the positioned element against: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center". Each dimension can also contains offsets, in pixels or percent, e.g. `right+10 top-25%`. A perecentage is relative to the target element. /// - [IntrinsicProperty] + [ScriptField] public string At { get { return null; @@ -37,7 +37,7 @@ public string At { /// /// When the positioned element overflows the window in some direction, move it to an alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical, eg. "flip", "fit", "fit flip", "fit none".
    • flip: to the opposite side and the collision detection is run again to see if it will fit. Whichever side allows more of the element to be visible will be used.
    • fit: so the element keeps in the desired direction, but is re-positioned so it fits.
    • flipfit: apply both flip and fit. If flip works out, fit won't do anything, if flip gives up, fit should help.
    • none: no collision detection.
    ///
    - [IntrinsicProperty] + [ScriptField] public string Collision { get { return null; @@ -49,7 +49,7 @@ public string Collision { /// /// Defines which position on the element being positioned to align with the target element: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center". Each dimension can also contains offsets, in pixels or percent, e.g. `right+10 top-25%`. A perecentage is relative to the element being positioned. /// - [IntrinsicProperty] + [ScriptField] public string My { get { return null; @@ -61,7 +61,7 @@ public string My { /// /// Element to position against. If you provide a selector or jQuery object, the first matching element will be used. If you provide an event object, the pageX and pageY properties will be used. Example: "#top-menu" /// - [IntrinsicProperty] + [ScriptField] public object Of { get { return null; @@ -73,7 +73,7 @@ public object Of { /// /// Add these left-top values to the calculated position, eg. "50 50" (left top) A single value such as "50" will apply to both. /// - [IntrinsicProperty] + [ScriptField] public string Offset { get { return null; @@ -85,7 +85,7 @@ public string Offset { /// /// When specified the actual property setting is delegated to this callback. Receives two parameters: The first is a hash of top and left values for the position that should be set and can be forwarded to offset() or animate() calls.The second provides feedback about the position and dimensions of both elements, as well as calculations to their relative position. Both `target` and `element` have these properties: element, left, top, width, height. In addition, there's `horizontal`, `vertical` and `important`, giving you twelve potential directions like { horizontal: "center", vertical: "left", important: "horizontal" }. /// - [IntrinsicProperty] + [ScriptField] public Action Using { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Properties/AssemblyInfo.cs b/src/Libraries/jQuery/jQuery.UI/Properties/AssemblyInfo.cs index 4850b6396..1194f2294 100644 --- a/src/Libraries/jQuery/jQuery.UI/Properties/AssemblyInfo.cs +++ b/src/Libraries/jQuery/jQuery.UI/Properties/AssemblyInfo.cs @@ -10,4 +10,4 @@ [assembly: AssemblyTitle("Script.jQuery.UI")] [assembly: AssemblyDescription("Script# jQuery UI Plugin")] -[assembly: ScriptAssembly("jQueryUI")] +[assembly: ScriptAssembly("jqueryUI")] diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetEvents.cs b/src/Libraries/jQuery/jQuery.UI/WidgetEvents.cs index 45d250cdd..a59bab539 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI { /// /// Events raised by Widget. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum WidgetEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetMethod.cs b/src/Libraries/jQuery/jQuery.UI/WidgetMethod.cs index 8d2782f97..d45521587 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI { /// /// Operations supported by Widget. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum WidgetMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetObject.cs b/src/Libraries/jQuery/jQuery.UI/WidgetObject.cs index baef48603..f9406fd40 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetObject.cs @@ -14,36 +14,36 @@ namespace jQueryApi.UI { /// /// You can create new widgets from scratch, using just the $.Widget object as base to inherit from, or you can explicitly inherit from existing jQuery UI or third-party widgets. Defining a widget with the same name as you inherit from even allows you to extend widgets in place.For now, more details can be found at github.com/scottgonzalez/widget-factory-docs/ /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("$.Widget")] public abstract class WidgetObject : jQueryUIObject { protected WidgetObject() { } - [IntrinsicProperty] + [ScriptField] public static object Prototype { get { return null; } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Element { get { return null; } } - [IntrinsicProperty] + [ScriptField] public object Options { get { return null; } } - [IntrinsicProperty] + [ScriptField] [ScriptName("_setOption")] public Function SetOption { get { @@ -51,7 +51,7 @@ public Function SetOption { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("_setOptions")] public Function SetOptions { get { diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetOption.cs b/src/Libraries/jQuery/jQuery.UI/WidgetOption.cs index d119606ad..60fb675d9 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI { /// /// Options for use with Widget. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum WidgetOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetOptions.cs b/src/Libraries/jQuery/jQuery.UI/WidgetOptions.cs index 121ee7a97..53a7bbb02 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI { /// /// Options used to initialize or customize Widget. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public class WidgetOptions { @@ -25,7 +25,7 @@ public WidgetOptions(params object[] nameValuePairs) { /// /// This event is triggered when the widget is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -37,7 +37,7 @@ public jQueryEventHandler Create { /// /// Disables the widget if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; diff --git a/src/Libraries/jQuery/jQuery.UI/WidgetType.cs b/src/Libraries/jQuery/jQuery.UI/WidgetType.cs index 87dffca83..757f599a6 100644 --- a/src/Libraries/jQuery/jQuery.UI/WidgetType.cs +++ b/src/Libraries/jQuery/jQuery.UI/WidgetType.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI { /// /// The default widgets that are part of jQueryUI. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("$.ui")] public sealed class WidgetType { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangeEvent.cs index 2fc887753..4d8c1b06c 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AccordionChangeEvent { - [IntrinsicProperty] + [ScriptField] public object NewContent { get { return null; @@ -22,7 +22,7 @@ public object NewContent { } } - [IntrinsicProperty] + [ScriptField] public object NewHeader { get { return null; @@ -31,7 +31,7 @@ public object NewHeader { } } - [IntrinsicProperty] + [ScriptField] public object OldContent { get { return null; @@ -40,7 +40,7 @@ public object OldContent { } } - [IntrinsicProperty] + [ScriptField] public object OldHeader { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangestartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangestartEvent.cs index f827d9e6a..6e983bcc5 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangestartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionChangestartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AccordionChangestartEvent { - [IntrinsicProperty] + [ScriptField] public object NewContent { get { return null; @@ -22,7 +22,7 @@ public object NewContent { } } - [IntrinsicProperty] + [ScriptField] public object NewHeader { get { return null; @@ -31,7 +31,7 @@ public object NewHeader { } } - [IntrinsicProperty] + [ScriptField] public object OldContent { get { return null; @@ -40,7 +40,7 @@ public object OldContent { } } - [IntrinsicProperty] + [ScriptField] public object OldHeader { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionEvents.cs index 692f43848..c34a7c480 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by Accordion. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AccordionEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionMethod.cs index f4886a717..1699b34a6 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by Accordion. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AccordionMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionObject.cs index 18485ee3e..79d6047f0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// Make the selected elements Accordion widgets.The markup of your accordion container needs pairs of headers and content panels:

    First header

    First content

    Second header

    Second content
    If you use a different element for the header, specify the header-option with an appropriate selector, eg. header: 'a.header'. The content element must be always next to its header.If you have links inside a accordion panel and use a-elements as headers, add a class to them and use that as the header, eg. header: 'a.header'.Use activate(Number) to change the active panel programmatically.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. ///
    - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class AccordionObject : WidgetObject { private AccordionObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOption.cs index 7207d9049..50cc31ef2 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with Accordion. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AccordionOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOptions.cs index 01ade79d5..d6345170d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Accordion/AccordionOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize Accordion. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AccordionOptions { @@ -25,7 +25,7 @@ public AccordionOptions(params object[] nameValuePairs) { /// /// This event is triggered every time the accordion changes. If the accordion is animated, the event will be triggered upon completion of the animation; otherwise, it is triggered immediately. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Change { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Change { /// /// This event is triggered every time the accordion starts to change. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Changestart { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Changestart { /// /// This event is triggered when the accordion is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -61,7 +61,7 @@ public jQueryEventHandler Create { /// /// The zero-based index of the panel that is active (open). A negative value select panels going backward from the last panel. When collapsible is set to true, a false value closes the accordion, otherwise nothing happens /// - [IntrinsicProperty] + [ScriptField] public object Active { get { return null; @@ -73,7 +73,7 @@ public object Active { /// /// Choose your favorite animation, or disable them (set to false). In addition to the default, 'bounceslide' and all defined easing methods are supported ('bounceslide' requires UI Effects Core). /// - [IntrinsicProperty] + [ScriptField] public object Animated { get { return null; @@ -85,7 +85,7 @@ public object Animated { /// /// If set, the highest content part is used as height reference for all other parts. Provides more consistent animations. /// - [IntrinsicProperty] + [ScriptField] public bool AutoHeight { get { return false; @@ -97,7 +97,7 @@ public bool AutoHeight { /// /// If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight. /// - [IntrinsicProperty] + [ScriptField] public bool ClearStyle { get { return false; @@ -109,7 +109,7 @@ public bool ClearStyle { /// /// Whether all the sections can be closed at once. Allows collapsing the active section. /// - [IntrinsicProperty] + [ScriptField] public bool Collapsible { get { return false; @@ -121,7 +121,7 @@ public bool Collapsible { /// /// Disables the accordion if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -133,7 +133,7 @@ public bool Disabled { /// /// The event on which to trigger the accordion. /// - [IntrinsicProperty] + [ScriptField] public string Event { get { return null; @@ -145,7 +145,7 @@ public string Event { /// /// If set, the accordion completely fills the height of the parent element. Overrides autoheight. /// - [IntrinsicProperty] + [ScriptField] public bool FillSpace { get { return false; @@ -157,7 +157,7 @@ public bool FillSpace { /// /// Selector for the header element. Must be a selector that applies to the accordion container element, via .find()The default covers both ul/li accordions, as well as flat structures like dl/dt/dd /// - [IntrinsicProperty] + [ScriptField] public string Header { get { return null; @@ -169,7 +169,7 @@ public string Header { /// /// Icons to use for headers, matching an icon defined by the jQuery UI CSS Framework. Set to false to have no icons displayed.
    • header (string, default: "ui-icon-triangle-1-e")
    • activeHeader (string, default: "ui-icon-triangle-1-s")
    ///
    - [IntrinsicProperty] + [ScriptField] public object Icons { get { return null; @@ -181,7 +181,7 @@ public object Icons { /// /// If set, looks for the anchor that matches location.href and activates it. Great for href-based state-saving. Use navigationFilter to implement your own matcher. /// - [IntrinsicProperty] + [ScriptField] public bool Navigation { get { return false; @@ -193,7 +193,7 @@ public bool Navigation { /// /// Overwrite the default location.href-matching with your own matcher. /// - [IntrinsicProperty] + [ScriptField] public Action NavigationFilter { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteChangeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteChangeEvent.cs index 6f370b3d2..d611600f9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteChangeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteChangeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AutoCompleteChangeEvent { - [IntrinsicProperty] + [ScriptField] public object Item { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteEvents.cs index 1201c402c..92da8b625 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by AutoComplete. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AutoCompleteEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteFocusEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteFocusEvent.cs index 7f42c1440..fca2903fd 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteFocusEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteFocusEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AutoCompleteFocusEvent { - [IntrinsicProperty] + [ScriptField] public object Item { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteMethod.cs index c28b1e215..fc285db67 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by AutoComplete. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AutoCompleteMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteObject.cs index fbb2c3a5d..5cf04f927 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// By giving an Autocomplete field focus or entering something into it, the plugin starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches.This can be used to enter previous selected values, for example you could use Autocomplete for entering tags, to complete an address, you could enter a city name and get the zip code, or maybe enter email addresses from an address book.You can pull data in from a local and/or a remote source: Local is good for small data sets (like an address book with 50 entries), remote is necessary for big data sets, like a database with hundreds or millions of entries to select from.Autocomplete can be customized to work with various data sources, by just specifying the source option.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class AutoCompleteObject : WidgetObject { private AutoCompleteObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOption.cs index 17d3e421c..0bb06489d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with AutoComplete. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum AutoCompleteOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOptions.cs index 752127461..bb9f37aec 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize AutoComplete. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AutoCompleteOptions { @@ -25,7 +25,7 @@ public AutoCompleteOptions(params object[] nameValuePairs) { /// /// Triggered when the field is blurred, if the value has changed; ui.item refers to the selected item. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Change { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Change { /// /// When the list is hidden - doesn't have to occur together with a change. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Close { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Close { /// /// This event is triggered when the autocomplete is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -61,7 +61,7 @@ public jQueryEventHandler Create { /// /// Before focus is moved to an item (not selecting), ui.item refers to the focused item. The default action of focus is to replace the text field's value with the value of the focused item, though only if the focus event was triggered by a keyboard interaction.Canceling this event prevents the value from being updated, but does not prevent the menu item from being focused. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Focus { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Focus { /// /// Triggered when the suggestion menu is opened or updated. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Open { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Open { /// /// Triggered after a request (source-option) completes, before the menu is shown. Useful for local manipulation of suggestion data, where a custom source-option callback is not required. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Response { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler Response { /// /// Before a request (source-option) is started, after minLength and delay are met. Can be canceled, then no request will be started and no items suggested. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Search { get { return null; @@ -109,7 +109,7 @@ public jQueryUIEventHandler Search { /// /// Triggered when an item is selected from the menu; ui.item refers to the selected item. The default action of select is to replace the text field's value with the value of the selected item.Canceling this event prevents the value from being updated, but does not prevent the menu from closing. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Select { get { return null; @@ -121,7 +121,7 @@ public jQueryUIEventHandler Select { /// /// Which element the menu should be appended to. Override this when the autocomplete is inside a position:fixed element. Otherwise the popup menu would still scroll with the page. /// - [IntrinsicProperty] + [ScriptField] public string AppendTo { get { return null; @@ -133,7 +133,7 @@ public string AppendTo { /// /// If set to true the first item will be automatically focused. /// - [IntrinsicProperty] + [ScriptField] public bool AutoFocus { get { return false; @@ -145,7 +145,7 @@ public bool AutoFocus { /// /// The delay in milliseconds the Autocomplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive. /// - [IntrinsicProperty] + [ScriptField] public int Delay { get { return 0; @@ -157,7 +157,7 @@ public int Delay { /// /// Disables the autocomplete if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -169,7 +169,7 @@ public bool Disabled { /// /// The minimum number of characters a user has to type before the Autocomplete activates. Zero is useful for local data with just a few items. Should be increased when there are a lot of items, where a single character would match a few thousand items. /// - [IntrinsicProperty] + [ScriptField] public int MinLength { get { return 0; @@ -181,7 +181,7 @@ public int MinLength { /// /// Identifies the position of the Autocomplete widget in relation to the associated input element. The "of" option defaults to the input element, but you can specify another element to position against. You can refer to the [http://docs.jquery.com/UI/Position jQuery UI Position] utility for more details about the various options. /// - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -193,7 +193,7 @@ public object Position { /// /// Defines the data to use, must be specified.Independent of the variant you use, the label is always treated as text. If you want the label to be treated as html you can use [https://github.com/scottgonzalez/jquery-ui-extensions/blob/master/autocomplete/jquery.ui.autocomplete.html.js Scott González' html extension]. The demos all focus on different variations of the source-option - look for the one that matches your use case, and take a look at the code. /// - [IntrinsicProperty] + [ScriptField] public object Source { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteResponseEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteResponseEvent.cs index 7875e9d94..8620a4996 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteResponseEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteResponseEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AutoCompleteResponseEvent { - [IntrinsicProperty] + [ScriptField] public object Content { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteSelectEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteSelectEvent.cs index d843d00e0..2dd18242a 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteSelectEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/AutoComplete/AutoCompleteSelectEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class AutoCompleteSelectEvent { - [IntrinsicProperty] + [ScriptField] public object Item { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonEvents.cs index b5d659ac5..585dd3f6d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by Button. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonMethod.cs index 6aa53415f..d00dec852 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by Button. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonObject.cs index 6d762cdd7..4e2203cc5 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// Button enhances standard form elements like button, input of type submit or reset or anchors to themable buttons with appropiate mouseover and active styles.In addition to basic push buttons, radio buttons and checkboxes (inputs of type radio and checkbox) can be converted to buttons: Their associated label is styled to appear as the button, while the underlying input is updated on click.In order to group radio buttons, Button also provides an additional widget-method, called buttonset. Its used by selecting a container element (which contains the radio buttons) and calling buttonset(). Buttonset will also provide visual grouping, and therefore should be used whenever you have a group of buttons. It works by selecting all descendents and applying button() to them. You can enable and disable a buttonset, which will enable and disable all contained buttons. Destroying a buttonset also calls each button's destroy method.When using an input of type button, submit or reset, support is limited to plain text labels with no icons.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ButtonObject : WidgetObject { private ButtonObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOption.cs index f947a5825..2ecbee968 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with Button. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOptions.cs index 22f8996b9..3a09a6995 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Button/ButtonOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize Button. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ButtonOptions { @@ -25,7 +25,7 @@ public ButtonOptions(params object[] nameValuePairs) { /// /// This event is triggered when the button is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -37,7 +37,7 @@ public jQueryEventHandler Create { /// /// Disables the button if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -49,7 +49,7 @@ public bool Disabled { /// /// Icons to display, with or without text (see text option). The primary icon is displayed by default on the left of the label text, the secondary by default is on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only one icon: icons: {primary:'ui-icon-locked'}. For using two icons: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} /// - [IntrinsicProperty] + [ScriptField] public object Icons { get { return null; @@ -61,7 +61,7 @@ public object Icons { /// /// Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox /// - [IntrinsicProperty] + [ScriptField] public string Label { get { return null; @@ -73,7 +73,7 @@ public string Label { /// /// Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored. /// - [IntrinsicProperty] + [ScriptField] public bool Text { get { return false; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetEvents.cs index e20e93745..7f7e070a1 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by ButtonSet. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonSetEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetMethod.cs index 12445697f..60488bf18 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by ButtonSet. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonSetMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetObject.cs index 1c49438aa..cd8f90168 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// In order to group radio buttons, Button also provides an additional widget-method, called buttonset. Its used by selecting a container element (which contains the radio buttons) and calling buttonset(). Buttonset will also provide visual grouping, and therefore should be used whenever you have a group of buttons. It works by selecting all descendents and applying button() to them. You can enable and disable a buttonset, which will enable and disable all contained buttons. Destroying a buttonset also calls each button's destroy method.When using an input of type button, submit or reset, support is limited to plain text labels with no icons.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ButtonSetObject : WidgetObject { private ButtonSetObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOption.cs index 7560f3532..70cfa75a0 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with ButtonSet. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ButtonSetOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOptions.cs index cba5539a0..2ffbb1738 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ButtonSet/ButtonSetOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize ButtonSet. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ButtonSetOptions { @@ -25,7 +25,7 @@ public ButtonSetOptions(params object[] nameValuePairs) { /// /// This event is triggered when the button is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -34,7 +34,7 @@ public jQueryEventHandler Create { } } - [IntrinsicProperty] + [ScriptField] public string Items { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerEvents.cs index 11d4cb8c0..3ce566f24 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by DatePicker. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DatePickerEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerMethod.cs index d03322b26..b985fa899 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by DatePicker. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DatePickerMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerObject.cs index 933a0f4c3..37d6f9352 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and language, restrict the selectable date ranges and add in buttons and other navigation options easily.By default, the datepicker calendar opens in a small overlay onFocus and closes automatically onBlur or when a date is selected. For an inline calendar, simply attach the datepicker to a div or span.You can use keyboard shortcuts to drive the datepicker:
    • page up/down - previous/next month
    • ctrl+page up/down - previous/next year
    • ctrl+home - current month or open when closed
    • ctrl+left/right - previous/next day
    • ctrl+up/down - previous/next week
    • enter - accept the selected date
    • ctrl+end - close and erase the date
    • escape - close the datepicker without selection

    Utility functions

    • $.datepicker.setDefaults( settings ) - Set settings for all datepicker instances.
    • $.datepicker.formatDate( format, date, settings ) - Format a date into a string value with a specified format.
    • $.datepicker.parseDate( format, value, settings ) - Extract a date from a string value with a specified format.
    • $.datepicker.iso8601Week( date ) - Determine the week of the year for a given date: 1 to 53.
    • $.datepicker.noWeekends - Set as beforeShowDay function to prevent selection of weekends.

    Localization

    Datepicker provides support for localizing its content to cater for different languagesand date formats. Each localization is contained within its own file with thelanguage code appended to the name, e.g. jquery.ui.datepicker-fr.js for French.The desired localization file should be included after the main datepicker code. They add their settings to the setof available localizations and automatically apply them as defaults for all instances.The $.datepicker.regional attribute holds an array of localizations,indexed by language code, with "" referring to the default (English). Each entry isan object with the following attributes: closeText, prevText,nextText, currentText, monthNames,monthNamesShort, dayNames, dayNamesShort,dayNamesMin, weekHeader, dateFormat,firstDay, isRTL, showMonthAfterYear,and yearSuffix.You can restore the default localizations with:$.datepicker.setDefaults($.datepicker.regional[""]);And can then override an individual datepicker for a specific locale:$(selector).datepicker($.datepicker.regional['fr']);This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. ///
    - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class DatePickerObject : WidgetObject { private DatePickerObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOption.cs index 3232603a7..08b9e62ff 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with DatePicker. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DatePickerOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOptions.cs index 2715f91de..f44742e7d 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/DatePicker/DatePickerOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize DatePicker. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DatePickerOptions { @@ -25,7 +25,7 @@ public DatePickerOptions(params object[] nameValuePairs) { /// /// The jQuery selector for another field that is to be updated with the selected date from the datepicker. Use the [[UI/Datepicker#option-altFormat|altFormat]] setting to change the format of the date within this field. Leave as blank for no alternate field. /// - [IntrinsicProperty] + [ScriptField] public object AltField { get { return null; @@ -37,7 +37,7 @@ public object AltField { /// /// The [[UI/Datepicker#option-dateFormat|dateFormat]] to be used for the [[UI/Datepicker#option-altField|altField]] option. This allows one date format to be shown to the user for selection purposes, while a different format is actually sent behind the scenes. For a full list of the possible formats see the [[UI/Datepicker/formatDate|formatDate]] function /// - [IntrinsicProperty] + [ScriptField] public string AltFormat { get { return null; @@ -49,7 +49,7 @@ public string AltFormat { /// /// The text to display after each date field, e.g. to show the required format. /// - [IntrinsicProperty] + [ScriptField] public string AppendText { get { return null; @@ -61,7 +61,7 @@ public string AppendText { /// /// Set to true to automatically resize the input field to accommodate dates in the current [[UI/Datepicker#option-dateFormat|dateFormat]]. /// - [IntrinsicProperty] + [ScriptField] public bool AutoSize { get { return false; @@ -73,7 +73,7 @@ public bool AutoSize { /// /// The URL for the popup button image. If set, [[UI/Datepicker#option-buttonText|buttonText]] becomes the ''alt'' value and is not directly displayed. /// - [IntrinsicProperty] + [ScriptField] public string ButtonImage { get { return null; @@ -85,7 +85,7 @@ public string ButtonImage { /// /// Set to true to place an image after the field to use as the trigger without it appearing on a button. /// - [IntrinsicProperty] + [ScriptField] public bool ButtonImageOnly { get { return false; @@ -97,7 +97,7 @@ public bool ButtonImageOnly { /// /// The text to display on the trigger button. Use in conjunction with [[UI/Datepicker#option-showOn|showOn]] equal to 'button' or 'both'. /// - [IntrinsicProperty] + [ScriptField] public string ButtonText { get { return null; @@ -109,7 +109,7 @@ public string ButtonText { /// /// myWeekCalc /// - [IntrinsicProperty] + [ScriptField] public object CalculateWeek { get { return null; @@ -121,7 +121,7 @@ public object CalculateWeek { /// /// Allows you to change the month by selecting from a drop-down list. You can enable this feature by setting the attribute to true. /// - [IntrinsicProperty] + [ScriptField] public bool ChangeMonth { get { return false; @@ -133,7 +133,7 @@ public bool ChangeMonth { /// /// Allows you to change the year by selecting from a drop-down list. You can enable this feature by setting the attribute to true. Use the [[UI/Datepicker#option-yearRange|yearRange]] option to control which years are made available for selection. /// - [IntrinsicProperty] + [ScriptField] public bool ChangeYear { get { return false; @@ -145,7 +145,7 @@ public bool ChangeYear { /// /// The text to display for the close link. This attribute is one of the regionalisation attributes. Use the [[UI/Datepicker#option-showButtonPanel|showButtonPanel]] to display this button. /// - [IntrinsicProperty] + [ScriptField] public string CloseText { get { return null; @@ -157,7 +157,7 @@ public string CloseText { /// /// When true entry in the input field is constrained to those characters allowed by the current [[UI/Datepicker#option-dateFormat|dateFormat]]. /// - [IntrinsicProperty] + [ScriptField] public bool ConstrainInput { get { return false; @@ -169,7 +169,7 @@ public bool ConstrainInput { /// /// The text to display for the current day link. This attribute is one of the regionalisation attributes. Use the [[UI/Datepicker#option-showButtonPanel|showButtonPanel]] to display this button. /// - [IntrinsicProperty] + [ScriptField] public string CurrentText { get { return null; @@ -181,7 +181,7 @@ public string CurrentText { /// /// The format for parsed and displayed dates. This attribute is one of the regionalisation attributes. For a full list of the possible formats see the [[UI/Datepicker/formatDate|formatDate]] function. /// - [IntrinsicProperty] + [ScriptField] public string DateFormat { get { return null; @@ -193,7 +193,7 @@ public string DateFormat { /// /// The list of long day names, starting from Sunday, for use as requested via the [[UI/Datepicker#option-dateFormat|dateFormat]] setting. They also appear as popup hints when hovering over the corresponding column headings. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public Array DayNames { get { return null; @@ -205,7 +205,7 @@ public Array DayNames { /// /// The list of minimised day names, starting from Sunday, for use as column headers within the datepicker. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public Array DayNamesMin { get { return null; @@ -217,7 +217,7 @@ public Array DayNamesMin { /// /// The list of abbreviated day names, starting from Sunday, for use as requested via the [[UI/Datepicker#option-dateFormat|dateFormat]] setting. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public Array DayNamesShort { get { return null; @@ -229,7 +229,7 @@ public Array DayNamesShort { /// /// Set the date to highlight on first opening if the field is blank. Specify either an actual date via a Date object or as a string in the current [[UI/Datepicker#option-dateFormat|dateFormat]], or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null for today. /// - [IntrinsicProperty] + [ScriptField] public object DefaultDate { get { return null; @@ -241,7 +241,7 @@ public object DefaultDate { /// /// Control the speed at which the datepicker appears, it may be a time in milliseconds or a string representing one of the three predefined speeds ("slow", "normal", "fast"). /// - [IntrinsicProperty] + [ScriptField] public object Duration { get { return null; @@ -253,7 +253,7 @@ public object Duration { /// /// Set the first day of the week: Sunday is 0, Monday is 1, ... This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public int FirstDay { get { return 0; @@ -265,7 +265,7 @@ public int FirstDay { /// /// When true the current day link moves to the currently selected date instead of today. /// - [IntrinsicProperty] + [ScriptField] public bool GotoCurrent { get { return false; @@ -277,7 +277,7 @@ public bool GotoCurrent { /// /// Normally the previous and next links are disabled when not applicable (see [[UI/Datepicker#option-minDate|minDate]]/[[UI/Datepicker#option-maxDate|maxDate]]). You can hide them altogether by setting this attribute to true. /// - [IntrinsicProperty] + [ScriptField] public bool HideIfNoPrevNext { get { return false; @@ -289,7 +289,7 @@ public bool HideIfNoPrevNext { /// /// True if the current language is drawn from right to left. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public bool IsRTL { get { return false; @@ -301,7 +301,7 @@ public bool IsRTL { /// /// Set a maximum selectable date via a Date object or as a string in the current [[UI/Datepicker#option-dateFormat|dateFormat]], or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +1w'), or null for no limit. /// - [IntrinsicProperty] + [ScriptField] public object MaxDate { get { return null; @@ -313,7 +313,7 @@ public object MaxDate { /// /// Set a minimum selectable date via a Date object or as a string in the current [[UI/Datepicker#option-dateFormat|dateFormat]], or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '-1y -1m'), or null for no limit. /// - [IntrinsicProperty] + [ScriptField] public object MinDate { get { return null; @@ -325,7 +325,7 @@ public object MinDate { /// /// The list of full month names, for use as requested via the [[UI/Datepicker#option-dateFormat|dateFormat]] setting. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public Array MonthNames { get { return null; @@ -337,7 +337,7 @@ public Array MonthNames { /// /// The list of abbreviated month names, as used in the month header on each datepicker and as requested via the [[UI/Datepicker#option-dateFormat|dateFormat]] setting. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public Array MonthNamesShort { get { return null; @@ -349,7 +349,7 @@ public Array MonthNamesShort { /// /// When true the [[UI/Datepicker/formatDate|formatDate]] function is applied to the [[UI/Datepicker#option-prevText|prevText]], [[UI/Datepicker#option-nextText|nextText]], and [[UI/Datepicker#option-currentText|currentText]] values before display, allowing them to display the target month names for example. /// - [IntrinsicProperty] + [ScriptField] public bool NavigationAsDateFormat { get { return false; @@ -361,7 +361,7 @@ public bool NavigationAsDateFormat { /// /// The text to display for the next month link. This attribute is one of the regionalisation attributes. With the standard ThemeRoller styling, this value is replaced by an icon. /// - [IntrinsicProperty] + [ScriptField] public string NextText { get { return null; @@ -373,7 +373,7 @@ public string NextText { /// /// Set how many months to show at once. The value can be a straight integer, or can be a two-element array to define the number of rows and columns to display. /// - [IntrinsicProperty] + [ScriptField] public object NumberOfMonths { get { return null; @@ -385,7 +385,7 @@ public object NumberOfMonths { /// /// The text to display for the previous month link. This attribute is one of the regionalisation attributes. With the standard ThemeRoller styling, this value is replaced by an icon. /// - [IntrinsicProperty] + [ScriptField] public string PrevText { get { return null; @@ -397,7 +397,7 @@ public string PrevText { /// /// When true days in other months shown before or after the current month are selectable. This only applies if [[UI/Datepicker#option-showOtherMonths|showOtherMonths]] is also true. /// - [IntrinsicProperty] + [ScriptField] public bool SelectOtherMonths { get { return false; @@ -409,7 +409,7 @@ public bool SelectOtherMonths { /// /// Set the cutoff year for determining the century for a date (used in conjunction with [[UI/Datepicker#option-dateFormat|dateFormat]] 'y'). If a numeric value (0-99) is provided then this value is used directly. If a string value is provided then it is converted to a number and added to the current year. Once the cutoff year is calculated, any dates entered with a year value less than or equal to it are considered to be in the current century, while those greater than it are deemed to be in the previous century. /// - [IntrinsicProperty] + [ScriptField] public object ShortYearCutoff { get { return null; @@ -421,7 +421,7 @@ public object ShortYearCutoff { /// /// Set the name of the animation used to show/hide the datepicker. Use 'show' (the default), 'slideDown', 'fadeIn', any of the show/hide [http://docs.jquery.com/UI/Effects jQuery UI effects], or "" for no animation. /// - [IntrinsicProperty] + [ScriptField] public string ShowAnim { get { return null; @@ -433,7 +433,7 @@ public string ShowAnim { /// /// Whether to show the button panel. /// - [IntrinsicProperty] + [ScriptField] public bool ShowButtonPanel { get { return false; @@ -445,7 +445,7 @@ public bool ShowButtonPanel { /// /// Specify where in a [[UI/Datepicker#option-numberOfMonths|multi-month]] display the current month shows, starting from 0 at the top/left. /// - [IntrinsicProperty] + [ScriptField] public int ShowCurrentAtPos { get { return 0; @@ -457,7 +457,7 @@ public int ShowCurrentAtPos { /// /// Whether to show the month after the year in the header. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public bool ShowMonthAfterYear { get { return false; @@ -469,7 +469,7 @@ public bool ShowMonthAfterYear { /// /// Have the datepicker appear automatically when the field receives focus ("focus"), appear only when a button is clicked ("button"), or appear when either event taks place ("both"). /// - [IntrinsicProperty] + [ScriptField] public string ShowOn { get { return null; @@ -481,7 +481,7 @@ public string ShowOn { /// /// If using one of the jQuery UI effects for [[UI/Datepicker#option-showAnim|showAnim]], you can provide additional settings for that animation via this option. /// - [IntrinsicProperty] + [ScriptField] public object ShowOptions { get { return null; @@ -493,7 +493,7 @@ public object ShowOptions { /// /// Display dates in other months (non-selectable) at the start or end of the current month. To make these days selectable use [[UI/Datepicker#option-selectOtherMonths|selectOtherMonths]]. /// - [IntrinsicProperty] + [ScriptField] public bool ShowOtherMonths { get { return false; @@ -505,7 +505,7 @@ public bool ShowOtherMonths { /// /// When true a column is added to show the week of the year. The [[UI/Datepicker#option-calculateWeek|calculateWeek]] option determines how the week of the year is calculated. You may also want to change the [[UI/Datepicker#option-firstDay|firstDay]] option. /// - [IntrinsicProperty] + [ScriptField] public bool ShowWeek { get { return false; @@ -517,7 +517,7 @@ public bool ShowWeek { /// /// Set how many months to move when clicking the Previous/Next links. /// - [IntrinsicProperty] + [ScriptField] public int StepMonths { get { return 0; @@ -529,7 +529,7 @@ public int StepMonths { /// /// The text to display for the week of the year column heading. This attribute is one of the regionalisation attributes. Use [[UI/Datepicker#option-showWeek|showWeek]] to display this column. /// - [IntrinsicProperty] + [ScriptField] public string WeekHeader { get { return null; @@ -541,7 +541,7 @@ public string WeekHeader { /// /// Control the range of years displayed in the year drop-down: either relative to today's year (-nn:+nn), relative to the currently selected year (c-nn:c+nn), absolute (nnnn:nnnn), or combinations of these formats (nnnn:-nn). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the [[UI/Datepicker#option-minDate|minDate]] and/or [[UI/Datepicker#option-maxDate|maxDate]] options. /// - [IntrinsicProperty] + [ScriptField] public string YearRange { get { return null; @@ -553,7 +553,7 @@ public string YearRange { /// /// Additional text to display after the year in the month headers. This attribute is one of the regionalisation attributes. /// - [IntrinsicProperty] + [ScriptField] public string YearSuffix { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragEvent.cs index 4b1ea567a..11ad96699 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogDragEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStartEvent.cs index 3e9280081..72a8a4083 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogDragStartEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStopEvent.cs index 06f599163..8bbf5b25f 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogDragStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogDragStopEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogEvents.cs index bd8bef7fd..e31c71dca 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by Dialog. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DialogEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogMethod.cs index f33706aac..73c5cacb5 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by Dialog. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DialogMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogObject.cs index 6e36edf61..75775e2dc 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// A dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and closed with the 'x' icon by default.If the content length exceeds the maximum height, a scrollbar will automatically appear.A bottom button bar and semi-transparent modal overlay layer are common options that can be added.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class DialogObject : WidgetObject { private DialogObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOption.cs index a7dc19447..79fed7024 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with Dialog. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum DialogOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOptions.cs index 2532047f4..cda2c5233 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize Dialog. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogOptions { @@ -25,7 +25,7 @@ public DialogOptions(params object[] nameValuePairs) { /// /// This event is triggered when a dialog attempts to close. If the beforeClose event handler (callback function) returns false, the close will be prevented. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler BeforeClose { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler BeforeClose { /// /// This event is triggered when the dialog is closed. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Close { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Close { /// /// This event is triggered when the dialog is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -61,7 +61,7 @@ public jQueryEventHandler Create { /// /// This event is triggered when the dialog is dragged. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Drag { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Drag { /// /// This event is triggered at the beginning of the dialog being dragged. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler DragStart { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler DragStart { /// /// This event is triggered after the dialog has been dragged. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler DragStop { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler DragStop { /// /// This event is triggered when the dialog gains focus. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Focus { get { return null; @@ -109,7 +109,7 @@ public jQueryUIEventHandler Focus { /// /// This event is triggered when dialog is opened. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Open { get { return null; @@ -121,7 +121,7 @@ public jQueryUIEventHandler Open { /// /// This event is triggered when the dialog is resized. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Resize { get { return null; @@ -133,7 +133,7 @@ public jQueryUIEventHandler Resize { /// /// This event is triggered at the beginning of the dialog being resized. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler ResizeStart { get { return null; @@ -145,7 +145,7 @@ public jQueryUIEventHandler ResizeStart { /// /// This event is triggered after the dialog has been resized. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler ResizeStop { get { return null; @@ -157,7 +157,7 @@ public jQueryUIEventHandler ResizeStop { /// /// When ''autoOpen'' is ''true'' the dialog will open automatically when ''dialog'' is called. If ''false'' it will stay hidden until ''.dialog("open")'' is called on it. /// - [IntrinsicProperty] + [ScriptField] public bool AutoOpen { get { return false; @@ -169,7 +169,7 @@ public bool AutoOpen { /// /// Specifies which buttons should be displayed on the dialog. Each element of the array must be an Object defining the properties to set on the button. /// - [IntrinsicProperty] + [ScriptField] public Array Buttons { get { return null; @@ -181,7 +181,7 @@ public Array Buttons { /// /// Specifies whether the dialog should close when it has focus and the user presses the esacpe (ESC) key. /// - [IntrinsicProperty] + [ScriptField] public bool CloseOnEscape { get { return false; @@ -193,7 +193,7 @@ public bool CloseOnEscape { /// /// Specifies the text for the close button. Note that the close text is visibly hidden when using a standard theme. /// - [IntrinsicProperty] + [ScriptField] public string CloseText { get { return null; @@ -205,7 +205,7 @@ public string CloseText { /// /// The specified class name(s) will be added to the dialog, for additional theming. /// - [IntrinsicProperty] + [ScriptField] public string DialogClass { get { return null; @@ -217,7 +217,7 @@ public string DialogClass { /// /// Disables the dialog if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -229,7 +229,7 @@ public bool Disabled { /// /// If set to true, the dialog will be draggable by the titlebar. /// - [IntrinsicProperty] + [ScriptField] public bool Draggable { get { return false; @@ -241,7 +241,7 @@ public bool Draggable { /// /// The height of the dialog, in pixels. Specifying 'auto' is also supported to make the dialog adjust based on its content. /// - [IntrinsicProperty] + [ScriptField] public int Height { get { return 0; @@ -253,7 +253,7 @@ public int Height { /// /// The effect to be used when the dialog is closed. /// - [IntrinsicProperty] + [ScriptField] public object Hide { get { return null; @@ -265,7 +265,7 @@ public object Hide { /// /// The maximum height to which the dialog can be resized, in pixels. /// - [IntrinsicProperty] + [ScriptField] public int MaxHeight { get { return 0; @@ -277,7 +277,7 @@ public int MaxHeight { /// /// The maximum width to which the dialog can be resized, in pixels. /// - [IntrinsicProperty] + [ScriptField] public int MaxWidth { get { return 0; @@ -289,7 +289,7 @@ public int MaxWidth { /// /// The minimum height to which the dialog can be resized, in pixels. /// - [IntrinsicProperty] + [ScriptField] public int MinHeight { get { return 0; @@ -301,7 +301,7 @@ public int MinHeight { /// /// The minimum width to which the dialog can be resized, in pixels. /// - [IntrinsicProperty] + [ScriptField] public int MinWidth { get { return 0; @@ -313,7 +313,7 @@ public int MinWidth { /// /// If set to true, the dialog will have modal behavior; other items on the page will be disabled (i.e. cannot be interacted with). Modal dialogs create an overlay below the dialog but above other page elements. /// - [IntrinsicProperty] + [ScriptField] public bool Modal { get { return false; @@ -325,7 +325,7 @@ public bool Modal { /// /// Specifies where the dialog should be displayed. Possible values:
    1) a single string representing position within viewport: 'center', 'left', 'right', 'top', 'bottom'.
    2) an array containing an x,y coordinate pair in pixel offset from left, top corner of viewport (e.g. [350,100])
    3) an array containing x,y position string values (e.g. ['right','top'] for top right corner). ///
    - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; @@ -337,7 +337,7 @@ public object Position { /// /// If set to true, the dialog will be resizable. /// - [IntrinsicProperty] + [ScriptField] public bool Resizable { get { return false; @@ -349,7 +349,7 @@ public bool Resizable { /// /// The effect to be used when the dialog is opened. /// - [IntrinsicProperty] + [ScriptField] public object Show { get { return null; @@ -361,7 +361,7 @@ public object Show { /// /// Specifies whether the dialog will stack on top of other dialogs. This will cause the dialog to move to the front of other dialogs when it gains focus. /// - [IntrinsicProperty] + [ScriptField] public bool Stack { get { return false; @@ -373,7 +373,7 @@ public bool Stack { /// /// Specifies the title of the dialog. Any valid HTML may be set as the title. The title can also be specified by the title attribute on the dialog source element. /// - [IntrinsicProperty] + [ScriptField] public string Title { get { return null; @@ -385,7 +385,7 @@ public string Title { /// /// The width of the dialog, in pixels. /// - [IntrinsicProperty] + [ScriptField] public int Width { get { return 0; @@ -397,7 +397,7 @@ public int Width { /// /// The starting z-index for the dialog. /// - [IntrinsicProperty] + [ScriptField] public int ZIndex { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeEvent.cs index 3d1e2059b..c6eeea9b3 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogResizeEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStartEvent.cs index a1ac30645..04fd73e52 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogResizeStartEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStopEvent.cs index e4f0e77d4..7af6d713e 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Dialog/DialogResizeStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class DialogResizeStopEvent { - [IntrinsicProperty] + [ScriptField] public object Offset { get { return null; @@ -22,7 +22,7 @@ public object Offset { } } - [IntrinsicProperty] + [ScriptField] public object Position { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarEvents.cs index 4b2678e0b..95f2a8dac 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by ProgressBar. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ProgressBarEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarMethod.cs index fd8c498c5..1c71c5883 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by ProgressBar. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ProgressBarMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarObject.cs index 34589e9d0..611bf2966 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// The progress bar is designed to simply display the current percent complete for a process. The bar is coded to be flexibly sized through CSS and will scale to fit inside it's parent container by default.This is a determinate progress bar, meaning that it should only be used in situations where the system can accurately update the current status complete. A determinate progress bar should never fill from left to right, then loop back to empty for a single process -- if the actual percent complete status cannot be calculated, an indeterminate progress bar or spinner animation is a better way to provide user feedback.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class ProgressBarObject : WidgetObject { private ProgressBarObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOption.cs index 46f6a7d39..71eaf4311 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with ProgressBar. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum ProgressBarOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOptions.cs index cea1f8d44..ace030455 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/ProgressBar/ProgressBarOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize ProgressBar. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class ProgressBarOptions { @@ -25,7 +25,7 @@ public ProgressBarOptions(params object[] nameValuePairs) { /// /// This event is triggered when the value of the progressbar changes. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Change { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Change { /// /// This event is triggered when the value of the progressbar reaches the maximum value of 100. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Complete { get { return null; @@ -49,7 +49,7 @@ public jQueryUIEventHandler Complete { /// /// This event is triggered when the progressbar is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -61,7 +61,7 @@ public jQueryEventHandler Create { /// /// Disables the progressbar if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -73,7 +73,7 @@ public bool Disabled { /// /// The value of the progressbar. /// - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideChangeEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideChangeEvent.cs index a5f65f256..d864e3579 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideChangeEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideChangeEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SlideChangeEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Handle { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Handle { } } - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideEvent.cs index 49fbe2c12..f7dc82a88 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SlideEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Handle { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Handle { } } - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; @@ -31,7 +31,7 @@ public int Value { } } - [IntrinsicProperty] + [ScriptField] public Array Values { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStartEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStartEvent.cs index 9abf43990..2d61417b6 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStartEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStartEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SlideStartEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Handle { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Handle { } } - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStopEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStopEvent.cs index 09558a73b..49855e4bb 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStopEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SlideStopEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SlideStopEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Handle { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Handle { } } - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderEvents.cs index 7b856fe76..f49dc3bce 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by Slider. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SliderEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderMethod.cs index 3d8bdf066..18c0e0751 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by Slider. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SliderMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderObject.cs index 71e6ca394..31f04e502 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// The jQuery UI Slider plugin makes selected elements into sliders. There are various options such as multiple handles, and ranges. The handle can be moved with the mouse or the arrow keys.The start, slide, and stop callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):The slider widget will create handle elements with the class 'ui-slider-handle' on initialization. You can specify custom handle elements by creating and appending the elements and adding the 'ui-slider-handle' class before init. It will only create the number of handles needed to match the length of value/values. For example, if you specify 'values: [1, 5, 18]' and create one custom handle, the plugin will create the other two.
    • ui.handle: DOMElement - the current focused handle
    • ui.value: Integer - the current handle's value
    This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. ///
    - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class SliderObject : WidgetObject { private SliderObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOption.cs index bf81fb613..81e648349 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with Slider. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum SliderOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOptions.cs index 943ba82ce..4bd0a1b20 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Slider/SliderOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize Slider. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class SliderOptions { @@ -25,7 +25,7 @@ public SliderOptions(params object[] nameValuePairs) { /// /// This event is triggered on slide stop, or if the value is changed programmatically (by the value method). Takes arguments event and ui. Use event.originalEvent to detect whether the value changed by mouse, keyboard, or programmatically. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(this).slider('values', index) to get another handle's value. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Change { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Change { /// /// This event is triggered when the slider is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -49,7 +49,7 @@ public jQueryEventHandler Create { /// /// This event is triggered on every mouse move during slide. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(..).slider('value', index) to get another handles' value.Return false in order to prevent a slide, based on ui.value. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Slide { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Slide { /// /// This event is triggered when the user starts sliding. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Start { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Start { /// /// This event is triggered when the user stops sliding. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Stop { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Stop { /// /// Whether to slide handle smoothly when user click outside handle on the bar. Will also accept a string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). /// - [IntrinsicProperty] + [ScriptField] public object Animate { get { return null; @@ -97,7 +97,7 @@ public object Animate { /// /// Disables the slider if set to true. /// - [IntrinsicProperty] + [ScriptField] public bool Disabled { get { return false; @@ -109,7 +109,7 @@ public bool Disabled { /// /// The maximum value of the slider. /// - [IntrinsicProperty] + [ScriptField] public int Max { get { return 0; @@ -121,7 +121,7 @@ public int Max { /// /// The minimum value of the slider. /// - [IntrinsicProperty] + [ScriptField] public int Min { get { return 0; @@ -133,7 +133,7 @@ public int Min { /// /// This option determines whether the slider has the min at the left, the max at the right or the min at the bottom, the max at the top. Possible values: 'horizontal', 'vertical'. /// - [IntrinsicProperty] + [ScriptField] public string Orientation { get { return null; @@ -145,7 +145,7 @@ public string Orientation { /// /// If set to true, the slider will detect if you have two handles and create a stylable range element between these two. Two other possible values are 'min' and 'max'. A min range goes from the slider min to one handle. A max range goes from one handle to the slider max. /// - [IntrinsicProperty] + [ScriptField] public object Range { get { return null; @@ -157,7 +157,7 @@ public object Range { /// /// Determines the size or amount of each interval or step the slider takes between min and max. The full specified value range of the slider (max - min) needs to be evenly divisible by the step. /// - [IntrinsicProperty] + [ScriptField] public int Step { get { return 0; @@ -169,7 +169,7 @@ public int Step { /// /// Determines the value of the slider, if there's only one handle. If there is more than one handle, determines the value of the first handle. /// - [IntrinsicProperty] + [ScriptField] public int Value { get { return 0; @@ -181,7 +181,7 @@ public int Value { /// /// This option can be used to specify multiple handles. If range is set to true, the length of 'values' should be 2. /// - [IntrinsicProperty] + [ScriptField] public Array Values { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsAddEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsAddEvent.cs index ff8a7078e..a5a4711ce 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsAddEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsAddEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsAddEvent { - [IntrinsicProperty] + [ScriptField] public string Panel { get { return null; @@ -22,7 +22,7 @@ public string Panel { } } - [IntrinsicProperty] + [ScriptField] public string Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsDisableEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsDisableEvent.cs index 3b74b8c16..f7d2a97f9 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsDisableEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsDisableEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsDisableEvent { - [IntrinsicProperty] + [ScriptField] public string Panel { get { return null; @@ -22,7 +22,7 @@ public string Panel { } } - [IntrinsicProperty] + [ScriptField] public string Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEnableEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEnableEvent.cs index 0cc926c44..e55e92a60 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEnableEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEnableEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsEnableEvent { - [IntrinsicProperty] + [ScriptField] public string Panel { get { return null; @@ -22,7 +22,7 @@ public string Panel { } } - [IntrinsicProperty] + [ScriptField] public string Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEvents.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEvents.cs index 467e9fb09..8caca9001 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEvents.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsEvents.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Events raised by Tabs. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum TabsEvents { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsLoadEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsLoadEvent.cs index e9d27c716..7de2530df 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsLoadEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsLoadEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsLoadEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Panel { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Panel { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsMethod.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsMethod.cs index 7291debac..e1669b380 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Operations supported by Tabs. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum TabsMethod { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsObject.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsObject.cs index d04feb491..781abd25b 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsObject.cs @@ -14,8 +14,8 @@ namespace jQueryApi.UI.Widgets { /// /// Tabs are generally used to break content into multiple sections that can be swapped to save space, much like an accordion.By default a tab widget will swap between tabbed sections on click, but the events can be changed to onHover through an option. Tab content can be loaded via Ajax by setting an href on a tab.This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class TabsObject : WidgetObject { private TabsObject() { diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOption.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOption.cs index 82788fb7f..bb93be1da 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOption.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOption.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI.Widgets { /// /// Options for use with Tabs. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum TabsOption { /// diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOptions.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOptions.cs index 454be658a..be0d163da 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOptions.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsOptions.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI.Widgets { /// /// Options used to initialize or customize Tabs. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsOptions { @@ -25,7 +25,7 @@ public TabsOptions(params object[] nameValuePairs) { /// /// Triggered after a new tab is added. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Add { get { return null; @@ -37,7 +37,7 @@ public jQueryUIEventHandler Add { /// /// This event is triggered when the tabs widget is created. /// - [IntrinsicProperty] + [ScriptField] public jQueryEventHandler Create { get { return null; @@ -49,7 +49,7 @@ public jQueryEventHandler Create { /// /// Triggered after an enabled tab has been disabled. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Disable { get { return null; @@ -61,7 +61,7 @@ public jQueryUIEventHandler Disable { /// /// Triggered after a disabled tab has been enabled. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Enable { get { return null; @@ -73,7 +73,7 @@ public jQueryUIEventHandler Enable { /// /// Triggered after a remote tab has been loaded. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Load { get { return null; @@ -85,7 +85,7 @@ public jQueryUIEventHandler Load { /// /// Triggered after a tab has been removed. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Remove { get { return null; @@ -97,7 +97,7 @@ public jQueryUIEventHandler Remove { /// /// This event is triggered when clicking a tab. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Select { get { return null; @@ -109,7 +109,7 @@ public jQueryUIEventHandler Select { /// /// Triggered after a tab has been shown. /// - [IntrinsicProperty] + [ScriptField] public jQueryUIEventHandler Show { get { return null; @@ -121,7 +121,7 @@ public jQueryUIEventHandler Show { /// /// The zero-based index of the panel that is active (open). A negative value select panels going backward from the last panel.When collapsible is set to true, a false value closes the accordion, otherwise nothing happens /// - [IntrinsicProperty] + [ScriptField] public object Active { get { return null; @@ -133,7 +133,7 @@ public object Active { /// /// Allow the active panel to be closed. /// - [IntrinsicProperty] + [ScriptField] public bool Collapsible { get { return false; @@ -145,7 +145,7 @@ public bool Collapsible { /// /// An array containing the position of the tabs (zero-based index) that should be disabled. /// - [IntrinsicProperty] + [ScriptField] public object Disabled { get { return null; @@ -157,7 +157,7 @@ public object Disabled { /// /// The type of event to be used for activating a tab. To activate on hover, use "mouseover". /// - [IntrinsicProperty] + [ScriptField] public string Event { get { return null; @@ -169,7 +169,7 @@ public string Event { /// /// Controls the height of the tabs widget and each panel. Possible values:
    • auto: all panels will be set to the height of the tallest panel
    • fill: expand to the available height based on the tabs's parent height
    • content: each panel will be only as tall as its content
    ///
    - [IntrinsicProperty] + [ScriptField] public string HeightStyle { get { return null; @@ -181,7 +181,7 @@ public string HeightStyle { /// /// How to hide a panel. /// - [IntrinsicProperty] + [ScriptField] public object Hide { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsRemoveEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsRemoveEvent.cs index 8035deece..4319cea4e 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsRemoveEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsRemoveEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsRemoveEvent { - [IntrinsicProperty] + [ScriptField] public string Panel { get { return null; @@ -22,7 +22,7 @@ public string Panel { } } - [IntrinsicProperty] + [ScriptField] public string Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsSelectEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsSelectEvent.cs index 5b544572b..59ab9a901 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsSelectEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsSelectEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsSelectEvent { - [IntrinsicProperty] + [ScriptField] public int Index { get { return 0; @@ -22,7 +22,7 @@ public int Index { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Panel { get { return null; @@ -31,7 +31,7 @@ public jQueryObject Panel { } } - [IntrinsicProperty] + [ScriptField] public jQueryObject Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsShowEvent.cs b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsShowEvent.cs index 7a0d07b41..dd919daee 100644 --- a/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsShowEvent.cs +++ b/src/Libraries/jQuery/jQuery.UI/Widgets/Tabs/TabsShowEvent.cs @@ -8,12 +8,12 @@ namespace jQueryApi.UI.Widgets { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class TabsShowEvent { - [IntrinsicProperty] + [ScriptField] public jQueryObject Panel { get { return null; @@ -22,7 +22,7 @@ public jQueryObject Panel { } } - [IntrinsicProperty] + [ScriptField] public string Tab { get { return null; diff --git a/src/Libraries/jQuery/jQuery.UI/jQueryUI.cs b/src/Libraries/jQuery/jQuery.UI/jQueryUI.cs index abfb0c656..4258f24ed 100644 --- a/src/Libraries/jQuery/jQuery.UI/jQueryUI.cs +++ b/src/Libraries/jQuery/jQuery.UI/jQueryUI.cs @@ -11,8 +11,8 @@ namespace jQueryApi.UI { /// /// Top-level jQueryUI methods. /// - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("$")] public static class jQueryUI { diff --git a/src/Libraries/jQuery/jQuery.UI/jQueryUIEventHandler.cs b/src/Libraries/jQuery/jQuery.UI/jQueryUIEventHandler.cs index b9bc3e100..9f2f06211 100644 --- a/src/Libraries/jQuery/jQuery.UI/jQueryUIEventHandler.cs +++ b/src/Libraries/jQuery/jQuery.UI/jQueryUIEventHandler.cs @@ -14,7 +14,7 @@ namespace jQueryApi.UI { /// The type of the widget event object. /// The associated jQuery event object. /// The widget event information. - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public delegate void jQueryUIEventHandler(jQueryEvent e, T uiEvent); } diff --git a/src/Libraries/jQuery/jQuery.UI/jQueryUIMethod.cs b/src/Libraries/jQuery/jQuery.UI/jQueryUIMethod.cs index b8448f7b3..c71d73674 100644 --- a/src/Libraries/jQuery/jQuery.UI/jQueryUIMethod.cs +++ b/src/Libraries/jQuery/jQuery.UI/jQueryUIMethod.cs @@ -11,9 +11,9 @@ namespace jQueryApi.UI { /// /// Operations supported by jQueryUI. /// - [Imported] - [IgnoreNamespace] - [NamedValues] + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] public enum jQueryUIMethod { DisableSelection, diff --git a/src/Libraries/jQuery/jQuery.UI/jQueryUIObject.cs b/src/Libraries/jQuery/jQuery.UI/jQueryUIObject.cs index a28c6d413..f6544b55f 100644 --- a/src/Libraries/jQuery/jQuery.UI/jQueryUIObject.cs +++ b/src/Libraries/jQuery/jQuery.UI/jQueryUIObject.cs @@ -8,8 +8,8 @@ namespace jQueryApi.UI { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public abstract class jQueryUIObject : jQueryObject { protected jQueryUIObject() { diff --git a/src/Libraries/jQuery/jQuery.Validation/Properties/AssemblyInfo.cs b/src/Libraries/jQuery/jQuery.Validation/Properties/AssemblyInfo.cs index 08aff32e5..26755acc7 100644 --- a/src/Libraries/jQuery/jQuery.Validation/Properties/AssemblyInfo.cs +++ b/src/Libraries/jQuery/jQuery.Validation/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ [assembly: AssemblyTitle("Script.jQuery.Validation")] [assembly: AssemblyDescription("Script# jQuery Validation Plugin")] -[assembly: ScriptAssembly("jQueryValidation")] +[assembly: ScriptAssembly("jqueryValidation")] diff --git a/src/Libraries/jQuery/jQuery.Validation/jQueryValidationObject.cs b/src/Libraries/jQuery/jQuery.Validation/jQueryValidationObject.cs index f366e65dd..a54cb0ecf 100644 --- a/src/Libraries/jQuery/jQuery.Validation/jQueryValidationObject.cs +++ b/src/Libraries/jQuery/jQuery.Validation/jQueryValidationObject.cs @@ -8,8 +8,8 @@ namespace jQueryApi.Validation { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryValidationObject : jQueryObject { private jQueryValidationObject() { diff --git a/src/Libraries/jQuery/jQuery.Validation/jQueryValidationRules.cs b/src/Libraries/jQuery/jQuery.Validation/jQueryValidationRules.cs index 9dea2db84..87b498946 100644 --- a/src/Libraries/jQuery/jQuery.Validation/jQueryValidationRules.cs +++ b/src/Libraries/jQuery/jQuery.Validation/jQueryValidationRules.cs @@ -8,8 +8,8 @@ namespace jQueryApi.Validation { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class jQueryValidationRules { @@ -19,7 +19,7 @@ private jQueryValidationRules() { /// /// Makes the element require a certain file extension /// - [IntrinsicProperty] + [ScriptField] public string Accept { get { return null; @@ -31,7 +31,7 @@ public string Accept { /// /// Makes the element require a creditcard number /// - [IntrinsicProperty] + [ScriptField] [ScriptName("creditcard")] public bool CreditCard { get { @@ -44,7 +44,7 @@ public bool CreditCard { /// /// Makes the element require a date /// - [IntrinsicProperty] + [ScriptField] public bool Date { get { return false; @@ -56,7 +56,7 @@ public bool Date { /// /// Makes the element require a ISO date /// - [IntrinsicProperty] + [ScriptField] [ScriptName("dateISO")] public bool DateISO { get { @@ -69,7 +69,7 @@ public bool DateISO { /// /// Makes the element require digits only /// - [IntrinsicProperty] + [ScriptField] public bool Digits { get { return false; @@ -81,7 +81,7 @@ public bool Digits { /// /// Makes the element require a valid email address /// - [IntrinsicProperty] + [ScriptField] public bool Email { get { return false; @@ -93,7 +93,7 @@ public bool Email { /// /// Requires the element to be the same as another one /// - [IntrinsicProperty] + [ScriptField] public string EqualTo { get { return null; @@ -105,7 +105,7 @@ public string EqualTo { /// /// Makes the element require a given maximum /// - [IntrinsicProperty] + [ScriptField] public int Max { get { return 0; @@ -117,7 +117,7 @@ public int Max { /// /// Makes the element require a given maximum length /// - [IntrinsicProperty] + [ScriptField] public int MaxLength { get { return 0; @@ -129,7 +129,7 @@ public int MaxLength { /// /// Makes the element require given minimum /// - [IntrinsicProperty] + [ScriptField] public int Min { get { return 0; @@ -141,7 +141,7 @@ public int Min { /// /// Makes the element require a given minimum length /// - [IntrinsicProperty] + [ScriptField] public int MinLength { get { return 0; @@ -153,7 +153,7 @@ public int MinLength { /// /// Makes the element require a decimal number /// - [IntrinsicProperty] + [ScriptField] public bool Number { get { return false; @@ -162,7 +162,7 @@ public bool Number { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("phoneUS")] public bool PhoneUS { get { @@ -175,7 +175,7 @@ public bool PhoneUS { /// /// Makes the value require a given value range /// - [IntrinsicProperty] + [ScriptField] public int[] Range { get { return null; @@ -187,7 +187,7 @@ public int[] Range { /// /// Makes the element require a given value range /// - [IntrinsicProperty] + [ScriptField] public int[] RangeLength { get { return null; @@ -199,7 +199,7 @@ public int[] RangeLength { /// /// Requests a resource to check the element for validity /// - [IntrinsicProperty] + [ScriptField] public object Remote { get { return null; @@ -211,7 +211,7 @@ public object Remote { /// /// Makes the element required, depending on the result of the given callback /// - [IntrinsicProperty] + [ScriptField] [ScriptName("required")] public Func RequiredCallback { get { @@ -224,7 +224,7 @@ public Func RequiredCallback { /// /// Makes the element required, depending on the result of the given expression /// - [IntrinsicProperty] + [ScriptField] [ScriptName("required")] public string RequiredExpression { get { @@ -237,7 +237,7 @@ public string RequiredExpression { /// /// Makes the element always required /// - [IntrinsicProperty] + [ScriptField] public bool Required { get { return false; @@ -249,7 +249,7 @@ public bool Required { /// /// Makes the element require a valid url /// - [IntrinsicProperty] + [ScriptField] public bool Url { get { return false; diff --git a/src/Libraries/jQuery/jQuery.Validation/jQueryValidator.cs b/src/Libraries/jQuery/jQuery.Validation/jQueryValidator.cs index bf14d0cb5..659c51711 100644 --- a/src/Libraries/jQuery/jQuery.Validation/jQueryValidator.cs +++ b/src/Libraries/jQuery/jQuery.Validation/jQueryValidator.cs @@ -10,8 +10,8 @@ namespace jQueryApi.Validation { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] public sealed class jQueryValidator { private jQueryValidator() { diff --git a/src/Libraries/jQuery/jQuery.Validation/jQueryValidatorOptions.cs b/src/Libraries/jQuery/jQuery.Validation/jQueryValidatorOptions.cs index 6707d02bb..a94cf6e06 100644 --- a/src/Libraries/jQuery/jQuery.Validation/jQueryValidatorOptions.cs +++ b/src/Libraries/jQuery/jQuery.Validation/jQueryValidatorOptions.cs @@ -9,12 +9,12 @@ namespace jQueryApi.Validation { - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public sealed class jQueryValidatorOptions { - [IntrinsicProperty] + [ScriptField] public bool Debug { get { return false; @@ -23,7 +23,7 @@ public bool Debug { } } - [IntrinsicProperty] + [ScriptField] public string ErrorClass { get { return null; @@ -32,7 +32,7 @@ public string ErrorClass { } } - [IntrinsicProperty] + [ScriptField] public string ErrorContainer { get { return null; @@ -41,7 +41,7 @@ public string ErrorContainer { } } - [IntrinsicProperty] + [ScriptField] public string ErrorElement { get { return null; @@ -50,7 +50,7 @@ public string ErrorElement { } } - [IntrinsicProperty] + [ScriptField] public string ErrorLabelContainer { get { return null; @@ -59,7 +59,7 @@ public string ErrorLabelContainer { } } - [IntrinsicProperty] + [ScriptField] public bool FocusCleanup { get { return false; @@ -68,7 +68,7 @@ public bool FocusCleanup { } } - [IntrinsicProperty] + [ScriptField] public bool FocusInvalid { get { return false; @@ -77,7 +77,7 @@ public bool FocusInvalid { } } - [IntrinsicProperty] + [ScriptField] public Dictionary Groups { get { return null; @@ -86,7 +86,7 @@ public Dictionary Groups { } } - [IntrinsicProperty] + [ScriptField] public jQueryValidationHighlight Highlight { get { return null; @@ -95,7 +95,7 @@ public jQueryValidationHighlight Highlight { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("ignore")] public string IgnoreSelector { get { @@ -105,7 +105,7 @@ public string IgnoreSelector { } } - [IntrinsicProperty] + [ScriptField] public string IgnoreTitle { get { return null; @@ -114,7 +114,7 @@ public string IgnoreTitle { } } - [IntrinsicProperty] + [ScriptField] public Action InvalidHandler { get { return null; @@ -123,7 +123,7 @@ public Action InvalidHandler { } } - [IntrinsicProperty] + [ScriptField] public Dictionary Messages { get { return null; @@ -132,7 +132,7 @@ public Dictionary Messages { } } - [IntrinsicProperty] + [ScriptField] public string Meta { get { return null; @@ -141,7 +141,7 @@ public string Meta { } } - [IntrinsicProperty] + [ScriptField] public Dictionary Rules { get { return null; @@ -150,7 +150,7 @@ public Dictionary Rules { } } - [IntrinsicProperty] + [ScriptField] public Action SubmitHandler { get { return null; @@ -159,7 +159,7 @@ public Action SubmitHandler { } } - [IntrinsicProperty] + [ScriptField] public jQueryValidationHighlight Unhighlight { get { return null; @@ -168,7 +168,7 @@ public jQueryValidationHighlight Unhighlight { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("onclick")] public bool ValidateOnClick { get { @@ -178,7 +178,7 @@ public bool ValidateOnClick { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("onfocusout")] public bool ValidateOnFocusOut { get { @@ -188,7 +188,7 @@ public bool ValidateOnFocusOut { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("onkeyup")] public bool ValidateOnKeyUp { get { @@ -198,7 +198,7 @@ public bool ValidateOnKeyUp { } } - [IntrinsicProperty] + [ScriptField] [ScriptName("onsubmit")] public bool ValidateOnSubmit { get { @@ -208,7 +208,7 @@ public bool ValidateOnSubmit { } } - [IntrinsicProperty] + [ScriptField] public string ValidClass { get { return null; @@ -217,7 +217,7 @@ public string ValidClass { } } - [IntrinsicProperty] + [ScriptField] public string Wrapper { get { return null; diff --git a/src/ScriptSharp.cs b/src/ScriptSharp.cs index 12a97f09c..245a06b2d 100644 --- a/src/ScriptSharp.cs +++ b/src/ScriptSharp.cs @@ -12,6 +12,6 @@ [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.7.0.0")] -[assembly: AssemblyFileVersion("0.7.6.0")] +[assembly: AssemblyVersion("0.8.0.0")] +[assembly: AssemblyFileVersion("0.8.0.0")] [assembly: CLSCompliant(true)] diff --git a/src/ScriptSharp.sln b/src/ScriptSharp.sln index 93cf128d8..fef45edef 100644 --- a/src/ScriptSharp.sln +++ b/src/ScriptSharp.sln @@ -29,34 +29,54 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Core\Build\Build.c EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipX", "ZipX\ZipX.csproj", "{4123C976-739E-42A2-87FB-E04D163BC99C}" ProjectSection(ProjectDependencies) = postProject - {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {1772A38C-7204-42DC-B81D-6C74D17A4F66} - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} + {8780581F-7C26-4B64-9236-BA1C458DF36E} = {8780581F-7C26-4B64-9236-BA1C458DF36E} + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} + {B87E403B-354D-47A1-9876-14C618A80A41} = {B87E403B-354D-47A1-9876-14C618A80A41} {31456150-1093-407F-9231-58D0F663945D} = {31456150-1093-407F-9231-58D0F663945D} - {3681A9A8-FC40-4125-B842-7775713C8DCE} = {3681A9A8-FC40-4125-B842-7775713C8DCE} + {9600C55B-E14E-45EA-92C6-F453B19F5D7F} = {9600C55B-E14E-45EA-92C6-F453B19F5D7F} + {DCA0235F-88C1-43A0-A8DB-FF765D344E06} = {DCA0235F-88C1-43A0-A8DB-FF765D344E06} + {9F14036F-673F-418E-B817-7E2289D7F3F6} = {9F14036F-673F-418E-B817-7E2289D7F3F6} + {9D59077D-1A05-4D6C-A1A4-FB748D200578} = {9D59077D-1A05-4D6C-A1A4-FB748D200578} + {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {1772A38C-7204-42DC-B81D-6C74D17A4F66} {36D4B098-A21C-4725-ACD3-400922885F38} = {36D4B098-A21C-4725-ACD3-400922885F38} + {3681A9A8-FC40-4125-B842-7775713C8DCE} = {3681A9A8-FC40-4125-B842-7775713C8DCE} + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} = {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} + {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} = {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} {4A9F7CE0-5A45-4B28-AD01-05528709B6E4} = {4A9F7CE0-5A45-4B28-AD01-05528709B6E4} + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} = {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} = {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} = {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} {824C1FEC-2455-4183-AFC6-891EDB88213A} = {824C1FEC-2455-4183-AFC6-891EDB88213A} - {8780581F-7C26-4B64-9235-BA1C458DF36E} = {8780581F-7C26-4B64-9235-BA1C458DF36E} - {9600C55B-E14E-45EA-92C6-F453B19F5D7F} = {9600C55B-E14E-45EA-92C6-F453B19F5D7F} - {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} = {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} - {B87E403B-354D-47A1-9876-14C618A80A41} = {B87E403B-354D-47A1-9876-14C618A80A41} - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} = {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} - {DCA0235F-88C1-43A0-A8DB-FF765D344E06} = {DCA0235F-88C1-43A0-A8DB-FF765D344E06} + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} + {232445FF-22AA-46F7-BA12-4590C670F2B1} = {232445FF-22AA-46F7-BA12-4590C670F2B1} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jQuery.Validation", "Libraries\jQuery\jQuery.Validation\jQuery.Validation.csproj", "{967A6FD7-E14B-4DB0-81D9-86E0DC12291A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{D1DF352A-45B6-4130-9A8B-A24C20257B7D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreScript", "Core\CoreScript\CoreScript.csproj", "{8780581F-7C26-4B64-9235-BA1C458DF36E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jQuery.UI", "Libraries\jQuery\jQuery.UI\jQuery.UI.csproj", "{824C1FEC-2455-4183-AFC6-891EDB88213A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{BB2DB888-0F52-4CB5-9625-9D99A33DCE4F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compiler", "Core\Compiler\Compiler.csproj", "{9F14036F-673F-418E-B817-7E2289D7F3F6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scripts", "Core\Scripts\Scripts.csproj", "{8780581F-7C26-4B64-9236-BA1C458DF36E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Core", "Libraries\Node\Node.Core\Node.Core.csproj", "{4A9F7CE9-5A45-4B28-AD01-05528709B6E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Express", "Libraries\Node\Node.Express\Node.Express.csproj", "{4A9F7CE9-5B45-4B28-AD01-05528709B6E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Mongo", "Libraries\Node\Node.Mongo\Node.Mongo.csproj", "{4A9F7CE9-5B45-4B28-AD01-05529709B6E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Neo4j", "Libraries\Node\Node.Neo4j\Node.Neo4j.csproj", "{232445FF-22AA-46F7-BA12-4590C670F2B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deployment", "Tools\Deployment\Deployment.csproj", "{9D59077D-1A05-4D6C-A1A4-FB748D200578}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Restify", "Libraries\Node\Node.Restify\Node.Restify.csproj", "{1ECC689C-2542-4EE8-8A86-7627E63F44F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Azure", "Libraries\Node\Node.Azure\Node.Azure.csproj", "{4A9F7CE9-5B55-4B28-AD01-05528709B6E4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -69,42 +89,18 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|.NET.ActiveCfg = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|x86.ActiveCfg = Debug|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|.NET.ActiveCfg = Release|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Any CPU.Build.0 = Release|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|x86.ActiveCfg = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|.NET.ActiveCfg = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|.NET.ActiveCfg = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Any CPU.Build.0 = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|x86.ActiveCfg = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|.NET.ActiveCfg = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Debug|x86.ActiveCfg = Debug|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|.NET.ActiveCfg = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|Any CPU.Build.0 = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {31456150-1093-407F-9231-58D0F663945D}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU {3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|.NET.ActiveCfg = Debug|Any CPU {3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -117,6 +113,54 @@ Global {3681A9A8-FC40-4125-B842-7775713C8DCE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {3681A9A8-FC40-4125-B842-7775713C8DCE}.Release|Mixed Platforms.Build.0 = Release|Any CPU {3681A9A8-FC40-4125-B842-7775713C8DCE}.Release|x86.ActiveCfg = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|.NET.ActiveCfg = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Debug|x86.ActiveCfg = Debug|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|.NET.ActiveCfg = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Any CPU.Build.0 = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}.Release|x86.ActiveCfg = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|.NET.ActiveCfg = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|x86.ActiveCfg = Debug|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|.NET.ActiveCfg = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Any CPU.Build.0 = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|x86.ActiveCfg = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|.NET.ActiveCfg = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|x86.ActiveCfg = Debug|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|.NET.ActiveCfg = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Any CPU.Build.0 = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|x86.ActiveCfg = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|.NET.ActiveCfg = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|x86.ActiveCfg = Debug|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|.NET.ActiveCfg = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Any CPU.Build.0 = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|x86.ActiveCfg = Release|Any CPU {36D4B098-A21C-4725-ACD3-400922885F38}.Debug|.NET.ActiveCfg = Debug|Any CPU {36D4B098-A21C-4725-ACD3-400922885F38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {36D4B098-A21C-4725-ACD3-400922885F38}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -129,10 +173,57 @@ Global {36D4B098-A21C-4725-ACD3-400922885F38}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {36D4B098-A21C-4725-ACD3-400922885F38}.Release|Mixed Platforms.Build.0 = Release|Any CPU {36D4B098-A21C-4725-ACD3-400922885F38}.Release|x86.ActiveCfg = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|.NET.ActiveCfg = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Debug|x86.ActiveCfg = Debug|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|.NET.ActiveCfg = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|Any CPU.Build.0 = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {31456150-1093-407F-9231-58D0F663945D}.Release|x86.ActiveCfg = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|.NET.ActiveCfg = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|x86.ActiveCfg = Debug|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|.NET.ActiveCfg = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Any CPU.Build.0 = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B87E403B-354D-47A1-9876-14C618A80A41}.Release|x86.ActiveCfg = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|.NET.ActiveCfg = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Debug|x86.ActiveCfg = Debug|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|.NET.ActiveCfg = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Any CPU.Build.0 = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1772A38C-7204-42DC-B81D-6C74D17A4F66}.Release|x86.ActiveCfg = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|x86.ActiveCfg = Debug|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|.NET.ActiveCfg = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Any CPU.Build.0 = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|x86.ActiveCfg = Release|Any CPU {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|.NET.ActiveCfg = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|Any CPU.ActiveCfg = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|Mixed Platforms.Build.0 = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|x86.ActiveCfg = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Debug|x86.Build.0 = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Release|.NET.ActiveCfg = Debug|x86 @@ -141,54 +232,6 @@ Global {4123C976-739E-42A2-87FB-E04D163BC99C}.Release|Mixed Platforms.Build.0 = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Release|x86.ActiveCfg = Debug|x86 {4123C976-739E-42A2-87FB-E04D163BC99C}.Release|x86.Build.0 = Debug|x86 - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|.NET.ActiveCfg = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|x86.ActiveCfg = Debug|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|.NET.ActiveCfg = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Any CPU.Build.0 = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|x86.ActiveCfg = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|.NET.ActiveCfg = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Debug|x86.ActiveCfg = Debug|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|.NET.ActiveCfg = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|Any CPU.Build.0 = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {8780581F-7C26-4B64-9235-BA1C458DF36E}.Release|x86.ActiveCfg = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|.NET.ActiveCfg = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Debug|x86.ActiveCfg = Debug|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|.NET.ActiveCfg = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Any CPU.Build.0 = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9600C55B-E14E-45EA-92C6-F453B19F5D7F}.Release|x86.ActiveCfg = Release|Any CPU {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Debug|.NET.ActiveCfg = Debug|Any CPU {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -201,6 +244,18 @@ Global {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Release|Mixed Platforms.Build.0 = Release|Any CPU {967A6FD7-E14B-4DB0-81D9-86E0DC12291A}.Release|x86.ActiveCfg = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|.NET.ActiveCfg = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Debug|x86.ActiveCfg = Debug|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|.NET.ActiveCfg = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Any CPU.Build.0 = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {824C1FEC-2455-4183-AFC6-891EDB88213A}.Release|x86.ActiveCfg = Release|Any CPU {9F14036F-673F-418E-B817-7E2289D7F3F6}.Debug|.NET.ActiveCfg = Debug|Any CPU {9F14036F-673F-418E-B817-7E2289D7F3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9F14036F-673F-418E-B817-7E2289D7F3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -213,74 +268,129 @@ Global {9F14036F-673F-418E-B817-7E2289D7F3F6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {9F14036F-673F-418E-B817-7E2289D7F3F6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {9F14036F-673F-418E-B817-7E2289D7F3F6}.Release|x86.ActiveCfg = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|.NET.ActiveCfg = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Debug|x86.ActiveCfg = Debug|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|.NET.ActiveCfg = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Any CPU.Build.0 = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B87E403B-354D-47A1-9876-14C618A80A41}.Release|x86.ActiveCfg = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|.NET.ActiveCfg = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Debug|x86.ActiveCfg = Debug|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|.NET.ActiveCfg = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Any CPU.Build.0 = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A}.Release|x86.ActiveCfg = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|.NET.ActiveCfg = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Debug|x86.ActiveCfg = Debug|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|.NET.ActiveCfg = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Any CPU.Build.0 = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4}.Release|x86.ActiveCfg = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|.NET.ActiveCfg = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Debug|x86.ActiveCfg = Debug|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|.NET.ActiveCfg = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Any CPU.Build.0 = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {DCA0235F-88C1-43A0-A8DB-FF765D344E06}.Release|x86.ActiveCfg = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|.NET.ActiveCfg = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Debug|x86.ActiveCfg = Debug|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|.NET.ActiveCfg = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|Any CPU.Build.0 = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8780581F-7C26-4B64-9236-BA1C458DF36E}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|x86.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|.NET.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|x86.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|.NET.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Any CPU.Build.0 = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|x86.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|.NET.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|.NET.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Any CPU.Build.0 = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|x86.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|.NET.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|x86.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|.NET.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} - {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} - {31456150-1093-407F-9231-58D0F663945D} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} {3681A9A8-FC40-4125-B842-7775713C8DCE} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} - {36D4B098-A21C-4725-ACD3-400922885F38} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} - {4123C976-739E-42A2-87FB-E04D163BC99C} = {BB2DB888-0F52-4CB5-9625-9D99A33DCE4F} {4A9F7CE0-5A45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} - {824C1FEC-2455-4183-AFC6-891EDB88213A} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} - {8780581F-7C26-4B64-9235-BA1C458DF36E} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} + {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {9600C55B-E14E-45EA-92C6-F453B19F5D7F} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {DCA0235F-88C1-43A0-A8DB-FF765D344E06} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {824C1FEC-2455-4183-AFC6-891EDB88213A} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {232445FF-22AA-46F7-BA12-4590C670F2B1} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} + {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} + {36D4B098-A21C-4725-ACD3-400922885F38} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {9F14036F-673F-418E-B817-7E2289D7F3F6} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} + {8780581F-7C26-4B64-9236-BA1C458DF36E} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} + {31456150-1093-407F-9231-58D0F663945D} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} {B87E403B-354D-47A1-9876-14C618A80A41} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} - {BA1CDDAF-7E54-4DC0-A4D3-AEF05B975A4A} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} - {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} - {DCA0235F-88C1-43A0-A8DB-FF765D344E06} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {9D59077D-1A05-4D6C-A1A4-FB748D200578} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} + {4123C976-739E-42A2-87FB-E04D163BC99C} = {BB2DB888-0F52-4CB5-9625-9D99A33DCE4F} EndGlobalSection EndGlobal diff --git a/src/Tools/Deployment/Deployment.csproj b/src/Tools/Deployment/Deployment.csproj new file mode 100644 index 000000000..6d7a332df --- /dev/null +++ b/src/Tools/Deployment/Deployment.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578} + Library + Properties + ScriptSharp + ScriptSharp.Deployment + true + ..\..\ScriptSharp.snk + false + v4.0 + 512 + + + true + full + false + ..\..\..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/src/Tools/Deployment/Properties/AssemblyInfo.cs b/src/Tools/Deployment/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..db773d527 --- /dev/null +++ b/src/Tools/Deployment/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +// AssemblyInfo.cs +// Script#/Common +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("ScriptSharp.Deployment")] +[assembly: AssemblyDescription("Script# Web Application Integration")] diff --git a/src/Tools/Deployment/ScriptDeployTask.cs b/src/Tools/Deployment/ScriptDeployTask.cs new file mode 100644 index 000000000..1c23feb45 --- /dev/null +++ b/src/Tools/Deployment/ScriptDeployTask.cs @@ -0,0 +1,185 @@ +// ScriptDeployTask.cs +// Script#/Core/Build +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace ScriptSharp.Tasks { + + public sealed class ScriptDeployTask : Task { + + private string _projectPath; + private string _scriptsPath; + private ITaskItem[] _references; + + private HashSet _scriptSet; + private List _scripts; + + [Required] + public string ProjectPath { + get { + return _projectPath; + } + set { + _projectPath = value; + } + } + + [Required] + public ITaskItem[] References { + get { + return _references; + } + set { + _references = value; + } + } + + [Output] + public ITaskItem[] Scripts { + get { + if (_scripts == null) { + return new ITaskItem[0]; + } + return _scripts.ToArray(); + } + } + + public string ScriptsPath { + get { + if (String.IsNullOrEmpty(_scriptsPath)) { + return "Scripts"; + } + return _scriptsPath; + } + set { + _scriptsPath = value; + } + } + + private void CopyFile(string sourceFilePath, string targetFilePath) { + if (File.Exists(targetFilePath)) { + // If the file already exists, make sure it is not read-only, so + // it can be overrwritten. + File.SetAttributes(targetFilePath, FileAttributes.Normal); + } + + File.Copy(sourceFilePath, targetFilePath, /* overwrite */ true); + + // Copy the file, and then make sure it is not read-only (for example, if the + // source file for a referenced script is read-only). + File.SetAttributes(targetFilePath, FileAttributes.Normal); + } + + private void DeployScripts(string projectName, string scriptsFile, string projectPath, string scriptsTargetPath) { + string sourceDirectory = Path.GetDirectoryName(scriptsFile); + string[] scripts = File.ReadAllLines(scriptsFile); + + scripts = scripts.Select(s => Path.Combine(sourceDirectory, s)).ToArray(); + + Log.LogMessage("Deploying scripts from {0} project:", projectName); + foreach (string scriptPath in scripts) { + string scriptFile = Path.GetFileName(scriptPath); + if (scriptFile.Equals("ss.js", StringComparison.OrdinalIgnoreCase) || + scriptFile.Equals("ss.min.js", StringComparison.OrdinalIgnoreCase)) { + continue; + } + + string targetScriptPath = Path.Combine(scriptsTargetPath, scriptFile); + if (_scriptSet.Add(targetScriptPath)) { + CopyFile(scriptPath, targetScriptPath); + + Uri baseUri = new Uri(projectPath, UriKind.Absolute); + Uri targetUri = new Uri(targetScriptPath, UriKind.Absolute); + string relativePath = Uri.UnescapeDataString(baseUri.MakeRelativeUri(targetUri).ToString()).Replace("/", "\\"); + + Log.LogMessage("-> " + relativePath); + _scripts.Add(new TaskItem(relativePath)); + } + } + } + + public override bool Execute() { + _scriptSet = new HashSet(StringComparer.OrdinalIgnoreCase); + _scripts = new List(); + + string projectDirectory = Path.GetDirectoryName(_projectPath); + string scriptsDirectory = Path.Combine(projectDirectory, ScriptsPath); + if (Directory.Exists(scriptsDirectory) == false) { + Directory.CreateDirectory(scriptsDirectory); + } + + foreach (ITaskItem reference in _references) { + string referencePath = Path.GetFullPath(reference.ItemSpec); + string referenceName = Path.GetFileNameWithoutExtension(referencePath); + + Project project = GetReferencedProject(referencePath); + if (project == null) { + Log.LogError("Unable to load project {0}.", referenceName); + return false; + } + + if (IsScriptSharpProject(project) == false) { + continue; + } + + string scriptsFile = GetScriptsFile(project, referencePath); + if (String.IsNullOrEmpty(scriptsFile)) { + Log.LogError("Unable to find scripts list for project {0}.", referenceName); + return false; + } + + try { + DeployScripts(referenceName, scriptsFile, _projectPath, scriptsDirectory); + } + catch (Exception e) { + Log.LogError("Error deploying scripts from project {0}.\r\n{1}", referenceName, e.ToString()); + return false; + } + } + + return true; + } + + private string GetScriptsFile(Project project, string projectPath) { + string outputPath = project.GetProperty("OutputPath").EvaluatedValue; + string assemblyName = project.GetProperty("AssemblyName").EvaluatedValue; + + string scriptsFilePath = Path.Combine(Path.GetDirectoryName(projectPath), outputPath, assemblyName + ".scripts"); + if (File.Exists(scriptsFilePath) == false) { + return null; + } + + return scriptsFilePath; + } + + private Project GetReferencedProject(string projectPath) { + ProjectCollection projects = ProjectCollection.GlobalProjectCollection; + ICollection loadedProjects = projects.GetLoadedProjects(projectPath); + + Project project = loadedProjects.FirstOrDefault(); + if (project == null) { + project = new Project(projectPath); + } + + return project; + } + + private bool IsScriptSharpProject(Project project) { + ProjectProperty scriptSharpProperty = project.GetProperty("ScriptSharp"); + if ((scriptSharpProperty != null) && + scriptSharpProperty.EvaluatedValue.Equals("true", StringComparison.OrdinalIgnoreCase)) { + return true; + } + + return false; + } + } +} diff --git a/src/Tools/Deployment/ScriptSharpWeb.targets b/src/Tools/Deployment/ScriptSharpWeb.targets new file mode 100644 index 000000000..4264b3a96 --- /dev/null +++ b/src/Tools/Deployment/ScriptSharpWeb.targets @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + $(CompileDependsOn);CopyReferencedScripts + + diff --git a/src/Tools/FxCop/ScriptUnusedFields.cs b/src/Tools/FxCop/ScriptUnusedFields.cs index 6f2f522ea..1f666faa5 100644 --- a/src/Tools/FxCop/ScriptUnusedFields.cs +++ b/src/Tools/FxCop/ScriptUnusedFields.cs @@ -12,7 +12,7 @@ namespace ScriptSharp.FxCop { public sealed class ScriptUnusedFields : BaseIntrospectionRule { private TypeNode _importedAttributeType; - private TypeNode _recordType; + private TypeNode _recordAttributeType; public ScriptUnusedFields() : base(typeof(ScriptUnusedFields).Name, @@ -31,10 +31,10 @@ public override void BeforeAnalysis() { _importedAttributeType = FrameworkAssemblies.Mscorlib.GetType(Identifier.For("System.Runtime.CompilerServices"), - Identifier.For("ImportedAttribute")); - _recordType = + Identifier.For("ScriptImportAttribute")); + _recordAttributeType = FrameworkAssemblies.Mscorlib.GetType(Identifier.For("System"), - Identifier.For("Record")); + Identifier.For("ScriptObjectAttribute")); } public override ProblemCollection Check(Member member) { @@ -47,8 +47,8 @@ public override ProblemCollection Check(Member member) { return null; } - // If the type derives from Record, allow the field to exist - if (member.DeclaringType.BaseType == _recordType) { + // If the type is a ScriptObject, allow the field to exist + if (RuleUtilities.HasCustomAttribute(member.DeclaringType, _recordAttributeType)) { return null; } diff --git a/src/Tools/Testing/Testing.csproj b/src/Tools/Testing/Testing.csproj index e8a35b4f2..f6ea33294 100644 --- a/src/Tools/Testing/Testing.csproj +++ b/src/Tools/Testing/Testing.csproj @@ -47,7 +47,6 @@ - diff --git a/src/Tools/Testing/WebBrowser.cs b/src/Tools/Testing/WebBrowser.cs index 5bbcb5f77..76f556d09 100644 --- a/src/Tools/Testing/WebBrowser.cs +++ b/src/Tools/Testing/WebBrowser.cs @@ -47,9 +47,19 @@ public string Name { private static string GetChromeExecutablePath() { string path = null; - RegistryKey chromeKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\"); + RegistryKey chromeKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\"); if (chromeKey != null) { - path = Path.Combine((string)chromeKey.GetValue("InstallLocation"), "chrome.exe"); + path = (string)chromeKey.GetValue("Path"); + } + else { + chromeKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\"); + if (chromeKey != null) { + path = (string)chromeKey.GetValue("InstallLocation"); + } + } + + if (path != null) { + path = Path.Combine(path, "chrome.exe"); if (!File.Exists(path)) { path = null; } diff --git a/src/Tools/Testing/WebServer/HttpServer.cs b/src/Tools/Testing/WebServer/HttpServer.cs index b0f17ddbc..ffdef1289 100644 --- a/src/Tools/Testing/WebServer/HttpServer.cs +++ b/src/Tools/Testing/WebServer/HttpServer.cs @@ -29,10 +29,12 @@ private void Run() { while (_alive) { try { - TcpClient client = listener.AcceptTcpClient(); + if (listener.Pending()) { + TcpClient client = listener.AcceptTcpClient(); - HttpMessage message = new HttpMessage(this, _getHandler, _postHandler); - message.ProcessClient(client); + HttpMessage message = new HttpMessage(this, _getHandler, _postHandler); + message.ProcessClient(client); + } } catch { } diff --git a/src/Tools/Testing/WebServer/WebTestHttpServer.cs b/src/Tools/Testing/WebServer/WebTestHttpServer.cs index 928e3505a..083e573ae 100644 --- a/src/Tools/Testing/WebServer/WebTestHttpServer.cs +++ b/src/Tools/Testing/WebServer/WebTestHttpServer.cs @@ -13,12 +13,12 @@ namespace ScriptSharp.Testing.WebServer { internal sealed class WebTestHttpServer : HttpServer { private Uri _baseUri; - private string _contentRoot; + private string[] _contentRoots; private Dictionary> _registeredContent; - public WebTestHttpServer(string contentRoot) { - _contentRoot = contentRoot; + public WebTestHttpServer(string[] contentRoots) { + _contentRoots = contentRoots; _baseUri = new Uri("http://localhost/", UriKind.Absolute); Initialize(HandleGetRequest, HandlePostRequest); @@ -55,9 +55,7 @@ private string GetResolvedPath(string urlPath, out string cleanedUrlPath) { // Get the cleaned up path with the leading slash trimmed off cleanedUrlPath = resolvedUri.LocalPath; - string path = resolvedUri.LocalPath.Substring(1); - - return Path.Combine(_contentRoot, path); + return resolvedUri.LocalPath.Substring(1); } private void HandleGetRequest(HttpMessage message) { @@ -70,12 +68,15 @@ private void HandleGetRequest(HttpMessage message) { return; } - if (File.Exists(path)) { - message.WriteFile(path, GetContentType(path)); - } - else { - message.WriteStatus(HttpStatusCode.NotFound); + foreach (string contentRoot in _contentRoots) { + string possiblePath = Path.Combine(contentRoot, path); + if (File.Exists(possiblePath)) { + message.WriteFile(possiblePath, GetContentType(possiblePath)); + return; + } } + + message.WriteStatus(HttpStatusCode.NotFound); } private void HandlePostRequest(HttpMessage message) { @@ -90,14 +91,14 @@ private void HandlePostRequest(HttpMessage message) { } if (success.HasValue) { - if (Log != null) { - string log = new StreamReader(message.RequestStream).ReadToEnd(); + string log = new StreamReader(message.RequestStream).ReadToEnd(); + message.WriteStatus(HttpStatusCode.NoContent); + if (Log != null) { WebTestLogEventArgs logEvent = new WebTestLogEventArgs(success.Value, log); Log(this, logEvent); } - message.WriteStatus(HttpStatusCode.NoContent); return; } diff --git a/src/Tools/Testing/WebTest.cs b/src/Tools/Testing/WebTest.cs index 7a8835200..d64723ce2 100644 --- a/src/Tools/Testing/WebTest.cs +++ b/src/Tools/Testing/WebTest.cs @@ -144,20 +144,23 @@ public WebTestResult RunTest(Uri testUri, WebBrowser browser, TimeSpan timeout) } } - public bool StartWebServer(string webRoot, int port) { + public bool StartWebServer(int port, params string[] webRoots) { if (_server != null) { throw new InvalidOperationException("The server has already been started."); } - if (String.IsNullOrEmpty(webRoot)) { - throw new ArgumentNullException("webRoot"); + if (webRoots == null) { + throw new ArgumentNullException("webRoots"); } - if (Directory.Exists(webRoot) == false) { - throw new ArgumentException("Invalid directory specified as the web root.", "webRoot"); + + foreach (string webRoot in webRoots) { + if (Directory.Exists(webRoot) == false) { + throw new ArgumentException("Invalid directory specified as the web root: '" + webRoot + "'"); + } } bool started = false; try { - WebTestHttpServer server = new WebTestHttpServer(webRoot); + WebTestHttpServer server = new WebTestHttpServer(webRoots); server.Start(port); _server = server; diff --git a/src/Tools/Testing/WebTestPageBuilder.cs b/src/Tools/Testing/WebTestPageBuilder.cs deleted file mode 100644 index 82bf093ac..000000000 --- a/src/Tools/Testing/WebTestPageBuilder.cs +++ /dev/null @@ -1,82 +0,0 @@ -// WebTestPageBuilder.cs -// Script#/Tools/Testing -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.Collections.Generic; -using System.Text; - -namespace ScriptSharp.Testing { - - public sealed class WebTestPageBuilder { - - private const string PageMarkupFormat = -@" - - - {0} - - - - {1} -
    -

    {1}

    -

    -

    -
      -
      - -
      - - -{2} - - -"; - - private const string ScriptFormat = -@" "; - - private string _title; - private List _scripts; - private string _content; - - public WebTestPageBuilder() - : this("Tests") { - } - - public WebTestPageBuilder(string title) { - _title = title; - _content = String.Empty; - _scripts = new List(); - } - - public WebTestPageBuilder AddScript(string scriptPath) { - _scripts.Add(scriptPath); - return this; - } - - public WebTestPageBuilder AddScripts(params string[] scriptPaths) { - _scripts.AddRange(scriptPaths); - return this; - } - - public WebTestPageBuilder SetContent(string content) { - _content = content; - return this; - } - - public string ToHtml() { - StringBuilder scriptsBuilder = new StringBuilder(); - foreach (string s in _scripts) { - scriptsBuilder.AppendFormat(ScriptFormat, s); - scriptsBuilder.AppendLine(); - } - - return String.Format(PageMarkupFormat, - _title, _content, - scriptsBuilder.ToString()); - } - } -} diff --git a/src/ZipX/ItemTemplates/Class/Class.cs b/src/ZipX/ItemTemplates/Class/Class.cs index 946c8be89..e9171c3b2 100644 --- a/src/ZipX/ItemTemplates/Class/Class.cs +++ b/src/ZipX/ItemTemplates/Class/Class.cs @@ -4,9 +4,8 @@ using System; using System.Collections.Generic; -namespace $rootnamespace$ -{ - public class $safeitemrootname$ - { +namespace $rootnamespace$ { + + public class $safeitemrootname$ { } } diff --git a/src/ZipX/ItemTemplates/Class/Class.vstemplate b/src/ZipX/ItemTemplates/Class/Class.vstemplate index a42726b37..20d8c5dd0 100644 --- a/src/ZipX/ItemTemplates/Class/Class.vstemplate +++ b/src/ZipX/ItemTemplates/Class/Class.vstemplate @@ -16,8 +16,7 @@ - - + diff --git a/src/ZipX/ItemTemplates/Page/Page.cs b/src/ZipX/ItemTemplates/Page/Page.cs index 280d9c34c..ced2307aa 100644 --- a/src/ZipX/ItemTemplates/Page/Page.cs +++ b/src/ZipX/ItemTemplates/Page/Page.cs @@ -4,17 +4,12 @@ using System; using System.Collections.Generic; using System.Html; -using System.Runtime.CompilerServices; -namespace $rootnamespace$ -{ - [GlobalMethods] - internal static class $safeitemrootname$ - { - static $safeitemrootname$() - { - // Add script that runs on startup as the script is loaded into - // the page - } +[ScriptModule] +internal static class $safeitemrootname$ { + + static $safeitemrootname$() { + // Add script that runs on startup as the script is loaded into + // the page } } diff --git a/src/ZipX/ItemTemplates/Page/Page.vstemplate b/src/ZipX/ItemTemplates/Page/Page.vstemplate index 2453c27dd..931e1ec77 100644 --- a/src/ZipX/ItemTemplates/Page/Page.vstemplate +++ b/src/ZipX/ItemTemplates/Page/Page.vstemplate @@ -1,7 +1,7 @@ Page Script - A new script within a web application project associated with a specific page. + Script within an application project that runs as the script loads within a page. CSharp 20 @@ -16,8 +16,8 @@ - - + + diff --git a/src/ZipX/ItemTemplates/Resource/Resource.vstemplate b/src/ZipX/ItemTemplates/Resource/Resource.vstemplate index 85348ed33..1f742bf00 100644 --- a/src/ZipX/ItemTemplates/Resource/Resource.vstemplate +++ b/src/ZipX/ItemTemplates/Resource/Resource.vstemplate @@ -21,7 +21,7 @@ - + diff --git a/src/ZipX/ItemTemplates/TestClass/TestClass.cs b/src/ZipX/ItemTemplates/TestClass/TestClass.cs index dbb82df03..2da5120c9 100644 --- a/src/ZipX/ItemTemplates/TestClass/TestClass.cs +++ b/src/ZipX/ItemTemplates/TestClass/TestClass.cs @@ -7,21 +7,19 @@ using System.Html; using System.Testing; -namespace $rootnamespace$ -{ +namespace $rootnamespace$ { + [SuppressMessage("Microsoft.Performance", "CA1812", Justification = "Tests don't have internal consumers. They're only compiled into .test.js scripts.")] - internal sealed class $safeitemrootname$ : TestClass - { - public void TestMethod1() - { + internal sealed class $safeitemrootname$ : TestClass { + + public void TestMethod1() { // TODO: Uncomment and specify n to indicate the number of // asserts that will be invoked. // Assert.ExpectAsserts(n); } - public void TestMethod2() - { + public void TestMethod2() { // TODO: Uncomment and specify n to indicate the number of // asserts that will be invoked. // Assert.ExpectAsserts(n); diff --git a/src/ZipX/ItemTemplates/TestClass/TestClass.vstemplate b/src/ZipX/ItemTemplates/TestClass/TestClass.vstemplate index 857f9edeb..eb9530e43 100644 --- a/src/ZipX/ItemTemplates/TestClass/TestClass.vstemplate +++ b/src/ZipX/ItemTemplates/TestClass/TestClass.vstemplate @@ -16,8 +16,8 @@ - - + + diff --git a/src/ZipX/ItemTemplates/jQueryPage/Page.cs b/src/ZipX/ItemTemplates/jQueryPage/Page.cs index 4857fa966..a216b15f9 100644 --- a/src/ZipX/ItemTemplates/jQueryPage/Page.cs +++ b/src/ZipX/ItemTemplates/jQueryPage/Page.cs @@ -4,20 +4,15 @@ using System; using System.Collections.Generic; using System.Html; -using System.Runtime.CompilerServices; using jQueryApi; -namespace $rootnamespace$ -{ - [GlobalMethods] - internal static class $safeitemrootname$ - { - static $safeitemrootname$() - { - jQuery.OnDocumentReady(delegate() { - // Add script that runs once the document is ready for being - // consumed by script. - }); - } +[ScriptModule] +internal static class $safeitemrootname$ { + + static $safeitemrootname$() { + jQuery.OnDocumentReady(delegate() { + // Add script that runs once the document is ready for being + // consumed by script. + }); } } diff --git a/src/ZipX/ItemTemplates/jQueryPage/jQueryPage.vstemplate b/src/ZipX/ItemTemplates/jQueryPage/jQueryPage.vstemplate index 3b15dc4c7..4afcb773b 100644 --- a/src/ZipX/ItemTemplates/jQueryPage/jQueryPage.vstemplate +++ b/src/ZipX/ItemTemplates/jQueryPage/jQueryPage.vstemplate @@ -1,7 +1,7 @@ jQuery Page Script - A new jQuery-based script within a web application project associated with a specific page. + Script within an application project that runs as the script loads within a page. CSharp 20 @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/ZipX/ItemTemplates/jQueryPlugin/Plugin.cs b/src/ZipX/ItemTemplates/jQueryPlugin/Plugin.cs index 20f79ceb4..af0eaa020 100644 --- a/src/ZipX/ItemTemplates/jQueryPlugin/Plugin.cs +++ b/src/ZipX/ItemTemplates/jQueryPlugin/Plugin.cs @@ -1,4 +1,4 @@ -// $safeitemrootname$.cs +// $safeitemname$Plugin.cs // using System; @@ -7,17 +7,17 @@ using System.Runtime.CompilerServices; using jQueryApi; -[Mixin("$.fn")] -public static class $safeitemrootname$Plugin -{ - public static jQueryObject $safeitemrootname$($safeitemrootname$Options customOptions) - { - $safeitemrootname$Options defaultOptions = - new $safeitemrootname$Options("myOption", 0 +[ScriptExtension("$.fn")] +internal static class $safeitemname$Plugin { + + public static jQueryObject $safeitemname$($safeitemname$Options customOptions) { + + $safeitemname$Options defaultOptions = + new $safeitemname$Options("myOption", 0 /* name/value pairs corresponding to default options */); - $safeitemrootname$Options options = - jQuery.ExtendObject<$safeitemrootname$Options>(new $safeitemrootname$Options(), defaultOptions, customOptions); + $safeitemname$Options options = + jQuery.ExtendObject<$safeitemname$Options>(new $safeitemname$Options(), defaultOptions, customOptions); return jQuery.Current.Each(delegate (int i, Element element) { // TODO: Consume the matched elements @@ -25,29 +25,33 @@ public static class $safeitemrootname$Plugin } } -[Imported] +[ScriptImport] [ScriptName("Object")] -public sealed class $safeitemrootname$Options -{ +public sealed class $safeitemname$Options { + // TODO: Replace with fields corresponding to options for the plugin public int myOption; - public $safeitemrootname$Options() { + public $safeitemname$Options() { } - public $safeitemrootname$Options(params object[] nameValuePairs) { + public $safeitemname$Options(params object[] nameValuePairs) { } } #region Script# Support -[Imported] -public sealed class $safeitemrootname$Object : jQueryObject -{ - public jQueryObject $safeitemrootname$() { +// This class allows calling into the plugin from an application or another plugin. +[ScriptImport] +public sealed class $safeitemname$Object : jQueryObject { + + private $safeitemname$Object() { + } + + public jQueryObject $safeitemname$() { return null; } - public jQueryObject $safeitemrootname$($safeitemrootname$Options options) { + public jQueryObject $safeitemname$($safeitemname$Options options) { return null; } } diff --git a/src/ZipX/ItemTemplates/jQueryPlugin/jQueryPlugin.vstemplate b/src/ZipX/ItemTemplates/jQueryPlugin/jQueryPlugin.vstemplate index d68b576b1..b37b6ca91 100644 --- a/src/ZipX/ItemTemplates/jQueryPlugin/jQueryPlugin.vstemplate +++ b/src/ZipX/ItemTemplates/jQueryPlugin/jQueryPlugin.vstemplate @@ -1,11 +1,11 @@ jQuery Plugin Class - A jQuery plugin that will be compiled into script. + A jQuery plugin that will be compiled into script (NOTE: Do not add the 'Plugin' suffix to the class name). CSharp 20 - Plugin.cs + false Plugin.cs @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/ZipX/Packages/Core.nuspec b/src/ZipX/Packages/Core.nuspec index 781ae76ef..86df2d8ac 100644 --- a/src/ZipX/Packages/Core.nuspec +++ b/src/ZipX/Packages/Core.nuspec @@ -2,7 +2,7 @@ ScriptSharp - 0.7.6.0 + 0.8 Script# Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -21,12 +21,13 @@ - - + + + diff --git a/src/ZipX/Packages/FxCop.nuspec b/src/ZipX/Packages/FxCop.nuspec index f9a74b0dd..594b597e5 100644 --- a/src/ZipX/Packages/FxCop.nuspec +++ b/src/ZipX/Packages/FxCop.nuspec @@ -2,7 +2,7 @@ ScriptSharp.FxCop - 0.7.6.0 + 0.8 Script# FxCop Rules Nikhil Kothari Copyright (c) 2012, Nikhil Kothari diff --git a/src/ZipX/Packages/Lib.BingMaps.nuspec b/src/ZipX/Packages/Lib.BingMaps.nuspec index 00c18e54d..9f235744e 100644 --- a/src/ZipX/Packages/Lib.BingMaps.nuspec +++ b/src/ZipX/Packages/Lib.BingMaps.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.BingMaps - 0.7.6.0 + 0.8 Script# Bing Maps Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,8 +17,8 @@ en-US false - - + + diff --git a/src/ZipX/Packages/Lib.HTML.nuspec b/src/ZipX/Packages/Lib.HTML.nuspec index 580b659e3..416e46e82 100644 --- a/src/ZipX/Packages/Lib.HTML.nuspec +++ b/src/ZipX/Packages/Lib.HTML.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.HTML - 0.7.6.0 + 0.8 Script# HTML5 Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,7 +17,7 @@ en-US false - + diff --git a/src/ZipX/Packages/Lib.Knockout.nuspec b/src/ZipX/Packages/Lib.Knockout.nuspec index ec231c09c..13d7b0678 100644 --- a/src/ZipX/Packages/Lib.Knockout.nuspec +++ b/src/ZipX/Packages/Lib.Knockout.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.Knockout - 0.7.6.0 + 0.8 Script# Knockout Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,8 +17,8 @@ en-US false - - + + diff --git a/src/ZipX/Packages/Lib.Node.Azure.nuspec b/src/ZipX/Packages/Lib.Node.Azure.nuspec new file mode 100644 index 000000000..ee7cee95b --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Azure.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Azure + 0.8 + Script# Azure for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Azure APIs in node.js Script# projects. + + This package contains contains the Script.Node.Azure assembly that allows you to reference and program against the Windows Azure APIs when creating Node.js based applications and modules with Script#. + + script azure windowsazure node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Express.nuspec b/src/ZipX/Packages/Lib.Node.Express.nuspec new file mode 100644 index 000000000..02d23d661 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Express.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Express + 0.8 + Script# ExpressJS for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use ExpressJS APIs in node.js Script# projects. + + This package contains contains the Script.Node.Express assembly that allows you to reference and program against the ExpressJS APIs when creating Node.js based applications and modules with Script#. + + script expressjs node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Mongo.nuspec b/src/ZipX/Packages/Lib.Node.Mongo.nuspec new file mode 100644 index 000000000..fabbc8749 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Mongo.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Mongo + 0.8 + Script# MongoDB for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use MongoDB APIs in node.js Script# projects. + + This package contains contains the Script.Node.Mongo assembly that allows you to reference and program against the MongoDB APIs when creating Node.js based applications and modules with Script#. + + script mongo mongodb node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Neo4j.nuspec b/src/ZipX/Packages/Lib.Node.Neo4j.nuspec new file mode 100644 index 000000000..880393b9e --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Neo4j.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Neo4j + 0.8 + Script# Neo4j for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Neo4j APIs in node.js Script# projects. + + This package contains contains the Script.Node.Neo4j assembly that allows you to reference and program against the Neo4j APIs when creating Node.js based applications and modules with Script#. + + script neo4j graph node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Restify.nuspec b/src/ZipX/Packages/Lib.Node.Restify.nuspec new file mode 100644 index 000000000..d62e0c784 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Restify.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Restify + 0.8 + Script# Restify for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Restify APIs in node.js Script# projects. + + This package contains contains the Script.Node.Restify assembly that allows you to reference and program against the Restify APIs when creating Node.js based applications and modules with Script#. + + script restify node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.nuspec b/src/ZipX/Packages/Lib.Node.nuspec new file mode 100644 index 000000000..199846e68 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.nuspec @@ -0,0 +1,28 @@ + + + + ScriptSharp.Lib.Node + 0.8 + Script# Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use node.js APIs in Script# projects. + + This package contains contains the Script.Node assembly that allows you to reference and program against the core Node.js APIs when creating Node.js based applications and modules with Script#. + + script node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.jQuery.History.nuspec b/src/ZipX/Packages/Lib.jQuery.History.nuspec index dc5d86e0a..8d355308c 100644 --- a/src/ZipX/Packages/Lib.jQuery.History.nuspec +++ b/src/ZipX/Packages/Lib.jQuery.History.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.jQuery.History - 0.7.6.0 + 0.8 Script# jQuery History (BBQ plugin) Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,9 +17,9 @@ en-US false - - - + + + diff --git a/src/ZipX/Packages/Lib.jQuery.Templating.nuspec b/src/ZipX/Packages/Lib.jQuery.Templating.nuspec index 61299e3cf..33a904b67 100644 --- a/src/ZipX/Packages/Lib.jQuery.Templating.nuspec +++ b/src/ZipX/Packages/Lib.jQuery.Templating.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.jQuery.Templating - 0.7.6.0 + 0.8 Script# jQuery Templating Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,9 +17,9 @@ en-US false - - - + + + diff --git a/src/ZipX/Packages/Lib.jQuery.UI.nuspec b/src/ZipX/Packages/Lib.jQuery.UI.nuspec index 0f2fd1b61..00f28e97f 100644 --- a/src/ZipX/Packages/Lib.jQuery.UI.nuspec +++ b/src/ZipX/Packages/Lib.jQuery.UI.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.jQuery.UI - 0.7.6.0 + 0.8 Script# jQueryUI Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,9 +17,9 @@ en-US false - - - + + + diff --git a/src/ZipX/Packages/Lib.jQuery.Validation.nuspec b/src/ZipX/Packages/Lib.jQuery.Validation.nuspec index 542b8c95b..624b14947 100644 --- a/src/ZipX/Packages/Lib.jQuery.Validation.nuspec +++ b/src/ZipX/Packages/Lib.jQuery.Validation.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.jQuery.Validation - 0.7.6.0 + 0.8 Script# jQuery Validation Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,9 +17,9 @@ en-US false - - - + + + diff --git a/src/ZipX/Packages/Lib.jQuery.nuspec b/src/ZipX/Packages/Lib.jQuery.nuspec index d4a995ce5..4f32e9dd3 100644 --- a/src/ZipX/Packages/Lib.jQuery.nuspec +++ b/src/ZipX/Packages/Lib.jQuery.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Lib.jQuery - 0.7.6.0 + 0.8 Script# jQuery Reference Assembly Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -17,8 +17,8 @@ en-US false - - + + diff --git a/src/ZipX/Packages/Runtime.nuspec b/src/ZipX/Packages/Runtime.nuspec index 8d32c3382..06bb2a6fa 100644 --- a/src/ZipX/Packages/Runtime.nuspec +++ b/src/ZipX/Packages/Runtime.nuspec @@ -2,25 +2,30 @@ ScriptSharp.Runtime - 0.7.6.0 - Script# Runtime Scripts + 0.8 + Script# Runtime and Script Deployment Support Nikhil Kothari Copyright (c) 2012, Nikhil Kothari http://scriptsharp.com http://scriptsharp.com/nuget/Package.png http://scriptsharp.com/nuget/License.txt - Provides the core javascript runtime for Script#-based scripts for use in Web projects. + Provides the core javascript runtime (ss.js) for Script#-based scripts and script deployment functionality into Web application projects. - This package contains scripts like mscorlib.js which provides the runtime script implementations of a type system and core APIs available to scripts generated using Script# for deployment within web applications (such as asp.net mvc projects). + This package contains ss.js and related scripts used by script# generated scripts at runtime. It also adds script deployment functionality, to copy generated scripts from referenced script# projects into Web applications. script scriptsharp javascript html aspnet mvc thescriptsharp en-US false - - + + - + + + + + + diff --git a/src/ZipX/Packages/Runtime/Install.ps1 b/src/ZipX/Packages/Runtime/Install.ps1 new file mode 100644 index 000000000..f477b16eb --- /dev/null +++ b/src/ZipX/Packages/Runtime/Install.ps1 @@ -0,0 +1,29 @@ +param($installPath, $toolsPath, $package, $project) + +Import-Module (Join-Path $toolsPath "Reset.psm1") + +function Compute-RelativePath ($basePath, $referencePath) { + $baseUri = New-Object -typename System.Uri -argumentlist $basePath + $referenceUri = New-Object -typename System.Uri -argumentlist $referencePath + + $relativeUri = $baseUri.MakeRelativeUri($referenceUri) + $relativePath = [System.Uri]::UnescapeDataString($relativeUri.ToString()).Replace('/', '\') + return $relativePath +} + +# Get the msbuild object associated with the project +Add-Type -AssemblyName "Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" +$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 + +# first remove any existing import reference +Reset-Project $msbuild + +# get a relative reference to the targets file in the package's tools directory +# and add it to the project +$targetsAbsolutePath = Join-Path $toolsPath "ScriptSharpWeb.targets" +$targetsRelativePath = Compute-RelativePath $project.FullName $targetsAbsolutePath +$import = $msbuild.Xml.AddImport($targetsRelativePath) +$import.Condition = "Exists('" + $targetsRelativePath + "')" + +# finally save the project +$project.Save() diff --git a/src/ZipX/Packages/Runtime/Reset.psm1 b/src/ZipX/Packages/Runtime/Reset.psm1 new file mode 100644 index 000000000..7d8ca8798 --- /dev/null +++ b/src/ZipX/Packages/Runtime/Reset.psm1 @@ -0,0 +1,11 @@ +function Reset-Project($msbuild) { + $imports = $msbuild.Xml.Imports + + if ($imports.Count -gt 0) { + foreach ($import in $imports) { + if ($import.Project.IndexOf("ScriptSharpWeb.targets") -gt 0) { + $msbuild.Xml.RemoveChild($import) + } + } + } +} diff --git a/src/ZipX/Packages/Runtime/Uninstall.ps1 b/src/ZipX/Packages/Runtime/Uninstall.ps1 new file mode 100644 index 000000000..4453cf626 --- /dev/null +++ b/src/ZipX/Packages/Runtime/Uninstall.ps1 @@ -0,0 +1,13 @@ +param($installPath, $toolsPath, $package, $project) + +Import-Module (Join-Path $toolsPath "Reset.psm1") + +# Get the msbuild object associated with the project and add an import +Add-Type -AssemblyName "Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" +$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName)[0] + +# remove import reference +Reset-Project $msbuild + +# and then save the project +$project.Save() diff --git a/src/ZipX/Packages/Testing.nuspec b/src/ZipX/Packages/Testing.nuspec index de55e079e..8e1938304 100644 --- a/src/ZipX/Packages/Testing.nuspec +++ b/src/ZipX/Packages/Testing.nuspec @@ -2,7 +2,7 @@ ScriptSharp.Testing - 0.7.6.0 + 0.8 Script# Unit Testing Helpers Nikhil Kothari Copyright (c) 2012, Nikhil Kothari @@ -21,5 +21,7 @@ + + diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/Script.template b/src/ZipX/ProjectTemplates/ClassLibrary/Script.template deleted file mode 100644 index d0fad56de..000000000 --- a/src/ZipX/ProjectTemplates/ClassLibrary/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function() { -#include[as-is] "%code%" -})(); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj b/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj new file mode 100644 index 000000000..bcb3b6168 --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj @@ -0,0 +1,40 @@ + + + Debug + AnyCPU + 8.0.30703 + 2.0 + $guid1$ + Library + Properties + $safeprojectname$ + $safeprojectname$ + Properties\FxCop.ruleset + True + True + True + True + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\$safeprojectname$.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\$safeprojectname$.xml + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/HTMLApplication/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/HTMLApplication/AssemblyInfo.cs new file mode 100644 index 000000000..fc5cfff96 --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLApplication/AssemblyInfo.cs @@ -0,0 +1,38 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("$safeprojectname$")] + +// A script template using an AMD pattern for declaring dependencies consumed +// by the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/src/ZipX/ProjectTemplates/HTMLApplication/FxCop.ruleset b/src/ZipX/ProjectTemplates/HTMLApplication/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLApplication/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/jQueryClassLibrary/jQueryClassLibrary.vstemplate b/src/ZipX/ProjectTemplates/HTMLApplication/HTMLApplication.vstemplate similarity index 62% rename from src/ZipX/ProjectTemplates/jQueryClassLibrary/jQueryClassLibrary.vstemplate rename to src/ZipX/ProjectTemplates/HTMLApplication/HTMLApplication.vstemplate index 94dd8e96f..207525e1e 100644 --- a/src/ZipX/ProjectTemplates/jQueryClassLibrary/jQueryClassLibrary.vstemplate +++ b/src/ZipX/ProjectTemplates/HTMLApplication/HTMLApplication.vstemplate @@ -1,20 +1,19 @@ - jQuery Script Library - A jQuery-based script file. + HTML5 Application + An HTML5 script application based on the AMD pattern. CSharp 10 true - ScriptLibrary + Application true - + FxCop.ruleset - Script.template AssemblyInfo.cs - Class1.cs + Page.cs @@ -23,9 +22,8 @@ - - - + + diff --git a/src/ZipX/ProjectTemplates/HTMLApplication/Page.cs b/src/ZipX/ProjectTemplates/HTMLApplication/Page.cs new file mode 100644 index 000000000..78ebff03b --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLApplication/Page.cs @@ -0,0 +1,16 @@ +// Page.cs +// + +using System; +using System.Collections.Generic; +using System.Html; + +[ScriptModule] +internal static class Page { + + static Page() { + // TODO: Implement your startup code here + // You can add other classes within your project for functionality + // making up your application. + } +} diff --git a/src/ZipX/ProjectTemplates/HTMLModule/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/HTMLModule/AssemblyInfo.cs new file mode 100644 index 000000000..9e00c0098 --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLModule/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("$safeprojectname$")] + +// A script template providing an AMD pattern-based structure around +// the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +define('{name}', [{requires}], function({dependencies}) { + var $global = this; + + {script} + return $exports; +}); +")] diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/Class1.cs b/src/ZipX/ProjectTemplates/HTMLModule/Class1.cs similarity index 100% rename from src/ZipX/ProjectTemplates/ClassLibrary/Class1.cs rename to src/ZipX/ProjectTemplates/HTMLModule/Class1.cs diff --git a/src/ZipX/ProjectTemplates/HTMLModule/FxCop.ruleset b/src/ZipX/ProjectTemplates/HTMLModule/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/HTMLModule/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.vstemplate b/src/ZipX/ProjectTemplates/HTMLModule/HTMLModule.vstemplate similarity index 73% rename from src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.vstemplate rename to src/ZipX/ProjectTemplates/HTMLModule/HTMLModule.vstemplate index f4fcb7b34..61ea9df90 100644 --- a/src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.vstemplate +++ b/src/ZipX/ProjectTemplates/HTMLModule/HTMLModule.vstemplate @@ -1,18 +1,17 @@ - Script Library - A script file. + HTML5 Module + A reusable script library packaged using the AMD-style module. CSharp 10 true - ScriptLibrary + Module true - + FxCop.ruleset - Script.template AssemblyInfo.cs Class1.cs @@ -23,8 +22,8 @@ - - + + diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.csproj b/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj similarity index 94% rename from src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.csproj rename to src/ZipX/ProjectTemplates/HTMLModule/Module.csproj index b75466071..39490e368 100644 --- a/src/ZipX/ProjectTemplates/ClassLibrary/ClassLibrary.csproj +++ b/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj @@ -9,10 +9,11 @@ Properties $safeprojectname$ $safeprojectname$ - Properties\Script.template Properties\FxCop.ruleset True True + True + True bin\Debug\ @@ -32,7 +33,6 @@ - diff --git a/src/ZipX/ProjectTemplates/ImportLibrary/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/ImportLibrary/AssemblyInfo.cs index 53d3c0162..fdd3867f3 100644 --- a/src/ZipX/ProjectTemplates/ImportLibrary/AssemblyInfo.cs +++ b/src/ZipX/ProjectTemplates/ImportLibrary/AssemblyInfo.cs @@ -19,4 +19,4 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("$safeprojectname$")] +[assembly: ScriptAssembly("")] diff --git a/src/ZipX/ProjectTemplates/ImportLibrary/ImportLibrary.vstemplate b/src/ZipX/ProjectTemplates/ImportLibrary/ImportLibrary.vstemplate index bf9b55f62..c1fbb91f2 100644 --- a/src/ZipX/ProjectTemplates/ImportLibrary/ImportLibrary.vstemplate +++ b/src/ZipX/ProjectTemplates/ImportLibrary/ImportLibrary.vstemplate @@ -1,7 +1,7 @@ Import Library - An assembly defining existing script APIs to import for use in Script#. + Allows importing existing script APIs and frameworks (types, methods, signatures) for use with Script#. CSharp 100 @@ -22,8 +22,8 @@ - - + + diff --git a/src/ZipX/ProjectTemplates/jQueryClassLibrary/ClassLibrary.csproj b/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj similarity index 92% rename from src/ZipX/ProjectTemplates/jQueryClassLibrary/ClassLibrary.csproj rename to src/ZipX/ProjectTemplates/NodeApplication/Application.csproj index b75466071..7233aa44d 100644 --- a/src/ZipX/ProjectTemplates/jQueryClassLibrary/ClassLibrary.csproj +++ b/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj @@ -9,10 +9,12 @@ Properties $safeprojectname$ $safeprojectname$ - Properties\Script.template Properties\FxCop.ruleset True True + False + True + node_modules bin\Debug\ @@ -32,7 +34,6 @@ - diff --git a/src/ZipX/ProjectTemplates/ClassLibrary/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/NodeApplication/AssemblyInfo.cs similarity index 80% rename from src/ZipX/ProjectTemplates/ClassLibrary/AssemblyInfo.cs rename to src/ZipX/ProjectTemplates/NodeApplication/AssemblyInfo.cs index 53d3c0162..52de723d8 100644 --- a/src/ZipX/ProjectTemplates/ClassLibrary/AssemblyInfo.cs +++ b/src/ZipX/ProjectTemplates/NodeApplication/AssemblyInfo.cs @@ -3,7 +3,6 @@ using System; using System.Reflection; -using System.Runtime.CompilerServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -20,3 +19,13 @@ [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ScriptAssembly("$safeprojectname$")] + +// A script template allows customization of the generated script. +[assembly: ScriptTemplate(@" +// {name}.js {version} + +{dependenciesLookup} +var $global = this; + +{script} +")] diff --git a/src/ZipX/ProjectTemplates/NodeApplication/Class1.cs b/src/ZipX/ProjectTemplates/NodeApplication/Class1.cs new file mode 100644 index 000000000..74da3eeca --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeApplication/Class1.cs @@ -0,0 +1,24 @@ +// Class1.cs +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using NodeApi; +using NodeApi.Network; + +[ScriptModule] +internal static class Class1 { + + static Class1() { + // A basic Hello-World app. Replace with your own application... + + Http.CreateServer(delegate(HttpServerRequest request, HttpServerResponse response) { + response.WriteHead(HttpStatusCode.OK, + new Dictionary("Content-Type", "text/html")); + response.End("Hello Node.js World, from Script#!"); + }).Listen(1337, "127.0.0.1"); + + Debug.WriteLine("Server running at http://127.0.0.1:1337/"); + } +} diff --git a/src/ZipX/ProjectTemplates/NodeApplication/FxCop.ruleset b/src/ZipX/ProjectTemplates/NodeApplication/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeApplication/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/NodeApplication/NodeApplication.vstemplate b/src/ZipX/ProjectTemplates/NodeApplication/NodeApplication.vstemplate new file mode 100644 index 000000000..4756a7ce9 --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeApplication/NodeApplication.vstemplate @@ -0,0 +1,29 @@ + + + Node.js Application + A node.js application. + + CSharp + 30 + true + NodeApplication + true + + + + FxCop.ruleset + AssemblyInfo.cs + Class1.cs + + + + NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + NuGet.VisualStudio.TemplateWizard + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/jQueryClassLibrary/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/NodeModule/AssemblyInfo.cs similarity index 75% rename from src/ZipX/ProjectTemplates/jQueryClassLibrary/AssemblyInfo.cs rename to src/ZipX/ProjectTemplates/NodeModule/AssemblyInfo.cs index 53d3c0162..6d696e1e5 100644 --- a/src/ZipX/ProjectTemplates/jQueryClassLibrary/AssemblyInfo.cs +++ b/src/ZipX/ProjectTemplates/NodeModule/AssemblyInfo.cs @@ -3,7 +3,6 @@ using System; using System.Reflection; -using System.Runtime.CompilerServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -20,3 +19,16 @@ [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ScriptAssembly("$safeprojectname$")] + +// A script template providing a CommonJS module structure around +// the generated script. +[assembly: ScriptTemplate(@" +// {name}.js {version} +// {description} + +{dependenciesLookup} +var $global = this; + +{script} +ss.extend(exports, $exports); +")] diff --git a/src/ZipX/ProjectTemplates/jQueryClassLibrary/Class1.cs b/src/ZipX/ProjectTemplates/NodeModule/Class1.cs similarity index 77% rename from src/ZipX/ProjectTemplates/jQueryClassLibrary/Class1.cs rename to src/ZipX/ProjectTemplates/NodeModule/Class1.cs index d7449cfe3..933a3aa7a 100644 --- a/src/ZipX/ProjectTemplates/jQueryClassLibrary/Class1.cs +++ b/src/ZipX/ProjectTemplates/NodeModule/Class1.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; -using System.Html; -using jQueryApi; +using NodeApi; +using NodeApi.Network; namespace $safeprojectname$ { diff --git a/src/ZipX/ProjectTemplates/NodeModule/FxCop.ruleset b/src/ZipX/ProjectTemplates/NodeModule/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeModule/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/NodeModule/Module.csproj b/src/ZipX/ProjectTemplates/NodeModule/Module.csproj new file mode 100644 index 000000000..7233aa44d --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeModule/Module.csproj @@ -0,0 +1,41 @@ + + + Debug + AnyCPU + 8.0.30703 + 2.0 + $guid1$ + Library + Properties + $safeprojectname$ + $safeprojectname$ + Properties\FxCop.ruleset + True + True + False + True + node_modules + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\$safeprojectname$.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\$safeprojectname$.xml + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/NodeModule/NodeModule.vstemplate b/src/ZipX/ProjectTemplates/NodeModule/NodeModule.vstemplate new file mode 100644 index 000000000..593153ac1 --- /dev/null +++ b/src/ZipX/ProjectTemplates/NodeModule/NodeModule.vstemplate @@ -0,0 +1,29 @@ + + + Node.js Module + A reusable node.js library packaged as a CommonJS-style module. + + CSharp + 35 + true + NodeModule + true + + + + FxCop.ruleset + AssemblyInfo.cs + Class1.cs + + + + NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + NuGet.VisualStudio.TemplateWizard + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/UnitTest/TestClass1.cs b/src/ZipX/ProjectTemplates/UnitTest/TestClass1.cs index 34265524f..3c87a77d3 100644 --- a/src/ZipX/ProjectTemplates/UnitTest/TestClass1.cs +++ b/src/ZipX/ProjectTemplates/UnitTest/TestClass1.cs @@ -35,7 +35,7 @@ public static void OnInitialize(TestContext testContext) { int port = 3976; _webTest = new WebTest(); - _webTest.StartWebServer(webRoot, port); + _webTest.StartWebServer(port, webRoot); } [ClassCleanup()] diff --git a/src/ZipX/ProjectTemplates/UnitTest/UnitTest.vstemplate b/src/ZipX/ProjectTemplates/UnitTest/UnitTest.vstemplate index 492f200ff..3d1cd16d6 100644 --- a/src/ZipX/ProjectTemplates/UnitTest/UnitTest.vstemplate +++ b/src/ZipX/ProjectTemplates/UnitTest/UnitTest.vstemplate @@ -27,7 +27,7 @@ - + diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj b/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj new file mode 100644 index 000000000..bcb3b6168 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj @@ -0,0 +1,40 @@ + + + Debug + AnyCPU + 8.0.30703 + 2.0 + $guid1$ + Library + Properties + $safeprojectname$ + $safeprojectname$ + Properties\FxCop.ruleset + True + True + True + True + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\$safeprojectname$.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\$safeprojectname$.xml + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/jQueryApplication/AssemblyInfo.cs new file mode 100644 index 000000000..fc5cfff96 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryApplication/AssemblyInfo.cs @@ -0,0 +1,38 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("$safeprojectname$")] + +// A script template using an AMD pattern for declaring dependencies consumed +// by the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +require([{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/FxCop.ruleset b/src/ZipX/ProjectTemplates/jQueryApplication/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryApplication/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/Page.cs b/src/ZipX/ProjectTemplates/jQueryApplication/Page.cs new file mode 100644 index 000000000..856f3e2ed --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryApplication/Page.cs @@ -0,0 +1,20 @@ +// Page.cs +// + +using System; +using System.Collections.Generic; +using System.Html; +using jQueryApi; + +[ScriptModule] +internal static class Page { + + static Page() { + jQuery.OnDocumentReady(delegate() { + // TODO: Add script that runs once the document is ready for being + // consumed by script. + // You can also add other classes comprising your application + // to the project. + }); + } +} diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/jQueryApplication.vstemplate b/src/ZipX/ProjectTemplates/jQueryApplication/jQueryApplication.vstemplate new file mode 100644 index 000000000..faa458fdd --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryApplication/jQueryApplication.vstemplate @@ -0,0 +1,30 @@ + + + jQuery Application + An HTML5 application based on the AMD pattern, and jQuery. + + CSharp + 20 + true + Application + true + + + + FxCop.ruleset + AssemblyInfo.cs + Page.cs + + + + NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + NuGet.VisualStudio.TemplateWizard + + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/jQueryClassLibrary/Script.template b/src/ZipX/ProjectTemplates/jQueryClassLibrary/Script.template deleted file mode 100644 index 8fcd90176..000000000 --- a/src/ZipX/ProjectTemplates/jQueryClassLibrary/Script.template +++ /dev/null @@ -1,8 +0,0 @@ -//! #= ScriptFile ## -// - -(function($) { -#include[as-is] "%code%" -})(jQuery); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/AssemblyInfo.cs b/src/ZipX/ProjectTemplates/jQueryPlugin/AssemblyInfo.cs new file mode 100644 index 000000000..8b8c12305 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/AssemblyInfo.cs @@ -0,0 +1,37 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("$safeprojectname$")] + +// A script template allows customization of the generated script. +[assembly: ScriptTemplate(@" +/*! {name}.js {version} + * {description} + */ + +""use strict""; + +define('{name}', [{requires}], function({dependencies}) { + var $global = this; + + {script} +}); +")] diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/FxCop.ruleset b/src/ZipX/ProjectTemplates/jQueryPlugin/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.cs b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.cs new file mode 100644 index 000000000..421bb236a --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.cs @@ -0,0 +1,57 @@ +// $safeprojectname$Plugin.cs +// + +using System; +using System.Collections.Generic; +using System.Html; +using System.Runtime.CompilerServices; +using jQueryApi; + +[ScriptExtension("$.fn")] +internal static class $safeprojectname$Plugin { + + public static jQueryObject $safeprojectname$($safeprojectname$Options customOptions) { + $safeprojectname$Options defaultOptions = + new $safeprojectname$Options("myOption", 0 + /* name/value pairs corresponding to default options */); + + $safeprojectname$Options options = + jQuery.ExtendObject<$safeprojectname$Options>(new $safeprojectname$Options(), defaultOptions, customOptions); + + return jQuery.Current.Each(delegate (int i, Element element) { + // TODO: Consume the matched elements + }); + } +} + +[ScriptImport] +[ScriptName("Object")] +public sealed class $safeprojectname$Options { + + // TODO: Replace with fields corresponding to options for the plugin + public int myOption; + + public $safeprojectname$Options() { + } + + public $safeprojectname$Options(params object[] nameValuePairs) { + } +} + +#region Script# Support +// This class allows calling into the plugin from an application or another plugin. +[ScriptImport] +public sealed class $safeprojectname$Object : jQueryObject { + + private $safeprojectname$Object() { + } + + public $safeprojectname$Object $safeprojectname$() { + return null; + } + + public $safeprojectname$Object $safeprojectname$($safeprojectname$Options options) { + return null; + } +} +#endregion diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj new file mode 100644 index 000000000..8cecbeee7 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj @@ -0,0 +1,40 @@ + + + Debug + AnyCPU + 8.0.30703 + 2.0 + $guid1$ + Library + Properties + $safeprojectname$ + $safeprojectname$ + Properties\FxCop.ruleset + True + True + True + True + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\$safeprojectname$.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\$safeprojectname$.xml + + + + + + + + diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/jQueryPlugin.vstemplate b/src/ZipX/ProjectTemplates/jQueryPlugin/jQueryPlugin.vstemplate new file mode 100644 index 000000000..776f7f352 --- /dev/null +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/jQueryPlugin.vstemplate @@ -0,0 +1,29 @@ + + + jQuery Plugin + A reusable jQuery plugin packaged using the AMD-style module (NOTE: Do not add the 'Plugin' suffix to the project name). + + CSharp + 20 + true + false + + + + FxCop.ruleset + AssemblyInfo.cs + Plugin.cs + + + + NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + NuGet.VisualStudio.TemplateWizard + + + + + + + + + diff --git a/src/ZipX/VSIX/Extension.vsixmanifest b/src/ZipX/VSIX/Extension.vsixmanifest index 6f5e5e6ab..459fd8d27 100644 --- a/src/ZipX/VSIX/Extension.vsixmanifest +++ b/src/ZipX/VSIX/Extension.vsixmanifest @@ -7,7 +7,7 @@ Script# Nikhil Kothari - 0.7.6 + 0.8 Script# lets you author your HTML5 apps in C# and compile them into JavaScript. 1033 http://www.scriptsharp.com/ @@ -29,6 +29,13 @@ VCSExpress VWDExpress + + Ultimate + Premium + Pro + VCSExpress + VWDExpress + diff --git a/src/ZipX/ZipX.csproj b/src/ZipX/ZipX.csproj index e57a97731..faa70ac0b 100644 --- a/src/ZipX/ZipX.csproj +++ b/src/ZipX/ZipX.csproj @@ -26,6 +26,12 @@ + + + + + + @@ -38,8 +44,12 @@ - - + + + + + + @@ -71,15 +81,27 @@ + + + + + + + - - + + + + + + + diff --git a/tests/ScriptSharp/BasicTests.cs b/tests/BasicTests.cs similarity index 65% rename from tests/ScriptSharp/BasicTests.cs rename to tests/BasicTests.cs index ab68eb7f1..b7a680f2b 100644 --- a/tests/ScriptSharp/BasicTests.cs +++ b/tests/BasicTests.cs @@ -19,7 +19,6 @@ public sealed class BasicTests : CompilationTest { public void TestConditionals() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; c.Options.Defines = new string[] { "DEBUG" }; }, "DebugBaseline.txt"); @@ -29,13 +28,45 @@ public void TestConditionals() { }, "TraceBaseline.txt"); } + [TestMethod] + public void TestDependencies() { + RunTest((c) => { + c.AddReference("Lib1.dll"). + AddReference("Lib2.dll"). + AddReference("Lib3.dll"). + AddSource("Code1.cs"); + }, "Code1Baseline.txt"); + + RunTest((c) => { + c.AddReference("Lib1.dll"). + AddReference("Lib2.dll"). + AddReference("Lib3.dll"). + AddSource("Code2.cs"); + }, "Code2Baseline.txt"); + + RunTest((c) => { + c.AddReference("Script.Web.dll"). + AddReference("Lib1.dll"). + AddReference("Lib2.dll"). + AddReference("Lib3.dll"). + AddSource("Code3.cs"); + }, "Code3Baseline.txt"); + + RunTest((c) => { + c.AddReference("Script.Web.dll"). + AddReference("Lib1.dll"). + AddReference("Lib2.dll"). + AddReference("Lib3.dll"). + AddSource("Code4.cs"); + }, "Code4Baseline.txt"); + } + [TestMethod] public void TestDocComments() { RunTest((c) => { c.AddReference("Script.Web.dll"). AddSource("Code.cs"). AddComments("DocComments.xml"); - c.Options.DebugFlavor = true; }); } @@ -48,10 +79,21 @@ public void TestFlags() { } [TestMethod] - public void TestSimple() { + public void TestIncludes() { RunTest((c) => { c.AddSource("Code.cs"); - }); + }, "ZeroIncBaseline.txt"); + + RunTest((c) => { + c.AddSource("Code.cs"). + AddIncludeResolver(); + }, "SingleIncBaseline.txt"); + + RunTest((c) => { + c.AddSource("Code.cs"). + AddIncludeResolver(); + c.Options.Defines = new string[] { "MULTIPLE_INCLUDE" }; + }, "MultipleIncBaseline.txt"); } [TestMethod] @@ -60,7 +102,6 @@ public void TestMetadata() { c.AddReference("Lib.dll"). AddSource("Code.cs"); c.Options.InternalTestType = "metadata"; - c.Options.DebugFlavor = true; }); } @@ -101,20 +142,25 @@ public void TestResources() { AddResource("Strings1.fr.resx"). AddResource("Strings1.fr-FR.resx"). AddResource("Strings2.resx"); - c.Options.DebugFlavor = true; c.Options.Defines = new string[] { "DEBUG" }; }); } [TestMethod] - public void TestTemplate() { + public void TestSimple() { RunTest((c) => { - c.AddReference("Script.Web.dll"). - AddTemplate("Template.js"). - AddSource("Code.cs"); - c.Options.DebugFlavor = true; - c.Options.Defines = new string[] { "DEBUG" }; - }); + c.AddSource("Code.cs"); + }, "DefaultBaseline.txt"); + + RunTest((c) => { + c.AddSource("Code.cs"); + c.Options.Defines = new string[] { "SIMPLE_TEMPLATE" }; + }, "SimpleBaseline.txt"); + + RunTest((c) => { + c.AddSource("Code.cs"); + c.Options.Defines = new string[] { "AMD_TEMPLATE" }; + }, "AMDBaseline.txt"); } [TestMethod] diff --git a/tests/Core/BrowserTest.cs b/tests/Core/BrowserTest.cs new file mode 100644 index 000000000..2dc75d4ab --- /dev/null +++ b/tests/Core/BrowserTest.cs @@ -0,0 +1,87 @@ +// BrowserTest.cs +// Script#/Tests +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScriptSharp.Testing; + +namespace ScriptSharp.Tests.Core { + + public abstract class BrowserTest { + + private static readonly WebTest _webTest; + private static readonly string[] _scripts = new string[] { + "ss.js", "ss.min.js", "ssloader.js", "ssloader.min.js" + }; + private static readonly string[] _codeFiles = new string[] { + "OOP.cs" + }; + private static string _compilationFailures; + + private const int _port = 3976; + + private TestContext _context; + + static BrowserTest() { + string assemblyPath = typeof(BrowserTest).Assembly.GetModules()[0].FullyQualifiedName; + string binDirectory = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\bin\\Debug\\")); + + string webRoot = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\TestSite\\")); + string scriptsDirectory = Path.Combine(webRoot, "Scripts"); + string codeDirectory = Path.Combine(webRoot, "Code"); + + Directory.CreateDirectory(scriptsDirectory); + foreach (string script in _scripts) { + File.Copy(Path.Combine(binDirectory, script), Path.Combine(scriptsDirectory, script), overwrite: true); + } + + List codeFailures = new List(); + + string mscorlibPath = Path.Combine(binDirectory, "mscorlib.dll"); + foreach (string codeFile in _codeFiles) { + string script = Path.GetFileNameWithoutExtension(codeFile) + Path.ChangeExtension(".cs", ".js"); + + SimpleCompilation compilation = new SimpleCompilation(Path.Combine(scriptsDirectory, script)); + bool result = compilation.AddReference(mscorlibPath) + .AddSource(Path.Combine(codeDirectory, codeFile)) + .Execute(); + + if (result == false) { + codeFailures.Add(codeFile); + } + } + + _compilationFailures = (codeFailures.Count == 0) ? null : String.Join(", ", codeFailures); + + _webTest = new WebTest(); + _webTest.StartWebServer(_port, webRoot); + } + + public TestContext TestContext { + get { + return _context; + } + set { + _context = value; + } + } + + protected void RunTest(string url) { + if (_compilationFailures != null) { + Assert.Fail("Could not run test due to compilation failure of " + _compilationFailures + "."); + return; + } + + Uri testUri = _webTest.GetTestUri(url); + + WebTestResult result = _webTest.RunTest(testUri, WebBrowser.Chrome); + Assert.IsTrue(result.Succeeded, "Log:\r\n" + result.Log); + } + } +} diff --git a/tests/ScriptSharp/Core/Compilation.cs b/tests/Core/Compilation.cs similarity index 88% rename from tests/ScriptSharp/Core/Compilation.cs rename to tests/Core/Compilation.cs index 6fdba296c..8c48014fb 100644 --- a/tests/ScriptSharp/Core/Compilation.cs +++ b/tests/Core/Compilation.cs @@ -11,16 +11,16 @@ namespace ScriptSharp.Tests.Core { - public sealed class Compilation : IErrorHandler { + public sealed class Compilation : IErrorHandler, IStreamSourceResolver { private CompilationTest _test; private List _references; private List _sources; private List _resources; - private CompilationInput _template; private CompilationInput _comments; private CompilationOutput _output; + private IStreamSourceResolver _includeResolver; private List _errors; @@ -34,7 +34,6 @@ public Compilation(CompilationTest test) { _resources = new List(); _options = new CompilerOptions(); - _options.DebugFlavor = false; _options.Minimize = false; _options.InternalTestMode = true; _options.Defines = new string[] { }; @@ -86,6 +85,10 @@ public Compilation AddComments(string name) { return this; } + public void AddIncludeResolver() { + _includeResolver = this; + } + public Compilation AddReference(string name) { string assemblyPath = _test.GetAssemblyFilePath(name); if (File.Exists(assemblyPath)) { @@ -119,22 +122,15 @@ public Compilation AddSource(string name) { return this; } - public Compilation AddTemplate(string name) { - string templatePath = _test.GetTestFilePath(name); - - _template = new CompilationInput(templatePath, name); - return this; - } - public bool Execute() { _output = new CompilationOutput(_test.TestContext.TestName); _options.References = _references; _options.Sources = _sources.Cast().ToList(); _options.Resources = _resources.Cast().ToList(); - _options.TemplateFile = _template; _options.DocCommentFile = _comments; _options.ScriptFile = _output; + _options.IncludeResolver = _includeResolver; ScriptCompiler compiler = new ScriptCompiler(this); return compiler.Compile(_options); @@ -154,5 +150,14 @@ void IErrorHandler.ReportError(string errorMessage, string location) { } #endregion + + #region Implementation of IStreamSourceResolver + + IStreamSource IStreamSourceResolver.Resolve(string name) { + string path = _test.GetTestFilePath(name); + return new CompilationInput(path, name); + } + + #endregion } } diff --git a/tests/ScriptSharp/Core/CompilationInput.cs b/tests/Core/CompilationInput.cs similarity index 100% rename from tests/ScriptSharp/Core/CompilationInput.cs rename to tests/Core/CompilationInput.cs diff --git a/tests/ScriptSharp/Core/CompilationOutput.cs b/tests/Core/CompilationOutput.cs similarity index 100% rename from tests/ScriptSharp/Core/CompilationOutput.cs rename to tests/Core/CompilationOutput.cs diff --git a/tests/ScriptSharp/Core/CompilationTest.cs b/tests/Core/CompilationTest.cs similarity index 96% rename from tests/ScriptSharp/Core/CompilationTest.cs rename to tests/Core/CompilationTest.cs index 5cd4afd78..d58237450 100644 --- a/tests/ScriptSharp/Core/CompilationTest.cs +++ b/tests/Core/CompilationTest.cs @@ -41,7 +41,7 @@ protected Compilation CreateCompilation(bool avoidStandardReferences) { public string GetAssemblyFilePath(string fileName) { // Get the path to the ScriptSharp build output folder string assemblyPath = this.GetType().Assembly.GetModules()[0].FullyQualifiedName; - string binPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\..\\bin\\Debug")); + string binPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\bin\\Debug")); return Path.Combine(binPath, fileName); } @@ -49,7 +49,7 @@ public string GetAssemblyFilePath(string fileName) { public string GetTestFilePath(string fileName) { // Get the path to the test cases folder string assemblyPath = this.GetType().Assembly.GetModules()[0].FullyQualifiedName; - string testCasesPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\TestCases\\")); + string testCasesPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\TestCases\\")); // Files within the test cases folder are organized into a two level folder // structure ... group\test @@ -70,7 +70,7 @@ public string GetTestFilePath(string fileName) { public string GetToolPath(string fileName) { // Get the path to the tools folder string assemblyPath = this.GetType().Assembly.GetModules()[0].FullyQualifiedName; - string toolsPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\..\\tools\\bin")); + string toolsPath = Path.GetFullPath(Path.Combine(assemblyPath, "..\\..\\..\\..\\tools\\bin")); return Path.Combine(toolsPath, fileName); } @@ -98,6 +98,8 @@ protected void RunTest(Action compilationInitializer, string baseli if (validResults == false) { string outputPath = Path.Combine(_context.TestRunDirectory, "..", this.GetType().Name + "." + _context.TestName + ".txt"); File.WriteAllText(outputPath, output); + + // File.WriteAllText(baselinePath, output); } Assert.IsTrue(validResults, "Unexpected differences between baseline and result."); diff --git a/tests/Core/SimpleCompilation.cs b/tests/Core/SimpleCompilation.cs new file mode 100644 index 000000000..c2f279601 --- /dev/null +++ b/tests/Core/SimpleCompilation.cs @@ -0,0 +1,115 @@ +// SimpleCompilation.cs +// Script#/Tests +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScriptSharp; + +namespace ScriptSharp.Tests.Core { + + public sealed class SimpleCompilation : IErrorHandler { + + private List _references; + private List _sources; + private IStreamSource _output; + + private CompilerOptions _options; + + private List _errors; + + public SimpleCompilation(string outputPath) { + _references = new List(); + _sources = new List(); + _output = new FileStreamSource(outputPath, writable: true); + + _options = new CompilerOptions(); + _options.Minimize = false; + } + + public bool HasErrors { + get { + return _errors.Count != 0; + } + } + + public SimpleCompilation AddReference(string path) { + _references.Add(path); + return this; + } + + public SimpleCompilation AddSource(string path) { + FileStreamSource sourceInput = new FileStreamSource(path, writable: false); + _sources.Add(sourceInput); + + return this; + } + + public bool Execute() { + _options.References = _references; + _options.Sources = _sources.Cast().ToList(); + _options.ScriptFile = _output; + + ScriptCompiler compiler = new ScriptCompiler(this); + return compiler.Compile(_options); + } + + #region Implementation of IErrorHandler + + void IErrorHandler.ReportError(string errorMessage, string location) { + if (_errors == null) { + _errors = new List(); + } + + string error = errorMessage + " " + location; + _errors.Add(error); + } + + #endregion + + + private sealed class FileStreamSource : IStreamSource { + + private string _path; + private bool _writable; + + public FileStreamSource(string path, bool writable) { + _path = path; + _writable = writable; + } + + #region Implementation of IStreamSource + + string IStreamSource.FullName { + get { + return _path; + } + } + + string IStreamSource.Name { + get { + return Path.GetFileNameWithoutExtension(_path); + } + } + + void IStreamSource.CloseStream(Stream stream) { + stream.Close(); + } + + Stream IStreamSource.GetStream() { + if (_writable) { + return new FileStream(_path, FileMode.Create, FileAccess.ReadWrite, FileShare.None); + } + else { + return new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read); + } + } + + #endregion + } + } +} diff --git a/tests/CoreLib/TestArray.htm b/tests/CoreLib/TestArray.htm deleted file mode 100644 index 6589857ba..000000000 --- a/tests/CoreLib/TestArray.htm +++ /dev/null @@ -1,29 +0,0 @@ - - - - Test - Array - - - - - -

      Test Results

      -

      -

      -
        -
        - - - - - diff --git a/tests/CoreLib/TestDelegate.htm b/tests/CoreLib/TestDelegate.htm deleted file mode 100644 index e369968fe..000000000 --- a/tests/CoreLib/TestDelegate.htm +++ /dev/null @@ -1,148 +0,0 @@ - - - - Test - Delegate - - - - - -

        Test Results

        -

        -

        -
          -
          - - - - - diff --git a/tests/CoreLib/TestEnum.htm b/tests/CoreLib/TestEnum.htm deleted file mode 100644 index f1d06eb24..000000000 --- a/tests/CoreLib/TestEnum.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - Test - Enum - - - - - -

          Test Results

          -

          -

          -
            -
            - - - - - diff --git a/tests/CoreLib/TestOOP.htm b/tests/CoreLib/TestOOP.htm deleted file mode 100644 index a576bb95e..000000000 --- a/tests/CoreLib/TestOOP.htm +++ /dev/null @@ -1,112 +0,0 @@ - - - - Test - OOP - - - - - -

            Test Results

            -

            -

            -
              -
              - - - - - - diff --git a/tests/CoreLib/TestOOP.js b/tests/CoreLib/TestOOP.js deleted file mode 100644 index eb54a34de..000000000 --- a/tests/CoreLib/TestOOP.js +++ /dev/null @@ -1,94 +0,0 @@ -Type.registerNamespace('Test'); -Type.registerNamespace('Test.More'); - -//////////////////////////////////////////////////////////////////////////////// -// Test.IMammal - -Test.IMammal = function() { }; -Test.IMammal.prototype = { - -} -Test.IMammal.registerInterface('Test.IMammal'); - - -//////////////////////////////////////////////////////////////////////////////// -// Test.IPet - -Test.IPet = function() { }; -Test.IPet.prototype = { - get_name : null, - get_owner : null -} -Test.IPet.registerInterface('Test.IPet'); - - -//////////////////////////////////////////////////////////////////////////////// -// Test.Animal - -Test.Animal = function Test_Animal(species) { - this._species = species; -} -Test.Animal.prototype = { - _species: null, - - get_species: function Test_Animal$get_species() { - return this._species; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Test.Cat - -Test.Cat = function Test_Cat() { - Test.Cat.initializeBase(this, [ 'Cat' ]); -} -Test.Cat.prototype = { - - speak: function Test_Cat$speak() { - return 'meow'; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Test.Garfield - -Test.Garfield = function Test_Garfield() { - Test.Garfield.initializeBase(this); -} -Test.Garfield.prototype = { - - get_name: function Test_Garfield$get_name() { - return 'Garfield'; - }, - - get_owner: function Test_Garfield$get_owner() { - return 'Jon'; - }, - - speak: function Test_Garfield$speak() { - return Test.Garfield.callBaseMethod(this, 'speak') + '\r\n' + 'I am fat, lazy, and cynical, but still, a favorite cat...'; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Test.More.Comic - -Test.More.Comic = function(name) { - this._name = name; -} -Test.More.Comic.prototype = { - - get_name: function() { - return this._name; - } -} - - - -Test.Animal.registerClass('Test.Animal'); -Test.Cat.registerClass('Test.Cat', Test.Animal, Test.IMammal); -Test.Garfield.registerClass('Test.Garfield', Test.Cat, Test.IPet); -Test.More.Comic.registerClass('Test.More.Comic'); diff --git a/tests/CoreLib/TestObject.htm b/tests/CoreLib/TestObject.htm deleted file mode 100644 index 1ad2fbab5..000000000 --- a/tests/CoreLib/TestObject.htm +++ /dev/null @@ -1,54 +0,0 @@ - - - - Test - Object - - - - - -

              Test Results

              -

              -

              -
                -
                - - - - - diff --git a/tests/CoreLib/TestObservable.htm b/tests/CoreLib/TestObservable.htm deleted file mode 100644 index 8ab72de5f..000000000 --- a/tests/CoreLib/TestObservable.htm +++ /dev/null @@ -1,136 +0,0 @@ - - - - Test - Observable - - - - - -

                Test Results

                -

                -

                -
                  -
                  - - - - - diff --git a/tests/CoreLib/TestStartup.htm b/tests/CoreLib/TestStartup.htm deleted file mode 100644 index 85c698ea2..000000000 --- a/tests/CoreLib/TestStartup.htm +++ /dev/null @@ -1,52 +0,0 @@ - - - - Test - Startup - - - - - -

                  Test Results

                  -

                  -

                  -
                    -
                    - - - - - - - diff --git a/tests/CoreLib/TestString.htm b/tests/CoreLib/TestString.htm deleted file mode 100644 index a7ff3ef1d..000000000 --- a/tests/CoreLib/TestString.htm +++ /dev/null @@ -1,108 +0,0 @@ - - - - Test - String - - - - - -

                    Test Results

                    -

                    -

                    -
                      -
                      - - - - - diff --git a/tests/CoreLib/TestStringBuilder.htm b/tests/CoreLib/TestStringBuilder.htm deleted file mode 100644 index 0108553ac..000000000 --- a/tests/CoreLib/TestStringBuilder.htm +++ /dev/null @@ -1,68 +0,0 @@ - - - - Test - StringBuilder - - - - - -

                      Test Results

                      -

                      -

                      -
                        -
                        - - - - - diff --git a/tests/CoreLib/TestTask.htm b/tests/CoreLib/TestTask.htm deleted file mode 100644 index e37d041c1..000000000 --- a/tests/CoreLib/TestTask.htm +++ /dev/null @@ -1,295 +0,0 @@ - - - - Test - Task - - - - - -

                        Test Results

                        -

                        -

                        -
                          -
                          - - - - - diff --git a/tests/CoreLib/Tests.htm b/tests/CoreLib/Tests.htm deleted file mode 100644 index 1508b141f..000000000 --- a/tests/CoreLib/Tests.htm +++ /dev/null @@ -1,52 +0,0 @@ - - - - Tests - - - -

                          mscorlib.js Tests

                          -
                          -

                          Infrastructure

                          -
                          -
                          TestStartup
                          -
                          Tests startup/loader functionlity
                          -
                          -
                          -

                          Type System

                          -
                          -
                          TestOOP
                          -
                          Tests classes, interfaces and related APIs
                          -
                          TestDelegate
                          -
                          Tests delegates
                          -
                          TestEnum
                          -
                          Tests enums
                          -
                          -
                          -

                          Script Extensions

                          -
                          -
                          TestObject
                          -
                          Tests object extensions
                          -
                          TestString
                          -
                          Tests string extensions
                          -
                          TestArray
                          -
                          Tests array extensions
                          -
                          -
                          -

                          Script BCL

                          -
                          -
                          TestStringBuilder
                          -
                          Test StringBuilder functionality
                          -
                          TestObservable
                          -
                          Test Observable and change notifications
                          -
                          TestTask
                          -
                          Test Deferred and Task
                          -
                          - - diff --git a/tests/ScriptSharp/ExpressionTests.cs b/tests/ExpressionTests.cs similarity index 86% rename from tests/ScriptSharp/ExpressionTests.cs rename to tests/ExpressionTests.cs index 77e3eaa89..f3cf2a00d 100644 --- a/tests/ScriptSharp/ExpressionTests.cs +++ b/tests/ExpressionTests.cs @@ -26,6 +26,13 @@ public void TestArguments() { }); } + [TestMethod] + public void TestArray() { + RunTest((c) => { + c.AddSource("Code.cs"); + }); + } + [TestMethod] public void TestBase() { RunTest((c) => { @@ -54,6 +61,13 @@ public void TestConditional() { }); } + [TestMethod] + public void TestDate() { + RunTest((c) => { + c.AddSource("Code.cs"); + }); + } + [TestMethod] public void TestDelegates() { RunTest((c) => { @@ -76,7 +90,6 @@ public void TestEnumToString() { RunTest((c) => { c.AddSource("Code2.cs"); - c.Options.DebugFlavor = false; c.Options.Minimize = true; }, "MinBaseline.txt"); } @@ -89,23 +102,23 @@ public void TestEvents() { } [TestMethod] - public void TestGenerics() { + public void TestExtensionMethods() { RunTest((c) => { - c.AddReference("Script.Web.dll"). - AddReference("Script.jQuery.dll"). - AddSource("Code.cs"); + c.AddSource("Code.cs"); }); } [TestMethod] - public void TestGetType() { + public void TestGenerics() { RunTest((c) => { - c.AddSource("Code.cs"); + c.AddReference("Script.Web.dll"). + AddReference("Script.jQuery.dll"). + AddSource("Code.cs"); }); } [TestMethod] - public void TestGlobalMethods() { + public void TestGetType() { RunTest((c) => { c.AddSource("Code.cs"); }); @@ -174,6 +187,13 @@ public void TestString() { }); } + [TestMethod] + public void TestTasks() { + RunTest((c) => { + c.AddSource("Code.cs"); + }); + } + [TestMethod] public void TestTruthy() { RunTest((c) => { @@ -181,6 +201,13 @@ public void TestTruthy() { }); } + [TestMethod] + public void TestTuples() { + RunTest((c) => { + c.AddSource("Code.cs"); + }); + } + [TestMethod] public void TestUnary() { RunTest((c) => { diff --git a/tests/ScriptSharp/LibraryTests.cs b/tests/LibraryTests.cs similarity index 76% rename from tests/ScriptSharp/LibraryTests.cs rename to tests/LibraryTests.cs index 83ec1f075..7d7236d35 100644 --- a/tests/ScriptSharp/LibraryTests.cs +++ b/tests/LibraryTests.cs @@ -18,9 +18,16 @@ public void TestjQuery() { c.AddReference("Script.Web.dll"). AddReference("Script.jQuery.dll"). AddSource("Code.cs"); - c.Options.DebugFlavor = true; c.Options.Defines = new string[] { "DEBUG" }; }); } + + [TestMethod] + public void TestNode() { + RunTest((c) => { + c.AddReference("Script.Node.dll"). + AddSource("Code.cs"); + }); + } } } diff --git a/tests/ScriptSharp/MemberTests.cs b/tests/MemberTests.cs similarity index 100% rename from tests/ScriptSharp/MemberTests.cs rename to tests/MemberTests.cs diff --git a/tests/ScriptSharp/Properties/AssemblyInfo.cs b/tests/Properties/AssemblyInfo.cs similarity index 100% rename from tests/ScriptSharp/Properties/AssemblyInfo.cs rename to tests/Properties/AssemblyInfo.cs diff --git a/tests/ScriptSharpTests.sln b/tests/ScriptSharpTests.sln deleted file mode 100644 index 8fcdb92c6..000000000 --- a/tests/ScriptSharpTests.sln +++ /dev/null @@ -1,49 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptSharp", "ScriptSharp\ScriptSharp.csproj", "{0E3485F3-D66D-4907-BDB9-D61D34F97538}" -EndProject -Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "CoreLib", "CoreLib\", "{956971CD-A3AA-4C69-BF6E-A42A580B08CB}" - ProjectSection(WebsiteProperties) = preProject - TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" - Debug.AspNetCompiler.VirtualPath = "/CoreLib" - Debug.AspNetCompiler.PhysicalPath = "CoreLib\" - Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\CoreLib\" - Debug.AspNetCompiler.Updateable = "true" - Debug.AspNetCompiler.ForceOverwrite = "true" - Debug.AspNetCompiler.FixedNames = "false" - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.VirtualPath = "/CoreLib" - Release.AspNetCompiler.PhysicalPath = "CoreLib\" - Release.AspNetCompiler.TargetPath = "PrecompiledWeb\CoreLib\" - Release.AspNetCompiler.Updateable = "true" - Release.AspNetCompiler.ForceOverwrite = "true" - Release.AspNetCompiler.FixedNames = "false" - Release.AspNetCompiler.Debug = "False" - VWDPort = "23597" - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{37D238E7-539B-497A-98D7-760DAFCF6527}" - ProjectSection(SolutionItems) = preProject - ScriptSharp.testsettings = ScriptSharp.testsettings - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Release|Any CPU.Build.0 = Release|Any CPU - {956971CD-A3AA-4C69-BF6E-A42A580B08CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {956971CD-A3AA-4C69-BF6E-A42A580B08CB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {956971CD-A3AA-4C69-BF6E-A42A580B08CB}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {956971CD-A3AA-4C69-BF6E-A42A580B08CB}.Release|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tests/ScriptTests.cs b/tests/ScriptTests.cs new file mode 100644 index 000000000..6ea00bfb1 --- /dev/null +++ b/tests/ScriptTests.cs @@ -0,0 +1,109 @@ +// TypeSystemTests.cs +// Script#/Tests +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScriptSharp.Tests.Core; + +namespace ScriptSharp.Tests { + + [TestClass] + public class ScriptTests : BrowserTest { + + [TestMethod] + public void TestGlobals() { + RunTest("/Globals.htm"); + } + + [TestMethod] + public void TestTypeSystem() { + RunTest("/TypeSystem.htm"); + } + + [TestMethod] + public void TestBases() { + RunTest("/Bases.htm"); + } + + #region Loader Tests + [TestMethod] + public void TestLoader() { + RunTest("/Loader.htm"); + } + + [TestMethod] + public void TestLoaderChain() { + RunTest("/LoaderChain.htm"); + } + + [TestMethod] + public void TestLoaderCombined() { + RunTest("/LoaderCombined.htm"); + } + + [TestMethod] + public void TestLoaderConfig() { + RunTest("/LoaderConfig.htm"); + } + + [TestMethod] + public void TestLoaderNonAMD() { + RunTest("/LoaderNonAMD.htm"); + } + #endregion + + #region BCL Tests + [TestMethod] + public void TestDate() { + RunTest("/Date.htm"); + } + + [TestMethod] + public void TestDelegates() { + RunTest("/Delegates.htm"); + } + + [TestMethod] + public void TestString() { + RunTest("/String.htm"); + } + + [TestMethod] + public void TestStringBuilder() { + RunTest("/StringBuilder.htm"); + } + + [TestMethod] + public void TestDictionary() { + RunTest("/Dictionary.htm"); + } + + [TestMethod] + public void TestQueue() { + RunTest("/Queue.htm"); + } + + [TestMethod] + public void TestStack() { + RunTest("/Stack.htm"); + } + + [TestMethod] + public void TestEnumerator() { + RunTest("/Enumerator.htm"); + } + + [TestMethod] + public void TestObservable() { + RunTest("/Observable.htm"); + } + + [TestMethod] + public void TestTasks() { + RunTest("/Tasks.htm"); + } + #endregion + } +} diff --git a/tests/ScriptSharp/StatementTests.cs b/tests/StatementTests.cs similarity index 100% rename from tests/ScriptSharp/StatementTests.cs rename to tests/StatementTests.cs diff --git a/tests/TestCases/Basic/Conditionals/Code.cs b/tests/TestCases/Basic/Conditionals/Code.cs index ca5ec90bc..98dd9a947 100644 --- a/tests/TestCases/Basic/Conditionals/Code.cs +++ b/tests/TestCases/Basic/Conditionals/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { diff --git a/tests/TestCases/Basic/Conditionals/DebugBaseline.txt b/tests/TestCases/Basic/Conditionals/DebugBaseline.txt index eb4eaa464..6adf248c7 100644 --- a/tests/TestCases/Basic/Conditionals/DebugBaseline.txt +++ b/tests/TestCases/Basic/Conditionals/DebugBaseline.txt @@ -1,46 +1,57 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.MyDebug +define('test', ['ss'], function(ss) { + var $global = this; -test.MyDebug = function test_MyDebug() { -} -test.MyDebug.showInfo = function test_MyDebug$showInfo() { -} -test.MyDebug.traceInfo = function test_MyDebug$traceInfo() { -} -test.MyDebug.logInfo = function test_MyDebug$logInfo() { -} + // BasicTests.MyDebug + function MyDebug() { + } + MyDebug.showInfo = function() { + }; + MyDebug.traceInfo = function() { + }; + MyDebug.logInfo = function() { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App -test.App = function test_App(i) { + // BasicTests.App + + function App(i) { console.assert(false); - test.MyDebug.showInfo(); + MyDebug.showInfo(); while (true) { - console.assert(false); + console.assert(false); } switch (i) { - case 0: - console.assert(false); - break; + case 0: + console.assert(false); + break; } console.assert(!!i); console.assert(!!i); i++; if (false) { - console.log('Debug spew'); + console.log('Debug spew'); } while (false) { - console.log('.'); + console.log('.'); } for (var i = 0; i < 10; i++) { - console.log('.'); + console.log('.'); } -} + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + MyDebug: [ MyDebug, null, null ], + App: [ App, App$, null ] + }); -test.MyDebug.registerClass('test.MyDebug'); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Basic/Conditionals/TraceBaseline.txt b/tests/TestCases/Basic/Conditionals/TraceBaseline.txt index 68b6097d4..314a855f3 100644 --- a/tests/TestCases/Basic/Conditionals/TraceBaseline.txt +++ b/tests/TestCases/Basic/Conditionals/TraceBaseline.txt @@ -1,32 +1,43 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.MyDebug +define('test', ['ss'], function(ss) { + var $global = this; -test.MyDebug = function() { -} -test.MyDebug.showInfo = function() { -} -test.MyDebug.traceInfo = function() { -} -test.MyDebug.logInfo = function() { -} + // BasicTests.MyDebug + function MyDebug() { + } + MyDebug.showInfo = function() { + }; + MyDebug.traceInfo = function() { + }; + MyDebug.logInfo = function() { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App -test.App = function(i) { + // BasicTests.App + + function App(i) { while (true) { } switch (i) { - case 0: - break; + case 0: + break; } i++; - test.MyDebug.traceInfo(); -} + MyDebug.traceInfo(); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + MyDebug: [ MyDebug, null, null ], + App: [ App, App$, null ] + }); -test.MyDebug.registerClass('test.MyDebug'); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Basic/Template/Code.cs b/tests/TestCases/Basic/Dependencies/Code1.cs similarity index 50% rename from tests/TestCases/Basic/Template/Code.cs rename to tests/TestCases/Basic/Dependencies/Code1.cs index c877fcbc1..3442ca6e8 100644 --- a/tests/TestCases/Basic/Template/Code.cs +++ b/tests/TestCases/Basic/Dependencies/Code1.cs @@ -1,16 +1,17 @@ using System; -using System.Html; -using System.Runtime.CompilerServices; +using Library1; +using Library2; +using Library3; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { public class App { public App() { - Element e = Document.Body; + Component1 c1 = new Component1(); + Component1 c2 = new Component2(); } } } diff --git a/tests/TestCases/Basic/Dependencies/Code1Baseline.txt b/tests/TestCases/Basic/Dependencies/Code1Baseline.txt new file mode 100644 index 000000000..9098c97f5 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code1Baseline.txt @@ -0,0 +1,24 @@ +"use strict"; + +define('test', ['ss', 'lib1'], function(ss, lib1) { + var $global = this; + + // BasicTests.App + + function App() { + var c1 = new lib1.Component1(); + var c2 = new Component2(); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Basic/Dependencies/Code2.cs b/tests/TestCases/Basic/Dependencies/Code2.cs new file mode 100644 index 000000000..01cd86d9d --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code2.cs @@ -0,0 +1,19 @@ +using System; +using Library1; +using Library2; +using Library3; + +[assembly: ScriptAssembly("test")] + +namespace BasicTests { + + public class App { + + public App() { + Component1 c1 = new Component1(); + Component2 c2 = new Component2(); + Component3 c3 = new Component3(); + Component4 c4 = new Component4(); + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Code2Baseline.txt b/tests/TestCases/Basic/Dependencies/Code2Baseline.txt new file mode 100644 index 000000000..8eb615e24 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code2Baseline.txt @@ -0,0 +1,26 @@ +"use strict"; + +define('test', ['ss', 'lib1', 'comp3', 'comp4'], function(ss, lib1, comp3, comp4) { + var $global = this; + + // BasicTests.App + + function App() { + var c1 = new lib1.Component1(); + var c2 = new Component2(); + var c3 = new comp3.Component3(); + var c4 = new Component4(); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Basic/Dependencies/Code3.cs b/tests/TestCases/Basic/Dependencies/Code3.cs new file mode 100644 index 000000000..053784651 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code3.cs @@ -0,0 +1,25 @@ +using System; +using System.Html; +using Library1; +using Library2; +using Library3; + +[assembly: ScriptAssembly("test")] +[assembly: ScriptReference("comp3", Path = "/lib/comp3")] +[assembly: ScriptReference("comp4", DelayLoad = true)] + +namespace BasicTests { + + public class App { + + public App() { + Component1 c1 = new Component1(); + Component2 c2 = new Component2(); + Component3 c3 = new Component3(); + + Window.Require("comp4", delegate() { + Component4 c4 = new Component4(); + }); + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Code3Baseline.txt b/tests/TestCases/Basic/Dependencies/Code3Baseline.txt new file mode 100644 index 000000000..bb32d1c67 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code3Baseline.txt @@ -0,0 +1,28 @@ +"use strict"; + +define('test', ['ss', 'lib1', '/lib/comp3'], function(ss, lib1, comp3) { + var $global = this; + + // BasicTests.App + + function App() { + var c1 = new lib1.Component1(); + var c2 = new Component2(); + var c3 = new comp3.Component3(); + require('comp4', function() { + var c4 = new Component4(); + }); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Basic/Dependencies/Code4.cs b/tests/TestCases/Basic/Dependencies/Code4.cs new file mode 100644 index 000000000..f3bfdb99d --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code4.cs @@ -0,0 +1,39 @@ +using System; +using System.Html; +using System.Runtime.CompilerServices; +using Library1; +using Library2; +using Library3; + +[assembly: ScriptAssembly("test")] +[assembly: ScriptReference("comp3", Path = "/lib/comp3")] +[assembly: ScriptReference("comp4", DelayLoad = true)] +[assembly: ScriptReference("text!data.html", Identifier = "dataTemplate")] + +namespace BasicTests { + + [ScriptImport] + public static class Templates { + + [ScriptField] + [ScriptAlias("dataTemplate")] + public static string DataTemplate { + get { return null; } + } + } + + public class App { + + public App() { + Component1 c1 = new Component1(); + Component2 c2 = new Component2(); + Component3 c3 = new Component3(); + + Window.Require("comp4", delegate() { + Component4 c4 = new Component4(); + }); + + Window.Alert(Templates.DataTemplate); + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Code4Baseline.txt b/tests/TestCases/Basic/Dependencies/Code4Baseline.txt new file mode 100644 index 000000000..8fa573502 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Code4Baseline.txt @@ -0,0 +1,29 @@ +"use strict"; + +define('test', ['ss', 'lib1', '/lib/comp3', 'text!data.html'], function(ss, lib1, comp3, dataTemplate) { + var $global = this; + + // BasicTests.App + + function App() { + var c1 = new lib1.Component1(); + var c2 = new Component2(); + var c3 = new comp3.Component3(); + require('comp4', function() { + var c4 = new Component4(); + }); + alert(dataTemplate); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Basic/Dependencies/Lib.bat b/tests/TestCases/Basic/Dependencies/Lib.bat new file mode 100644 index 000000000..20c1d5600 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Lib.bat @@ -0,0 +1,3 @@ +csc.exe /t:library /noconfig /nologo /nostdlib /r:..\..\..\..\bin\Debug\mscorlib.dll /out:Lib1.dll Lib1.cs +csc.exe /t:library /noconfig /nologo /nostdlib /r:..\..\..\..\bin\Debug\mscorlib.dll /out:Lib2.dll Lib2.cs +csc.exe /t:library /noconfig /nologo /nostdlib /r:..\..\..\..\bin\Debug\mscorlib.dll /out:Lib3.dll Lib3.cs diff --git a/tests/TestCases/Basic/Dependencies/Lib1.cs b/tests/TestCases/Basic/Dependencies/Lib1.cs new file mode 100644 index 000000000..aa25e3ab9 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Lib1.cs @@ -0,0 +1,14 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("lib1")] + +namespace Library1 { + + [ScriptImport] + public class Component1 { + + public Component1() { + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Lib1.dll b/tests/TestCases/Basic/Dependencies/Lib1.dll new file mode 100644 index 000000000..bb9fa01d1 Binary files /dev/null and b/tests/TestCases/Basic/Dependencies/Lib1.dll differ diff --git a/tests/TestCases/Basic/Dependencies/Lib2.cs b/tests/TestCases/Basic/Dependencies/Lib2.cs new file mode 100644 index 000000000..d815459d9 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Lib2.cs @@ -0,0 +1,15 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("")] + +namespace Library2 { + + [ScriptImport] + [ScriptIgnoreNamespace] + public class Component2 { + + public Component2() { + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Lib2.dll b/tests/TestCases/Basic/Dependencies/Lib2.dll new file mode 100644 index 000000000..f2aeababd Binary files /dev/null and b/tests/TestCases/Basic/Dependencies/Lib2.dll differ diff --git a/tests/TestCases/Basic/Dependencies/Lib3.cs b/tests/TestCases/Basic/Dependencies/Lib3.cs new file mode 100644 index 000000000..95e5359a9 --- /dev/null +++ b/tests/TestCases/Basic/Dependencies/Lib3.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("")] + +namespace Library3 { + + [ScriptImport] + [ScriptDependency("comp3")] + public class Component3 { + + public Component3() { + } + } + + [ScriptImport] + [ScriptDependency("comp4")] + [ScriptIgnoreNamespace] + public class Component4 { + + public Component4() { + } + } +} diff --git a/tests/TestCases/Basic/Dependencies/Lib3.dll b/tests/TestCases/Basic/Dependencies/Lib3.dll new file mode 100644 index 000000000..fa4cc5fc8 Binary files /dev/null and b/tests/TestCases/Basic/Dependencies/Lib3.dll differ diff --git a/tests/TestCases/Basic/DocComments/Baseline.txt b/tests/TestCases/Basic/DocComments/Baseline.txt index 76c48625e..bd7a0aa61 100644 --- a/tests/TestCases/Basic/DocComments/Baseline.txt +++ b/tests/TestCases/Basic/DocComments/Baseline.txt @@ -1,61 +1,34 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Suit +define('test', ['ss'], function(ss) { + var $global = this; -test.Suit = function() { - /// - /// Represents a card suit. - /// - /// - /// The hearts. - /// - /// - /// The spades. - /// - /// - /// The clubs. - /// - /// - /// The diamonds. - /// -}; -test.Suit.prototype = { + // BasicTests.Suit + + var Suit = { heart: 0, spade: 1, club: 2, diamond: 3 -} -test.Suit.registerEnum('test.Suit', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.RecordClass + // BasicTests.IInterface -test.$create_RecordClass = function test_RecordClass(count) { - var $o = { }; - return $o; -} + function IInterface() { } -//////////////////////////////////////////////////////////////////////////////// -// test.IInterface + // BasicTests.RecordClass -test.IInterface = function() { - /// - /// Represents an interface. - /// -}; -test.IInterface.prototype = { - execute : null -} -test.IInterface.registerInterface('test.IInterface'); + function RecordClass(count) { + var $o = {}; + return $o; + } -//////////////////////////////////////////////////////////////////////////////// -// test.BaseClass + // BasicTests.BaseClass -test.BaseClass = function test_BaseClass(domElement, name, count) { + function BaseClass(domElement, name, count) { /// /// Represents a base class. /// @@ -82,213 +55,211 @@ test.BaseClass = function test_BaseClass(domElement, name, count) { /// /// /// + this.instanceField = 0; this._domElement = domElement; -} -test.BaseClass.get_totalCount = function test_BaseClass$get_totalCount() { + } + BaseClass.get_totalCount = function() { /// /// Gets the total count. /// /// return 0; -} -test.BaseClass.staticMethod = function test_BaseClass$staticMethod(length) { + }; + BaseClass.staticMethod = function(length) { /// /// A static method. /// /// /// The length. /// -} -test.BaseClass.prototype = { - instanceField: 0, - _domElement: null, - - get_name: function test_BaseClass$get_name() { - /// - /// Gets or sets the name. - /// - /// - return null; + }; + var BaseClass$ = { + get_name: function() { + /// + /// Gets or sets the name. + /// + /// + return null; }, - set_name: function test_BaseClass$set_name(value) { - /// - /// Gets or sets the name. - /// - /// - return value; + set_name: function(value) { + /// + /// Gets or sets the name. + /// + /// + return value; }, - - get_domElement: function test_BaseClass$get_domElement() { - /// - /// Gets or sets the element. - /// - /// - return null; + get_domElement: function() { + /// + /// Gets or sets the element. + /// + /// + return null; }, - set_domElement: function test_BaseClass$set_domElement(value) { - /// - /// Gets or sets the element. - /// - /// - return value; + set_domElement: function(value) { + /// + /// Gets or sets the element. + /// + /// + return value; }, - - get_count: function test_BaseClass$get_count() { - /// - /// Gets the count. - /// - /// - return 0; + get_count: function() { + /// + /// Gets the count. + /// + /// + return 0; }, - - get__privateName: function test_BaseClass$get__privateName() { - /// - /// Gets the private name. - /// - /// - return null; + get__privateName: function() { + /// + /// Gets the private name. + /// + /// + return null; }, - - add_initialized: function test_BaseClass$add_initialized(value) { - /// - /// Adds or removes a delegate for the Initialized event. - /// - /// - this.__initialized = ss.Delegate.combine(this.__initialized, value); + add_initialized: function(value) { + /// + /// Adds or removes a delegate for the Initialized event. + /// + /// + this.__initialized = ss.bindAdd(this.__initialized, value); }, - remove_initialized: function test_BaseClass$remove_initialized(value) { - /// - /// Adds or removes a delegate for the Initialized event. - /// - /// - this.__initialized = ss.Delegate.remove(this.__initialized, value); + remove_initialized: function(value) { + /// + /// Adds or removes a delegate for the Initialized event. + /// + /// + this.__initialized = ss.bindSub(this.__initialized, value); }, - - __initialized: null, - - method1: function test_BaseClass$method1() { - /// - /// Empty method. - /// + method1: function() { + /// + /// Empty method. + /// }, - - method2: function test_BaseClass$method2() { - /// - /// Method with return value. - /// - /// - return null; + method2: function() { + /// + /// Method with return value. + /// + /// + return null; }, - - method3: function test_BaseClass$method3(first, last) { - /// - /// Method with params. - /// - /// - /// The first name. - /// - /// - /// The last name. - /// + method3: function(first, last) { + /// + /// Method with params. + /// + /// + /// The first name. + /// + /// + /// The last name. + /// }, - - method4: function test_BaseClass$method4(count) { - /// - /// Method with both params and return value. - /// - /// - /// The count. - /// - /// - return null; + method4: function(count) { + /// + /// Method with both params and return value. + /// + /// + /// The count. + /// + /// + return null; }, - - onInitialized: function test_BaseClass$onInitialized() { - /// - /// Raises the Initialized event. - /// - if (this.__initialized != null) { - } + onInitialized: function() { + /// + /// Raises the Initialized event. + /// + if (this.__initialized != null) { + } }, - - _privateMethod: function test_BaseClass$_privateMethod(count) { - /// - /// Private method. - /// - /// - /// The count. - /// + _privateMethod: function(count) { + /// + /// Private method. + /// + /// + /// The count. + /// }, - get_item: function test_BaseClass$get_item(ids) { - /// - /// Gets item by identifiers. - /// - /// - /// The identifiers. - /// - /// - /// - /// - return null; + get_item: function(ids) { + /// + /// Gets item by identifiers. + /// + /// + /// The identifiers. + /// + /// + /// + /// + return null; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.DerivedClass + // BasicTests.InternalClass -test.DerivedClass = function test_DerivedClass() { + function InternalClass() { /// - /// Represents a derived class. + /// An internal class. /// - test.DerivedClass.initializeBase(this, [ null, null, 0 ]); -} -test.DerivedClass.prototype = { - - method3: function test_DerivedClass$method3(first, last) { - /// - /// Overriden method with params. - /// - /// - /// The first name. - /// - /// - /// The last name. - /// - } -} + } + var InternalClass$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test._internalClass - -test._internalClass = function test__internalClass() { - /// - /// An internal class. - /// -} + // BasicTests.InternalClassWithNoComments -//////////////////////////////////////////////////////////////////////////////// -// test._internalClassWithNoComments + function InternalClassWithNoComments() { + } + var InternalClassWithNoComments$ = { -test._internalClassWithNoComments = function test__internalClassWithNoComments() { -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.GlobalMethodsClass + // BasicTests.GlobalMethodsClass -window.run = function test_GlobalMethodsClass$run() { + $global.run = function() { /// /// Runs. /// -} + }; + + + // BasicTests.DerivedClass + + function DerivedClass() { + /// + /// Represents a derived class. + /// + BaseClass.call(this, null, null, 0); + } + var DerivedClass$ = { + method3: function(first, last) { + /// + /// Overriden method with params. + /// + /// + /// The first name. + /// + /// + /// The last name. + /// + } + }; + + + var $exports = ss.module('test', + { + InternalClass: [ InternalClass, InternalClass$, null ], + InternalClassWithNoComments: [ InternalClassWithNoComments, InternalClassWithNoComments$, null ] + }, + { + Suit: Suit, + IInterface: [ IInterface ], + RecordClass: RecordClass, + BaseClass: [ BaseClass, BaseClass$, null ], + DerivedClass: [ DerivedClass, DerivedClass$, BaseClass ] + }); + BaseClass.constantField = 3; -test.BaseClass.registerClass('test.BaseClass'); -test.DerivedClass.registerClass('test.DerivedClass', test.BaseClass); -test._internalClass.registerClass('test._internalClass'); -test._internalClassWithNoComments.registerClass('test._internalClassWithNoComments'); -test.BaseClass.constantField = 3; -test.BaseClass.staticField = null; + return $exports; +}); diff --git a/tests/TestCases/Basic/DocComments/Code.cs b/tests/TestCases/Basic/DocComments/Code.cs index a91822eee..4bcdc3892 100644 --- a/tests/TestCases/Basic/DocComments/Code.cs +++ b/tests/TestCases/Basic/DocComments/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { @@ -221,7 +220,8 @@ internal class InternalClassWithNoComments { /// /// Represents a record. /// - public sealed class RecordClass : Record { + [ScriptObject] + public sealed class RecordClass { /// /// Gets or sets a count. @@ -248,9 +248,9 @@ public interface IInterface { } /// - /// Class with global methods. + /// Class with extension methods. /// - [GlobalMethods] + [ScriptExtension("$global")] public static class GlobalMethodsClass { /// diff --git a/tests/TestCases/Basic/Flags/Baseline.txt b/tests/TestCases/Basic/Flags/Baseline.txt index 74720d529..faa3eb6b4 100644 --- a/tests/TestCases/Basic/Flags/Baseline.txt +++ b/tests/TestCases/Basic/Flags/Baseline.txt @@ -1,22 +1,29 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // BasicTests.App + + function App() { + } + var App$ = { method1: function(i) { - var j = i; - var x = j++; + var j = i; + var x = j++; }, - method2: function(i) { - var j = 10; - var x = j++; + var j = 10; + var x = j++; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Basic/Flags/Code.cs b/tests/TestCases/Basic/Flags/Code.cs index 8efcaf1b9..1c67ab6cf 100644 --- a/tests/TestCases/Basic/Flags/Code.cs +++ b/tests/TestCases/Basic/Flags/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { diff --git a/tests/TestCases/Basic/Includes/Code.cs b/tests/TestCases/Basic/Includes/Code.cs new file mode 100644 index 000000000..1e018ae90 --- /dev/null +++ b/tests/TestCases/Basic/Includes/Code.cs @@ -0,0 +1,36 @@ +// Code.cs +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("basic")] + +#if MULTIPLE_INCLUDE +[assembly: ScriptTemplate(@" +// {name}.js +""use strict""; + +(function($global) { + {include:pre.js} + {script} + {include:post.js} +})(this); +")] +#else +[assembly: ScriptTemplate(@" +// {name}.js {version} +// + +{include:pre.js} +{script} +")] +#endif + + +namespace Basic { + + public class App { + } +} diff --git a/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt b/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt new file mode 100644 index 000000000..920451184 --- /dev/null +++ b/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt @@ -0,0 +1,24 @@ +// basic.js +"use strict"; + +(function($global) { + // pre script + + // Basic.App + + function App() { + } + var App$ = { + + }; + + + var $exports = ss.module('basic', null, + { + App: [ App, App$, null ] + }); + + + // post script + +})(this); diff --git a/tests/TestCases/Basic/Includes/Post.js b/tests/TestCases/Basic/Includes/Post.js new file mode 100644 index 000000000..12e352760 --- /dev/null +++ b/tests/TestCases/Basic/Includes/Post.js @@ -0,0 +1 @@ +// post script diff --git a/tests/TestCases/Basic/Includes/Pre.js b/tests/TestCases/Basic/Includes/Pre.js new file mode 100644 index 000000000..182c72a8e --- /dev/null +++ b/tests/TestCases/Basic/Includes/Pre.js @@ -0,0 +1 @@ +// pre script diff --git a/tests/TestCases/Basic/Includes/SingleIncBaseline.txt b/tests/TestCases/Basic/Includes/SingleIncBaseline.txt new file mode 100644 index 000000000..299a56c9b --- /dev/null +++ b/tests/TestCases/Basic/Includes/SingleIncBaseline.txt @@ -0,0 +1,20 @@ +// basic.js +// + +// pre script + +// Basic.App + +function App() { +} +var App$ = { + +}; + + +var $exports = ss.module('basic', null, + { + App: [ App, App$, null ] + }); + + diff --git a/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt b/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt new file mode 100644 index 000000000..29a53f0a1 --- /dev/null +++ b/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt @@ -0,0 +1,19 @@ +// basic.js +// + +{include:pre.js} +// Basic.App + +function App() { +} +var App$ = { + +}; + + +var $exports = ss.module('basic', null, + { + App: [ App, App$, null ] + }); + + diff --git a/tests/TestCases/Basic/Metadata/Baseline.txt b/tests/TestCases/Basic/Metadata/Baseline.txt index d880a5d98..dac4adc20 100644 --- a/tests/TestCases/Basic/Metadata/Baseline.txt +++ b/tests/TestCases/Basic/Metadata/Baseline.txt @@ -11,12 +11,12 @@ Types: Application Type: True Public: True Generated Name: App - Global Methods: False + Extension Methods: False Interfaces: - BasicTests.IApp + IApp Constructor: Constructor: - AssociatedType: BasicTests.App + AssociatedType: App Visibility: Public Generated Name: Members: @@ -63,7 +63,7 @@ Types: Application Type: True Public: False Generated Name: AppHelper - Global Methods: False + Extension Methods: False Indexer: Indexer: Item AssociatedType: Int32 @@ -137,10 +137,10 @@ Types: Application Type: True Public: False Generated Name: Point - Global Methods: False + Extension Methods: False Constructor: Constructor: - AssociatedType: BasicTests.Point + AssociatedType: Point Visibility: Public Generated Name: Parameters:Parameter: x @@ -163,7 +163,7 @@ Types: Application Type: True Public: False Generated Name: Util - Global Methods: True + Extension Methods: True Members: Method: ShowHelp AssociatedType: Void @@ -278,7 +278,8 @@ Types: Application Type: False Public: True Generated Name: arguments - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -310,7 +311,8 @@ Types: Application Type: False Public: True Generated Name: Array - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -323,11 +325,6 @@ Types: AssociatedType: Int32 Visibility: Public Generated Name: length - Method: Clone - AssociatedType: Array - Visibility: Public - Generated Name: clone - Abstract: False Method: Concat AssociatedType: Array Visibility: Public @@ -343,11 +340,6 @@ Types: Visibility: Public Generated Name: every Abstract: False - Method: Extract - AssociatedType: Array - Visibility: Public - Generated Name: extract - Abstract: False Method: Filter AssociatedType: Array Visibility: Public @@ -359,19 +351,14 @@ Types: Generated Name: forEach Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.IEnumerator + AssociatedType: IEnumerator Visibility: Public Generated Name: getEnumerator Abstract: False - Method: GroupBy + Method: GetRange AssociatedType: Array Visibility: Public - Generated Name: groupBy - Abstract: False - Method: Index - AssociatedType: Dictionary - Visibility: Public - Generated Name: index + Generated Name: getRange Abstract: False Method: IndexOf AssociatedType: Int32 @@ -396,7 +383,7 @@ Types: Method: Parse AssociatedType: Array Visibility: Public, Static - Generated Name: parse + Generated Name: ss.array Abstract: False Method: Reduce AssociatedType: Object @@ -441,7 +428,7 @@ Types: Method: ToArray AssociatedType: Array Visibility: Public, Static - Generated Name: toArray + Generated Name: ss.array Abstract: False Method: Unshift AssociatedType: Void @@ -453,30 +440,20 @@ Types: Application Type: False Public: True Generated Name: Boolean - Global Methods: False + Extension Methods: False Members: Method: Parse AssociatedType: Boolean Visibility: Public, Static - Generated Name: parse + Generated Name: ss.boolean Abstract: False Class: Byte Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False Method: ToString AssociatedType: String Visibility: Public @@ -498,8 +475,8 @@ Types: Application Type: False Public: True Generated Name: CancelEventArgs - Global Methods: False - BaseClass: System.EventArgs + Extension Methods: False + BaseClass: EventArgs Members: Field: Cancel AssociatedType: Boolean @@ -510,7 +487,7 @@ Types: Application Type: False Public: True Generated Name: String - Global Methods: False + Extension Methods: False Members: Delegate: CompareCallback @@ -528,29 +505,17 @@ Types: Application Type: False Public: True Generated Name: Date - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Field: Empty + Field: Now AssociatedType: Date Visibility: Public, Static - Generated Name: empty - Property: Now + Generated Name: ss.now() + Field: Today AssociatedType: Date Visibility: Public, Static - Generated Name: now - ReadOnly: True - Abstract: False - Property: Today - AssociatedType: Date - Visibility: Public, Static - Generated Name: today - ReadOnly: True - Abstract: False - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False + Generated Name: ss.today() Method: GetDate AssociatedType: Int32 Visibility: Public @@ -641,20 +606,10 @@ Types: Visibility: Public Generated Name: getUTCSeconds Abstract: False - Method: IsEmpty - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: isEmpty - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False Method: Parse AssociatedType: Date Visibility: Public, Static - Generated Name: parseDate + Generated Name: ss.date Abstract: False Method: SetDate AssociatedType: Void @@ -776,7 +731,7 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: Method: Format AssociatedType: String @@ -803,59 +758,56 @@ Types: Application Type: False Public: True Generated Name: Delegate - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Field: Empty - AssociatedType: System.Delegate - Visibility: Public, Static - Generated Name: empty - Method: ClearExport - AssociatedType: Void - Visibility: Public, Static - Generated Name: clearExport - Abstract: False Method: Combine - AssociatedType: System.Delegate + AssociatedType: Delegate Visibility: Public, Static - Generated Name: combine + Generated Name: ss.bindAdd Abstract: False Method: Create - AssociatedType: System.Delegate + AssociatedType: Delegate Visibility: Public, Static - Generated Name: create + Generated Name: ss.bind Abstract: False - Method: CreateExport - AssociatedType: String - Visibility: Public, Static - Generated Name: createExport - Abstract: False - Method: DeleteExport - AssociatedType: Void + Method: Export + AssociatedType: Export Visibility: Public, Static - Generated Name: deleteExport + Generated Name: ss.bindExport Abstract: False Method: Remove - AssociatedType: System.Delegate + AssociatedType: Delegate Visibility: Public, Static - Generated Name: remove + Generated Name: ss.bindSub Abstract: False Class: Double Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False + Field: MaxValue + AssociatedType: Double + Visibility: Public, Static + Generated Name: MAX_VALUE + Field: MinValue + AssociatedType: Double + Visibility: Public, Static + Generated Name: MIN_VALUE + Field: NaN + AssociatedType: Double + Visibility: Public, Static + Generated Name: NaN + Field: NegativeInfinity + AssociatedType: Double + Visibility: Public, Static + Generated Name: NEGATIVE_INFINITY + Field: PositiveInfinity + AssociatedType: Double + Visibility: Public, Static + Generated Name: POSITIVE_INFINITY Method: Parse AssociatedType: Double Visibility: Public, Static @@ -881,17 +833,18 @@ Types: Application Type: False Public: True Generated Name: Enum - Global Methods: False + Extension Methods: False Members: Class: EventArgs Application Type: False Public: True Generated Name: EventArgs - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: Empty - AssociatedType: System.EventArgs + AssociatedType: EventArgs Visibility: Public, Static Generated Name: Empty @@ -921,7 +874,8 @@ Types: Application Type: False Public: True Generated Name: Error - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -945,7 +899,29 @@ Types: Method: Create AssociatedType: Exception Visibility: Public, Static - Generated Name: Error.createError + Generated Name: ss.error + Abstract: False + + Class: Export + Application Type: False + Public: True + Generated Name: Export + Extension Methods: False + BaseClass: Object + Members: + Field: Name + AssociatedType: String + Visibility: Public + Generated Name: name + Method: Detach + AssociatedType: Void + Visibility: Public + Generated Name: detach + Abstract: False + Method: Dispose + AssociatedType: Void + Visibility: Public + Generated Name: dispose Abstract: False Delegate: Func`1 @@ -1051,7 +1027,8 @@ Types: Application Type: False Public: True Generated Name: Function - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: Length AssociatedType: Int32 @@ -1083,18 +1060,16 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False + Field: MaxValue + AssociatedType: Int32 + Visibility: Public, Static + Generated Name: MAX_VALUE + Field: MinValue + AssociatedType: Int32 + Visibility: Public, Static + Generated Name: MIN_VALUE Method: ToString AssociatedType: String Visibility: Public @@ -1105,18 +1080,16 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False + Field: MaxValue + AssociatedType: Int32 + Visibility: Public, Static + Generated Name: MAX_VALUE + Field: MinValue + AssociatedType: Int32 + Visibility: Public, Static + Generated Name: MIN_VALUE Method: Parse AssociatedType: Int32 Visibility: Public, Static @@ -1132,18 +1105,16 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False + Field: MaxValue + AssociatedType: Int64 + Visibility: Public, Static + Generated Name: MAX_VALUE + Field: MinValue + AssociatedType: Int64 + Visibility: Public, Static + Generated Name: MIN_VALUE Method: ToString AssociatedType: String Visibility: Public @@ -1154,7 +1125,8 @@ Types: Application Type: False Public: True Generated Name: Math - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: E AssociatedType: Double @@ -1281,14 +1253,14 @@ Types: Method: Truncate AssociatedType: Int32 Visibility: Public, Static - Generated Name: parseInt + Generated Name: ss.truncate Abstract: False Class: Nullable`1 Application Type: False Public: True Generated Name: Nullable`1 - Global Methods: False + Extension Methods: False Members: Property: HasValue AssociatedType: Boolean @@ -1312,33 +1284,29 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Field: MAX_VALUE - AssociatedType: Int32 + Field: MaxValue + AssociatedType: Double Visibility: Public, Static Generated Name: MAX_VALUE - Field: MIN_VALUE - AssociatedType: Int32 + Field: MinValue + AssociatedType: Double Visibility: Public, Static Generated Name: MIN_VALUE Field: NaN - AssociatedType: Int32 + AssociatedType: Double Visibility: Public, Static Generated Name: NaN - Field: NEGATIVE_INFINITY - AssociatedType: Int32 + Field: NegativeInfinity + AssociatedType: Double Visibility: Public, Static Generated Name: NEGATIVE_INFINITY - Field: POSITIVE_INFINITY - AssociatedType: Int32 + Field: PositiveInfinity + AssociatedType: Double Visibility: Public, Static Generated Name: POSITIVE_INFINITY - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False Method: IsFinite AssociatedType: Boolean Visibility: Public, Static @@ -1349,15 +1317,10 @@ Types: Visibility: Public, Static Generated Name: isNaN Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False Method: Parse AssociatedType: Number Visibility: Public, Static - Generated Name: parse + Generated Name: ss.number Abstract: False Method: ParseDouble AssociatedType: Double @@ -1399,12 +1362,12 @@ Types: Application Type: False Public: True Generated Name: Object - Global Methods: False + Extension Methods: False Members: Method: GetType AssociatedType: Type Visibility: Public - Generated Name: getType + Generated Name: ss.typeOf Abstract: False Method: ToString AssociatedType: String @@ -1417,18 +1380,12 @@ Types: Generated Name: toLocaleString Abstract: False - Class: Record - Application Type: False - Public: True - Generated Name: Record - Global Methods: False - Members: - - Class: RegularExpression + Class: RegExp Application Type: False Public: True Generated Name: RegExp - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: LastIndex AssociatedType: Int32 @@ -1460,9 +1417,9 @@ Types: Generated Name: exec Abstract: False Method: Parse - AssociatedType: RegularExpression + AssociatedType: RegExp Visibility: Public, Static - Generated Name: parse + Generated Name: ss.regexp Abstract: False Method: Test AssociatedType: Boolean @@ -1474,18 +1431,8 @@ Types: Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False Method: ToString AssociatedType: String Visibility: Public @@ -1496,8 +1443,21 @@ Types: Application Type: False Public: True Generated Name: Script - Global Methods: True + Extension Methods: False + BaseClass: Object Members: + Field: Global + AssociatedType: Object + Visibility: Public, Static + Generated Name: $global + Field: Modules + AssociatedType: Dictionary`2 + Visibility: Public, Static + Generated Name: ss.modules + Field: Undefined + AssociatedType: Object + Visibility: Public, Static + Generated Name: undefined Method: Boolean AssociatedType: Boolean Visibility: Public, Static @@ -1513,11 +1473,6 @@ Types: Visibility: Public, Static Generated Name: clearTimeout Abstract: False - Method: Confirm - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: confirm - Abstract: False Method: CreateInstance AssociatedType: Object Visibility: Public, Static @@ -1558,6 +1513,21 @@ Types: Visibility: Public, Static Generated Name: invokeMethod Abstract: False + Method: IsFalsey + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isFalsey + Abstract: False + Method: IsFinite + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isFinite + Abstract: False + Method: IsNaN + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isNaN + Abstract: False Method: IsNull AssociatedType: Boolean Visibility: Public, Static @@ -1578,11 +1548,21 @@ Types: Visibility: Public, Static Generated Name: ss.isValue Abstract: False + Method: IsTruthy + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isTruthy + Abstract: False Method: Literal AssociatedType: Object Visibility: Public, Static Generated Name: literal Abstract: False + Method: Or + AssociatedType: TValue + Visibility: Public, Static + Generated Name: or + Abstract: False Method: SetField AssociatedType: Void Visibility: Public, Static @@ -1601,55 +1581,45 @@ Types: Method: Value AssociatedType: TValue Visibility: Public, Static - Generated Name: value + Generated Name: ss.value Abstract: False - Method: Escape - AssociatedType: String - Visibility: Public, Static - Generated Name: escape - Abstract: False - Method: Unescape - AssociatedType: String - Visibility: Public, Static - Generated Name: unescape - Abstract: False - Method: EncodeUri - AssociatedType: String - Visibility: Public, Static - Generated Name: encodeURI - Abstract: False - Method: DecodeUri - AssociatedType: String + Method: Enumerate + AssociatedType: Object Visibility: Public, Static - Generated Name: decodeURI + Generated Name: ss.enumerate Abstract: False - Method: EncodeUriComponent + Parameters: + Parameter: obj + AssociatedType: Object + Mode: In + Method: GetTypeName AssociatedType: String Visibility: Public, Static - Generated Name: encodeURIComponent + Generated Name: ss.typeName Abstract: False - Method: DecodeUriComponent - AssociatedType: String + Parameters: + Parameter: obj + AssociatedType: Object + Mode: In + Method: CompareDates + AssociatedType: Boolean Visibility: Public, Static - Generated Name: decodeURIComponent + Generated Name: ss.compareDates Abstract: False + Parameters: + Parameter: d1 + AssociatedType: Date + Mode: In + Parameter: d2 + AssociatedType: Date + Mode: In Class: Single Application Type: False Public: True Generated Name: Number - Global Methods: False + Extension Methods: False Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False Method: Parse AssociatedType: Single Visibility: Public, Static @@ -1675,7 +1645,8 @@ Types: Application Type: False Public: True Generated Name: String - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Char @@ -1687,7 +1658,7 @@ Types: Field: Empty AssociatedType: String Visibility: Public, Static - Generated Name: Empty + Generated Name: empty Field: Length AssociatedType: Int32 Visibility: Public @@ -1705,17 +1676,12 @@ Types: Method: Compare AssociatedType: Int32 Visibility: Public, Static - Generated Name: compare - Abstract: False - Method: CompareTo - AssociatedType: Int32 - Visibility: Public - Generated Name: compareTo + Generated Name: ss.compareStrings Abstract: False Method: Concat AssociatedType: String Visibility: Public, Static - Generated Name: concat + Generated Name: ss.string Abstract: False Method: DecodeUri AssociatedType: String @@ -1740,12 +1706,7 @@ Types: Method: EndsWith AssociatedType: Boolean Visibility: Public - Generated Name: endsWith - Abstract: False - Method: Equals - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: equals + Generated Name: ss.endsWith Abstract: False Method: Escape AssociatedType: String @@ -1755,73 +1716,43 @@ Types: Method: Format AssociatedType: String Visibility: Public, Static - Generated Name: format + Generated Name: ss.format Abstract: False Method: FromChar AssociatedType: String Visibility: Public, Static - Generated Name: fromChar + Generated Name: ss.string Abstract: False Method: FromCharCode AssociatedType: String Visibility: Public, Static Generated Name: fromCharCode Abstract: False - Method: HtmlDecode - AssociatedType: String - Visibility: Public - Generated Name: htmlDecode - Abstract: False - Method: HtmlEncode - AssociatedType: String - Visibility: Public - Generated Name: htmlEncode - Abstract: False Method: IndexOf AssociatedType: Int32 Visibility: Public Generated Name: indexOf Abstract: False - Method: IndexOfAny - AssociatedType: Int32 - Visibility: Public - Generated Name: indexOfAny - Abstract: False Method: Insert AssociatedType: String Visibility: Public - Generated Name: insert + Generated Name: ss.insertString Abstract: False Method: IsNullOrEmpty AssociatedType: Boolean Visibility: Public, Static - Generated Name: isNullOrEmpty + Generated Name: ss.emptyString Abstract: False Method: IsNullOrWhiteSpace AssociatedType: Boolean Visibility: Public, Static - Generated Name: isNullOrWhiteSpace + Generated Name: ss.whitespace Abstract: False Method: LastIndexOf AssociatedType: Int32 Visibility: Public Generated Name: lastIndexOf Abstract: False - Method: LastIndexOfAny - AssociatedType: Int32 - Visibility: Public - Generated Name: lastIndexOfAny - Abstract: False - Method: LocaleCompare - AssociatedType: Int32 - Visibility: Public - Generated Name: localeCompare - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public, Static - Generated Name: localeFormat - Abstract: False Method: Match AssociatedType: Array Visibility: Public @@ -1830,22 +1761,22 @@ Types: Method: PadLeft AssociatedType: String Visibility: Public - Generated Name: padLeft + Generated Name: ss.padLeft Abstract: False Method: PadRight AssociatedType: String Visibility: Public - Generated Name: padRight + Generated Name: ss.padRight Abstract: False Method: Remove AssociatedType: String Visibility: Public - Generated Name: remove + Generated Name: ss.removeString Abstract: False Method: Replace AssociatedType: String Visibility: Public - Generated Name: replaceAll + Generated Name: ss.replaceString Abstract: False Method: ReplaceFirst AssociatedType: String @@ -1870,7 +1801,7 @@ Types: Method: StartsWith AssociatedType: Boolean Visibility: Public - Generated Name: startsWith + Generated Name: ss.startsWith Abstract: False Method: Substr AssociatedType: String @@ -1905,17 +1836,17 @@ Types: Method: Trim AssociatedType: String Visibility: Public - Generated Name: trim + Generated Name: ss.trim Abstract: False - Method: TrimStart + Method: TrimEnd AssociatedType: String Visibility: Public - Generated Name: trimStart + Generated Name: ss.trimEnd Abstract: False - Method: TrimEnd + Method: TrimStart AssociatedType: String Visibility: Public - Generated Name: trimEnd + Generated Name: ss.trimStart Abstract: False Method: Unescape AssociatedType: String @@ -1927,19 +1858,20 @@ Types: Application Type: False Public: True Generated Name: StringBuilder - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: IsEmpty AssociatedType: Boolean Visibility: Public Generated Name: isEmpty Method: Append - AssociatedType: System.StringBuilder + AssociatedType: StringBuilder Visibility: Public Generated Name: append Abstract: False Method: AppendLine - AssociatedType: System.StringBuilder + AssociatedType: StringBuilder Visibility: Public Generated Name: appendLine Abstract: False @@ -1969,54 +1901,73 @@ Types: Application Type: False Public: True Generated Name: Tuple - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Field: First + Field: Item1 AssociatedType: T1 Visibility: Public - Generated Name: first - Field: Second + Generated Name: item1 + Field: Item2 AssociatedType: T2 Visibility: Public - Generated Name: second + Generated Name: item2 Class: Tuple`3 Application Type: False Public: True Generated Name: Tuple - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Field: First + Field: Item1 AssociatedType: T1 Visibility: Public - Generated Name: first - Field: Second + Generated Name: item1 + Field: Item2 AssociatedType: T2 Visibility: Public - Generated Name: second - Field: Third + Generated Name: item2 + Field: Item3 AssociatedType: T3 Visibility: Public - Generated Name: third + Generated Name: item3 + + Class: Tuple`4 + Application Type: False + Public: True + Generated Name: Tuple + Extension Methods: False + BaseClass: Object + Members: + Field: Item1 + AssociatedType: T1 + Visibility: Public + Generated Name: item1 + Field: Item2 + AssociatedType: T2 + Visibility: Public + Generated Name: item2 + Field: Item3 + AssociatedType: T3 + Visibility: Public + Generated Name: item3 + Field: Item4 + AssociatedType: T4 + Visibility: Public + Generated Name: item4 Class: Type Application Type: False Public: True Generated Name: Type - Global Methods: False + Extension Methods: False + BaseClass: Object Members: - Property: BaseType + Field: BaseType AssociatedType: Type Visibility: Public - Generated Name: baseType - ReadOnly: True - Abstract: False - Property: FullName - AssociatedType: String - Visibility: Public - Generated Name: fullName - ReadOnly: True - Abstract: False + Generated Name: $base Property: Name AssociatedType: String Visibility: Public @@ -2030,250 +1981,82 @@ Types: Method: GetType AssociatedType: Type Visibility: Public, Static - Generated Name: getType - Abstract: False - Method: IsAssignableFrom - AssociatedType: Boolean - Visibility: Public - Generated Name: isAssignableFrom - Abstract: False - Method: IsClass - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: isClass - Abstract: False - Method: IsInterface - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: isInterface - Abstract: False - Method: IsInstanceOfType - AssociatedType: Boolean - Visibility: Public - Generated Name: isInstanceOfType - Abstract: False - Method: GetTypeFromHandle - AssociatedType: Type - Visibility: Public, Static - Generated Name: getTypeFromHandle - Abstract: False - Method: GetInstanceType - AssociatedType: Type - Visibility: Public, Static - Generated Name: getInstanceType - Abstract: False - Parameters: - Parameter: instance - AssociatedType: Object - Mode: In - - Class: UInt16 - Application Type: False - Public: True - Generated Name: Number - Global Methods: False - Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False - Method: ToString - AssociatedType: String - Visibility: Public - Generated Name: toString - Abstract: False - - Class: UInt32 - Application Type: False - Public: True - Generated Name: Number - Global Methods: False - Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False - Method: ToString - AssociatedType: String - Visibility: Public - Generated Name: toString - Abstract: False - - Class: UInt64 - Application Type: False - Public: True - Generated Name: Number - Global Methods: False - Members: - Method: Format - AssociatedType: String - Visibility: Public - Generated Name: format - Abstract: False - Method: LocaleFormat - AssociatedType: String - Visibility: Public - Generated Name: localeFormat - Abstract: False - Method: ToString - AssociatedType: String - Visibility: Public - Generated Name: toString - Abstract: False - - Class: Void - Application Type: False - Public: True - Generated Name: Void - Global Methods: False - Members: - - -Namespace: System.Collections -HasApplicationTypes: False -Types: - Delegate: ArrayCallback - Application Type: False - Public: True - Generated Name: Function - Members: - Method: Invoke - AssociatedType: Void - Visibility: Public - Generated Name: - Abstract: True - - Delegate: ArrayFilterCallback - Application Type: False - Public: True - Generated Name: Function - Members: - Method: Invoke - AssociatedType: Boolean - Visibility: Public - Generated Name: - Abstract: True - - Class: ArrayGrouping - Application Type: False - Public: True - Generated Name: Array - Global Methods: False - Indexer: - Indexer: Item - AssociatedType: Object - Visibility: Public - Generated Name: item - ReadOnly: False - Abstract: False - Members: - Field: Key - AssociatedType: String - Visibility: Public - Generated Name: key - Field: Length - AssociatedType: Int32 - Visibility: Public - Generated Name: length - Method: Clone - AssociatedType: Array - Visibility: Public - Generated Name: clone - Abstract: False - Method: Concat - AssociatedType: Array - Visibility: Public - Generated Name: concat - Abstract: False - Method: Contains - AssociatedType: Boolean - Visibility: Public - Generated Name: contains - Abstract: False - Method: Every - AssociatedType: Boolean - Visibility: Public - Generated Name: every - Abstract: False - Method: Extract - AssociatedType: Array - Visibility: Public - Generated Name: extract - Abstract: False - Method: Filter - AssociatedType: Array - Visibility: Public - Generated Name: filter - Abstract: False - Method: ForEach - AssociatedType: Void - Visibility: Public - Generated Name: forEach - Abstract: False - Method: GetEnumerator - AssociatedType: System.Collections.IEnumerator - Visibility: Public - Generated Name: getEnumerator - Abstract: False - Method: GroupBy - AssociatedType: Array - Visibility: Public - Generated Name: groupBy + Generated Name: ss.type Abstract: False - Method: Index - AssociatedType: Dictionary + Method: IsAssignableFrom + AssociatedType: Boolean Visibility: Public - Generated Name: index + Generated Name: ss.canAssign Abstract: False - Method: IndexOf - AssociatedType: Int32 - Visibility: Public - Generated Name: indexOf + Method: IsClass + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: ss.isClass Abstract: False - Method: Join - AssociatedType: String - Visibility: Public - Generated Name: join + Method: IsInterface + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: ss.isInterface Abstract: False - Method: LastIndexOf - AssociatedType: Int32 + Method: IsInstanceOfType + AssociatedType: Boolean Visibility: Public - Generated Name: lastIndexOf + Generated Name: ss.instanceOf Abstract: False - Method: Map - AssociatedType: Array - Visibility: Public - Generated Name: map + Method: GetTypeFromHandle + AssociatedType: Type + Visibility: Public, Static + Generated Name: getTypeFromHandle Abstract: False - Method: Reverse - AssociatedType: Void + + Class: UInt16 + Application Type: False + Public: True + Generated Name: Number + Extension Methods: False + Members: + Method: ToString + AssociatedType: String Visibility: Public - Generated Name: reverse + Generated Name: toString Abstract: False - Method: Some - AssociatedType: Boolean + + Class: UInt32 + Application Type: False + Public: True + Generated Name: Number + Extension Methods: False + Members: + Method: ToString + AssociatedType: String Visibility: Public - Generated Name: some + Generated Name: toString Abstract: False - Method: Sort - AssociatedType: Void + + Class: UInt64 + Application Type: False + Public: True + Generated Name: Number + Extension Methods: False + Members: + Method: ToString + AssociatedType: String Visibility: Public - Generated Name: sort + Generated Name: toString Abstract: False - Delegate: ArrayItemCallback + Class: Void + Application Type: False + Public: True + Generated Name: Void + Extension Methods: False + Members: + + +Namespace: System.Collections +HasApplicationTypes: False +Types: + Delegate: ArrayCallback Application Type: False Public: True Generated Name: Function @@ -2284,7 +2067,7 @@ Types: Generated Name: Abstract: True - Delegate: ArrayItemFilterCallback + Delegate: ArrayFilterCallback Application Type: False Public: True Generated Name: Function @@ -2295,13 +2078,24 @@ Types: Generated Name: Abstract: True - Delegate: ArrayItemKeyGenerator + Delegate: ArrayItemCallback Application Type: False Public: True Generated Name: Function Members: Method: Invoke - AssociatedType: String + AssociatedType: Void + Visibility: Public + Generated Name: + Abstract: True + + Delegate: ArrayItemFilterCallback + Application Type: False + Public: True + Generated Name: Function + Members: + Method: Invoke + AssociatedType: Boolean Visibility: Public Generated Name: Abstract: True @@ -2332,7 +2126,8 @@ Types: Application Type: False Public: True Generated Name: Array - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -2348,17 +2143,12 @@ Types: Method: Add AssociatedType: Void Visibility: Public - Generated Name: add + Generated Name: push Abstract: False Method: AddRange AssociatedType: Void Visibility: Public - Generated Name: addRange - Abstract: False - Method: Clone - AssociatedType: ArrayList - Visibility: Public - Generated Name: clone + Generated Name: push Abstract: False Method: Clear AssociatedType: Void @@ -2380,11 +2170,6 @@ Types: Visibility: Public Generated Name: every Abstract: False - Method: Extract - AssociatedType: Array - Visibility: Public - Generated Name: extract - Abstract: False Method: Filter AssociatedType: Array Visibility: Public @@ -2396,19 +2181,14 @@ Types: Generated Name: forEach Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.IEnumerator + AssociatedType: IEnumerator Visibility: Public Generated Name: getEnumerator Abstract: False - Method: GroupBy + Method: GetRange AssociatedType: Array Visibility: Public - Generated Name: groupBy - Abstract: False - Method: Index - AssociatedType: Dictionary - Visibility: Public - Generated Name: index + Generated Name: getRange Abstract: False Method: IndexOf AssociatedType: Int32 @@ -2458,7 +2238,7 @@ Types: Method: Remove AssociatedType: Boolean Visibility: Public - Generated Name: remove + Generated Name: ss.remove Abstract: False Method: RemoveAt AssociatedType: Void @@ -2532,7 +2312,8 @@ Types: Application Type: False Public: True Generated Name: Object - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -2556,12 +2337,12 @@ Types: Method: Clear AssociatedType: Void Visibility: Public - Generated Name: clear + Generated Name: ss.clearKeys Abstract: False Method: ContainsKey AssociatedType: Boolean Visibility: Public - Generated Name: containsKey + Generated Name: ss.keyExists Abstract: False Method: GetDictionary AssociatedType: Dictionary @@ -2576,34 +2357,20 @@ Types: Method: GetKeys AssociatedType: Array Visibility: Public, Static - Generated Name: keys + Generated Name: ss.keys Abstract: False Method: GetKeyCount AssociatedType: Int32 Visibility: Public, Static - Generated Name: getKeyCount - Abstract: False - Method: ClearKeys - AssociatedType: Void - Visibility: Public, Static - Generated Name: clearKeys - Abstract: False - Method: DeleteKey - AssociatedType: Void - Visibility: Public, Static - Generated Name: deleteKey - Abstract: False - Method: KeyExists - AssociatedType: Boolean - Visibility: Public, Static - Generated Name: keyExists + Generated Name: ss.keyCount Abstract: False Class: DictionaryEntry Application Type: False Public: True Generated Name: DictionaryEntry - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: Key AssociatedType: String @@ -2630,7 +2397,7 @@ Types: Generated Name: IEnumerable Members: Method: GetEnumerator - AssociatedType: System.Collections.IEnumerator + AssociatedType: IEnumerator Visibility: Public Generated Name: getEnumerator Abstract: True @@ -2669,7 +2436,8 @@ Types: Application Type: False Public: True Generated Name: ObservableCollection - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: Object @@ -2700,7 +2468,7 @@ Types: Generated Name: contains Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.IEnumerator + AssociatedType: IEnumerator Visibility: Public Generated Name: getEnumerator Abstract: False @@ -2733,13 +2501,14 @@ Types: Class: Queue Application Type: False Public: True - Generated Name: Array - Global Methods: False + Generated Name: Queue + Extension Methods: False + BaseClass: Object Members: Field: Count AssociatedType: Int32 Visibility: Public - Generated Name: length + Generated Name: count Method: Clear AssociatedType: Void Visibility: Public @@ -2769,13 +2538,14 @@ Types: Class: Stack Application Type: False Public: True - Generated Name: Array - Global Methods: False + Generated Name: Stack + Extension Methods: False + BaseClass: Object Members: Field: Count AssociatedType: Int32 Visibility: Public - Generated Name: length + Generated Name: count Method: Clear AssociatedType: Void Visibility: Public @@ -2821,7 +2591,8 @@ Types: Application Type: False Public: True Generated Name: Object - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: TValue @@ -2837,7 +2608,7 @@ Types: ReadOnly: True Abstract: False Property: Keys - AssociatedType: System.Collections.Generic.IReadonlyCollection`1 + AssociatedType: IReadonlyCollection`1 Visibility: Public Generated Name: keys ReadOnly: True @@ -2850,12 +2621,12 @@ Types: Method: Clear AssociatedType: Void Visibility: Public - Generated Name: clear + Generated Name: ss.clearKeys Abstract: False Method: ContainsKey AssociatedType: Boolean Visibility: Public - Generated Name: containsKey + Generated Name: ss.keyExists Abstract: False Method: GetDictionary AssociatedType: Dictionary`2 @@ -2863,7 +2634,7 @@ Types: Generated Name: getDictionary Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.Generic.IEnumerator`1 + AssociatedType: IEnumerator`1 Visibility: Public Generated Name: getEnumerator Abstract: False @@ -2894,7 +2665,7 @@ Types: Generated Name: IEnumerable Members: Method: GetEnumerator - AssociatedType: System.Collections.Generic.IEnumerator`1 + AssociatedType: IEnumerator`1 Visibility: Public Generated Name: getEnumerator Abstract: True @@ -2933,7 +2704,8 @@ Types: Application Type: False Public: True Generated Name: Object - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: Key AssociatedType: TKey @@ -2948,7 +2720,8 @@ Types: Application Type: False Public: True Generated Name: Array - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: T @@ -2964,17 +2737,12 @@ Types: Method: Add AssociatedType: Void Visibility: Public - Generated Name: add + Generated Name: push Abstract: False Method: AddRange AssociatedType: Void Visibility: Public - Generated Name: addRange - Abstract: False - Method: Clone - AssociatedType: List`1 - Visibility: Public - Generated Name: clone + Generated Name: push Abstract: False Method: Clear AssociatedType: Void @@ -2996,11 +2764,6 @@ Types: Visibility: Public Generated Name: every Abstract: False - Method: Extract - AssociatedType: List`1 - Visibility: Public - Generated Name: extract - Abstract: False Method: Filter AssociatedType: List`1 Visibility: Public @@ -3012,14 +2775,14 @@ Types: Generated Name: forEach Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.Generic.IEnumerator`1 + AssociatedType: IEnumerator`1 Visibility: Public Generated Name: getEnumerator Abstract: False - Method: GroupBy - AssociatedType: Array + Method: GetRange + AssociatedType: List`1 Visibility: Public - Generated Name: groupBy + Generated Name: getRange Abstract: False Method: IndexOf AssociatedType: Int32 @@ -3069,7 +2832,7 @@ Types: Method: Remove AssociatedType: Boolean Visibility: Public - Generated Name: remove + Generated Name: ss.remove Abstract: False Method: RemoveAt AssociatedType: Void @@ -3134,93 +2897,6 @@ Types: Generated Name: Abstract: True - Class: ListGrouping`1 - Application Type: False - Public: True - Generated Name: Array - Global Methods: False - Indexer: - Indexer: Item - AssociatedType: T - Visibility: Public - Generated Name: item - ReadOnly: True - Abstract: False - Members: - Field: Key - AssociatedType: String - Visibility: Public - Generated Name: key - Field: Count - AssociatedType: Int32 - Visibility: Public - Generated Name: length - Method: Contains - AssociatedType: Boolean - Visibility: Public - Generated Name: contains - Abstract: False - Method: Every - AssociatedType: Boolean - Visibility: Public - Generated Name: every - Abstract: False - Method: Extract - AssociatedType: List`1 - Visibility: Public - Generated Name: extract - Abstract: False - Method: Filter - AssociatedType: List`1 - Visibility: Public - Generated Name: filter - Abstract: False - Method: ForEach - AssociatedType: Void - Visibility: Public - Generated Name: forEach - Abstract: False - Method: GetEnumerator - AssociatedType: System.Collections.Generic.IEnumerator`1 - Visibility: Public - Generated Name: getEnumerator - Abstract: False - Method: GroupBy - AssociatedType: Array - Visibility: Public - Generated Name: groupBy - Abstract: False - Method: IndexOf - AssociatedType: Int32 - Visibility: Public - Generated Name: indexOf - Abstract: False - Method: Join - AssociatedType: String - Visibility: Public - Generated Name: join - Abstract: False - Method: LastIndexOf - AssociatedType: Int32 - Visibility: Public - Generated Name: lastIndexOf - Abstract: False - Method: Map - AssociatedType: List`1 - Visibility: Public - Generated Name: map - Abstract: False - Method: Reverse - AssociatedType: Void - Visibility: Public - Generated Name: reverse - Abstract: False - Method: Some - AssociatedType: Boolean - Visibility: Public - Generated Name: some - Abstract: False - Delegate: ListItemCallback`1 Application Type: False Public: True @@ -3243,17 +2919,6 @@ Types: Generated Name: Abstract: True - Delegate: ListItemKeyGenerator`1 - Application Type: False - Public: True - Generated Name: Function - Members: - Method: Invoke - AssociatedType: String - Visibility: Public - Generated Name: - Abstract: True - Delegate: ListItemMapCallback`2 Application Type: False Public: True @@ -3302,7 +2967,8 @@ Types: Application Type: False Public: True Generated Name: ObservableCollection - Global Methods: False + Extension Methods: False + BaseClass: Object Indexer: Indexer: Item AssociatedType: T @@ -3333,7 +2999,7 @@ Types: Generated Name: contains Abstract: False Method: GetEnumerator - AssociatedType: System.Collections.Generic.IEnumerator`1 + AssociatedType: IEnumerator`1 Visibility: Public Generated Name: getEnumerator Abstract: False @@ -3366,13 +3032,14 @@ Types: Class: Queue`1 Application Type: False Public: True - Generated Name: Array - Global Methods: False + Generated Name: Queue + Extension Methods: False + BaseClass: Object Members: Field: Count AssociatedType: Int32 Visibility: Public - Generated Name: length + Generated Name: count Method: Clear AssociatedType: Void Visibility: Public @@ -3402,13 +3069,14 @@ Types: Class: Stack`1 Application Type: False Public: True - Generated Name: Array - Global Methods: False + Generated Name: Stack + Extension Methods: False + BaseClass: Object Members: Field: Count AssociatedType: Int32 Visibility: Public - Generated Name: length + Generated Name: count Method: Clear AssociatedType: Void Visibility: Public @@ -3523,7 +3191,8 @@ Types: Application Type: False Public: True Generated Name: Observable - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: GetValue AssociatedType: T @@ -3540,10 +3209,11 @@ Types: Application Type: False Public: True Generated Name: Observable - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: RegisterObserver - AssociatedType: System.IDisposable + AssociatedType: IDisposable Visibility: Public, Static Generated Name: registerObserver Abstract: False @@ -3556,7 +3226,8 @@ Types: Application Type: False Public: True Generated Name: console - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: Assert AssociatedType: Void @@ -3568,7 +3239,7 @@ Types: Method: Fail AssociatedType: Void Visibility: Public, Static - Generated Name: fail + Generated Name: ss.fail Abstract: False Conditions: DEBUG @@ -3587,21 +3258,22 @@ Types: Class: CultureInfo Application Type: False Public: True - Generated Name: CultureInfo - Global Methods: False + Generated Name: culture + Extension Methods: False + BaseClass: Object Members: Field: CurrentCulture - AssociatedType: System.Globalization.CultureInfo + AssociatedType: CultureInfo Visibility: Public, Static - Generated Name: CurrentCulture + Generated Name: current Field: DateFormat AssociatedType: DateFormatInfo Visibility: Public - Generated Name: dateFormat + Generated Name: dtf Field: InvariantCulture - AssociatedType: System.Globalization.CultureInfo + AssociatedType: CultureInfo Visibility: Public, Static - Generated Name: InvariantCulture + Generated Name: neutral Field: Name AssociatedType: String Visibility: Public @@ -3609,185 +3281,187 @@ Types: Field: NumberFormat AssociatedType: NumberFormatInfo Visibility: Public - Generated Name: numberFormat + Generated Name: nf Class: DateFormatInfo Application Type: False Public: True Generated Name: DateFormatInfo - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: AMDesignator AssociatedType: String Visibility: Public - Generated Name: amDesignator + Generated Name: am Field: PMDesignator AssociatedType: String Visibility: Public - Generated Name: pmDesignator + Generated Name: pm Field: DateSeparator AssociatedType: String Visibility: Public - Generated Name: dateSeparator + Generated Name: ds Field: TimeSeparator AssociatedType: String Visibility: Public - Generated Name: timeSeparator + Generated Name: ts Field: GMTDateTimePattern AssociatedType: String Visibility: Public - Generated Name: gmtDateTimePattern + Generated Name: gmt Field: UniversalDateTimePattern AssociatedType: String Visibility: Public - Generated Name: universalDateTimePattern + Generated Name: uni Field: SortableDateTimePattern AssociatedType: String Visibility: Public - Generated Name: sortableDateTimePattern + Generated Name: sort Field: DateTimePattern AssociatedType: String Visibility: Public - Generated Name: dateTimePattern + Generated Name: dt Field: LongDatePattern AssociatedType: String Visibility: Public - Generated Name: longDatePattern + Generated Name: ld Field: ShortDatePattern AssociatedType: String Visibility: Public - Generated Name: shortDatePattern + Generated Name: sd Field: LongTimePattern AssociatedType: String Visibility: Public - Generated Name: longTimePattern + Generated Name: lt Field: ShortTimePattern AssociatedType: String Visibility: Public - Generated Name: shortTimePattern + Generated Name: st Field: FirstDayOfWeek AssociatedType: Int32 Visibility: Public - Generated Name: firstDayOfWeek + Generated Name: day0 Field: DayNames AssociatedType: Array Visibility: Public - Generated Name: dayNames + Generated Name: day Field: ShortDayNames AssociatedType: Array Visibility: Public - Generated Name: shortDayNames + Generated Name: sday Field: MinimizedDayNames AssociatedType: Array Visibility: Public - Generated Name: minimizedDayNames + Generated Name: mday Field: MonthNames AssociatedType: Array Visibility: Public - Generated Name: monthNames + Generated Name: mon Field: ShortMonthNames AssociatedType: Array Visibility: Public - Generated Name: shortMonthNames + Generated Name: smon Class: NumberFormatInfo Application Type: False Public: True Generated Name: NumberFormatInfo - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: NaNSymbol AssociatedType: String Visibility: Public - Generated Name: naNSymbol + Generated Name: nan Field: NegativeSign AssociatedType: String Visibility: Public - Generated Name: negativeSign + Generated Name: neg Field: PositiveSign AssociatedType: String Visibility: Public - Generated Name: positiveSign + Generated Name: pos Field: NegativeInfinityText AssociatedType: String Visibility: Public - Generated Name: negativeInfinityText + Generated Name: negInf Field: PositiveInfinityText AssociatedType: String Visibility: Public - Generated Name: positiveInfinityText + Generated Name: posInf Field: PercentSymbol AssociatedType: String Visibility: Public - Generated Name: percentSymbol + Generated Name: per Field: PercentGroupSizes AssociatedType: Array Visibility: Public - Generated Name: percentGroupSizes + Generated Name: perGW Field: PercentDecimalDigits AssociatedType: Int32 Visibility: Public - Generated Name: percentDecimalDigits + Generated Name: perDD Field: PercentDecimalSeparator AssociatedType: String Visibility: Public - Generated Name: percentDecimalSeparator + Generated Name: perDS Field: PercentGroupSeparator AssociatedType: String Visibility: Public - Generated Name: percentGroupSeparator - Field: PercentPositivePattern + Generated Name: perGS + Field: PercentNegativePattern AssociatedType: String Visibility: Public - Generated Name: percentPositivePattern - Field: PercentNegativePattern + Generated Name: perNP + Field: PercentPositivePattern AssociatedType: String Visibility: Public - Generated Name: percentNegativePattern + Generated Name: perPP Field: CurrencySymbol AssociatedType: String Visibility: Public - Generated Name: currencySymbol + Generated Name: cur Field: CurrencyGroupSizes AssociatedType: Array Visibility: Public - Generated Name: currencyGroupSizes + Generated Name: curGW Field: CurrencyDecimalDigits AssociatedType: Int32 Visibility: Public - Generated Name: currencyDecimalDigits + Generated Name: curDD Field: CurrencyDecimalSeparator AssociatedType: String Visibility: Public - Generated Name: currencyDecimalSeparator + Generated Name: curDS Field: CurrencyGroupSeparator AssociatedType: String Visibility: Public - Generated Name: currencyGroupSeparator - Field: CurrencyPositivePattern + Generated Name: curGS + Field: CurrencyNegativePattern AssociatedType: String Visibility: Public - Generated Name: currencyPositivePattern - Field: CurrencyNegativePattern + Generated Name: curNP + Field: CurrencyPositivePattern AssociatedType: String Visibility: Public - Generated Name: currencyNegativePattern + Generated Name: curPP Field: NumberGroupSizes AssociatedType: Array Visibility: Public - Generated Name: numberGroupSizes + Generated Name: gw Field: NumberDecimalDigits AssociatedType: Int32 Visibility: Public - Generated Name: numberDecimalDigits + Generated Name: dd Field: NumberDecimalSeparator AssociatedType: String Visibility: Public - Generated Name: numberDecimalSeparator + Generated Name: ds Field: NumberGroupSeparator AssociatedType: String Visibility: Public - Generated Name: numberGroupSeparator + Generated Name: gs Namespace: System.Serialization @@ -3797,7 +3471,8 @@ Types: Application Type: False Public: True Generated Name: JSON - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: Parse AssociatedType: Object @@ -3845,7 +3520,8 @@ Types: Application Type: False Public: True Generated Name: Assert - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: AreEqual AssociatedType: Void @@ -3872,7 +3548,8 @@ Types: Application Type: False Public: True Generated Name: TestClass - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: Cleanup AssociatedType: Void @@ -3889,7 +3566,8 @@ Types: Application Type: False Public: True Generated Name: TestEngine - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Method: Log AssociatedType: Void @@ -3920,12 +3598,18 @@ Types: Application Type: False Public: True Generated Name: Deferred - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Field: Task - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public Generated Name: task + Method: Create + AssociatedType: Deferred + Visibility: Public, Static + Generated Name: ss.deferred + Abstract: False Method: Reject AssociatedType: Void Visibility: Public @@ -3941,11 +3625,11 @@ Types: Application Type: False Public: True Generated Name: Deferred - Global Methods: False - BaseClass: System.Threading.Deferred + Extension Methods: False + BaseClass: Deferred Members: Field: Task - AssociatedType: System.Threading.Task`1 + AssociatedType: Task`1 Visibility: Public Generated Name: task Method: Resolve @@ -3958,7 +3642,8 @@ Types: Application Type: False Public: True Generated Name: Task - Global Methods: False + Extension Methods: False + BaseClass: Object Members: Property: Completed AssociatedType: Boolean @@ -3975,37 +3660,42 @@ Types: Visibility: Public Generated Name: status Method: All - AssociatedType: System.Threading.Task`1 + AssociatedType: Task`1 Visibility: Public, Static Generated Name: all Abstract: False Method: Any - AssociatedType: System.Threading.Task`1 + AssociatedType: Task`1 Visibility: Public, Static Generated Name: any Abstract: False + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public Generated Name: continueWith Abstract: False Method: Delay - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public, Static Generated Name: delay Abstract: False Method: Done - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public Generated Name: done Abstract: False Method: Fail - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public Generated Name: fail Abstract: False Method: Then - AssociatedType: System.Threading.Task + AssociatedType: Task Visibility: Public Generated Name: then Abstract: False @@ -4014,20 +3704,25 @@ Types: Application Type: False Public: True Generated Name: Task - Global Methods: False - BaseClass: System.Threading.Task + Extension Methods: False + BaseClass: Task Members: Field: Result AssociatedType: T Visibility: Public Generated Name: result + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith - AssociatedType: System.Threading.Task`1 + AssociatedType: Task`1 Visibility: Public Generated Name: continueWith Abstract: False Method: Done - AssociatedType: System.Threading.Task`1 + AssociatedType: Task`1 Visibility: Public Generated Name: done Abstract: False @@ -4058,122 +3753,110 @@ Script ================================================================ -Type.registerNamespace('test'); +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; -//////////////////////////////////////////////////////////////////////////////// -// test.AppFlags + // BasicTests.AppFlags -test.AppFlags = function() { }; -test.AppFlags.prototype = { + var AppFlags = { AAA: 1, BBB: 2 -} -test.AppFlags.registerEnum('test.AppFlags', true); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Mode + // BasicTests.Mode -test.Mode = function() { }; -test.Mode.prototype = { + var Mode = { mode1: 0, mode2: 1 -} -test.Mode.registerEnum('test.Mode', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test._iFoo + // BasicTests.IFoo -test._iFoo = function() { }; -test._iFoo.prototype = { + function IFoo() { } -} -test._iFoo.registerInterface('test._iFoo'); + // BasicTests.IApp -//////////////////////////////////////////////////////////////////////////////// -// test.IApp + function IApp() { } -test.IApp = function() { }; -test.IApp.prototype = { - run : null -} -test.IApp.registerInterface('test.IApp'); + // BasicTests.Point -//////////////////////////////////////////////////////////////////////////////// -// test._point - -test.$create__point = function test__point(x, y) { - var $o = { }; + function Point(x, y) { + var $o = {}; $o.x = x; $o.y = y; return $o; -} + } -//////////////////////////////////////////////////////////////////////////////// -// test.App + // BasicTests.App -test.App = function test_App() { -} -test.App.prototype = { - - add_event1: function test_App$add_event1(value) { - this.__event1 = ss.Delegate.combine(this.__event1, value); + function App() { + } + var App$ = { + add_event1: function(value) { + this.__event1 = ss.bindAdd(this.__event1, value); }, - remove_event1: function test_App$remove_event1(value) { - this.__event1 = ss.Delegate.remove(this.__event1, value); + remove_event1: function(value) { + this.__event1 = ss.bindSub(this.__event1, value); }, - - __event1: null, - - add_event2: function test_App$add_event2(value) { + add_event2: function(value) { }, - remove_event2: function test_App$remove_event2(value) { + remove_event2: function(value) { }, - - run: function test_App$run() { + run: function() { }, - - _initialize: function test_App$_initialize() { + _initialize: function() { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test._appHelper + // BasicTests.AppHelper -test._appHelper = function test__appHelper() { -} -test._appHelper.prototype = { - - get_prop1: function test__appHelper$get_prop1() { - return 0; + function AppHelper() { + } + var AppHelper$ = { + get_prop1: function() { + return 0; }, - - get_prop2: function test__appHelper$get_prop2() { - return 0; + get_prop2: function() { + return 0; }, - set_prop2: function test__appHelper$set_prop2(value) { - return value; + set_prop2: function(value) { + return value; }, - - _showHelp: function test__appHelper$_showHelp() { + _showHelp: function() { }, - get_item: function test__appHelper$get_item(name) { - return 0; + get_item: function(name) { + return 0; } -} + }; + + // BasicTests.Util -//////////////////////////////////////////////////////////////////////////////// -// test._util + $global.showHelp = function() { + }; -window._showHelp = function test__util$_showHelp() { -} + + var $exports = ss.module('test', + { + IFoo: [ IFoo ], + Point: Point, + AppHelper: [ AppHelper, AppHelper$, null ] + }, + { + AppFlags: AppFlags, + Mode: Mode, + IApp: [ IApp ], + App: [ App, App$, null, IApp ] + }); -test.App.registerClass('test.App', null, test.IApp); -test._appHelper.registerClass('test._appHelper'); + return $exports; +}); diff --git a/tests/TestCases/Basic/Metadata/Code.cs b/tests/TestCases/Basic/Metadata/Code.cs index 6170ff312..759bbca79 100644 --- a/tests/TestCases/Basic/Metadata/Code.cs +++ b/tests/TestCases/Basic/Metadata/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { @@ -62,13 +61,14 @@ public interface IApp { void Run(); } - [GlobalMethods] + [ScriptExtension("$global")] internal static class Util { internal static void ShowHelp() { } } - internal sealed class Point : Record { + [ScriptObject] + internal sealed class Point { public int x; public int y; diff --git a/tests/TestCases/Basic/Minimization/Baseline.txt b/tests/TestCases/Basic/Minimization/Baseline.txt index 01dc79325..daf9da6f6 100644 --- a/tests/TestCases/Basic/Minimization/Baseline.txt +++ b/tests/TestCases/Basic/Minimization/Baseline.txt @@ -1,20 +1,11 @@ Minimization Map ================================================================ - Member '__valueChanged' renamed to '$1_5' - Member '_intVal' renamed to '$1_0' - Member '_intVal2' renamed to '$1_1' - Member '_intVal3' renamed to '$1_2' - Member '_strVal' renamed to '$1_3' -Type 'BasicTests.ABC' renamed to '_ABC' + Member '__valueChanged' renamed to 'c$5' + Member '_intVal' renamed to 'c$0' + Member '_intVal2' renamed to 'c$1' + Member '_intVal3' renamed to 'c$2' + Member '_strVal' renamed to 'c$3' Member 'Alpha' renamed to '$0' -Type 'BasicTests.AppHelper' renamed to 'test$3' -Type 'BasicTests.Bar' renamed to '_Bar' -Type 'BasicTests.Bar2' renamed to '_Bar2' -Type 'BasicTests.BarCustom2' renamed to 'test$6' -Type 'BasicTests.BarEx' renamed to 'test$5' -Type 'BasicTests.BaseBaseClass' renamed to 'test$1' -Type 'BasicTests.BaseClass' renamed to 'test$4' -Type 'BasicTests.DerivedClass' renamed to 'test$7' Member 'Dispose' renamed to '$1' Member 'DoStuff' renamed to '$0' Member 'DoStuff' renamed to '$0' @@ -25,16 +16,12 @@ Type 'BasicTests.DerivedClass' renamed to 'test$7' Member 'DoStuffInternal' renamed to '$3' Member 'ExecuteHandler' renamed to '$1' Member 'Foo' renamed to '$2' -Type 'BasicTests.IApp' renamed to '_IApp' Member 'Initialize' renamed to '$0' -Type 'BasicTests.MaskTextBox' renamed to 'test$8' -Type 'BasicTests.MyData' renamed to 'test$2' -Type 'BasicTests.MyMode' renamed to 'test$0' Member 'Numeric' renamed to '$1' - Member 'OnClicked' renamed to '$3_1' - Member 'OnValueChanged' renamed to '$1_6' - Member 'OnValueChanged' renamed to '$3_0' - Member 'Property1' renamed to '$1_7' + Member 'OnClicked' renamed to 'e$1' + Member 'OnValueChanged' renamed to 'c$6' + Member 'OnValueChanged' renamed to 'e$0' + Member 'Property1' renamed to 'c$7' Member 'Setup' renamed to '$2' Member 'ShowHelp' renamed to '$0' Member 'string1' renamed to '$0' @@ -42,275 +29,309 @@ Type 'BasicTests.MyMode' renamed to 'test$0' Member 'Stuff' renamed to '$5' Member 'StuffProperty' renamed to '$6' Member 'ToString' renamed to 'toString' - Member 'ValueChanged' renamed to '$1_4' + Member 'ValueChanged' renamed to 'c$4' Script ================================================================ -Type.registerNamespace('test'); +"use strict"; -test.AppFlags = function() { }; -test.AppFlags.prototype = { +define('test', ['ss', 'lib'], function(ss, lib) { + var $global = this; + + // BasicTests.AppFlags + + var AppFlags = { AAA: 0, BBB: 1 -} -test.AppFlags.registerEnum('test.AppFlags', false); + }; + + // BasicTests.IApp -test._IApp = function() { }; -test._IApp.registerInterface('test._IApp'); + function IApp() { } -test.$create_test$2 = function(a, b) { - var $o = { }; + // BasicTests.MyData + + function MyData(a, b) { + var $o = {}; $o.$0 = a; $o.$1 = b; return $o; -} + } + + // BasicTests.GlobalMethodsClass -window.run = function() { -} + $global.run = function() { + }; -test.App = function() { - var $0 = new test.test$3(); - $0.$0(); -} -test.App.prototype = { - + // BasicTests.App + + function App() { + var helper = new AppHelper(); + helper.$0(); + } + var App$ = { run: function() { }, - $0: function() { }, - $1: function() { } -} + }; + + // BasicTests.AppHelper -test.test$3 = function() { -} -test.test$3.prototype = { - + function AppHelper() { + } + var AppHelper$ = { $0: function() { } -} + }; + + // BasicTests.Bar -test._Bar = function() { -} -test._Bar.prototype = { - + function Bar() { + } + var Bar$ = { $0: function() { }, - toString: function() { - return null; + return null; }, - - $1: function($p0) { + $1: function(handler) { + } + }; + + + // BasicTests.BaseBaseClass + + function BaseBaseClass() { + } + var BaseBaseClass$ = { + $0: function() { } -} + }; + + + // BasicTests.ABC + + function ABC() { + var d = { }; + } + var ABC$ = { + + }; + + + // BasicTests.Bar2 + + function Bar2() { + Bar.call(this); + } + var Bar2$ = { + }; -test._Bar2 = function() { - test._Bar2.initializeBase(this); -} + // BasicTests.BarCustom -test.test$5 = function() { - test.test$5.initializeBase(this); -} -test.test$5.prototype = { - + function BarCustom() { + Bar.call(this); + } + var BarCustom$ = { + + }; + + + // BasicTests.BaseClass + + function BaseClass() { + BaseBaseClass.call(this); + } + var BaseClass$ = { + $1: function() { + } + }; + + + // BasicTests.BarEx + + function BarEx() { + Bar2.call(this); + } + var BarEx$ = { $2: function() { - var $0 = 1; + var mode = 1; }, - $0: function() { - this.$2(); - test.test$5.callBaseMethod(this, '$0'); - var $0 = test.$create_test$2('a', 'b'); - $0.$0 = $0.$1; + this.$2(); + Bar2.prototype.$0.call(this); + var d = MyData('a', 'b'); + d.$0 = d.$1; }, - - $3: function($p0) { - $p0 = $p0 + 2; + $3: function(blah) { + blah = blah + 2; }, - - $4: function($p0) { - var $0 = $p0 + 1; - var $1 = $p0.toString(); - var $2 = 0; - this.$1(ss.Delegate.create(this, function($p1_0, $p1_1) { - this.$1(function($p2_0, $p2_1) { - var $2_0 = 11; - return $p2_0; - }); - var $1_0 = 10; - var $1_1 = 11; - return $0 + $p1_0 + $1 + $p1_1 + $1_0; - })); + $4: function(currentValue) { + var $this = this; + + var numericValue = currentValue + 1; + var stringValue = currentValue.toString(); + var value = 0; + this.$1(function(indexValue, textValue) { + $this.$1(function(indexValue, textValue) { + var value = 11; + return indexValue; + }); + var value = 10; + var value2 = 11; + return numericValue + indexValue + stringValue + textValue + value; + }); }, - get_$5: function() { - return 0; + return 0; }, - set_$5: function($p0) { - var $0 = $p0; - return $p0; + set_$5: function(value) { + var x = value; + return value; }, - get_$6: function() { - this.$1(ss.Delegate.create(this, function($p1_0, $p1_1) { - this.$1(function($p2_0, $p2_1) { - var $2_0 = 11; - return $p2_0; - }); - var $1_0 = 10; - var $1_1 = 11; - return $p1_0 + $p1_1 + $1_0; - })); - return 0; + var $this = this; + + this.$1(function(indexValue, textValue) { + $this.$1(function(indexValue, textValue) { + var value = 11; + return indexValue; + }); + var value = 10; + var value2 = 11; + return indexValue + textValue + value; + }); + return 0; }, - set_$6: function($p0) { - var $0 = $p0 + 1; - var $1 = $p0.toString(); - this.$1(ss.Delegate.create(this, function($p1_0, $p1_1) { - this.$1(function($p2_0, $p2_1) { - var $2_0 = 11; - return $p2_0; - }); - var $1_0 = 10; - var $1_1 = 11; - return $0 + $p1_0 + $1 + $p1_1 + $p0 + $1_1; - })); - return $p0; + set_$6: function(value) { + var $this = this; + + var numericValue = value + 1; + var stringValue = value.toString(); + this.$1(function(indexValue, textValue) { + $this.$1(function(indexValue, textValue) { + var value1 = 11; + return indexValue; + }); + var value2 = 10; + var value3 = 11; + return numericValue + indexValue + stringValue + textValue + value + value3; + }); + return value; } -} - + }; -test.BarCustom = function() { - test.BarCustom.initializeBase(this); -} + // BasicTests.BarCustom2 -test.test$6 = function() { - test.test$6.initializeBase(this); -} -test.test$6.prototype = { - + function BarCustom2() { + BarCustom.call(this); + } + var BarCustom2$ = { $2: function() { - return 0; + return 0; }, - baz: function() { - return 0; + return 0; }, - xyz: function() { } -} - - -test.FooBehavior = function(e, i) { - test.FooBehavior.initializeBase(this, [ e, null ]); - this.$1_0 = i; - this.$1_1 = i * 2; - this.$1_2 = i * 4; -} -test.FooBehavior.prototype = { - $1_0: 0, - $1_1: 0, - $1_2: 0, - - add_$1_4: function($p0) { - this.$1_5 = ss.Delegate.combine(this.$1_5, $p0); + }; + + + // BasicTests.FooBehavior + + function FooBehavior(e, i) { + this.c$0 = 0; + this.c$1 = 0; + this.c$2 = 0; + lib.Behavior.call(this, e, null); + this.c$0 = i; + this.c$1 = i * 2; + this.c$2 = i * 4; + } + var FooBehavior$ = { + add_c$4: function(value) { + this.c$5 = ss.bindAdd(this.c$5, value); }, - remove_$1_4: function($p0) { - this.$1_5 = ss.Delegate.remove(this.$1_5, $p0); + remove_c$4: function(value) { + this.c$5 = ss.bindSub(this.c$5, value); }, - - $1_5: null, - dispose: function() { - this.$1_0 = 0; - test.FooBehavior.callBaseMethod(this, 'dispose'); + this.c$0 = 0; + lib.Behavior.prototype.dispose.call(this); }, - - $1_6: function() { + c$6: function() { }, - - get_$1_7: function() { - return null; + get_c$7: function() { + return null; }, - get_item: function($p0) { - return 0; + get_item: function(name) { + return 0; } -} + }; -test.test$8 = function(e) { - test.test$8.initializeBase(this, [ e ]); -} -test.test$8.prototype = { - - $3_0: function() { - }, - - $3_1: function() { - } -} - + // BasicTests.DerivedClass -test.test$7 = function() { - test.test$7.initializeBase(this); -} -test.test$7.prototype = { - + function DerivedClass() { + BaseClass.call(this); + } + var DerivedClass$ = { $2: function() { } -} + }; -test.test$4 = function() { - test.test$4.initializeBase(this); -} -test.test$4.prototype = { - - $1: function() { + // BasicTests.MaskTextBox + + function MaskTextBox(e) { + lib.TextBox.call(this, e); + } + var MaskTextBox$ = { + e$0: function() { + }, + e$1: function() { } -} + }; + + + var $exports = ss.module('test', + { + IApp: [ IApp ], + MyData: MyData, + AppHelper: [ AppHelper, AppHelper$, null ], + Bar: [ Bar, Bar$, null ], + BaseBaseClass: [ BaseBaseClass, BaseBaseClass$, null ], + ABC: [ ABC, ABC$, null ], + Bar2: [ Bar2, Bar2$, Bar ], + BarCustom: [ BarCustom, BarCustom$, Bar ], + BaseClass: [ BaseClass, BaseClass$, BaseBaseClass ], + BarEx: [ BarEx, BarEx$, Bar2 ], + BarCustom2: [ BarCustom2, BarCustom2$, BarCustom ], + DerivedClass: [ DerivedClass, DerivedClass$, BaseClass ], + MaskTextBox: [ MaskTextBox, MaskTextBox$, lib.TextBox ] + }, + { + AppFlags: AppFlags, + App: [ App, App$, null ], + FooBehavior: [ FooBehavior, FooBehavior$, lib.Behavior ] + }); -test.test$1 = function() { -} -test.test$1.prototype = { - - $0: function() { - } -} - - -test._ABC = function() { -} - - -test.App.registerClass('test.App'); -test.test$3.registerClass('test.test$3'); -test._Bar.registerClass('test._Bar'); -test._Bar2.registerClass('test._Bar2', test._Bar); -test.test$5.registerClass('test.test$5', test._Bar2); -test.BarCustom.registerClass('test.BarCustom', test._Bar); -test.test$6.registerClass('test.test$6', test.BarCustom); -test.FooBehavior.registerClass('test.FooBehavior', ScriptFX.Behavior); -test.test$8.registerClass('test.test$8', ScriptFX.TextBox); -test.test$1.registerClass('test.test$1'); -test.test$4.registerClass('test.test$4', test.test$1); -test.test$7.registerClass('test.test$7', test.test$4); -test._ABC.registerClass('test._ABC'); -test.FooBehavior.$1_3 = null; + return $exports; +}); diff --git a/tests/TestCases/Basic/Minimization/Code.cs b/tests/TestCases/Basic/Minimization/Code.cs index 94ded6c0f..9fb632ad4 100644 --- a/tests/TestCases/Basic/Minimization/Code.cs +++ b/tests/TestCases/Basic/Minimization/Code.cs @@ -4,11 +4,10 @@ using ScriptFX; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { - [GlobalMethods] + [ScriptExtension("$global")] public static class GlobalMethodsClass { public static void Run() { @@ -130,7 +129,7 @@ internal int StuffProperty { } } - [PreserveName] + [ScriptName(PreserveName = true)] internal class BarCustom : Bar { } @@ -138,10 +137,10 @@ internal class BarCustom2 : BarCustom { public int Foo() { return 0; } - [PreserveName] + [ScriptName(PreserveName = true)] public int Baz() { return 0; } - [PreserveName] + [ScriptName(PreserveName = true)] private void Xyz() { } } @@ -210,7 +209,8 @@ private void DoStuffBaseBase() { } } - internal sealed class MyData : Record { + [ScriptObject] + internal sealed class MyData { public string string1; public string string2; @@ -221,6 +221,17 @@ public MyData(string a, string b) { } } + [ScriptObject] + internal sealed class DataHolder { + + public string s1; + public string s2; + } + internal class ABC { + + public ABC() { + DataHolder d = new DataHolder(); + } } } diff --git a/tests/TestCases/Basic/Minimization/Lib.dll b/tests/TestCases/Basic/Minimization/Lib.dll index e7ebacbca..1944a593a 100644 Binary files a/tests/TestCases/Basic/Minimization/Lib.dll and b/tests/TestCases/Basic/Minimization/Lib.dll differ diff --git a/tests/TestCases/Basic/Resources/Baseline.txt b/tests/TestCases/Basic/Resources/Baseline.txt index 02edf7458..12a991b13 100644 --- a/tests/TestCases/Basic/Resources/Baseline.txt +++ b/tests/TestCases/Basic/Resources/Baseline.txt @@ -1,30 +1,44 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function test_App() { - var s1 = test._strings1.string1; -} + // Resources.Strings1 - -//////////////////////////////////////////////////////////////////////////////// -// test._strings1 - -test._strings1 = { + var Strings1 = { string1: 'neutral: aaa', string2: 'fr: bbb', string3: 'fr-FR: ccc' -}; + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Strings2 + // Resources.Strings2 -test.Strings2 = { + var Strings2 = { string1: 's2', string2: '1234' -}; + }; + + + // BasicTests.App + + function App() { + var s1 = Strings1.string1; + } + var App$ = { + + }; + + + var $exports = ss.module('test', + { + Strings1: Strings1 + }, + { + Strings2: Strings2, + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Basic/Resources/Code.cs b/tests/TestCases/Basic/Resources/Code.cs index 15d8060d6..aef5485e0 100644 --- a/tests/TestCases/Basic/Resources/Code.cs +++ b/tests/TestCases/Basic/Resources/Code.cs @@ -3,7 +3,6 @@ using Resources; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { diff --git a/tests/TestCases/Basic/Simple/AMDBaseline.txt b/tests/TestCases/Basic/Simple/AMDBaseline.txt new file mode 100644 index 000000000..fffbdfb6c --- /dev/null +++ b/tests/TestCases/Basic/Simple/AMDBaseline.txt @@ -0,0 +1,81 @@ +// basic.js 1.0.0.0 +// Simple code generation test. +// Copyright (c) Script# Project, 2012 +// + +"use strict"; + +define('basic', ['ss'], function(ss) { + var $global = this; + + // Basic.EventArgs + + function EventArgs() { + } + var EventArgs$ = { + + }; + + + // Basic.Button + + function Button(text) { + this._text = text; + } + var Button$ = { + add_click: function(value) { + this.__click = ss.bindAdd(this.__click, value); + }, + remove_click: function(value) { + this.__click = ss.bindSub(this.__click, value); + }, + get_text: function() { + return this._text; + }, + performClick: function() { + if (this.__click != null) { + this.__click(this, EventArgs.Empty); + } + } + }; + + + // Basic.App + + function App() { + this._btn1 = new Button('OK'); + this._btn1.add_click(ss.bind('_onClickButton', this)); + this._btn1.add_click(ss.bind('_onClickButtonDup', this)); + this._btn2 = new Button('Cancel'); + this._btn2.add_click(ss.bind('_onClickButton', this)); + } + App.main = function(args) { + var theApp = new App(); + theApp._btn1.performClick(); + theApp._btn2.performClick(); + }; + var App$ = { + _echo: function(s) { + }, + _onClickButton: function(sender, e) { + this._echo((sender).get_text() + ' was clicked!'); + }, + _onClickButtonDup: function(sender, e) { + this._echo((sender).get_text() + ' was clicked as well!'); + } + }; + + + var $exports = ss.module('basic', null, + { + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] + }); + + EventArgs.Empty = new EventArgs(); + + return $exports; +}); + +// Generated with Script# 0.8.0.0 diff --git a/tests/TestCases/Basic/Simple/Baseline.txt b/tests/TestCases/Basic/Simple/Baseline.txt deleted file mode 100644 index a753696fc..000000000 --- a/tests/TestCases/Basic/Simple/Baseline.txt +++ /dev/null @@ -1,75 +0,0 @@ -Type.registerNamespace('Basic'); - -//////////////////////////////////////////////////////////////////////////////// -// Basic.EventArgs - -Basic.EventArgs = function() { -} - - -//////////////////////////////////////////////////////////////////////////////// -// Basic.Button - -Basic.Button = function(text) { - this._text = text; -} -Basic.Button.prototype = { - _text: null, - - add_click: function(value) { - this.__click = ss.Delegate.combine(this.__click, value); - }, - remove_click: function(value) { - this.__click = ss.Delegate.remove(this.__click, value); - }, - - __click: null, - - get_text: function() { - return this._text; - }, - - performClick: function() { - if (this.__click != null) { - this.__click(this, Basic.EventArgs.Empty); - } - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Basic.App - -Basic.App = function() { - this._btn1 = new Basic.Button('OK'); - this._btn1.add_click(ss.Delegate.create(this, this.onClickButton)); - this._btn1.add_click(ss.Delegate.create(this, this.onClickButtonDup)); - this._btn2 = new Basic.Button('Cancel'); - this._btn2.add_click(ss.Delegate.create(this, this.onClickButton)); -} -Basic.App.main = function(args) { - var theApp = new Basic.App(); - theApp._btn1.performClick(); - theApp._btn2.performClick(); -} -Basic.App.prototype = { - _btn1: null, - _btn2: null, - - echo: function(s) { - }, - - onClickButton: function(sender, e) { - this.echo((sender).get_text() + ' was clicked!'); - }, - - onClickButtonDup: function(sender, e) { - this.echo((sender).get_text() + ' was clicked as well!'); - } -} - - -Basic.EventArgs.registerClass('Basic.EventArgs'); -Basic.Button.registerClass('Basic.Button'); -Basic.App.registerClass('Basic.App'); -Basic.EventArgs.Empty = new Basic.EventArgs(); diff --git a/tests/TestCases/Basic/Simple/Code.cs b/tests/TestCases/Basic/Simple/Code.cs index 07c6d7733..740f11448 100644 --- a/tests/TestCases/Basic/Simple/Code.cs +++ b/tests/TestCases/Basic/Simple/Code.cs @@ -6,12 +6,51 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("basic")] +[assembly: AssemblyDescription("Simple code generation test.")] +[assembly: AssemblyCopyright("Copyright (c) Script# Project, 2012")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +#if AMD_TEMPLATE +[assembly: ScriptTemplate(@" +// {name}.js {version} +// {description} +// {copyright} +// + +""use strict""; + +define('{name}', [{requires}], function({dependencies}) { + var $global = this; + + {script} + return $exports; +}); + +// Generated with Script# {compiler} +")] +#endif + +#if SIMPLE_TEMPLATE +[assembly: ScriptTemplate(@" +// {name}.js +// Sample script... +""use strict""; + +(function($global) { + {dependenciesLookup} + + {script} + return $exports; +})(this); +")] +#endif + namespace Basic { public class EventArgs { - [PreserveCase] + [ScriptName(PreserveCase = true)] public static readonly EventArgs Empty = new EventArgs(); } diff --git a/tests/TestCases/Basic/Simple/DefaultBaseline.txt b/tests/TestCases/Basic/Simple/DefaultBaseline.txt new file mode 100644 index 000000000..ab0d33b05 --- /dev/null +++ b/tests/TestCases/Basic/Simple/DefaultBaseline.txt @@ -0,0 +1,74 @@ +"use strict"; + +define('basic', ['ss'], function(ss) { + var $global = this; + + // Basic.EventArgs + + function EventArgs() { + } + var EventArgs$ = { + + }; + + + // Basic.Button + + function Button(text) { + this._text = text; + } + var Button$ = { + add_click: function(value) { + this.__click = ss.bindAdd(this.__click, value); + }, + remove_click: function(value) { + this.__click = ss.bindSub(this.__click, value); + }, + get_text: function() { + return this._text; + }, + performClick: function() { + if (this.__click != null) { + this.__click(this, EventArgs.Empty); + } + } + }; + + + // Basic.App + + function App() { + this._btn1 = new Button('OK'); + this._btn1.add_click(ss.bind('_onClickButton', this)); + this._btn1.add_click(ss.bind('_onClickButtonDup', this)); + this._btn2 = new Button('Cancel'); + this._btn2.add_click(ss.bind('_onClickButton', this)); + } + App.main = function(args) { + var theApp = new App(); + theApp._btn1.performClick(); + theApp._btn2.performClick(); + }; + var App$ = { + _echo: function(s) { + }, + _onClickButton: function(sender, e) { + this._echo((sender).get_text() + ' was clicked!'); + }, + _onClickButtonDup: function(sender, e) { + this._echo((sender).get_text() + ' was clicked as well!'); + } + }; + + + var $exports = ss.module('basic', null, + { + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] + }); + + EventArgs.Empty = new EventArgs(); + + return $exports; +}); diff --git a/tests/TestCases/Basic/Simple/SimpleBaseline.txt b/tests/TestCases/Basic/Simple/SimpleBaseline.txt new file mode 100644 index 000000000..68ee0124f --- /dev/null +++ b/tests/TestCases/Basic/Simple/SimpleBaseline.txt @@ -0,0 +1,76 @@ +// basic.js +// Sample script... +"use strict"; + +(function($global) { + var ss = require('scriptsharp'); + + // Basic.EventArgs + + function EventArgs() { + } + var EventArgs$ = { + + }; + + + // Basic.Button + + function Button(text) { + this._text = text; + } + var Button$ = { + add_click: function(value) { + this.__click = ss.bindAdd(this.__click, value); + }, + remove_click: function(value) { + this.__click = ss.bindSub(this.__click, value); + }, + get_text: function() { + return this._text; + }, + performClick: function() { + if (this.__click != null) { + this.__click(this, EventArgs.Empty); + } + } + }; + + + // Basic.App + + function App() { + this._btn1 = new Button('OK'); + this._btn1.add_click(ss.bind('_onClickButton', this)); + this._btn1.add_click(ss.bind('_onClickButtonDup', this)); + this._btn2 = new Button('Cancel'); + this._btn2.add_click(ss.bind('_onClickButton', this)); + } + App.main = function(args) { + var theApp = new App(); + theApp._btn1.performClick(); + theApp._btn2.performClick(); + }; + var App$ = { + _echo: function(s) { + }, + _onClickButton: function(sender, e) { + this._echo((sender).get_text() + ' was clicked!'); + }, + _onClickButtonDup: function(sender, e) { + this._echo((sender).get_text() + ' was clicked as well!'); + } + }; + + + var $exports = ss.module('basic', null, + { + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] + }); + + EventArgs.Empty = new EventArgs(); + + return $exports; +})(this); diff --git a/tests/TestCases/Basic/Template/Baseline.txt b/tests/TestCases/Basic/Template/Baseline.txt deleted file mode 100644 index c844360cb..000000000 --- a/tests/TestCases/Basic/Template/Baseline.txt +++ /dev/null @@ -1,22 +0,0 @@ -//! Test.js - -alert('some static script'); - -Type.registerNamespace('test'); - -//////////////////////////////////////////////////////////////////////////////// -// test.App - -test.App = function test_App() { - var e = document.body; -} - - -test.App.registerClass('test.App'); - -alert('debug'); - -ss.checkScripts('test', 'core'); - -//! Copyright (c) 2007 - diff --git a/tests/TestCases/Basic/Template/Static.js b/tests/TestCases/Basic/Template/Static.js deleted file mode 100644 index b977931eb..000000000 --- a/tests/TestCases/Basic/Template/Static.js +++ /dev/null @@ -1 +0,0 @@ -alert('some static script'); diff --git a/tests/TestCases/Basic/Template/Template.js b/tests/TestCases/Basic/Template/Template.js deleted file mode 100644 index feaaa3e73..000000000 --- a/tests/TestCases/Basic/Template/Template.js +++ /dev/null @@ -1,15 +0,0 @@ -//! Test.js - -#include "Static.js" -#include[as-is] "%code%" - -#if DEBUG -alert('debug'); -#endif - -#if DEBUG -ss.checkScripts('#= Name ##', '#= ExecutionDependencies ##'); -#endif - -//! Copyright (c) 2007 - \ No newline at end of file diff --git a/tests/TestCases/Basic/UnitTest/Code.cs b/tests/TestCases/Basic/UnitTest/Code.cs index 2f975d647..dddfd1541 100644 --- a/tests/TestCases/Basic/UnitTest/Code.cs +++ b/tests/TestCases/Basic/UnitTest/Code.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace BasicTests { @@ -64,3 +63,9 @@ public override void Cleanup() { } } } + +namespace BasicTests.Tests.Helpers { + + internal sealed class Foo { + } +} diff --git a/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt b/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt index 8c92ee524..08a4dbc1a 100644 --- a/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt +++ b/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt @@ -1,38 +1,44 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.PublicClass +define('test', ['ss'], function(ss) { + var $global = this; -test.PublicClass = function() { -} -test.PublicClass.prototype = { - + // BasicTests.PublicClass + + function PublicClass() { + } + var PublicClass$ = { format: function(i) { - return '0'; + return '0'; }, - parse: function(s) { - return 0; + return 0; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.InternalClass + // BasicTests.InternalClass -test.InternalClass = function() { -} -test.InternalClass.prototype = { - + function InternalClass() { + } + var InternalClass$ = { format: function(i) { - return null; + return null; }, - parse: function(s) { - return 0; + return 0; } -} + }; + + + var $exports = ss.module('test', + { + InternalClass: [ InternalClass, InternalClass$, null ] + }, + { + PublicClass: [ PublicClass, PublicClass$, null ] + }); -test.PublicClass.registerClass('test.PublicClass'); -test.InternalClass.registerClass('test.InternalClass'); + return $exports; +}); diff --git a/tests/TestCases/Basic/UnitTest/TestBaseline.txt b/tests/TestCases/Basic/UnitTest/TestBaseline.txt index 97e7b1d57..62aa4ea5f 100644 --- a/tests/TestCases/Basic/UnitTest/TestBaseline.txt +++ b/tests/TestCases/Basic/UnitTest/TestBaseline.txt @@ -1,122 +1,127 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.PublicClass +define('test', ['ss'], function(ss) { + var $global = this; -test.PublicClass = function() { -} -test.PublicClass.prototype = { - + // BasicTests.PublicClass + + function PublicClass() { + } + var PublicClass$ = { format: function(i) { - return '0'; + return '0'; }, - parse: function(s) { - return 0; + return 0; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.InternalClass + // BasicTests.InternalClass -test.InternalClass = function() { -} -test.InternalClass.prototype = { - + function InternalClass() { + } + var InternalClass$ = { format: function(i) { - return null; + return null; }, - parse: function(s) { - return 0; + return 0; } -} + }; + + + // BasicTests.Tests.Helpers.Foo + function Foo() { + } + var Foo$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.PublicTests + }; -test.PublicTests = function() { - test.PublicTests.initializeBase(this); -} -test.PublicTests.prototype = { - + + // BasicTests.Tests.PublicTests + + function PublicTests() { + } + var PublicTests$ = { testFormat: function() { - QUnit.expect(1); - var testee = new test.PublicClass(); - var s = testee.format(0); - QUnit.equal(s, '0', "Expected '0' for result."); + QUnit.expect(1); + var testee = new PublicClass(); + var s = testee.format(0); + QUnit.equal(s, '0', "Expected '0' for result."); } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.InternalTests + // BasicTests.Tests.InternalTests -test.InternalTests = function() { - test.InternalTests.initializeBase(this); -} -test.InternalTests.prototype = { - _startTime: null, - _endTime: null, - + function InternalTests() { + } + var InternalTests$ = { testFormat: function() { - QUnit.expect(1); - var testee = new test.InternalClass(); - var s = testee.format(0); - QUnit.equal(s, '0', "Expected '0' for result."); + QUnit.expect(1); + var testee = new InternalClass(); + var s = testee.format(0); + QUnit.equal(s, '0', "Expected '0' for result."); }, - testParse: function() { - QUnit.expect(1); - var testee = new test.InternalClass(); - var i = testee.parse('0'); - QUnit.equal(i, 0, 'Expected 0 for result.'); + QUnit.expect(1); + var testee = new InternalClass(); + var i = testee.parse('0'); + QUnit.equal(i, 0, 'Expected 0 for result.'); }, - setup: function() { - this._startTime = Date.get_now(); + this._startTime$2 = ss.now(); }, - cleanup: function() { - this._endTime = Date.get_now(); + this._endTime$2 = ss.now(); } -} + }; + + var $exports = ss.module('test', + { + InternalClass: [ InternalClass, InternalClass$, null ], + Foo: [ Foo, Foo$, null ], + PublicTests: [ PublicTests, PublicTests$, null ], + InternalTests: [ InternalTests, InternalTests$, null ] + }, + { + PublicClass: [ PublicClass, PublicClass$, null ] + }); -test.PublicClass.registerClass('test.PublicClass'); -test.InternalClass.registerClass('test.InternalClass'); -test.PublicTests.registerClass('test.PublicTests'); -test.InternalTests.registerClass('test.InternalTests'); -module('PublicTests', { + module('PublicTests', { setup: function() { - this.instance = new test.PublicTests(); + this.instance = new PublicTests(); }, teardown: function() { - delete this.instance; + delete this.instance; } -}); + }); -test('testFormat', function() { + test('testFormat', function() { this.instance.testFormat(); -}); + }); -module('InternalTests', { + module('InternalTests', { setup: function() { - this.instance = new test.InternalTests(); - this.instance.setup(); + this.instance = new InternalTests(); + this.instance.setup(); }, teardown: function() { - this.instance.cleanup(); - delete this.instance; + this.instance.cleanup(); + delete this.instance; } -}); + }); -test('testFormat', function() { + test('testFormat', function() { this.instance.testFormat(); -}); -test('testParse', function() { + }); + test('testParse', function() { this.instance.testParse(); + }); + + return $exports; }); diff --git a/tests/TestCases/Expression/AnonymousMethods/Baseline.txt b/tests/TestCases/Expression/AnonymousMethods/Baseline.txt index c1f3ea93c..479781c8d 100644 --- a/tests/TestCases/Expression/AnonymousMethods/Baseline.txt +++ b/tests/TestCases/Expression/AnonymousMethods/Baseline.txt @@ -1,59 +1,113 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.SomeClass +define('test', ['ss'], function(ss) { + var $global = this; -test.SomeClass = function(cb) { -} + // ExpressionTests.SomeClass + function SomeClass(cb) { + } + var SomeClass$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.Test + }; -test.Test = function() { -} -test.Test.main = function(args) { + + // ExpressionTests.Test + + function Test() { + this._n = 0; + } + Test.main = function(args) { var o = {}; var name; - test.Test.doStuffStatic(o, function(i, s, b) { - name = s; + Test.doStuffStatic(o, function(i, s, b) { + name = s; }); -} -test.Test.doStuffStatic = function(o, callback) { -} -test.Test.prototype = { - _n: 0, - + }; + Test.doStuffStatic = function(o, callback) { + var s = new SomeClass(function() { + var temp = o; + }); + }; + var Test$ = { AAA: function() { - var o = {}; - this.doStuff(o, ss.Delegate.create(this, function(i, s, b) { - this._n = i; - })); - var s = new test.SomeClass(function() { + var $this = this; + + var o = {}; + this.doStuff(o, function(i, s, b) { + $this._n = i; + }); + var s = new SomeClass(function() { + }); + for (var i = 0; i < 10; i++) { + var foo; + this.doStuff(o, function(i, s, b) { + foo = i + s; + }); + this.doStuff(o, function(i, s, b) { + $this._n += i; + }); + Test.doStuffStatic(o, function() { + }); + Test.doStuffStatic(o, function() { + $this._n++; + }); + } + var s2 = new SomeClass(function() { + var numbers = [ $this._n ]; + }); + var s3 = new SomeClass(function() { + var s4 = new SomeClass(function() { + var numbers = [ $this._n * 2 ]; }); - for (var i = 0; i < 10; i++) { - var foo; - this.doStuff(o, function(i, s, b) { - foo = i + s; - }); - this.doStuff(o, ss.Delegate.create(this, function(i, s, b) { - this._n += i; - })); - test.Test.doStuffStatic(o, function() { - }); - test.Test.doStuffStatic(o, ss.Delegate.create(this, function() { - this._n++; - })); - } - var s2 = new test.SomeClass(ss.Delegate.create(this, function() { - var numbers = [ this._n ]; - })); + }); + var j = 0; + (function() { + $this._n++; + })(); + (function() { + j++; + })(); + (function(i, s, b) { + i++; + b = ss.emptyString(s); + })(j, 'foo', false); + (function(i, s, b) { + i++; + b = ss.emptyString(s); + })(j, 'foo', false); + j = (function(k) { + return k + 1; + })(3); + j = (function(k) { + return k + 1; + })(3); + }, + BBB: function(o) { + var s = new SomeClass(function() { + var temp = o; + }); + }, + CCC: function(o) { + var $this = this; + + var s = new SomeClass(function() { + var s = new SomeClass(function() { + var numbers = [ $this._n * 2 ]; + }); + }); }, - doStuff: function(o, callback) { } -} + }; + + + var $exports = ss.module('test', null, + { + SomeClass: [ SomeClass, SomeClass$, null ], + Test: [ Test, Test$, null ] + }); -test.SomeClass.registerClass('test.SomeClass'); -test.Test.registerClass('test.Test'); + return $exports; +}); diff --git a/tests/TestCases/Expression/AnonymousMethods/Code.cs b/tests/TestCases/Expression/AnonymousMethods/Code.cs index a66915d12..5b8ce5407 100644 --- a/tests/TestCases/Expression/AnonymousMethods/Code.cs +++ b/tests/TestCases/Expression/AnonymousMethods/Code.cs @@ -2,12 +2,13 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { public delegate void Foo(int i, string s, bool b); + public delegate int Bar(int i); + public delegate void Callback(); public class SomeClass { @@ -53,9 +54,59 @@ public void AAA() { SomeClass s2 = new SomeClass(delegate { int[] numbers = new int[] { _n }; }); + + SomeClass s3 = new SomeClass(delegate { + SomeClass s4 = new SomeClass(delegate { + int[] numbers = new int[] { _n * 2 }; + }); + }); + + int j = 0; + new Callback(delegate { + this._n++; + }).Invoke(); + + new Callback(delegate { + j++; + })(); + + new Foo(delegate(int i, string s, bool b) { + i++; + b = string.IsNullOrEmpty(s); + }).Invoke(j, "foo", false); + + new Foo(delegate(int i, string s, bool b) { + i++; + b = string.IsNullOrEmpty(s); + })(j, "foo", false); + + j = new Bar(delegate (int k) { + return k + 1; + }).Invoke(3); + + j = new Bar(delegate(int k) { + return k + 1; + })(3); + } + + public void BBB(object o) { + SomeClass s = new SomeClass(delegate { + object temp = o; + }); + } + + public void CCC(object o) { + SomeClass s = new SomeClass(delegate { + SomeClass s = new SomeClass(delegate { + int[] numbers = new int[] { _n * 2 }; + }); + }); } public static void DoStuffStatic(object o, Foo callback) { + SomeClass s = new SomeClass(delegate { + object temp = o; + }); } public void DoStuff(object o, Foo callback) { diff --git a/tests/TestCases/Expression/Arguments/Baseline.txt b/tests/TestCases/Expression/Arguments/Baseline.txt index fc9ea7db0..81da848c6 100644 --- a/tests/TestCases/Expression/Arguments/Baseline.txt +++ b/tests/TestCases/Expression/Arguments/Baseline.txt @@ -1,18 +1,26 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var count = arguments.length; - var value = arguments[0]; - var items = Array.toArray(arguments); + var count = arguments.length; + var value = arguments[0]; + var items = ss.array(arguments); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Arguments/Code.cs b/tests/TestCases/Expression/Arguments/Code.cs index 7e8573e19..20ea7a4d9 100644 --- a/tests/TestCases/Expression/Arguments/Code.cs +++ b/tests/TestCases/Expression/Arguments/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Array/Baseline.txt b/tests/TestCases/Expression/Array/Baseline.txt new file mode 100644 index 000000000..cdf86987e --- /dev/null +++ b/tests/TestCases/Expression/Array/Baseline.txt @@ -0,0 +1,52 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.App + + function App() { + } + var App$ = { + test: function(arg) { + var items = []; + items.push(1); + items.push(1, 2, 3); + items.length = 0; + var b1 = (items.indexOf(2) >= 0); + items.splice(0, 0, 1); + items.splice(1, 0, 0, 5); + items.splice(4, 1); + items.splice(4, 3); + ss.remove(items, 1); + var newItems = items.slice(5, 7); + var newItems2 = items.slice(5, 5 + arg); + var numbers = []; + numbers.push(1); + numbers.push(1, 2, 3); + numbers.length = 0; + var b2 = (numbers.indexOf(4) >= 0); + numbers.splice(1, 0, 10); + numbers.splice(2, 0, 10, 3); + numbers.splice(4, 1); + numbers.splice(4, 2); + var newNumbers = items.slice(5, 7); + var newNumbers2 = items.slice(5, 5 + arg); + var words = new Array(5); + words[0] = 'hello'; + words[1] = 'world'; + var b3 = (words.indexOf('hi') >= 0); + var newWords = words.slice(5, 7); + var newWords2 = words.slice(5, 5 + arg); + } + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Expression/Array/Code.cs b/tests/TestCases/Expression/Array/Code.cs new file mode 100644 index 000000000..3219ad41c --- /dev/null +++ b/tests/TestCases/Expression/Array/Code.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + +namespace ExpressionTests { + + public class App { + + public void Test(int arg) { + ArrayList items = new ArrayList(); + items.Add(1); + items.AddRange(1, 2, 3); + items.Clear(); + bool b1 = items.Contains(2); + items.Insert(0, 1); + items.InsertRange(1, 0, 5); + items.RemoveAt(4); + items.RemoveRange(4, 3); + items.Remove(1); + object[] newItems = items.GetRange(5, 2); + object[] newItems2 = items.GetRange(5, arg); + + List numbers = new List(); + numbers.Add(1); + numbers.AddRange(1, 2, 3); + numbers.Clear(); + bool b2 = numbers.Contains(4); + numbers.Insert(1, 10); + numbers.InsertRange(2, 10, 3); + numbers.RemoveAt(4); + numbers.RemoveRange(4, 2); + int[] newNumbers = items.GetRange(5, 2); + int[] newNumbers2 = items.GetRange(5, arg); + + string[] words = new string[5]; + words[0] = "hello"; + words[1] = "world"; + bool b3 = words.Contains("hi"); + string[] newWords = words.GetRange(5, 2); + string[] newWords2 = words.GetRange(5, arg); + } + } +} diff --git a/tests/TestCases/Expression/Base/Baseline.txt b/tests/TestCases/Expression/Base/Baseline.txt index c2efec3aa..8c8ee0fd1 100644 --- a/tests/TestCases/Expression/Base/Baseline.txt +++ b/tests/TestCases/Expression/Base/Baseline.txt @@ -1,39 +1,43 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Foo +define('test', ['ss'], function(ss) { + var $global = this; -test.Foo = function(i, j) { -} -test.Foo.prototype = { - + // ExpressionTests.Foo + + function Foo(i, j) { + } + var Foo$ = { toString: function() { - return 'Foo'; + return 'Foo'; }, - sum: function(i) { - return 0; + return 0; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Bar + // ExpressionTests.Bar -test.Bar = function(i, j, f) { - test.Bar.initializeBase(this, [ i, j ]); -} -test.Bar.prototype = { - + function Bar(i, j, f) { + Foo.call(this, i, j); + } + var Bar$ = { sum: function() { - return test.Bar.callBaseMethod(this, 'sum', [ 1 ]) + 1; + return Foo.prototype.sum.call(this, 1) + 1; }, - toString: function() { - return test.Bar.callBaseMethod(this, 'toString') + ' -> Bar'; + return Foo.prototype.toString.call(this) + ' -> Bar'; } -} + }; + + + var $exports = ss.module('test', null, + { + Foo: [ Foo, Foo$, null ], + Bar: [ Bar, Bar$, Foo ] + }); -test.Foo.registerClass('test.Foo'); -test.Bar.registerClass('test.Bar', test.Foo); + return $exports; +}); diff --git a/tests/TestCases/Expression/Base/Code.cs b/tests/TestCases/Expression/Base/Code.cs index 15190ff4d..67b2f6f94 100644 --- a/tests/TestCases/Expression/Base/Code.cs +++ b/tests/TestCases/Expression/Base/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Binary/Baseline.txt b/tests/TestCases/Expression/Binary/Baseline.txt index bad74ddf1..262b6ad85 100644 --- a/tests/TestCases/Expression/Binary/Baseline.txt +++ b/tests/TestCases/Expression/Binary/Baseline.txt @@ -1,121 +1,120 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Data +define('test', ['ss'], function(ss) { + var $global = this; -test.Data = function() { -} -test.Data.prototype = { - _value: 0, - + // ExpressionTests.Data + + function Data() { + this._value = 0; + } + var Data$ = { get_value: function() { - return this._value; + return this._value; }, set_value: function(value) { - this._value = value; - return value; + this._value = value; + return value; }, - get_flag: function() { - return true; + return true; }, set_flag: function(value) { - return value; + return value; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // ExpressionTests.App -test.App = function() { -} -test.App.prototype = { - - get_foo: function() { - return 0; + function App() { + } + var App$ = { + get__foo: function() { + return 0; }, - set_foo: function(value) { - return value; + set__foo: function(value) { + return value; }, - - get_bar: function() { - return 0; + get__bar: function() { + return 0; }, - set_bar: function(value) { - return value; + set__bar: function(value) { + return value; }, - get_data: function() { - return new test.Data(); + return new Data(); }, set_data: function(value) { - return value; + return value; }, - get_flag1: function() { - return this.get_data().get_flag(); + return this.get_data().get_flag(); }, - get_flag2: function() { - return test.Data.staticFlag; + return Data.staticFlag; }, - test: function(arg1, arg2) { - var sum = arg1 + arg2; - sum += arg2 * -1; - sum = arg1 - arg2; - sum = arg1 * arg2; - sum = arg1 / arg2; - sum = arg1 ^ arg2; - sum = arg1 >> 2; - sum *= arg2; - sum ^= arg2; - var f = arg1; - var s = (f + 1).toExponential(); - var len = (10 + s).length; - var b = (f < 10); - sum = arg1 + (arg2 + 1) * 10; - sum = arg1 + (arg2 + ~arg1) * (arg1 - 10); - var b2 = Type.canCast(sum, Number); - var o = Type.safeCast(b, ss.IDisposable); - this.set_foo(this.get_foo() + 10); - this.set_foo(this.get_foo() - this.get_bar()); - sum = sum << 1; - sum <<= 1; - var xyz; - var abc; - abc = xyz << 1; - abc = xyz >>> 2; - abc <<= 1; - xyz >>>= 1; - var d = new test.Data(); - d.set_value(d.get_value() + 5); - d.set_flag((d.get_flag() | true) === 1); - var o1 = null || {}; - var s2 = (10).toString(); - s2 = (100).toString(); - s2 = true.toString(); - s2 = (10.1).toString(); - s2 = 'aaa'; + var sum = arg1 + arg2; + sum += arg2 * -1; + sum = arg1 - arg2; + sum = arg1 * arg2; + sum = arg1 / arg2; + sum = arg1 ^ arg2; + sum = arg1 >> 2; + sum *= arg2; + sum ^= arg2; + var f = arg1; + var s = (f + 1).toExponential(); + var len = (10 + s).length; + var b = (f < 10); + sum = arg1 + (arg2 + 1) * 10; + sum = arg1 + (arg2 + ~arg1) * (arg1 - 10); + var b2 = ss.canCast(sum, Number); + var o = ss.safeCast(b, ss.IDisposable); + this.set__foo(this.get__foo() + 10); + this.set__foo(this.get__foo() - this.get__bar()); + sum = sum << 1; + sum <<= 1; + var xyz; + var abc; + abc = xyz << 1; + abc = xyz >>> 2; + abc <<= 1; + xyz >>>= 1; + var d = new Data(); + d.set_value(d.get_value() + 5); + d.set_flag((d.get_flag() | true) === 1); + var o1 = ss.value(null, {}); + var s2 = (10).toString(); + s2 = (100).toString(); + s2 = true.toString(); + s2 = (10.1).toString(); + s2 = 'aaa'; }, - bitwiseBooleans: function() { - var a = (true & false) === 1; - var b = (true | false) === 1; - var c = (true ^ false) === 1; - a = (a & true) === 1; - b = (b | true) === 1; - c = (c ^ true) === 1; - a = (a | (a || a)) === 1; - var d = new test.Data(); - d.set_flag((d.get_flag() & true) === 1); - d.set_flag((d.get_flag() | true) === 1); - d.set_flag((d.get_flag() ^ true) === 1); + var a = (true & false) === 1; + var b = (true | false) === 1; + var c = (true ^ false) === 1; + a = (a & true) === 1; + b = (b | true) === 1; + c = (c ^ true) === 1; + a = (a | (a || a)) === 1; + var d = new Data(); + d.set_flag((d.get_flag() & true) === 1); + d.set_flag((d.get_flag() | true) === 1); + d.set_flag((d.get_flag() ^ true) === 1); } -} + }; + + + var $exports = ss.module('test', null, + { + Data: [ Data, Data$, null ], + App: [ App, App$, null ] + }); + Data.staticFlag = false; -test.Data.registerClass('test.Data'); -test.App.registerClass('test.App'); -test.Data.staticFlag = false; + return $exports; +}); diff --git a/tests/TestCases/Expression/Binary/Code.cs b/tests/TestCases/Expression/Binary/Code.cs index 486d4c8e0..b00e9fcbe 100644 --- a/tests/TestCases/Expression/Binary/Code.cs +++ b/tests/TestCases/Expression/Binary/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Cast/Baseline.txt b/tests/TestCases/Expression/Cast/Baseline.txt index 2467d09dc..db2245d2e 100644 --- a/tests/TestCases/Expression/Cast/Baseline.txt +++ b/tests/TestCases/Expression/Cast/Baseline.txt @@ -1,37 +1,45 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var f = arg / 2; - var d = 0.25; - var i = parseInt(f); - var j = parseInt(d); - var f2 = d; - var a = 1; - var b = 2; - var n1 = a / b; - var n2 = parseInt((a / b)); - var d2 = a / b; - var action = function() { - }; - var secondAction = Type.safeCast(action, Function); - if (Type.canCast(action, Function)) { - } - var cb = Type.safeCast(action, Function); - if (Type.canCast(action, Function)) { - cb = action; - } - var action2 = Type.safeCast(action, Function); - if (action2 != null) { - } + var f = arg / 2; + var d = 0.25; + var i = ss.truncate(f); + var j = ss.truncate(d); + var f2 = d; + var a = 1; + var b = 2; + var n1 = a / b; + var n2 = ss.truncate((a / b)); + var d2 = a / b; + var action = function() { + }; + var secondAction = ss.safeCast(action, Function); + if (ss.canCast(action, Function)) { + } + var cb = ss.safeCast(action, Function); + if (ss.canCast(action, Function)) { + cb = action; + } + var action2 = ss.safeCast(action, Function); + if (action2 != null) { + } } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Cast/Code.cs b/tests/TestCases/Expression/Cast/Code.cs index 30ac3e5d3..064026722 100644 --- a/tests/TestCases/Expression/Cast/Code.cs +++ b/tests/TestCases/Expression/Cast/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Conditional/Baseline.txt b/tests/TestCases/Expression/Conditional/Baseline.txt index e37cbb97b..e98010881 100644 --- a/tests/TestCases/Expression/Conditional/Baseline.txt +++ b/tests/TestCases/Expression/Conditional/Baseline.txt @@ -1,21 +1,29 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var b = (!arg) ? true : false; - b = (!arg) ? true : false; - var n = (!arg) ? --arg : ++arg; - n = (!arg) ? ((b) ? 10 : (arg - 1)) : 100; - var s = (n > 50) ? 'xyz' : 'abc'; - var l = (s != null) ? s.length : 'Hello'.length; + var b = (!arg) ? true : false; + b = (!arg) ? true : false; + var n = (!arg) ? --arg : ++arg; + n = (!arg) ? ((b) ? 10 : (arg - 1)) : 100; + var s = (n > 50) ? 'xyz' : 'abc'; + var l = (s != null) ? s.length : 'Hello'.length; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Conditional/Code.cs b/tests/TestCases/Expression/Conditional/Code.cs index 3a70a591b..fda55b7b6 100644 --- a/tests/TestCases/Expression/Conditional/Code.cs +++ b/tests/TestCases/Expression/Conditional/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Date/Baseline.txt b/tests/TestCases/Expression/Date/Baseline.txt new file mode 100644 index 000000000..b05e61462 --- /dev/null +++ b/tests/TestCases/Expression/Date/Baseline.txt @@ -0,0 +1,38 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.App + + function App() { + } + var App$ = { + equality: function() { + var d1 = null; + var d2 = null; + if (ss.compareDates(d1, d2)) { + } + if (!ss.compareDates(d1, d2)) { + } + if (ss.compareDates(d1, ss.now())) { + } + if (!ss.compareDates(d1, new Date())) { + } + var o; + if (d1 === o) { + } + if (d1 !== o) { + } + } + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Expression/Date/Code.cs b/tests/TestCases/Expression/Date/Code.cs new file mode 100644 index 000000000..02ee4dfe8 --- /dev/null +++ b/tests/TestCases/Expression/Date/Code.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + +namespace ExpressionTests { + + public class App { + + public void Equality() { + Date d1 = null; + Date d2 = null; + + if (d1 == d2) { + } + if (d1 != d2) { + } + + if (d1 == Date.Now) { + } + if (d1 != new Date()) { + } + + object o; + if (d1 == o) { + } + if (d1 != o) { + } + } + } +} diff --git a/tests/TestCases/Expression/Delegates/Baseline.txt b/tests/TestCases/Expression/Delegates/Baseline.txt index 55cd0eb8b..e9a027e26 100644 --- a/tests/TestCases/Expression/Delegates/Baseline.txt +++ b/tests/TestCases/Expression/Delegates/Baseline.txt @@ -1,54 +1,68 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.EventArgs +define('test', ['ss'], function(ss) { + var $global = this; -test.EventArgs = function() { -} + // ExpressionTests.EventArgs + function EventArgs() { + } + var EventArgs$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.SomeClass + }; -test.SomeClass = function(handler) { -} + // ExpressionTests.SomeClass -//////////////////////////////////////////////////////////////////////////////// -// test.Test + function SomeClass(handler) { + } + var SomeClass$ = { -test.Test = function() { - this._handler = ss.Delegate.create(this, this.onEvent); - this._handler = ss.Delegate.create(this, this.onEvent); - this._handler = ss.Delegate.create(this, this.onEvent); - this._handler = test.Test2.onGlobalEvent; - var s1 = new test.SomeClass(ss.Delegate.create(this, this.onEvent)); - var s2 = new test.SomeClass(this._handler); -} -test.Test.prototype = { - _handler: null, - + }; + + + // ExpressionTests.Test + + function Test() { + this._handler = ss.bind('onEvent', this); + this._handler = ss.bind('onEvent', this); + this._handler = ss.bind('onEvent', this); + this._handler = Test2.onGlobalEvent; + var s1 = new SomeClass(ss.bind('onEvent', this)); + var s2 = new SomeClass(this._handler); + var e = ss.bindExport(this._handler); + e.dispose(); + } + var Test$ = { doStuff: function() { - if (this._handler != null) { - this._handler(this, null); - } + if (this._handler != null) { + this._handler(this, null); + } }, - onEvent: function(sender, e) { } -} + }; + + + // ExpressionTests.Test2 + + function Test2() { + } + Test2.onGlobalEvent = function(sender, e) { + }; + var Test2$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Test2 -test.Test2 = function() { -} -test.Test2.onGlobalEvent = function(sender, e) { -} + var $exports = ss.module('test', null, + { + EventArgs: [ EventArgs, EventArgs$, null ], + SomeClass: [ SomeClass, SomeClass$, null ], + Test: [ Test, Test$, null ], + Test2: [ Test2, Test2$, null ] + }); -test.EventArgs.registerClass('test.EventArgs'); -test.SomeClass.registerClass('test.SomeClass'); -test.Test.registerClass('test.Test'); -test.Test2.registerClass('test.Test2'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Delegates/Code.cs b/tests/TestCases/Expression/Delegates/Code.cs index 0eaf59565..4c1e70576 100644 --- a/tests/TestCases/Expression/Delegates/Code.cs +++ b/tests/TestCases/Expression/Delegates/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -31,6 +30,9 @@ public Test() { SomeClass s1 = new SomeClass(OnEvent); SomeClass s2 = new SomeClass(_handler); + + Export e = Delegate.Export(_handler); + e.Dispose(); } public void DoStuff() { diff --git a/tests/TestCases/Expression/Dictionary/Baseline.txt b/tests/TestCases/Expression/Dictionary/Baseline.txt index 02ed22509..905b18c97 100644 --- a/tests/TestCases/Expression/Dictionary/Baseline.txt +++ b/tests/TestCases/Expression/Dictionary/Baseline.txt @@ -1,51 +1,61 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { getData: function() { - return null; + return null; }, - getData2: function() { - return null; + return null; }, - test: function(arg) { - var dictionary1 = {}; - var dictionary2 = { xyz: 1, abc: new test.App(), 'delete': 2, 'test.': 3, '\t': 4 }; + var dictionary1 = {}; + var dictionary2 = { xyz: 1, abc: new App(), 'delete': 2, 'test.': 3, '\t': 4 }; }, - test2: function(arg) { - var dictionary1 = { aaa: 123, xyz: true }; - var key = 'blah'; - var c = Object.getKeyCount(dictionary1); - var c2 = Object.getKeyCount(this.getData()); - var b = Object.keyExists(dictionary1, 'aaa'); - delete dictionary1.aaa; - delete dictionary1['Proxy-Connection']; - delete dictionary1[key]; - Object.clearKeys(dictionary1); - var keys = Object.keys(dictionary1); + var dictionary1 = { aaa: 123, xyz: true }; + var key = 'blah'; + var c = ss.keyCount(dictionary1); + var c2 = ss.keyCount(this.getData()); + var b = ss.keyExists(dictionary1, 'aaa'); + delete dictionary1.aaa; + delete dictionary1['Proxy-Connection']; + delete dictionary1[key]; + ss.clearKeys(dictionary1); + var keys = ss.keys(dictionary1); }, - test3: function(arg) { - var dictionary1 = { aaa: 123, xyz: true }; - var key = 'blah'; - var c = Object.getKeyCount(dictionary1); - var c2 = Object.getKeyCount(this.getData2()); - var b = Object.keyExists(dictionary1, 'aaa'); - delete dictionary1.aaa; - delete dictionary1['Proxy-Connection']; - delete dictionary1[key]; - Object.clearKeys(dictionary1); - var keys = Object.keys(dictionary1); + var dictionary1 = { aaa: 123, xyz: true }; + var key = 'blah'; + var c = ss.keyCount(dictionary1); + var c2 = ss.keyCount(this.getData2()); + var b = ss.keyExists(dictionary1, 'aaa'); + delete dictionary1.aaa; + delete dictionary1['Proxy-Connection']; + delete dictionary1[key]; + ss.clearKeys(dictionary1); + var keys = ss.keys(dictionary1); + }, + test4: function(arg) { + var d1 = {}; + d1[1] = d1[arg] = 'aaa'; + delete d1[1]; + delete d1[arg]; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Dictionary/Code.cs b/tests/TestCases/Expression/Dictionary/Code.cs index 73551bfa5..c7393e9fa 100644 --- a/tests/TestCases/Expression/Dictionary/Code.cs +++ b/tests/TestCases/Expression/Dictionary/Code.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -58,5 +57,12 @@ public void Test3(int arg) { string[] keys = dictionary1.Keys; } + + public void Test4(int arg) { + Dictionary d1 = new Dictionary(); + d1[1] = d1[arg] = "aaa"; + d1.Remove(1); + d1.Remove(arg); + } } } diff --git a/tests/TestCases/Expression/EnumToString/Code1.cs b/tests/TestCases/Expression/EnumToString/Code1.cs index a420c7245..6ddc8c246 100644 --- a/tests/TestCases/Expression/EnumToString/Code1.cs +++ b/tests/TestCases/Expression/EnumToString/Code1.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -10,7 +9,7 @@ enum Mode { A = 0, B = 1 } public enum Color { Red = 1, Green = 2, Blue = 3 } - [NamedValues] + [ScriptConstants(UseNames = true)] public enum State { Starting = 1, Running = 2, diff --git a/tests/TestCases/Expression/EnumToString/Code2.cs b/tests/TestCases/Expression/EnumToString/Code2.cs index a6c7de2ff..a77a82391 100644 --- a/tests/TestCases/Expression/EnumToString/Code2.cs +++ b/tests/TestCases/Expression/EnumToString/Code2.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -10,7 +9,7 @@ enum Mode { A = 0, B = 1 } enum Color { Red = 1, Green = 2, Blue = 3 } - [NamedValues] + [ScriptConstants(UseNames = true)] enum State { Starting = 1, Running = 2, diff --git a/tests/TestCases/Expression/EnumToString/MinBaseline.txt b/tests/TestCases/Expression/EnumToString/MinBaseline.txt index 1c048ddc4..834d6f228 100644 --- a/tests/TestCases/Expression/EnumToString/MinBaseline.txt +++ b/tests/TestCases/Expression/EnumToString/MinBaseline.txt @@ -1,23 +1,33 @@ -Type.registerNamespace('test'); +"use strict"; -test.App = function() { -} -test.App.prototype = { - +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var $0 = (0).toString(); - var $1 = (2).toString(); - var $2 = '$0'; - var $3 = (0).toString(); + var s1 = (0).toString(); + var s2 = (2).toString(); + var s3 = 'starting'; + var s4 = (0).toString(); }, - - $0: function($p0, $p1, $p2, $p3) { - var $0 = $p0.toString(); - var $1 = $p1.toString(); - var $2 = $p2; - var $3 = $p3.toString(); + $0: function(m, c, s, t) { + var mstr = m.toString(); + var cstr = c.toString(); + var sstr = s; + var tstr = t.toString(); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/EnumToString/NormalBaseline.txt b/tests/TestCases/Expression/EnumToString/NormalBaseline.txt index 2126c3d9f..b6e25ae0a 100644 --- a/tests/TestCases/Expression/EnumToString/NormalBaseline.txt +++ b/tests/TestCases/Expression/EnumToString/NormalBaseline.txt @@ -1,63 +1,54 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Color +define('test', ['ss'], function(ss) { + var $global = this; -test.Color = function() { }; -test.Color.prototype = { + // ExpressionTests.Color + + var Color = { red: 1, green: 2, blue: 3 -} -test.Color.registerEnum('test.Color', false); - - -//////////////////////////////////////////////////////////////////////////////// -// test.State + }; -test.State = function() { }; -test.State.prototype = { - starting: 'starting', - running: 'running', - completed: 'completed' -} -test.State.registerEnum('test.State', false); + // ExpressionTests.Types -//////////////////////////////////////////////////////////////////////////////// -// test.Types - -test.Types = function() { }; -test.Types.prototype = { + var Types = { none: 0, type1: 1, type2: 2, type3: 4 -} -test.Types.registerEnum('test.Types', true); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // ExpressionTests.App -test.App = function() { -} -test.App.prototype = { - + function App() { + } + var App$ = { test: function(arg) { - var s1 = (0).toString(); - var s2 = (2).toString(); - var s3 = 'starting'; - var s4 = (0).toString(); + var s1 = (0).toString(); + var s2 = (2).toString(); + var s3 = 'starting'; + var s4 = (0).toString(); }, - - display: function(m, c, s, t) { - var mstr = m.toString(); - var cstr = c.toString(); - var sstr = s; - var tstr = t.toString(); + _display: function(m, c, s, t) { + var mstr = m.toString(); + var cstr = c.toString(); + var sstr = s; + var tstr = t.toString(); } -} + }; + + + var $exports = ss.module('test', null, + { + Color: Color, + Types: Types, + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Events/Baseline.txt b/tests/TestCases/Expression/Events/Baseline.txt index be1954b23..e80702901 100644 --- a/tests/TestCases/Expression/Events/Baseline.txt +++ b/tests/TestCases/Expression/Events/Baseline.txt @@ -1,100 +1,99 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.FooEventArgs +define('test', ['ss'], function(ss) { + var $global = this; -test.FooEventArgs = function() { - test.FooEventArgs.initializeBase(this); -} + // ExpressionTests.Button - -//////////////////////////////////////////////////////////////////////////////// -// test.Button - -test.Button = function() { -} -test.Button.add_test = function(value) { - test.Button.__test = ss.Delegate.combine(test.Button.__test, value); -} -test.Button.remove_test = function(value) { - test.Button.__test = ss.Delegate.remove(test.Button.__test, value); -} -test.Button.prototype = { - _aaa: null, - _bbb: null, - + function Button() { + } + Button.add_test = function(value) { + Button.__test = ss.bindAdd(Button.__test, value); + }; + Button.remove_test = function(value) { + Button.__test = ss.bindSub(Button.__test, value); + }; + var Button$ = { add_click: function(value) { - this.__click = ss.Delegate.combine(this.__click, value); + this.__click = ss.bindAdd(this.__click, value); }, remove_click: function(value) { - this.__click = ss.Delegate.remove(this.__click, value); + this.__click = ss.bindSub(this.__click, value); }, - - __click: null, - add_aaa: function(value) { - if (this._aaa == null) { - this._aaa = value; - } - else { - this._aaa = ss.Delegate.combine(this._aaa, value); - } + if (this._aaa == null) { + this._aaa = value; + } + else { + this._aaa = ss.bindAdd(this._aaa, value); + } }, remove_aaa: function(value) { - this._aaa = ss.Delegate.remove(this._aaa, value); + this._aaa = ss.bindSub(this._aaa, value); }, - add_bbb: function(value) { - if (this._bbb == null) { - this._bbb = value; - } - else { - this._bbb = ss.Delegate.combine(this._bbb, value); - } + if (this._bbb == null) { + this._bbb = value; + } + else { + this._bbb = ss.bindAdd(this._bbb, value); + } }, remove_bbb: function(value) { - this._bbb = ss.Delegate.remove(this._bbb, value); + this._bbb = ss.bindSub(this._bbb, value); } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // ExpressionTests.App -test.App = function() { - this._btn.add_click(ss.Delegate.create(this, this.onClickButton)); - this._btn.add_click(ss.Delegate.create(this, this.onClickButton)); - this._btn.add_click(ss.Delegate.create(this, this.onClickButton)); - this._btn.remove_click(ss.Delegate.create(this, this.onClickButton)); - this._btn.remove_click(ss.Delegate.create(this, this.onClickButton)); - this._btn.remove_click(ss.Delegate.create(this, this.onClickButton)); - test.Button.add_test(test.App.onTestButton); - test.Button.add_test(test.App.onTestButton); - test.Button.add_test(test.App.onTestButton); - test.Button.remove_test(test.App.onTestButton); - test.Button.remove_test(test.App.onTestButton); - test.Button.remove_test(test.App.onTestButton); - this._btn.add_aaa(ss.Delegate.create(this, this.onAAAButton)); - this._btn.add_aaa(ss.Delegate.create(this, this.onAAAButton)); - this._btn.add_aaa(ss.Delegate.create(this, this.onAAAButton)); - this._btn.remove_aaa(ss.Delegate.create(this, this.onAAAButton)); - this._btn.remove_aaa(ss.Delegate.create(this, this.onAAAButton)); - this._btn.remove_aaa(ss.Delegate.create(this, this.onAAAButton)); -} -test.App.onTestButton = function(sender, e) { -} -test.App.prototype = { - _btn: null, - - onAAAButton: function(sender, e) { + function App() { + this._btn.add_click(ss.bind('_onClickButton', this)); + this._btn.add_click(ss.bind('_onClickButton', this)); + this._btn.add_click(ss.bind('_onClickButton', this)); + this._btn.remove_click(ss.bind('_onClickButton', this)); + this._btn.remove_click(ss.bind('_onClickButton', this)); + this._btn.remove_click(ss.bind('_onClickButton', this)); + Button.add_test(App._onTestButton); + Button.add_test(App._onTestButton); + Button.add_test(App._onTestButton); + Button.remove_test(App._onTestButton); + Button.remove_test(App._onTestButton); + Button.remove_test(App._onTestButton); + this._btn.add_aaa(ss.bind('_onAAAButton', this)); + this._btn.add_aaa(ss.bind('_onAAAButton', this)); + this._btn.add_aaa(ss.bind('_onAAAButton', this)); + this._btn.remove_aaa(ss.bind('_onAAAButton', this)); + this._btn.remove_aaa(ss.bind('_onAAAButton', this)); + this._btn.remove_aaa(ss.bind('_onAAAButton', this)); + } + App._onTestButton = function(sender, e) { + }; + var App$ = { + _onAAAButton: function(sender, e) { }, - - onClickButton: function(sender, e) { + _onClickButton: function(sender, e) { } -} + }; + + + // ExpressionTests.FooEventArgs + + function FooEventArgs() { + ss.EventArgs.call(this); + } + var FooEventArgs$ = { + + }; + + + var $exports = ss.module('test', null, + { + Button: [ Button, Button$, null ], + App: [ App, App$, null ], + FooEventArgs: [ FooEventArgs, FooEventArgs$, ss.EventArgs ] + }); -test.FooEventArgs.registerClass('test.FooEventArgs', ss.EventArgs); -test.Button.registerClass('test.Button'); -test.App.registerClass('test.App'); -test.Button.__test = null; + return $exports; +}); diff --git a/tests/TestCases/Expression/Events/Code.cs b/tests/TestCases/Expression/Events/Code.cs index 0c439c4c6..3e18a09df 100644 --- a/tests/TestCases/Expression/Events/Code.cs +++ b/tests/TestCases/Expression/Events/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/ExtensionMethods/Baseline.txt b/tests/TestCases/Expression/ExtensionMethods/Baseline.txt new file mode 100644 index 000000000..b0bb72f1a --- /dev/null +++ b/tests/TestCases/Expression/ExtensionMethods/Baseline.txt @@ -0,0 +1,32 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.App + + function App() { + } + var App$ = { + test: function(arg) { + eval('[ 1, 2 ]'); + $global.foo(); + setTimeout($global.foo, 0); + } + }; + + + // ExpressionTests.Util + + $global.foo = function() { + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Expression/GlobalMethods/Code.cs b/tests/TestCases/Expression/ExtensionMethods/Code.cs similarity index 87% rename from tests/TestCases/Expression/GlobalMethods/Code.cs rename to tests/TestCases/Expression/ExtensionMethods/Code.cs index c6b5e47ba..8332e153a 100644 --- a/tests/TestCases/Expression/GlobalMethods/Code.cs +++ b/tests/TestCases/Expression/ExtensionMethods/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -15,7 +14,7 @@ public void Test(int arg) { } } - [GlobalMethods] + [ScriptExtension("$global")] public static class Util { public static void Foo() { diff --git a/tests/TestCases/Expression/Generics/Baseline.txt b/tests/TestCases/Expression/Generics/Baseline.txt index dfc6b78b0..a4864a0d8 100644 --- a/tests/TestCases/Expression/Generics/Baseline.txt +++ b/tests/TestCases/Expression/Generics/Baseline.txt @@ -1,50 +1,53 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Foo +define('test', ['ss', 'jquery'], function(ss, $) { + var $global = this; -test.Foo = function() { + // ExpressionTests.Foo + + function Foo() { this._numbers = []; - var s = this._numbers[10].format('{0}'); - var s2 = this._numbers.getEnumerator().current.format('{0}'); + var s = this._numbers[10].toString(10); + var s2 = ss.enumerate(this._numbers).current.toString(10); var s3 = this._numbers.reduce(function(accumulated, item) { - return accumulated + item; - }, 0).format('{0}'); + return accumulated + item; + }, 0).toString(10); var s4 = encodeURIComponent(this._func(10)); var f2 = this._func; - f2(11).trim(); + ss.trim(f2(11)); var d = {}; - var s5 = $.extend(d, d)['abc'].format('{0}'); - var keys = Object.getKeyCount(d); - var b = Object.keyExists(d, 'abc'); + var s5 = $.extend(d, d)['abc'].toString(10); + var keys = ss.keyCount(d); + var b = ss.keyExists(d, 'abc'); delete d.abc; - var $dict1 = d; - for (var $key2 in $dict1) { - var de = { key: $key2, value: $dict1[$key2] }; + for (var $key1 in d) { + var de = { key: $key1, value: d[$key1] }; } $.ajax('http://example.com').success(function(html) { - alert(html); + alert(html); }); var json = ''; var f = JSON.parse(json).setup().run().cleanup(); var name = document.getElementById('nameTB').value; -} -test.Foo.prototype = { - _numbers: null, - _func: null, - + } + var Foo$ = { cleanup: function() { - return this; + return this; }, - run: function() { - return this; + return this; }, - setup: function() { - return this; + return this; } -} + }; + + + var $exports = ss.module('test', null, + { + Foo: [ Foo, Foo$, null ] + }); -test.Foo.registerClass('test.Foo'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Generics/Code.cs b/tests/TestCases/Expression/Generics/Code.cs index df438a2a2..00512ddd1 100644 --- a/tests/TestCases/Expression/Generics/Code.cs +++ b/tests/TestCases/Expression/Generics/Code.cs @@ -6,7 +6,6 @@ using jQueryApi; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -18,9 +17,9 @@ public class Foo { public Foo() { _numbers = new List(); - string s = _numbers[10].Format("{0}"); - string s2 = _numbers.GetEnumerator().Current.Format("{0}"); - string s3 = _numbers.Reduce(delegate(int accumulated, int item) { return accumulated + item; }, 0).Format("{0}"); + string s = _numbers[10].ToString(10); + string s2 = _numbers.GetEnumerator().Current.ToString(10); + string s3 = _numbers.Reduce(delegate(int accumulated, int item) { return accumulated + item; }, 0).ToString(10); string s4 = _func(10).EncodeUriComponent(); @@ -28,7 +27,7 @@ public Foo() { f2(11).Trim(); Dictionary d = new Dictionary(); - string s5 = jQuery.ExtendDictionary(d, d)["abc"].Format("{0}"); + string s5 = jQuery.ExtendDictionary(d, d)["abc"].ToString(10); int keys = d.Count; bool b = d.ContainsKey("abc"); d.Remove("abc"); diff --git a/tests/TestCases/Expression/GetType/Baseline.txt b/tests/TestCases/Expression/GetType/Baseline.txt index 382bddf0c..0336236bf 100644 --- a/tests/TestCases/Expression/GetType/Baseline.txt +++ b/tests/TestCases/Expression/GetType/Baseline.txt @@ -1,22 +1,39 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - - get_foo: function() { - return 0; + // ExpressionTests.App + + function App() { + } + var App$ = { + get__foo: function() { + return 0; }, - test: function(x) { - var t = Type.getInstanceType(x); - var t2 = Type.getInstanceType(x.toString()); - var t3 = Type.getInstanceType(this.get_foo()); + var t = ss.typeOf(x); + var t2 = ss.typeOf(x.toString()); + var t3 = ss.typeOf(this.get__foo()); + var t4 = ss.type('String'); + var t5 = ss.type('test.Foo'); + var b1 = ss.canAssign((Object), App); + var b2 = ss.canAssign((ss.IDisposable), App); + var b3 = ss.canAssign(t, App); + var b4 = ss.instanceOf((App), new App()); + var b5 = ss.instanceOf((ss.IDisposable), new App()); + var b6 = ss.instanceOf(t, new App()); + var b7 = ss.isInterface(t) || ss.isClass(t); + var n = ss.typeName(t); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/GetType/Code.cs b/tests/TestCases/Expression/GetType/Code.cs index 3697cfa03..3c82444e2 100644 --- a/tests/TestCases/Expression/GetType/Code.cs +++ b/tests/TestCases/Expression/GetType/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -14,6 +13,21 @@ public void Test(object x) { Type t = x.GetType(); Type t2 = x.ToString().GetType(); Type t3 = Foo.GetType(); + + Type t4 = Type.GetType("String"); + Type t5 = Type.GetType("test.Foo"); + + bool b1 = typeof(Object).IsAssignableFrom(typeof(App)); + bool b2 = typeof(IDisposable).IsAssignableFrom(typeof(App)); + bool b3 = t.IsAssignableFrom(typeof(App)); + + bool b4 = typeof(App).IsInstanceOfType(new App()); + bool b5 = typeof(IDisposable).IsInstanceOfType(new App()); + bool b6 = t.IsInstanceOfType(new App()); + + bool b7 = Type.IsInterface(t) || Type.IsClass(t); + + string n = t.Name; } } } diff --git a/tests/TestCases/Expression/GlobalMethods/Baseline.txt b/tests/TestCases/Expression/GlobalMethods/Baseline.txt deleted file mode 100644 index 405080a19..000000000 --- a/tests/TestCases/Expression/GlobalMethods/Baseline.txt +++ /dev/null @@ -1,25 +0,0 @@ -Type.registerNamespace('test'); - -//////////////////////////////////////////////////////////////////////////////// -// test.App - -test.App = function() { -} -test.App.prototype = { - - test: function(arg) { - eval('[ 1, 2 ]'); - foo(); - setTimeout(foo, 0); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.Util - -window.foo = function() { -} - - -test.App.registerClass('test.App'); diff --git a/tests/TestCases/Expression/InlineScript/Baseline.txt b/tests/TestCases/Expression/InlineScript/Baseline.txt index 0de43d7db..937b0d70c 100644 --- a/tests/TestCases/Expression/InlineScript/Baseline.txt +++ b/tests/TestCases/Expression/InlineScript/Baseline.txt @@ -1,21 +1,29 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - arg + 1; - var i = arg + 1; - var j = arg + 1; - var k = arg + 1; - var a = 10; - alert(a + a); + arg + 1; + var i = arg + 1; + var j = arg + 1; + var k = arg + 1; + var a = 10; + alert(a + a); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/InlineScript/Code.cs b/tests/TestCases/Expression/InlineScript/Code.cs index ccaee7a64..886ecdd29 100644 --- a/tests/TestCases/Expression/InlineScript/Code.cs +++ b/tests/TestCases/Expression/InlineScript/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/LateBound/Baseline.txt b/tests/TestCases/Expression/LateBound/Baseline.txt index 8ade21051..7269be60d 100644 --- a/tests/TestCases/Expression/LateBound/Baseline.txt +++ b/tests/TestCases/Expression/LateBound/Baseline.txt @@ -1,44 +1,52 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var o; - var b; - o[arg](); - o.xyz(); - o['Proxy-Connection'](); - o.xyz(0); - o.xyz(0, arg); - b = (typeof(o[arg]) === 'function'); - b = (typeof(o.xyz) === 'function'); - b = (typeof(Object.xyz) === 'function'); - o[arg] = 0; - o.abc = 0; - o['Proxy-Connection'] = 0; - var v = o[arg]; - v = o.abc; - v = o['Proxy-Connection']; - b = (arg in o); - b = ('abc' in o); - b = ('abc' in Object); - delete o.xyz; - delete o['Proxy-Connection']; - delete o[arg]; - var t = typeof(o); - if (typeof(o) === 'object') { - } - if ((typeof(o.execute) === 'function')) { - } - globalMethod(); - globalMethod('xyz'); + var o; + var b; + o[arg](); + o.xyz(); + o['Proxy-Connection'](); + o.xyz(0); + o.xyz(0, arg); + b = (typeof(o[arg]) === 'function'); + b = (typeof(o.xyz) === 'function'); + b = (typeof(Object.xyz) === 'function'); + o[arg] = 0; + o.abc = 0; + o['Proxy-Connection'] = 0; + var v = o[arg]; + v = o.abc; + v = o['Proxy-Connection']; + b = (arg in o); + b = ('abc' in o); + b = ('abc' in Object); + delete o.xyz; + delete o['Proxy-Connection']; + delete o[arg]; + var t = typeof(o); + if (typeof(o) === 'object') { + } + if ((typeof(o.execute) === 'function')) { + } + globalMethod(); + globalMethod('xyz'); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/LateBound/Code.cs b/tests/TestCases/Expression/LateBound/Code.cs index adb7b25a7..9cead415e 100644 --- a/tests/TestCases/Expression/LateBound/Code.cs +++ b/tests/TestCases/Expression/LateBound/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Literals/Baseline.txt b/tests/TestCases/Expression/Literals/Baseline.txt index 619e4cb34..4b322f9e4 100644 --- a/tests/TestCases/Expression/Literals/Baseline.txt +++ b/tests/TestCases/Expression/Literals/Baseline.txt @@ -1,40 +1,48 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var i = 0; - i = -1; - i = 1; - i = 1000000; - var n = 10000; - var f = 1; - var d = 1.01; - var d2 = 0.5; - var d3 = -0.5; - var b = true; - b = false; - var ch = '\n'; - ch = 'a'; - var s = 'Hello'; - var s2 = 'Hello\r\n'; - var s3 = 'abc' + '123'; - var s4 = "abc\"def'xyz"; - var s5 = 'abc\u00a9'; - var s6 = "abc'xyz"; - var s7 = 'abc"xyz'; - var t = test.App; - var t2 = Number; - var t3 = Number; - var t4 = Object; - var items = [ 1, 2, 3 ]; + var i = 0; + i = -1; + i = 1; + i = 1000000; + var n = 10000; + var f = 1; + var d = 1.01; + var d2 = 0.5; + var d3 = -0.5; + var b = true; + b = false; + var ch = '\n'; + ch = 'a'; + var s = 'Hello'; + var s2 = 'Hello\r\n'; + var s3 = 'abc' + '123'; + var s4 = "abc\"def'xyz"; + var s5 = 'abc\u00a9'; + var s6 = "abc'xyz"; + var s7 = 'abc"xyz'; + var t = App; + var t2 = Number; + var t3 = Number; + var t4 = Object; + var items = [ 1, 2, 3 ]; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Literals/Code.cs b/tests/TestCases/Expression/Literals/Code.cs index d66b6d1ce..dc7e1cbd7 100644 --- a/tests/TestCases/Expression/Literals/Code.cs +++ b/tests/TestCases/Expression/Literals/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Locals/Baseline.txt b/tests/TestCases/Expression/Locals/Baseline.txt index e1c82be80..978796200 100644 --- a/tests/TestCases/Expression/Locals/Baseline.txt +++ b/tests/TestCases/Expression/Locals/Baseline.txt @@ -1,31 +1,38 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var x; - var i = x.length; - while (i >= 0) { - var x2 = x.substring(0); - for (var j = 0; j < 1; j++) { - } - var j = x2; - i = j.length; - } - while (i >= 0) { - var x2 = '...'; + var x; + var i = x.length; + while (i >= 0) { + var x2 = x.substring(0); + for (var j = 0; j < 1; j++) { } + var j = x2; + i = j.length; + } + while (i >= 0) { + var x2 = '...'; + } }, - test2: function(arg1, arg2) { - arg2 = arg1; + arg2 = arg1; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Locals/Code.cs b/tests/TestCases/Expression/Locals/Code.cs index 36f783c66..8356d8e2a 100644 --- a/tests/TestCases/Expression/Locals/Code.cs +++ b/tests/TestCases/Expression/Locals/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Members/Baseline.txt b/tests/TestCases/Expression/Members/Baseline.txt index 1cab1c449..322c8d28e 100644 --- a/tests/TestCases/Expression/Members/Baseline.txt +++ b/tests/TestCases/Expression/Members/Baseline.txt @@ -1,108 +1,112 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.IFoo +define('test', ['ss'], function(ss) { + var $global = this; -test.IFoo = function() { }; -test.IFoo.registerInterface('test.IFoo'); + // ExpressionTests.IFoo + function IFoo() { } -//////////////////////////////////////////////////////////////////////////////// -// test.BApp -test.BApp = function() { -} + // ExpressionTests.BApp + function BApp() { + } + var BApp$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.App + }; -test.App = function() { - test.App.initializeBase(this); -} -test.App.prototype = { - _value: 0, - _value2: 0, - + + // ExpressionTests.App + + function App() { + this._value$1 = 0; + this._value2 = 0; + BApp.call(this); + } + var App$ = { get_XYZ: function() { - return 1; + return 1; }, set_XYZ: function(value) { - return value; + return value; }, - test: function(arg) { - var s = ''; - var n = s.length; - var n2 = Number.MAX_VALUE; - var m = 0; - n = this.get_XYZ(); - n = this.get_XYZ(); - this.set_XYZ(n); - this.set_XYZ(n); - var a; - n = a.get_XYZ(); - a.set_XYZ(n); - n = this._value; - n = this._value; - this._value = n; - this._value = n; - n = test.App.myDefault; - n = test.App.myDefault; - n = 3; - n = 3; - n = 3; - n = 3; - n = 3; + var s = ''; + var n = s.length; + var n2 = Number.MAX_VALUE; + var m = 0; + n = this.get_XYZ(); + n = this.get_XYZ(); + this.set_XYZ(n); + this.set_XYZ(n); + var a; + n = a.get_XYZ(); + a.set_XYZ(n); + n = this._value$1; + n = this._value$1; + this._value$1 = n; + this._value$1 = n; + n = App._myDefault$1; + n = App._myDefault$1; + n = 3; + n = 3; + n = 3; + n = 3; + n = 3; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.DApp + // ExpressionTests.DApp -test.DApp = function() { - test.DApp.initializeBase(this); -} -test.DApp.prototype = { - + function DApp() { + App.call(this); + } + var DApp$ = { test2: function() { - var n = this.get_XYZ(); - n = this.get_XYZ(); - n = test.DApp.callBaseMethod(this, 'get_XYZ'); - this.set_XYZ(n); - this.set_XYZ(n); - test.DApp.callBaseMethod(this, 'set_XYZ', [ n ]); - this._value2 = n; - this._value2 = n; - this._value2 = n; - n = test.App.myDefault2; - n = test.App.myDefault2; - n = 3; - n = 3; - n = 3; - n = 3; - n = 3; - n = 3; + var n = this.get_XYZ(); + n = this.get_XYZ(); + n = App.prototype.get_XYZ.call(this); + this.set_XYZ(n); + this.set_XYZ(n); + App.prototype.set_XYZ.call(this, n); + this._value2 = n; + this._value2 = n; + this._value2 = n; + n = App.myDefault2; + n = App.myDefault2; + n = 3; + n = 3; + n = 3; + n = 3; + n = 3; + n = 3; }, - test3: function() { - var i = [ 1, 2 ]; - i[0] = 1; - i[1] = i[0]; - i[i[0]] = 20; + var i = [ 1, 2 ]; + i[0] = 1; + i[1] = i[0]; + i[i[0]] = 20; }, - test4: function(foo) { - foo.bar(); + foo.bar(); } -} + }; + + + var $exports = ss.module('test', null, + { + IFoo: [ IFoo ], + BApp: [ BApp, BApp$, null ], + App: [ App, App$, BApp ], + DApp: [ DApp, DApp$, App ] + }); + BApp.myConstant = 3; + App.myConstant2 = 3; + App._myDefault$1 = 1; + App.myDefault2 = 2; -test.BApp.registerClass('test.BApp'); -test.App.registerClass('test.App', test.BApp); -test.DApp.registerClass('test.DApp', test.App); -test.BApp.myConstant = 3; -test.App.myConstant2 = 3; -test.App.myDefault = 1; -test.App.myDefault2 = 2; + return $exports; +}); diff --git a/tests/TestCases/Expression/Members/Code.cs b/tests/TestCases/Expression/Members/Code.cs index a6eb46815..5efb6f374 100644 --- a/tests/TestCases/Expression/Members/Code.cs +++ b/tests/TestCases/Expression/Members/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -34,7 +33,7 @@ public void Test(int arg) { string s = String.Empty; int n = s.Length; - int n2 = Number.MAX_VALUE; + int n2 = Number.MaxValue; Mode m = Mode.A; n = XYZ; diff --git a/tests/TestCases/Expression/New/Baseline.txt b/tests/TestCases/Expression/New/Baseline.txt index b3353d230..5cb1a5607 100644 --- a/tests/TestCases/Expression/New/Baseline.txt +++ b/tests/TestCases/Expression/New/Baseline.txt @@ -1,39 +1,44 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Point +define('test', ['ss'], function(ss) { + var $global = this; -test.$create_Point = function(x, y) { - var $o = { }; - $o.x = x; - $o.y = y; + // ExpressionTests.Point + + function Point(x, y) { + var $o = {}; + $o._x = x; + $o._y = y; return $o; -} + } + + + // ExpressionTests.Foo + function Foo(i, j) { + } + var Foo$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.Foo + }; -test.Foo = function(i, j) { -} + // ExpressionTests.Bar -//////////////////////////////////////////////////////////////////////////////// -// test.Bar + function Bar(i, j, f) { + } + var Bar$ = { -test.Bar = function(i, j, f) { -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Test + // ExpressionTests.Test -test.Test = function() { -} -test.Test.main = function() { - var f = new test.Foo(0, 1); - var b = new test.Bar(0, 1, new test.Foo(0, 1)); - var t = new test.Test(); + function Test() { + } + Test.main = function() { + var f = new Foo(0, 1); + var b = new Bar(0, 1, new Foo(0, 1)); + var t = new Test(); var d = new Date('3/9/1976'); var items = []; var items2 = [ 1, 2 ]; @@ -44,19 +49,30 @@ test.Test.main = function() { var list3 = ['abc', 'def', 'ghi']; var list4 = [1, 2, 3]; var dates = [ new Date('1/1/2006'), new Date('1/1/2005') ]; - var p = test.$create_Point(0, 0); + var p = Point(0, 0); var cd = {}; var cd2 = { abc: 123, def: true }; - var o1 = new test.Test(); - var type1 = test.Foo; + var o1 = new Test(); + var type1 = Foo; var o2 = new type1(1, 2); - var o3 = new test.Bar(1, 2, o2); + var o3 = new Bar(1, 2, o2); var f1 = new Function("alert('hello');"); var f2 = new Function('s', 'alert(s);'); var f3 = new Function('greeting', 'name', "alert(greeting + ' ' + name + '!');"); -} + }; + var Test$ = { + + }; + + + var $exports = ss.module('test', null, + { + Point: Point, + Foo: [ Foo, Foo$, null ], + Bar: [ Bar, Bar$, null ], + Test: [ Test, Test$, null ] + }); -test.Foo.registerClass('test.Foo'); -test.Bar.registerClass('test.Bar'); -test.Test.registerClass('test.Test'); + return $exports; +}); diff --git a/tests/TestCases/Expression/New/Code.cs b/tests/TestCases/Expression/New/Code.cs index 53ffcc3a2..ffc7aa7bc 100644 --- a/tests/TestCases/Expression/New/Code.cs +++ b/tests/TestCases/Expression/New/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { @@ -19,7 +18,8 @@ public Bar(int i, int j, Foo f) { } } - public sealed class Point : Record { + [ScriptObject] + public sealed class Point { int x; int y; @@ -29,8 +29,8 @@ public Point(int x, int y) { } } - [Imported] - [IgnoreNamespace] + [ScriptImport] + [ScriptIgnoreNamespace] [ScriptName("Object")] public class CustomDictionary { diff --git a/tests/TestCases/Expression/Number/Baseline.txt b/tests/TestCases/Expression/Number/Baseline.txt index a5e215886..08cbeb142 100644 --- a/tests/TestCases/Expression/Number/Baseline.txt +++ b/tests/TestCases/Expression/Number/Baseline.txt @@ -1,19 +1,27 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var i = parseInt('5'); - var f = parseFloat('5.3'); - var b1 = isNaN(0); - var b2 = isFinite(3); + var i = parseInt('5'); + var f = parseFloat('5.3'); + var b1 = isNaN(0); + var b2 = isFinite(3); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Number/Code.cs b/tests/TestCases/Expression/Number/Code.cs index 671b6e034..d3ab65c94 100644 --- a/tests/TestCases/Expression/Number/Code.cs +++ b/tests/TestCases/Expression/Number/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Script/Baseline.txt b/tests/TestCases/Expression/Script/Baseline.txt index 388a101cb..05f51928e 100644 --- a/tests/TestCases/Expression/Script/Baseline.txt +++ b/tests/TestCases/Expression/Script/Baseline.txt @@ -1,19 +1,52 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - arg = (arg || 10); - arg = (arg || 10 || 100); - var s = (arg || 10).format('{0}'); - var b = !!arg; + arg = (arg || 10); + arg = (arg || 10 || 100); + var s = (arg || 10).toString(10); + var b = !!arg; + var sb = new ss.StringBuilder(); + sb = new ss.StringBuilder('aaa'); + var i; + var tick = function() { + i = 10; + }; + var cookie = setInterval(tick, 500); + clearInterval(cookie); + var isNotSet = !ss.isValue(i); + b = (i === null); + b = (i === undefined); + b = ss.isValue(i); + b = isNaN(0); + b = isFinite(3); + b = !!(0); + b = !!b; + b = !!(b && b); + b = !(1); + b = !(b && b); + var addition = eval('2 + 2'); + addition = 2 + 2; + addition = 2 + 3; + var g = $global; + var u = undefined; + var coreModule = ss.modules['ss']; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Script/Code.cs b/tests/TestCases/Expression/Script/Code.cs index f65f9111f..6e7ca1502 100644 --- a/tests/TestCases/Expression/Script/Code.cs +++ b/tests/TestCases/Expression/Script/Code.cs @@ -2,17 +2,48 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { public class App { public void Test(int arg) { - arg = Script.Value(arg, 10); - arg = Script.Value(arg, 10, 100); - string s = Script.Value(arg, 10).Format("{0}"); + arg = Script.Or(arg, 10); + arg = Script.Or(arg, 10, 100); + string s = Script.Or(arg, 10).ToString(10); bool b = Script.Boolean(arg); + + StringBuilder sb = (StringBuilder)Script.CreateInstance(typeof(StringBuilder)); + sb = (StringBuilder)Script.CreateInstance(typeof(StringBuilder), "aaa"); + + int i; + Action tick = delegate() { + i = 10; + }; + int cookie = Script.SetInterval(tick, 500); + Script.ClearInterval(cookie); + + bool isNotSet = Script.IsNullOrUndefined(i); + b = Script.IsNull(i); + b = Script.IsUndefined(i); + b = Script.IsValue(i); + b = Script.IsNaN(0); + b = Script.IsFinite(3); + b = Script.IsTruthy(0); + b = Script.IsTruthy(b); + b = Script.IsTruthy(b && b); + b = Script.IsFalsey(1); + b = Script.IsFalsey(b && b); + + int addition = (int)Script.Eval("2 + 2"); + + addition = (int)Script.Literal("2 + 2"); + addition = (int)Script.Literal("{0} + {1}", 2, 3); + + object g = Script.Global; + object u = Script.Undefined; + + object coreModule = Script.Modules["ss"]; } } } diff --git a/tests/TestCases/Expression/String/Baseline.txt b/tests/TestCases/Expression/String/Baseline.txt index 9db6e2f66..33c486c21 100644 --- a/tests/TestCases/Expression/String/Baseline.txt +++ b/tests/TestCases/Expression/String/Baseline.txt @@ -1,23 +1,31 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var s = 'Hello'; - var s2; - s2 = escape(s); - s = unescape(s2); - s2 = encodeURI(s); - s = decodeURI(s2); - s2 = encodeURIComponent(s); - s = decodeURIComponent(s2); + var s = 'Hello'; + var s2; + s2 = escape(s); + s = unescape(s2); + s2 = encodeURI(s); + s = decodeURI(s2); + s2 = encodeURIComponent(s); + s = decodeURIComponent(s2); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/String/Code.cs b/tests/TestCases/Expression/String/Code.cs index 89fd1daf2..d249513c6 100644 --- a/tests/TestCases/Expression/String/Code.cs +++ b/tests/TestCases/Expression/String/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Tasks/Baseline.txt b/tests/TestCases/Expression/Tasks/Baseline.txt new file mode 100644 index 000000000..2fe114b6c --- /dev/null +++ b/tests/TestCases/Expression/Tasks/Baseline.txt @@ -0,0 +1,26 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.Test + + function Test() { + var deferredObject = ss.deferred(); + var deferredNumber = ss.deferred(); + var availabledNumber = ss.deferred(10); + deferredNumber.reject(); + } + var Test$ = { + + }; + + + var $exports = ss.module('test', null, + { + Test: [ Test, Test$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Expression/Tasks/Code.cs b/tests/TestCases/Expression/Tasks/Code.cs new file mode 100644 index 000000000..c9dae4a2f --- /dev/null +++ b/tests/TestCases/Expression/Tasks/Code.cs @@ -0,0 +1,21 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading; + +[assembly: ScriptAssembly("test")] + +namespace ExpressionTests { + + public class Test { + + private EventHandler _handler; + + public Test() { + Deferred deferredObject = Deferred.Create(); + Deferred deferredNumber = Deferred.Create(); + Deferred availabledNumber = Deferred.Create(10); + + deferredNumber.Reject(); + } + } +} diff --git a/tests/TestCases/Expression/Truthy/Baseline.txt b/tests/TestCases/Expression/Truthy/Baseline.txt index a9c401c86..64c50fda3 100644 --- a/tests/TestCases/Expression/Truthy/Baseline.txt +++ b/tests/TestCases/Expression/Truthy/Baseline.txt @@ -1,64 +1,72 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // ExpressionTests.App + + function App() { + } + var App$ = { test: function(arg) { - var i; - var j; - var f; - var o; - var s; - if (!i) { - } - if (!!i) { - } - if (i === 1) { - } - if (i === j) { - } - if (!!s.length) { - } - if (!s) { - } - if (!!s) { - } - if (!s) { - } - if (!!s) { - } - if (!!f) { - } - if (!f) { - } - if (!f) { - } - if (!!f) { - } - if (f === f) { - } - if (o == null) { - } - if (o != null) { - } - if ((s + s) != null) { - } - if ((s + s) == null) { - } - if (!!(i % 2)) { - } - if (!(i % 2)) { - } - if (!(i % 2)) { - } - if (!i++) { - } + var i; + var j; + var f; + var o; + var s; + if (!i) { + } + if (!!i) { + } + if (i === 1) { + } + if (i === j) { + } + if (!!s.length) { + } + if (!s) { + } + if (!!s) { + } + if (!s) { + } + if (!!s) { + } + if (!!f) { + } + if (!f) { + } + if (!f) { + } + if (!!f) { + } + if (f === f) { + } + if (o == null) { + } + if (o != null) { + } + if ((s + s) != null) { + } + if ((s + s) == null) { + } + if (!!(i % 2)) { + } + if (!(i % 2)) { + } + if (!(i % 2)) { + } + if (!i++) { + } } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Truthy/Code.cs b/tests/TestCases/Expression/Truthy/Code.cs index 82958126a..5f56bc735 100644 --- a/tests/TestCases/Expression/Truthy/Code.cs +++ b/tests/TestCases/Expression/Truthy/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Expression/Tuples/Baseline.txt b/tests/TestCases/Expression/Tuples/Baseline.txt new file mode 100644 index 000000000..6bd5cdd9f --- /dev/null +++ b/tests/TestCases/Expression/Tuples/Baseline.txt @@ -0,0 +1,27 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // ExpressionTests.App + + function App() { + } + var App$ = { + test: function(arg) { + var t1 = { }; + var t2 = { item1: 1, item2: 2 }; + var t3 = { }; + var t4 = { item1: 1, item2: 22, item3: '333' }; + } + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Expression/Tuples/Code.cs b/tests/TestCases/Expression/Tuples/Code.cs new file mode 100644 index 000000000..85725fad4 --- /dev/null +++ b/tests/TestCases/Expression/Tuples/Code.cs @@ -0,0 +1,18 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + +namespace ExpressionTests { + + public class App { + + public void Test(int arg) { + Tuple t1 = new Tuple(); + Tuple t2 = new Tuple(1, 2); + + Tuple t3 = new Tuple(); + Tuple t4 = new Tuple(1, 22, "333"); + } + } +} diff --git a/tests/TestCases/Expression/Unary/Baseline.txt b/tests/TestCases/Expression/Unary/Baseline.txt index cbe26248b..d79bb4404 100644 --- a/tests/TestCases/Expression/Unary/Baseline.txt +++ b/tests/TestCases/Expression/Unary/Baseline.txt @@ -1,52 +1,58 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Data +define('test', ['ss'], function(ss) { + var $global = this; -test.Data = function() { -} -test.Data.prototype = { - _value: 0, - + // ExpressionTests.Data + + function Data() { + this._value = 0; + } + var Data$ = { get_value: function() { - return this._value; + return this._value; }, set_value: function(value) { - this._value = value; - return value; + this._value = value; + return value; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // ExpressionTests.App -test.App = function() { -} -test.App.prototype = { - + function App() { + } + var App$ = { test: function(arg) { - var xyz = ~arg; - var f = (!arg); - f = !f; - var m = arg; - m++; - var n = ++m; - m--; - n = --m; - n = -m; - n = m; - n = 1; - n = 1 + (2); - var s = (!f).toString(); - var num = 1.01; - s = (~num).toExponential(); - var d = new test.Data(); - d.set_value(d.get_value() + 1) - 1; - d.set_value(d.get_value() + 1); + var xyz = ~arg; + var f = (!arg); + f = !f; + var m = arg; + m++; + var n = ++m; + m--; + n = --m; + n = -m; + n = m; + n = 1; + n = 1 + (2); + var s = (!f).toString(); + var num = 1.01; + s = (~num).toExponential(); + var d = new Data(); + d.set_value(d.get_value() + 1) - 1; + d.set_value(d.get_value() + 1); } -} + }; + + + var $exports = ss.module('test', null, + { + Data: [ Data, Data$, null ], + App: [ App, App$, null ] + }); -test.Data.registerClass('test.Data'); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Expression/Unary/Code.cs b/tests/TestCases/Expression/Unary/Code.cs index d53553ce8..a86bf8113 100644 --- a/tests/TestCases/Expression/Unary/Code.cs +++ b/tests/TestCases/Expression/Unary/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ExpressionTests { diff --git a/tests/TestCases/Library/Node/Baseline.txt b/tests/TestCases/Library/Node/Baseline.txt new file mode 100644 index 000000000..f53bbd167 --- /dev/null +++ b/tests/TestCases/Library/Node/Baseline.txt @@ -0,0 +1,12 @@ +// app.js +// + +var ss = require('scriptsharp'), + http = require('http'); +var $global = this; + +http.createServer(function(request, response) { + response.writeHead(200, { 'Content-Type': 'text/html' }); + response.end('Hello Node World, from Script#!'); +}).listen((process.env['port'] || 8888)); + diff --git a/tests/TestCases/Library/Node/Code.cs b/tests/TestCases/Library/Node/Code.cs new file mode 100644 index 000000000..3a1b8641a --- /dev/null +++ b/tests/TestCases/Library/Node/Code.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi; +using NodeApi.Network; + +[assembly:ScriptAssembly("app")] +[assembly:ScriptTemplate(@" +// {name}.js +// + +{dependenciesLookup} +var $global = this; + +{script} +")] + +[ScriptModule] +internal static class App { + + static App() { + Http.CreateServer(delegate(HttpServerRequest request, HttpServerResponse response) { + response.WriteHead(HttpStatusCode.OK, + new Dictionary("Content-Type", "text/html")); + response.End("Hello Node World, from Script#!"); + }).Listen(Script.Or(Node.Process.Environment["port"], 8888)); + } +} diff --git a/tests/TestCases/Library/jQuery/Baseline.txt b/tests/TestCases/Library/jQuery/Baseline.txt index 79797f338..76ddc570f 100644 --- a/tests/TestCases/Library/jQuery/Baseline.txt +++ b/tests/TestCases/Library/jQuery/Baseline.txt @@ -1,39 +1,53 @@ -//////////////////////////////////////////////////////////////////////////////// -// MyApp +"use strict"; -window.MyApp = function MyApp() { -} -MyApp._alertData = function MyApp$_alertData(url) { +define('test', ['ss', 'jquery'], function(ss, $) { + var $global = this; + + // MyApp + + function MyApp() { + } + MyApp._alertData = function(url) { $.ajax({ url: url, type: 'GET', dataType: 'html', contentType: 'application/json', processData: false, success: function(result, textData, xhr) { - var s = xhr.responseText; - alert(s); - xyz(s); + var s = xhr.responseText; + alert(s); + xyz(s); }, error: function(xhr, textData, e) { - console.log(xhr.status); + console.log(xhr.status); } }); -} -MyApp.postData = function MyApp$postData(url, data, succesCallback, errorCallback, returnType, requestType) { - returnType = returnType || 'text'; - requestType = requestType || 'POST'; + }; + MyApp.postData = function(url, data, succesCallback, errorCallback, returnType, requestType) { + returnType = (returnType || 'text'); + requestType = (requestType || 'POST'); $.ajax({ cache: false, data: data, dataType: returnType, error: function(req, textStatus, error) { - if (!ss.isNullOrUndefined(errorCallback)) { - errorCallback(req, textStatus, error); - } + if (ss.isValue(errorCallback)) { + errorCallback(req, textStatus, error); + } }, success: function(dataSuccess, textStatus, request) { - if (ss.isNullOrUndefined(succesCallback)) { - $(document).append(dataSuccess); - } - else { - succesCallback(dataSuccess, textStatus, request); - } + if (!ss.isValue(succesCallback)) { + $(document).append(dataSuccess); + } + else { + succesCallback(dataSuccess, textStatus, request); + } }, type: requestType, url: url }); -} + }; + var MyApp$ = { + + }; -MyApp.registerClass('MyApp'); -(function () { + var $exports = ss.module('test', null, + { + MyApp: [ MyApp, MyApp$, null ] + }); + + (function() { $('div').addClass('foo'); $('span').addClass('bar').addClass('baz'); var o = $('.special').foo(); $('.special').html(''); -})(); + })(); + + return $exports; +}); diff --git a/tests/TestCases/Library/jQuery/Code.cs b/tests/TestCases/Library/jQuery/Code.cs index d8b662da0..46395d620 100644 --- a/tests/TestCases/Library/jQuery/Code.cs +++ b/tests/TestCases/Library/jQuery/Code.cs @@ -6,8 +6,8 @@ [assembly: ScriptAssembly("test")] -[Imported] -[IgnoreNamespace] +[ScriptImport] +[ScriptIgnoreNamespace] public class FooObject : jQueryObject { public FooObject Foo() { @@ -43,15 +43,15 @@ private static void AlertData(string url) { } public static void PostData(string url, object data, AjaxRequestCallback succesCallback, AjaxErrorCallback errorCallback, string returnType, string requestType) { - returnType = returnType ?? "text"; - requestType = requestType ?? "POST"; + returnType = Script.Or(returnType, "text"); + requestType = Script.Or(requestType, "POST"); jQuery.Ajax(new jQueryAjaxOptions( "cache", false, "data", data, "dataType", returnType, "error", (AjaxErrorCallback)delegate(jQueryXmlHttpRequest req, string textStatus, Exception error) { - if (!Script.IsNullOrUndefined(errorCallback)) + if (Script.IsValue(errorCallback)) errorCallback(req, textStatus, error); }, "success", (AjaxRequestCallback)delegate(object dataSuccess, string textStatus, jQueryXmlHttpRequest request) { diff --git a/tests/TestCases/Member/Constructors/Baseline.txt b/tests/TestCases/Member/Constructors/Baseline.txt index e2cf6043f..caeefae8c 100644 --- a/tests/TestCases/Member/Constructors/Baseline.txt +++ b/tests/TestCases/Member/Constructors/Baseline.txt @@ -1,43 +1,57 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass +define('test', ['ss'], function(ss) { + var $global = this; -test.MyClass = function() { + // MemberTests.MyClass + + function MyClass() { + this._value = 0; this._value = 1; -} -test.MyClass.prototype = { - _value: 0 -} + } + var MyClass$ = { + + }; + + + // MemberTests.MyClass2 + + function MyClass2() { + } + var MyClass2$ = { + + }; + + // MemberTests.MyClass3 -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass2 + function MyClass3(arg, arg2) { + } + var MyClass3$ = { -test.MyClass2 = function() { -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass3 + // MemberTests.MyClass4 -test.MyClass3 = function(arg, arg2) { -} + function MyClass4(arg, arg2, arg3) { + MyClass3.call(this, arg, arg2); + } + var MyClass4$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass4 -test.MyClass4 = function(arg, arg2, arg3) { - test.MyClass4.initializeBase(this, [ arg, arg2 ]); -} + var $exports = ss.module('test', null, + { + MyClass: [ MyClass, MyClass$, null ], + MyClass2: [ MyClass2, MyClass2$, null ], + MyClass3: [ MyClass3, MyClass3$, null ], + MyClass4: [ MyClass4, MyClass4$, MyClass3 ] + }); + MyClass2._x = 'Hello'; + MyClass3.c = new MyClass(); -test.MyClass.registerClass('test.MyClass'); -test.MyClass2.registerClass('test.MyClass2'); -test.MyClass3.registerClass('test.MyClass3'); -test.MyClass4.registerClass('test.MyClass4', test.MyClass3); -test.MyClass2.x = null; -test.MyClass2.x = 'Hello'; -test.MyClass3.c = null; -test.MyClass3.c = new test.MyClass(); + return $exports; +}); diff --git a/tests/TestCases/Member/Constructors/Code.cs b/tests/TestCases/Member/Constructors/Code.cs index 4e9a188eb..9d931183e 100644 --- a/tests/TestCases/Member/Constructors/Code.cs +++ b/tests/TestCases/Member/Constructors/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { diff --git a/tests/TestCases/Member/Events/Baseline.txt b/tests/TestCases/Member/Events/Baseline.txt index 797417702..90f8c7329 100644 --- a/tests/TestCases/Member/Events/Baseline.txt +++ b/tests/TestCases/Member/Events/Baseline.txt @@ -1,55 +1,59 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.EventArgs +define('test', ['ss'], function(ss) { + var $global = this; -test.EventArgs = function() { -} + // MemberTests.EventArgs + function EventArgs() { + } + var EventArgs$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.Button + }; -test.Button = function() { -} -test.Button.add_test = function(value) { - test.Button.__test = ss.Delegate.combine(test.Button.__test, value); -} -test.Button.remove_test = function(value) { - test.Button.__test = ss.Delegate.remove(test.Button.__test, value); -} -test.Button.prototype = { - _aaa: null, - + + // MemberTests.Button + + function Button() { + } + Button.add_test = function(value) { + Button.__test = ss.bindAdd(Button.__test, value); + }; + Button.remove_test = function(value) { + Button.__test = ss.bindSub(Button.__test, value); + }; + var Button$ = { add_click: function(value) { - this.__click = ss.Delegate.combine(this.__click, value); + this.__click = ss.bindAdd(this.__click, value); }, remove_click: function(value) { - this.__click = ss.Delegate.remove(this.__click, value); + this.__click = ss.bindSub(this.__click, value); }, - - __click: null, - add_aaa: function(value) { - if (this._aaa == null) { - this._aaa = value; - } - else { - this._aaa = ss.Delegate.combine(this._aaa, value); - } + if (this._aaa == null) { + this._aaa = value; + } + else { + this._aaa = ss.bindAdd(this._aaa, value); + } }, remove_aaa: function(value) { - this._aaa = ss.Delegate.remove(this._aaa, value); + this._aaa = ss.bindSub(this._aaa, value); }, - performClick: function() { - if (this.__click != null) { - this.__click(this, new test.EventArgs()); - } + if (this.__click != null) { + this.__click(this, new EventArgs()); + } } -} + }; + + + var $exports = ss.module('test', null, + { + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ] + }); -test.EventArgs.registerClass('test.EventArgs'); -test.Button.registerClass('test.Button'); -test.Button.__test = null; + return $exports; +}); diff --git a/tests/TestCases/Member/Events/Code.cs b/tests/TestCases/Member/Events/Code.cs index 6c041f3e4..7d77b6891 100644 --- a/tests/TestCases/Member/Events/Code.cs +++ b/tests/TestCases/Member/Events/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { diff --git a/tests/TestCases/Member/Fields/Baseline.txt b/tests/TestCases/Member/Fields/Baseline.txt index 1de533a92..9dc6fefcf 100644 --- a/tests/TestCases/Member/Fields/Baseline.txt +++ b/tests/TestCases/Member/Fields/Baseline.txt @@ -1,71 +1,78 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Mode +define('test', ['ss'], function(ss) { + var $global = this; -test.Mode = function() { }; -test.Mode.prototype = { + // MemberTests.Mode + + var Mode = { a: 0, b: 1 -} -test.Mode.registerEnum('test.Mode', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Point + // MemberTests.Point -test.$create_Point = function(x, y) { - var $o = { }; + function Point(x, y) { + var $o = {}; $o.x = x; $o.y = y; return $o; -} + } -//////////////////////////////////////////////////////////////////////////////// -// test.Test + // MemberTests.Test -test.Test = function() { + function Test() { + this._value = 0; + this._uintValue = 0; + this._dblValue = 0; + this._enumValue = 0; + this._boolValue = false; this._value = 2006; this.s = 'aaa'; this.s = 'bbb'; this.s = 'aaa'; -} -test.Test.prototype = { - _value: 0, - _uintValue: 0, - _dblValue: 0, - _enumValue: 0, - _boolValue: false, - s: null -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.App - -test.App = function() { - this._t = new test.Test(); -} -test.App.prototype = { - _i: 5, - + } + var Test$ = { + + }; + + + // MemberTests.App + + function App() { + this._t = new Test(); + this._i = 5; + } + var App$ = { doTest: function() { - var t = new test.Test(); - t.s = 'World'; - var i = 1; - test.Test.done = true; - var p = test.$create_Point(1, 10); - p.x = p.y; + var t = new Test(); + t.s = 'World'; + var i = 1; + Test.done = true; + var p = Point(1, 10); + p.x = p.y; } -} + }; + + + var $exports = ss.module('test', + { + Point: Point + }, + { + Mode: Mode, + Test: [ Test, Test$, null ], + App: [ App, App$, null ] + }); + Test.greeting = 'Hello!'; + Test.myNumber = 1; + Test.defaultValue = 'aaa'; + Test.done = false; + Test.XYZ = 1; + Test._key = {}; -test.Test.registerClass('test.Test'); -test.App.registerClass('test.App'); -test.Test.greeting = 'Hello!'; -test.Test.myNumber = 1; -test.Test.defaultValue = 'aaa'; -test.Test.done = false; -test.Test.XYZ = 1; -test.Test.key = {}; + return $exports; +}); diff --git a/tests/TestCases/Member/Fields/Code.cs b/tests/TestCases/Member/Fields/Code.cs index 945bc9b78..10e7299f4 100644 --- a/tests/TestCases/Member/Fields/Code.cs +++ b/tests/TestCases/Member/Fields/Code.cs @@ -2,14 +2,12 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { public enum Mode { A = 0, B = 1 }; public class Test { - public static readonly string Greeting = "Hello!"; public const int MyNumber = 1; @@ -36,7 +34,8 @@ public Test() { } } - internal sealed class Point : Record { + [ScriptObject] + internal sealed class Point { public int x; public int y; diff --git a/tests/TestCases/Member/Indexers/Baseline.txt b/tests/TestCases/Member/Indexers/Baseline.txt index d671d39ca..3c2065171 100644 --- a/tests/TestCases/Member/Indexers/Baseline.txt +++ b/tests/TestCases/Member/Indexers/Baseline.txt @@ -1,207 +1,210 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.IIndexable +define('test', ['ss'], function(ss) { + var $global = this; -test.IIndexable = function() { }; -test.IIndexable.registerInterface('test.IIndexable'); + // MemberTests.IIndexable + function IIndexable() { } -//////////////////////////////////////////////////////////////////////////////// -// test.Normal -test.Normal = function() { + // MemberTests.Normal + + function Normal() { + this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); -} -test.Normal.prototype = { - n: 0, + } + var Normal$ = { get_item: function(name) { - return this.n; + return this._n; }, set_item: function(name, value) { - this.n = value; - return value; + this._n = value; + return value; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.GetterOnly + // MemberTests.GetterOnly -test.GetterOnly = function() { + function GetterOnly() { + this._n = 0; var i = this.get_item('name'); -} -test.GetterOnly.prototype = { - n: 0, + } + var GetterOnly$ = { get_item: function(name) { - return this.n; + return this._n; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.VirtualIndexer + // MemberTests.VirtualIndexer -test.VirtualIndexer = function() { + function VirtualIndexer() { + this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); -} -test.VirtualIndexer.prototype = { - n: 0, + } + var VirtualIndexer$ = { get_item: function(name) { - return this.n; + return this._n; }, set_item: function(name, value) { - this.n = value; - return value; + this._n = value; + return value; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.OverriddenIndexer + // MemberTests.AbstractIndexer -test.OverriddenIndexer = function() { - test.OverriddenIndexer.initializeBase(this); + function AbstractIndexer() { + this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); - var j = test.OverriddenIndexer.callBaseMethod(this, 'get_item', [ 'name' ]); - test.OverriddenIndexer.callBaseMethod(this, 'set_item', [ 'name', 43 ]); -} -test.OverriddenIndexer.prototype = { - get_item: function(name) { - return test.OverriddenIndexer.callBaseMethod(this, 'get_item', [ name ]) + 1; - }, - set_item: function(name, value) { - test.OverriddenIndexer.callBaseMethod(this, 'set_item', [ name, value - 1 ]); - return value; - } -} + } + var AbstractIndexer$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.AbstractIndexer - -test.AbstractIndexer = function() { - var i = this.get_item('name'); - this.set_item('name', i + 1); -} -test.AbstractIndexer.prototype = { - n: 0, - -} + // MemberTests.MultipleArgs -//////////////////////////////////////////////////////////////////////////////// -// test.ImplementedIndexer - -test.ImplementedIndexer = function() { - test.ImplementedIndexer.initializeBase(this); - var i = this.get_item('name'); - this.set_item('name', i + 1); -} -test.ImplementedIndexer.prototype = { - n: 0, - -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.MultipleArgs - -test.MultipleArgs = function() { + function MultipleArgs() { + this._n = 0; var i = this.get_item('name', 'name2', 'name3'); this.set_item('name', 'name2', 'name3', i + 1); -} -test.MultipleArgs.prototype = { - n: 0, + } + var MultipleArgs$ = { get_item: function(first, middle, last) { - var value = first + middle + last; - return value.length; + var value = first + middle + last; + return value.length; }, set_item: function(first, middle, last, value) { - this.n = value; - return value; + this._n = value; + return value; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.ImplementedIndexer2 + // MemberTests.ImplementedIndexer2 -test.ImplementedIndexer2 = function() { -} -test.ImplementedIndexer2.prototype = { + function ImplementedIndexer2() { + } + var ImplementedIndexer2$ = { get_item: function(index) { - return 0; + return 0; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Test + // MemberTests.Test -test.Test = function() { - var ma = new test.MultipleArgs(); + function Test() { + var ma = new MultipleArgs(); ma.set_item('1', '2', '3', ma.get_item('3', '2', '1')); - var ii = new test.ImplementedIndexer(); + var ii = new ImplementedIndexer(); ii.set_item('big', ii.get_item('small')); var ai = ii; ai.set_item('small', ai.get_item('big')); - var indexable = new test.ImplementedIndexer2(); + var indexable = new ImplementedIndexer2(); var o = indexable.get_item(0); -} + } + var Test$ = { + + }; -//////////////////////////////////////////////////////////////////////////////// -// test.A + // MemberTests.A -test.A = function() { -} -test.A.prototype = { + function A() { + } + var A$ = { get_item: function(name) { - return name; + return name; } -} + }; + + + // MemberTests.OverriddenIndexer + + function OverriddenIndexer() { + VirtualIndexer.call(this); + var i = this.get_item('name'); + this.set_item('name', i + 1); + var j = VirtualIndexer.prototype.get_item.call(this, 'name'); + VirtualIndexer.prototype.set_item.call(this, 'name', 43); + } + var OverriddenIndexer$ = { + get_item: function(name) { + return VirtualIndexer.prototype.get_item.call(this, name) + 1; + }, + set_item: function(name, value) { + VirtualIndexer.prototype.set_item.call(this, name, value - 1); + return value; + } + }; + + + // MemberTests.ImplementedIndexer + + function ImplementedIndexer() { + this._n$1 = 0; + AbstractIndexer.call(this); + var i = this.get_item('name'); + this.set_item('name', i + 1); + } + var ImplementedIndexer$ = { + + }; + + // MemberTests.B -//////////////////////////////////////////////////////////////////////////////// -// test.B + function B() { + A.call(this); + } + var B$ = { -test.B = function() { - test.B.initializeBase(this); -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.C + // MemberTests.C -test.C = function() { - test.C.initializeBase(this); -} -test.C.main = function() { - var c = new test.C(); + function C() { + B.call(this); + } + C.main = function() { + var c = new C(); c.set_item('a', c.get_item('b')); var a = c; a.set_item('b', a.get_item('c')); -} -test.C.prototype = { + }; + var C$ = { get_item: function(name) { - return name; + return name; } -} - - -test.Normal.registerClass('test.Normal'); -test.GetterOnly.registerClass('test.GetterOnly'); -test.VirtualIndexer.registerClass('test.VirtualIndexer'); -test.OverriddenIndexer.registerClass('test.OverriddenIndexer', test.VirtualIndexer); -test.AbstractIndexer.registerClass('test.AbstractIndexer'); -test.ImplementedIndexer.registerClass('test.ImplementedIndexer', test.AbstractIndexer); -test.MultipleArgs.registerClass('test.MultipleArgs'); -test.ImplementedIndexer2.registerClass('test.ImplementedIndexer2', null, test.IIndexable); -test.Test.registerClass('test.Test'); -test.A.registerClass('test.A'); -test.B.registerClass('test.B', test.A); -test.C.registerClass('test.C', test.B); + }; + + + var $exports = ss.module('test', null, + { + IIndexable: [ IIndexable ], + Normal: [ Normal, Normal$, null ], + GetterOnly: [ GetterOnly, GetterOnly$, null ], + VirtualIndexer: [ VirtualIndexer, VirtualIndexer$, null ], + AbstractIndexer: [ AbstractIndexer, AbstractIndexer$, null ], + MultipleArgs: [ MultipleArgs, MultipleArgs$, null ], + ImplementedIndexer2: [ ImplementedIndexer2, ImplementedIndexer2$, null, IIndexable ], + Test: [ Test, Test$, null ], + A: [ A, A$, null ], + OverriddenIndexer: [ OverriddenIndexer, OverriddenIndexer$, VirtualIndexer ], + ImplementedIndexer: [ ImplementedIndexer, ImplementedIndexer$, AbstractIndexer ], + B: [ B, B$, A ], + C: [ C, C$, B ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Member/Indexers/Code.cs b/tests/TestCases/Member/Indexers/Code.cs index 4278413ba..daef6a951 100644 --- a/tests/TestCases/Member/Indexers/Code.cs +++ b/tests/TestCases/Member/Indexers/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { diff --git a/tests/TestCases/Member/Methods/Baseline.txt b/tests/TestCases/Member/Methods/Baseline.txt index 37ca16502..667984ff6 100644 --- a/tests/TestCases/Member/Methods/Baseline.txt +++ b/tests/TestCases/Member/Methods/Baseline.txt @@ -1,94 +1,75 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Test +define('test', ['ss'], function(ss) { + var $global = this; -test.Test = function() { -} -test.Test.prototype = { - + // MemberTests.Test + + function Test() { + } + var Test$ = { do1: function() { }, - do2: function() { - return 0; + return 0; }, - do3: function(i, j) { - return i; + return i; }, - run: function() { - this.do1(); - var v = this.do2(); - var s = String.fromCharCode(0); - s = String.fromCharCode(32, 65, 66); - var i = s.indexOf('A'); - i = s.indexOf('A', 1); + this.do1(); + var v = this.do2(); + var s = ss.string('A', 3); + var i = s.indexOf('A'); + i = s.indexOf('A', 1); }, - toString: function() { - window.m1(); - var x = new test.X(); - $.fn.extend(x, 10); - return null; + window.m1(); + var x = new X(); + $.fn.extend(x, 10); + return null; } -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.Foo - -window.doStuff = function() { -} - + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Bar -window.m1 = function() { -} -window.m2 = function() { -} + // MemberTests.Foo + $global.doStuff = function() { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.FooBar -window.doStuff2 = function() { -} + // MemberTests.Bar + window.m1 = function() { + }; + window.m2 = function() { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.FooBar2 + // MemberTests.X - -//////////////////////////////////////////////////////////////////////////////// -// test.X - -test.X = function() { -} -test.X.prototype = { - + function X() { + } + var X$ = { update: function(i) { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Plugin + // MemberTests.Plugin -$.fn.extend = function(x, i) { + $.fn.extend = function(x, i) { x.update(i); return x; -} + }; + + + var $exports = ss.module('test', null, + { + Test: [ Test, Test$, null ], + X: [ X, X$, null ] + }); -test.Test.registerClass('test.Test'); -test.X.registerClass('test.X'); -alert('Startup code in FooBar'); -(function () { - var timeStamp = new Date().getMilliseconds(); - alert('Startup code in FooBar: ' + timeStamp); -})(); + return $exports; +}); diff --git a/tests/TestCases/Member/Methods/Code.cs b/tests/TestCases/Member/Methods/Code.cs index 8f7c37b86..d7d740352 100644 --- a/tests/TestCases/Member/Methods/Code.cs +++ b/tests/TestCases/Member/Methods/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { @@ -24,8 +23,7 @@ public void Run() { Do1(); int v = Do2(); - string s = String.FromCharCode(0); - s = String.FromCharCode(32, 65, 66); + string s = String.FromChar('A', 3); int i = s.IndexOf('A'); i = s.IndexOf('A', 1); } @@ -42,14 +40,14 @@ public override string ToString() { } } - [GlobalMethods] + [ScriptExtension("$global")] public static class Foo { public static void DoStuff() { } } - [Mixin("window")] + [ScriptExtension("window")] public static class Bar { public static void M1() { @@ -59,32 +57,12 @@ public static void M2() { } } - [GlobalMethods] - public static class FooBar { - - static FooBar() { - Window.Alert("Startup code in FooBar"); - } - - public static void DoStuff2() { - } - } - - [GlobalMethods] - public static class FooBar2 { - - static FooBar2() { - int timeStamp = (new Date()).GetMilliseconds(); - Window.Alert("Startup code in FooBar: " + timeStamp); - } - } - public class X { public void Update(int i) { } } - [Mixin("$.fn")] + [ScriptExtension("$.fn")] public static class Plugin { public static X Extend(X x, int i) { diff --git a/tests/TestCases/Member/Overloads/Baseline.txt b/tests/TestCases/Member/Overloads/Baseline.txt index 2abc04b74..801c322a0 100644 --- a/tests/TestCases/Member/Overloads/Baseline.txt +++ b/tests/TestCases/Member/Overloads/Baseline.txt @@ -1,34 +1,44 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Test +define('test', ['ss'], function(ss) { + var $global = this; -test.Test = function(name) { -} -test.Test.doSomething = function(o) { -} -test.Test.prototype = { - + // MemberTests.Test + + function Test(name) { + } + Test.doSomething = function(o) { + }; + var Test$ = { invoke: function(successCallback, errorCallback, context) { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // MemberTests.App -test.App = function() { - test.Test.doSomething(); - test.Test.doSomething(null); - var t1 = new test.Test(); - var t2 = new test.Test('test'); + function App() { + Test.doSomething(); + Test.doSomething(null); + var t1 = new Test(); + var t2 = new Test('test'); var cb1 = null; var cb2 = null; t1.invoke(cb1); t1.invoke(cb1, cb2); t2.invoke(cb1, cb2, t1); -} + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + Test: [ Test, Test$, null ], + App: [ App, App$, null ] + }); -test.Test.registerClass('test.Test'); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Member/Overloads/Code.cs b/tests/TestCases/Member/Overloads/Code.cs index a45d93b1d..0dfddb534 100644 --- a/tests/TestCases/Member/Overloads/Code.cs +++ b/tests/TestCases/Member/Overloads/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { @@ -10,22 +9,18 @@ namespace MemberTests { public abstract class Test { - [AlternateSignature] public extern Test(); public Test(string name) { } - [AlternateSignature] public static extern void DoSomething(); public static void DoSomething(object o) { } - [AlternateSignature] public extern void Invoke(Callback successCallback); - [AlternateSignature] public extern void Invoke(Callback successCallback, Callback errorCallback); public void Invoke(Callback successCallback, Callback errorCallback, object context) { diff --git a/tests/TestCases/Member/Properties/Baseline.txt b/tests/TestCases/Member/Properties/Baseline.txt index dadd20526..88c797959 100644 --- a/tests/TestCases/Member/Properties/Baseline.txt +++ b/tests/TestCases/Member/Properties/Baseline.txt @@ -1,57 +1,64 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Test +define('test', ['ss'], function(ss) { + var $global = this; -test.Test = function() { + // MemberTests.Test + + function Test() { this.set_XYZ(1); this.set_XYZ(this.get_name().length); this.set_XYZ(this.get_name().length); - var v = test.Test.get_staticProp(); - v = test.Test.get_staticProp(); -} -test.Test.get_staticProp = function() { + var v = Test.get_staticProp(); + v = Test.get_staticProp(); + } + Test.get_staticProp = function() { return 2006; -} -test.Test.set_staticProp = function(value) { + }; + Test.set_staticProp = function(value) { return value; -} -test.Test.prototype = { - + }; + var Test$ = { get_XYZ: function() { - return 0; + return 0; }, set_XYZ: function(value) { - return value; + return value; }, - get_isFoo: function() { - return true; + return true; }, - get_name: function() { - return 'nk'; + return 'nk'; }, - - get_isInitialized: function() { - return false; + get__isInitialized: function() { + return false; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Test2 + // MemberTests.Test2 -test.Test2 = function() { - test.Test2.initializeBase(this); - var n = test.Test2.callBaseMethod(this, 'get_XYZ'); + function Test2() { + Test.call(this); + var n = Test.prototype.get_XYZ.call(this); if (n === this.get_XYZ()) { } if (this.get_XYZ() === n) { } - n = test.Test.get_staticProp(); -} + n = Test.get_staticProp(); + } + var Test2$ = { + + }; + + + var $exports = ss.module('test', null, + { + Test: [ Test, Test$, null ], + Test2: [ Test2, Test2$, Test ] + }); -test.Test.registerClass('test.Test'); -test.Test2.registerClass('test.Test2', test.Test); + return $exports; +}); diff --git a/tests/TestCases/Member/Properties/Code.cs b/tests/TestCases/Member/Properties/Code.cs index 52f18604b..f4fba32e7 100644 --- a/tests/TestCases/Member/Properties/Code.cs +++ b/tests/TestCases/Member/Properties/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { diff --git a/tests/TestCases/Member/StaticConstructors/Baseline.txt b/tests/TestCases/Member/StaticConstructors/Baseline.txt index 652b197b3..913abdd21 100644 --- a/tests/TestCases/Member/StaticConstructors/Baseline.txt +++ b/tests/TestCases/Member/StaticConstructors/Baseline.txt @@ -1,64 +1,85 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Behavior +define('test', ['ss'], function(ss) { + var $global = this; -test.Behavior = function(e, name) { -} + // MemberTests.Behavior + function Behavior(e, name) { + } + var Behavior$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass + }; -test.MyClass = function(d) { -} + // MemberTests.MyClass -//////////////////////////////////////////////////////////////////////////////// -// test.MyClassEmpty + function MyClass(d) { + } + var MyClass$ = { -test.MyClassEmpty = function() { -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClassSimple + // MemberTests.MyClassEmpty -test.MyClassSimple = function() { -} + function MyClassEmpty() { + } + var MyClassEmpty$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClassSimpleMulti -test.MyClassSimpleMulti = function() { -} + // MemberTests.MyClassSimple + function MyClassSimple() { + } + var MyClassSimple$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.MyBehavior + }; -test.MyBehavior = function(element) { - test.MyBehavior.initializeBase(this, [ element, 'myBehavior' ]); -} + // MemberTests.MyClassSimpleMulti -test.Behavior.registerClass('test.Behavior'); -test.MyClass.registerClass('test.MyClass'); -test.MyClassEmpty.registerClass('test.MyClassEmpty'); -test.MyClassSimple.registerClass('test.MyClassSimple'); -test.MyClassSimpleMulti.registerClass('test.MyClassSimpleMulti'); -test.MyBehavior.registerClass('test.MyBehavior', test.Behavior); -test.MyClass.instance = null; -test.MyClass.instance = new test.MyClass(Date.get_now()); -alert('simple static ctor'); -alert('simple static ctor with multiple statements'); -document.getElementById('foo').innerHTML = '...'; -(function () { + function MyClassSimpleMulti() { + } + var MyClassSimpleMulti$ = { + + }; + + + // MemberTests.MyBehavior + + function MyBehavior(element) { + Behavior.call(this, element, 'myBehavior'); + } + var MyBehavior$ = { + + }; + + + var $exports = ss.module('test', null, + { + Behavior: [ Behavior, Behavior$, null ], + MyClass: [ MyClass, MyClass$, null ], + MyClassEmpty: [ MyClassEmpty, MyClassEmpty$, null ], + MyClassSimple: [ MyClassSimple, MyClassSimple$, null ], + MyClassSimpleMulti: [ MyClassSimpleMulti, MyClassSimpleMulti$, null ], + MyBehavior: [ MyBehavior, MyBehavior$, Behavior ] + }); + + MyClass.instance = new MyClass(ss.now()); + alert('simple static ctor'); + alert('simple static ctor with multiple statements'); + document.getElementById('foo').innerHTML = '...'; + (function() { var e = document.body; var b = true; if (!b) { - return; + return; } - new test.MyBehavior(e); -})(); + new MyBehavior(e); + })(); + + return $exports; +}); diff --git a/tests/TestCases/Member/StaticConstructors/Code.cs b/tests/TestCases/Member/StaticConstructors/Code.cs index 0d8be9b09..1291c0f39 100644 --- a/tests/TestCases/Member/StaticConstructors/Code.cs +++ b/tests/TestCases/Member/StaticConstructors/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace MemberTests { diff --git a/tests/TestCases/Statement/Exceptions/Baseline.txt b/tests/TestCases/Statement/Exceptions/Baseline.txt index 53ab15055..5759e75c4 100644 --- a/tests/TestCases/Statement/Exceptions/Baseline.txt +++ b/tests/TestCases/Statement/Exceptions/Baseline.txt @@ -1,43 +1,50 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test: function(arg) { - if (arg == null) { - throw new Error('null'); - } + if (arg == null) { + throw new Error('null'); + } }, - test2: function() { - try { - } - catch (e) { - } - try { - } - catch (e) { - } - finally { - } - try { - } - finally { - } - try { - } - catch ($e1) { - } - try { - } - catch ($e2) { - } + try { + } + catch (e) { + } + try { + } + catch (e) { + } + finally { + } + try { + } + finally { + } + try { + } + catch ($e1) { + } + try { + } + catch ($e2) { + } } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Exceptions/Code.cs b/tests/TestCases/Statement/Exceptions/Code.cs index 7ccc3ca05..724c4a755 100644 --- a/tests/TestCases/Statement/Exceptions/Code.cs +++ b/tests/TestCases/Statement/Exceptions/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/Expression/Baseline.txt b/tests/TestCases/Statement/Expression/Baseline.txt index d66592a2d..88a508977 100644 --- a/tests/TestCases/Statement/Expression/Baseline.txt +++ b/tests/TestCases/Statement/Expression/Baseline.txt @@ -1,19 +1,27 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test: function(arg) { - var x; - arg = x.length; - arg++; - x = arg.toString(); + var x; + arg = x.length; + arg++; + x = arg.toString(); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Expression/Code.cs b/tests/TestCases/Statement/Expression/Code.cs index bbd8aad1f..536633fb9 100644 --- a/tests/TestCases/Statement/Expression/Code.cs +++ b/tests/TestCases/Statement/Expression/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/For/Baseline.txt b/tests/TestCases/Statement/For/Baseline.txt index 7a9f4d6b6..d482246b1 100644 --- a/tests/TestCases/Statement/For/Baseline.txt +++ b/tests/TestCases/Statement/For/Baseline.txt @@ -1,32 +1,40 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test: function(arg) { - for (var i = 0; i < 10; i++) { - } - var x = 10; - var y = 100; - for (; x < y; x++) { - } - for (; x < y; ) { - } - for (var j = 1, k = 1; ; j++, k--) { - } - for (x = 1; x < 100; ) { - } - for (x = arg; x < 100; x++) { - } - for (x = 1; x < 2; x++) { - var z = x; - } + for (var i = 0; i < 10; i++) { + } + var x = 10; + var y = 100; + for (; x < y; x++) { + } + for (; x < y; ) { + } + for (var j = 1, k = 1; ; j++, k--) { + } + for (x = 1; x < 100; ) { + } + for (x = arg; x < 100; x++) { + } + for (x = 1; x < 2; x++) { + var z = x; + } } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/For/Code.cs b/tests/TestCases/Statement/For/Code.cs index fdd58b2b3..7eec7e65b 100644 --- a/tests/TestCases/Statement/For/Code.cs +++ b/tests/TestCases/Statement/For/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/Foreach/Baseline.txt b/tests/TestCases/Statement/Foreach/Baseline.txt index 5132203ec..05132b714 100644 --- a/tests/TestCases/Statement/Foreach/Baseline.txt +++ b/tests/TestCases/Statement/Foreach/Baseline.txt @@ -1,56 +1,66 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Set +define('test', ['ss'], function(ss) { + var $global = this; -test.Set = function() { -} -test.Set.prototype = { - _items: null, - + // StatementTests.Set + + function Set() { + } + var Set$ = { getEnumerator: function() { - return this._items.getEnumerator(); + return ss.enumerate(this._items); } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // StatementTests.App -test.App = function() { -} -test.App.prototype = { - + function App() { + } + var App$ = { test: function(arg) { - var items = [ 1, 2, 3 ]; - var sum = 0; - var $enum1 = ss.IEnumerator.getEnumerator(items); - while ($enum1.moveNext()) { - var i = $enum1.current; - sum += i; - } - var d = {}; - var $dict2 = d; - for (var $key3 in $dict2) { - var entry = { key: $key3, value: $dict2[$key3] }; - var s = entry.key + ' = ' + entry.value; - } - var s = new test.Set(); - var $enum4 = ss.IEnumerator.getEnumerator(s); - while ($enum4.moveNext()) { - var o = $enum4.current; - this.doStuff(o); - } + var items = [ 1, 2, 3 ]; + var sum = 0; + var $enum1 = ss.enumerate(items); + while ($enum1.moveNext()) { + var i = $enum1.current; + sum += i; + } + var d = {}; + for (var $key2 in d) { + var entry = { key: $key2, value: d[$key2] }; + var s = entry.key + ' = ' + entry.value; + } + var s = new Set(); + var $enum3 = ss.enumerate(s); + while ($enum3.moveNext()) { + var o = $enum3.current; + this._doStuff(o); + } + var $dict4 = this._getDictionary(); + for (var $key5 in $dict4) { + var entry = { key: $key5, value: $dict4[$key5] }; + var s = entry.key + ' = ' + entry.value; + } + }, + _doStuff: function(o) { + for (var $key1 in o) { + var entry = { key: $key1, value: o[$key1] }; + } }, - - doStuff: function(o) { - var $dict1 = o; - for (var $key2 in $dict1) { - var entry = { key: $key2, value: $dict1[$key2] }; - } + _getDictionary: function() { + return null; } -} + }; + + + var $exports = ss.module('test', null, + { + Set: [ Set, Set$, null, ss.IEnumerable ], + App: [ App, App$, null ] + }); -test.Set.registerClass('test.Set', null, ss.IEnumerable); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Foreach/Code.cs b/tests/TestCases/Statement/Foreach/Code.cs index 99848e49d..160feba0e 100644 --- a/tests/TestCases/Statement/Foreach/Code.cs +++ b/tests/TestCases/Statement/Foreach/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { @@ -27,7 +26,6 @@ public void Test(int arg) { } Dictionary d = new Dictionary(); - foreach (DictionaryEntry entry in d) { string s = entry.Key + " = " + entry.Value; } @@ -36,11 +34,19 @@ public void Test(int arg) { foreach (object o in s) { DoStuff(o); } + + foreach (DictionaryEntry entry in GetDictionary()) { + string s = entry.Key + " = " + entry.Value; + } } private void DoStuff(object o) { foreach (DictionaryEntry entry in Dictionary.GetDictionary(o)) { } } + + private Dictionary GetDictionary() { + return null; + } } } diff --git a/tests/TestCases/Statement/IfElse/Baseline.txt b/tests/TestCases/Statement/IfElse/Baseline.txt index 7baef40b1..c700a814d 100644 --- a/tests/TestCases/Statement/IfElse/Baseline.txt +++ b/tests/TestCases/Statement/IfElse/Baseline.txt @@ -1,34 +1,42 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { testMethod: function(boolValue, numValue) { - if (boolValue) { - } - if (boolValue) { - boolValue = false; - } - if (boolValue) { - } - else { - } - if (numValue === 1) { - } - else if (numValue === 2) { - } - if (numValue === 1) { - } - else if (numValue === 2) { - } - else { - } + if (boolValue) { + } + if (boolValue) { + boolValue = false; + } + if (boolValue) { + } + else { + } + if (numValue === 1) { + } + else if (numValue === 2) { + } + if (numValue === 1) { + } + else if (numValue === 2) { + } + else { + } } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/IfElse/Code.cs b/tests/TestCases/Statement/IfElse/Code.cs index 9fe6d6a5b..52c36c838 100644 --- a/tests/TestCases/Statement/IfElse/Code.cs +++ b/tests/TestCases/Statement/IfElse/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/Return/Baseline.txt b/tests/TestCases/Statement/Return/Baseline.txt index b5654610d..65deb254d 100644 --- a/tests/TestCases/Statement/Return/Baseline.txt +++ b/tests/TestCases/Statement/Return/Baseline.txt @@ -1,31 +1,40 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test1: function(arg) { - return 0; + return 0; }, - test2: function(arg) { - return arg; + return arg; }, - test3: function(a) { - if (a) { - return; - } - var i; - switch (i) { - case 0: - return; - } + if (a) { + return; + } + var i; + switch (i) { + case 0: + return; + } + }, + test4: function() { + return { a: 123, b: '456' }; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Return/Code.cs b/tests/TestCases/Statement/Return/Code.cs index 001285eae..dd6289a94 100644 --- a/tests/TestCases/Statement/Return/Code.cs +++ b/tests/TestCases/Statement/Return/Code.cs @@ -1,8 +1,8 @@ using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { @@ -27,5 +27,9 @@ public void Test3(bool a) { return; } } + + public Dictionary Test4() { + return new Dictionary("a", 123, "b", "456"); + } } } diff --git a/tests/TestCases/Statement/Switch/Baseline.txt b/tests/TestCases/Statement/Switch/Baseline.txt index 5a6622784..f5808b93a 100644 --- a/tests/TestCases/Statement/Switch/Baseline.txt +++ b/tests/TestCases/Statement/Switch/Baseline.txt @@ -1,59 +1,65 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Mode +define('test', ['ss'], function(ss) { + var $global = this; -test.Mode = function() { }; -test.Mode.prototype = { + // StatementTests.Mode + + var Mode = { foo: 0, bar: 1 -} -test.Mode.registerEnum('test.Mode', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // StatementTests.App -test.App = function() { -} -test.App.prototype = { - + function App() { + } + var App$ = { test: function(arg, m) { - var i; - switch (i) { - case 0: - i = 0; - break; - case 1: - i = 2; - break; - case 2: - break; - case 3: - case 4: - i = 4; - break; - default: - i = 5; - break; - } - switch (arg) { - case 0: - i = 0; - break; - case 1: - default: - i = 2; - break; - } - switch (m) { - case 0: - break; - case 1: - break; - } + var i; + switch (i) { + case 0: + i = 0; + break; + case 1: + i = 2; + break; + case 2: + break; + case 3: + case 4: + i = 4; + break; + default: + i = 5; + break; + } + switch (arg) { + case 0: + i = 0; + break; + case 1: + default: + i = 2; + break; + } + switch (m) { + case 0: + break; + case 1: + break; + } } -} + }; + + + var $exports = ss.module('test', null, + { + Mode: Mode, + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Switch/Code.cs b/tests/TestCases/Statement/Switch/Code.cs index b6d4a1096..489ddf7d1 100644 --- a/tests/TestCases/Statement/Switch/Code.cs +++ b/tests/TestCases/Statement/Switch/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/Variables/Baseline.txt b/tests/TestCases/Statement/Variables/Baseline.txt index f93ecac15..b43fc3187 100644 --- a/tests/TestCases/Statement/Variables/Baseline.txt +++ b/tests/TestCases/Statement/Variables/Baseline.txt @@ -1,37 +1,43 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test: function() { - var i = 0; - var b = true; - var x = i + 10; - var y, z; - var a = 1, c, d, e = c; + var i = 0; + var b = true; + var x = i + 10; + var y, z; + var a = 1, c, d, e = c; }, - test2: function(arg) { - var a = 1; - var b = arg; - while (a < b) { - var x = a - b; - a++; - } - while (a >= b) { - var x = 'Hello World'; - var foo = x.length; - } + var a = 1; + var b = arg; + while (a < b) { + var x = a - b; + a++; + } + while (a >= b) { + var x = 'Hello World'; + var foo = x.length; + } }, - test3: function(arg1, arg2) { - var value = arg1 + arg2; + var value = arg1 + arg2; } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/Variables/Code.cs b/tests/TestCases/Statement/Variables/Code.cs index d910b4c08..21846fbc2 100644 --- a/tests/TestCases/Statement/Variables/Code.cs +++ b/tests/TestCases/Statement/Variables/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Statement/While/Baseline.txt b/tests/TestCases/Statement/While/Baseline.txt index 0b07a14db..4abb1ea5c 100644 --- a/tests/TestCases/Statement/While/Baseline.txt +++ b/tests/TestCases/Statement/While/Baseline.txt @@ -1,29 +1,37 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { -} -test.App.prototype = { - + // StatementTests.App + + function App() { + } + var App$ = { test: function(arg) { - var i; - while (i < arg) { - } - while (i < arg) { - i++; - } - while (arg === i) { - break; - } - do { - i--; - } while (i > 0); - do { - } while (!!i); + var i; + while (i < arg) { + } + while (i < arg) { + i++; + } + while (arg === i) { + break; + } + do { + i--; + } while (i > 0); + do { + } while (!!i); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Statement/While/Code.cs b/tests/TestCases/Statement/While/Code.cs index 38f52deec..ee1b38bad 100644 --- a/tests/TestCases/Statement/While/Code.cs +++ b/tests/TestCases/Statement/While/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace StatementTests { diff --git a/tests/TestCases/Type/Classes/Baseline.txt b/tests/TestCases/Type/Classes/Baseline.txt index a64e404af..5117bc4c6 100644 --- a/tests/TestCases/Type/Classes/Baseline.txt +++ b/tests/TestCases/Type/Classes/Baseline.txt @@ -1,45 +1,72 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.FooBarBaz +define('test', ['ss'], function(ss) { + var $global = this; -test.FooBarBaz = function test_FooBarBaz() { -} + // TypeTests.Foo + function FooBarBaz() { + } + var FooBarBaz$ = { -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass + }; -test.MyClass = function test_MyClass() { - test.FooBarBaz = new test.FooBarBaz(); -} + // TypeTests.MyClass -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass2 + function MyClass() { + var f = new FooBarBaz(); + } + var MyClass$ = { -test.MyClass2 = function test_MyClass2() { - test.MyClass2.initializeBase(this); -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass3 + // TypeTests.MyClass3 -test.MyClass3 = function test_MyClass3() { -} + function MyClass3() { + } + var MyClass3$ = { + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass4 -test.MyClass4 = function test_MyClass4() { - test.MyClass4.initializeBase(this); -} + // TypeTests.StaticClass + function StaticClass() { + } -test.FooBarBaz.registerClass('test.FooBarBaz'); -test.MyClass.registerClass('test.MyClass'); -test.MyClass2.registerClass('test.MyClass2', test.MyClass); -test.MyClass3.registerClass('test.MyClass3', null, ss.IDisposable); -test.MyClass4.registerClass('test.MyClass4', test.MyClass, ss.IDisposable); + + // TypeTests.MyClass2 + + function MyClass2() { + MyClass.call(this); + } + var MyClass2$ = { + + }; + + + // TypeTests.MyClass4 + + function MyClass4() { + MyClass.call(this); + } + var MyClass4$ = { + + }; + + + var $exports = ss.module('test', null, + { + FooBarBaz: [ FooBarBaz, FooBarBaz$, null ], + MyClass: [ MyClass, MyClass$, null ], + MyClass3: [ MyClass3, MyClass3$, null, ss.IDisposable ], + StaticClass: [ StaticClass, null, null ], + MyClass2: [ MyClass2, MyClass2$, MyClass ], + MyClass4: [ MyClass4, MyClass4$, MyClass, ss.IDisposable ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Type/Classes/Code.cs b/tests/TestCases/Type/Classes/Code.cs index f08eff4f6..dc53ab7aa 100644 --- a/tests/TestCases/Type/Classes/Code.cs +++ b/tests/TestCases/Type/Classes/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { @@ -11,7 +10,7 @@ public class Foo { } public class MyClass { - public MyClass() { Foo = new Foo(); } + public MyClass() { Foo f = new Foo(); } } public class MyClass2 : MyClass { @@ -22,4 +21,7 @@ public class MyClass3 : IDisposable { public class MyClass4 : MyClass, IDisposable { } + + public static class StaticClass { + } } diff --git a/tests/TestCases/Type/Delegates/Baseline.txt b/tests/TestCases/Type/Delegates/Baseline.txt index de838d13c..126e195e7 100644 --- a/tests/TestCases/Type/Delegates/Baseline.txt +++ b/tests/TestCases/Type/Delegates/Baseline.txt @@ -1,10 +1,22 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.EventArgs +define('test', ['ss'], function(ss) { + var $global = this; -test.EventArgs = function test_EventArgs() { -} + // TypeTests.EventArgs + function EventArgs() { + } + var EventArgs$ = { -test.EventArgs.registerClass('test.EventArgs'); + }; + + + var $exports = ss.module('test', null, + { + EventArgs: [ EventArgs, EventArgs$, null ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Type/Delegates/Code.cs b/tests/TestCases/Type/Delegates/Code.cs index 538b4e3c9..b196525b8 100644 --- a/tests/TestCases/Type/Delegates/Code.cs +++ b/tests/TestCases/Type/Delegates/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { diff --git a/tests/TestCases/Type/Enumerator/Baseline.txt b/tests/TestCases/Type/Enumerator/Baseline.txt index 7f1c0c25d..3e8a15e0f 100644 --- a/tests/TestCases/Type/Enumerator/Baseline.txt +++ b/tests/TestCases/Type/Enumerator/Baseline.txt @@ -1,49 +1,54 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App1 +define('test', ['ss'], function(ss) { + var $global = this; -test.App1 = function test_App1() { -} -test.App1.prototype = { - - getEnumerator: function test_App1$getEnumerator() { - return null; + // TypeTests.App1 + + function App1() { + } + var App1$ = { + getEnumerator: function() { + return null; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // TypeTests.App -test.App = function test_App() { -} -test.App.prototype = { - - test1: function test_App$test1(arg) { + function App() { + } + var App$ = { + test1: function(arg) { }, - - test: function test_App$test(arg) { - var a; - var b; - var s = new Array(5); - var a1 = a.getEnumerator(); - a1 = b.getEnumerator(); - a1 = s.getEnumerator(); - var $enum1 = ss.IEnumerator.getEnumerator(s); - while ($enum1.moveNext()) { - var str = $enum1.current; - var s1 = str; - } - var app1; - var $enum2 = ss.IEnumerator.getEnumerator(app1); - while ($enum2.moveNext()) { - var str = $enum2.current; - var s1 = str; - } + test: function(arg) { + var a; + var b; + var s = new Array(5); + var a1 = ss.enumerate(a); + a1 = ss.enumerate(b); + a1 = ss.enumerate(s); + var $enum1 = ss.enumerate(s); + while ($enum1.moveNext()) { + var str = $enum1.current; + var s1 = str; + } + var app1; + var $enum2 = ss.enumerate(app1); + while ($enum2.moveNext()) { + var str = $enum2.current; + var s1 = str; + } } -} + }; + + + var $exports = ss.module('test', null, + { + App1: [ App1, App1$, null, ss.IEnumerable ], + App: [ App, App$, null ] + }); -test.App1.registerClass('test.App1', null, ss.IEnumerable); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Type/Enumerator/Code.cs b/tests/TestCases/Type/Enumerator/Code.cs index ba46929b5..512d88171 100644 --- a/tests/TestCases/Type/Enumerator/Code.cs +++ b/tests/TestCases/Type/Enumerator/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { @@ -29,8 +28,8 @@ public void Test(int arg) { string s1 = str; } - App1 app1; - foreach (string str in app1) { + App1 app1; + foreach (string str in app1) { string s1 = str; } } diff --git a/tests/TestCases/Type/Enums/Baseline.txt b/tests/TestCases/Type/Enums/Baseline.txt index 5287edb4d..8735225fd 100644 --- a/tests/TestCases/Type/Enums/Baseline.txt +++ b/tests/TestCases/Type/Enums/Baseline.txt @@ -1,126 +1,110 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Colors +define('test', ['ss'], function(ss) { + var $global = this; -test.Colors = function() { }; -test.Colors.prototype = { + // TypeTests.Colors + + var Colors = { red: 0, green: 1, blue: 2 -} -test.Colors.registerEnum('test.Colors', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Sequence + // TypeTests.Sequence -test.Sequence = function() { }; -test.Sequence.prototype = { + var Sequence = { item1: 1, item2: 2, item3: 3, item4: 5 -} -test.Sequence.registerEnum('test.Sequence', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Mode + // TypeTests.Mode -test.Mode = function() { }; -test.Mode.prototype = { + var Mode = { Public: 1, Protected: 2, Private: 4 -} -test.Mode.registerEnum('test.Mode', true); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.UInt32Mask + // TypeTests.UInt32Mask -test.UInt32Mask = function() { }; -test.UInt32Mask.prototype = { + var UInt32Mask = { v: 4026531840, a: 4278190080 -} -test.UInt32Mask.registerEnum('test.UInt32Mask', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.ShortMask + // TypeTests.ShortMask -test.ShortMask = function() { }; -test.ShortMask.prototype = { + var ShortMask = { v: 1, a: 4096 -} -test.ShortMask.registerEnum('test.ShortMask', false); + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Errors + // TypeTests.Errors -test.Errors = function() { }; -test.Errors.prototype = { + var Errors = { S_OK: 0, S_FALSE: 1, E_FAIL: -1 -} -test.Errors.registerEnum('test.Errors', false); - - -//////////////////////////////////////////////////////////////////////////////// -// test.Size + }; -test.Size = function() { }; -test.Size.prototype = { - small: 'small', - Medium: 'Medium', - large: 'large' -} -test.Size.registerEnum('test.Size', false); + // TypeTests.App -//////////////////////////////////////////////////////////////////////////////// -// test.App - -test.App = function test_App() { -} -test.App.main = function test_App$main() { + function App() { + } + App.main = function() { var m = 1; m = 1 | 4; var c = 0; -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.App2 - -test.App2 = function test_App2() { -} -test.App2.prototype = { - _httpMethod: null, - _sortMode: null, - - run: function test_App2$run() { - var method = 'POST'; - this.run1('GET'); - this.run2('status'); - this.run2('Group'); - this.run2('Ct'); - var s = 'Medium'; + }; + var App$ = { + + }; + + + // TypeTests.App2 + + function App2() { + } + var App2$ = { + run: function() { + var method = 'POST'; + this.run1('GET'); + this.run2('status'); + this.run2('Group'); + this.run2('Ct'); + var s = 'Medium'; }, - - run1: function test_App2$run1(m) { - var s = m; + run1: function(m) { + var s = m; }, - - run2: function test_App2$run2(m) { + run2: function(m) { + var aCode = 65; + var bCode = 66; } -} + }; + + + var $exports = ss.module('test', null, + { + Colors: Colors, + Sequence: Sequence, + Mode: Mode, + UInt32Mask: UInt32Mask, + ShortMask: ShortMask, + Errors: Errors, + App: [ App, App$, null ], + App2: [ App2, App2$, null ] + }); -test.App.registerClass('test.App'); -test.App2.registerClass('test.App2'); + return $exports; +}); diff --git a/tests/TestCases/Type/Enums/Code.cs b/tests/TestCases/Type/Enums/Code.cs index 581b62b0d..bb8b3d917 100644 --- a/tests/TestCases/Type/Enums/Code.cs +++ b/tests/TestCases/Type/Enums/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { @@ -16,11 +15,11 @@ public enum Sequence { [Flags] public enum Mode { - [PreserveCase] + [ScriptName(PreserveCase = true)] Public = 1, - [PreserveCase] + [ScriptName(PreserveCase = true)] Protected = 2, - [PreserveCase] + [ScriptName(PreserveCase = true)] Private = 4 } @@ -37,11 +36,11 @@ public enum ShortMask : short { public enum Errors { - [PreserveCase] + [ScriptName(PreserveCase = true)] S_OK = 0, - [PreserveCase] + [ScriptName(PreserveCase = true)] S_FALSE = 1, - [PreserveCase] + [ScriptName(PreserveCase = true)] E_FAIL = -1 } @@ -54,8 +53,8 @@ public static void Main() { } } - [NamedValues] - [Imported] + [ScriptConstants(UseNames = true)] + [ScriptImport] public enum HttpMethod { GET = 0, POST = 1, @@ -63,23 +62,28 @@ public enum HttpMethod { DELETE = 3, } - [NamedValues] + [ScriptConstants(UseNames = true)] internal enum SortMode { Status = 1, - [PreserveCase] + [ScriptName(PreserveCase = true)] Group = 2, [ScriptName("Ct")] Count = 3 } - [NamedValues] + [ScriptConstants(UseNames = true)] public enum Size { Small = 0, - [PreserveCase] + [ScriptName(PreserveCase = true)] Medium = 1, Large = 2, } + [ScriptConstants] + public enum Chars { + A = 65, B = 66 + } + public class App2 { private HttpMethod httpMethod; @@ -102,6 +106,8 @@ public void Run1(HttpMethod m) { } public void Run2(SortMode m) { + Chars aCode = Chars.A; + Chars bCode = Chars.B; } } } diff --git a/tests/TestCases/Type/Globals/Baseline.txt b/tests/TestCases/Type/Globals/Baseline.txt index 735befa49..3a47937f6 100644 --- a/tests/TestCases/Type/Globals/Baseline.txt +++ b/tests/TestCases/Type/Globals/Baseline.txt @@ -1,77 +1,87 @@ -//////////////////////////////////////////////////////////////////////////////// -// MyRecord +"use strict"; -window.$create_MyRecord = function MyRecord() { return {}; } +define('test', ['ss'], function(ss) { + var $global = this; + // MyEnum -//////////////////////////////////////////////////////////////////////////////// -// MyEnum + var MyEnum = { + }; -window.MyEnum = function() { }; -MyEnum.prototype = { -} -MyEnum.registerEnum('MyEnum', false); + // IXyzInterface -//////////////////////////////////////////////////////////////////////////////// -// IXyzInterface + function IXyzInterface() { } -window.IXyzInterface = function() { }; -IXyzInterface.prototype = { -} -IXyzInterface.registerInterface('IXyzInterface'); + // MyRecord + function MyRecord() { return {}; } -//////////////////////////////////////////////////////////////////////////////// -// MyClass -window.MyClass = function MyClass() { -} + // MyClass + function MyClass() { + } + var MyClass$ = { -//////////////////////////////////////////////////////////////////////////////// -// MyClass2 + }; -window.MyClass2 = function MyClass2() { - MyClass2.initializeBase(this); -} + // MyClass3 -//////////////////////////////////////////////////////////////////////////////// -// MyClass3 + function MyClass3() { + } + var MyClass3$ = { -window.MyClass3 = function MyClass3() { -} + }; -//////////////////////////////////////////////////////////////////////////////// -// MyClass4 + // Foo.MyClassF -window.MyClass4 = function MyClass4() { - MyClass4.initializeBase(this); -} -MyClass4.prototype = { - - someMethod: function MyClass4$someMethod() { - var xyz = null; - var c2 = new MyClass2(); - xyz = Type.safeCast(c2, IXyzInterface); - } -} + function MyClassF() { + } + var MyClassF$ = { + + }; + + + // MyClass2 + function MyClass2() { + MyClass.call(this); + } + var MyClass2$ = { -Type.registerNamespace('Foo'); + }; + + + // MyClass4 + + function MyClass4() { + MyClass.call(this); + } + var MyClass4$ = { + someMethod: function() { + var xyz = null; + var c2 = new MyClass2(); + xyz = ss.safeCast(c2, IXyzInterface); + } + }; -//////////////////////////////////////////////////////////////////////////////// -// Foo.MyClass -Foo.MyClass = function Foo_MyClass() { -} + var $exports = ss.module('test', null, + { + MyEnum: MyEnum, + IXyzInterface: [ IXyzInterface ], + MyRecord: MyRecord, + MyClass: [ MyClass, MyClass$, null ], + MyClass3: [ MyClass3, MyClass3$, null, ss.IDisposable ], + MyClassF: [ MyClassF, MyClassF$, null ], + MyClass2: [ MyClass2, MyClass2$, MyClass ], + MyClass4: [ MyClass4, MyClass4$, MyClass, ss.IDisposable ] + }); -MyClass.registerClass('MyClass'); -MyClass2.registerClass('MyClass2', MyClass); -MyClass3.registerClass('MyClass3', null, ss.IDisposable); -MyClass4.registerClass('MyClass4', MyClass, ss.IDisposable); -Foo.MyClass.registerClass('Foo.MyClass'); + return $exports; +}); diff --git a/tests/TestCases/Type/Globals/Code.cs b/tests/TestCases/Type/Globals/Code.cs index f949c127f..60bfd95cc 100644 --- a/tests/TestCases/Type/Globals/Code.cs +++ b/tests/TestCases/Type/Globals/Code.cs @@ -23,7 +23,8 @@ public void SomeMethod() { } } -public sealed class MyRecord : Record { +[ScriptObject] +public sealed class MyRecord { } public enum MyEnum { @@ -31,7 +32,7 @@ public enum MyEnum { namespace Foo { - public class MyClass { + public class MyClassF { } } diff --git a/tests/TestCases/Type/Imported/Baseline.txt b/tests/TestCases/Type/Imported/Baseline.txt index 09cd0aed4..5ba93744b 100644 --- a/tests/TestCases/Type/Imported/Baseline.txt +++ b/tests/TestCases/Type/Imported/Baseline.txt @@ -1,17 +1,35 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function() { + // TypeTests.App + + function App() { var elem = document.getElementById('foo'); var s = elem.myString; + elem.do('foo'); + elem.do('bar', 10); elem['Smith'] = elem['Joe']; - var n = parseInt(5.5); + var n = ss.truncate(5.5); var parser = new DOMParser(); var doc = parser.parseFromString('', 'text/xml'); - var d = Date.parseDate('1/1/2010'); -} + var d = ss.date('1/1/2010'); + var eventHandler = function() { + }; + elem.addEventListener('click', eventHandler); + elem.removeEventListener('click', eventHandler); + } + var App$ = { + + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Type/Imported/Code.cs b/tests/TestCases/Type/Imported/Code.cs index 9798fa743..7d6cbe069 100644 --- a/tests/TestCases/Type/Imported/Code.cs +++ b/tests/TestCases/Type/Imported/Code.cs @@ -4,27 +4,42 @@ using System.Xml; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { - [IgnoreNamespace] - [Imported] + [ScriptIgnoreNamespace] + [ScriptImport] public sealed class MyElement : Element { private MyElement() { } - [IntrinsicProperty] + [ScriptField] public string myString { get { return null; } set { } } - [IntrinsicProperty] + [ScriptField] public string this[string name] { get { return null; } set { } } + + [ScriptMethod("foo")] + [ScriptName("do")] + public void DoFoo() { + } + + [ScriptMethod("bar")] + [ScriptName("do")] + public void DoBar(int n) { + } + + [ScriptEvent("addEventListener", "removeEventListener")] + public event Action Click { + add { } + remove { } + } } public class App { @@ -32,6 +47,8 @@ public class App { public App() { MyElement elem = (MyElement)Document.GetElementById("foo"); string s = elem.myString; + elem.DoFoo(); + elem.DoBar(10); elem["Smith"] = elem["Joe"]; @@ -39,6 +56,10 @@ public App() { XmlDocumentParser parser = new XmlDocumentParser(); XmlDocument doc = parser.ParseFromString("", "text/xml"); Date d = Date.Parse("1/1/2010"); + + Action eventHandler = delegate() { }; + elem.Click += eventHandler; + elem.Click -= eventHandler; } } } diff --git a/tests/TestCases/Type/Interfaces/Baseline.txt b/tests/TestCases/Type/Interfaces/Baseline.txt index e4e79d061..6291d1c62 100644 --- a/tests/TestCases/Type/Interfaces/Baseline.txt +++ b/tests/TestCases/Type/Interfaces/Baseline.txt @@ -1,85 +1,73 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.IMarker +define('test', ['ss'], function(ss) { + var $global = this; -test.IMarker = function() { }; -test.IMarker.prototype = { + // TypeTests.IMarker -} -test.IMarker.registerInterface('test.IMarker'); + function IMarker() { } -//////////////////////////////////////////////////////////////////////////////// -// test.ISerializable + // TypeTests.ISerializable -test.ISerializable = function() { }; -test.ISerializable.prototype = { - serialize : null -} -test.ISerializable.registerInterface('test.ISerializable'); + function ISerializable() { } -//////////////////////////////////////////////////////////////////////////////// -// test.IRunnable + // TypeTests.IRunnable -test.IRunnable = function() { }; -test.IRunnable.prototype = { - get_canRun : null, - run : null -} -test.IRunnable.registerInterface('test.IRunnable'); + function IRunnable() { } -//////////////////////////////////////////////////////////////////////////////// -// test.MyObject + // TypeTests.MyObject -test.MyObject = function test_MyObject() { -} -test.MyObject.prototype = { - - dispose: function test_MyObject$dispose() { + function MyObject() { + } + var MyObject$ = { + dispose: function() { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyObject2 + // TypeTests.Foo -test.MyObject2 = function test_MyObject2() { - test.MyObject2.initializeBase(this); -} -test.MyObject2.prototype = { - - get_canRun: function test_MyObject2$get_canRun() { - return true; + function Foo() { + } + var Foo$ = { + get_canRun: function() { + return true; }, - - run: function test_MyObject2$run() { + run: function() { + }, + serialize: function() { + return null; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.Foo + // TypeTests.MyObject2 -test.Foo = function test_Foo() { -} -test.Foo.prototype = { - - get_canRun: function test_Foo$get_canRun() { - return true; - }, - - run: function test_Foo$run() { + function MyObject2() { + MyObject.call(this); + } + var MyObject2$ = { + get_canRun: function() { + return true; }, - - serialize: function test_Foo$serialize() { - return null; + run: function() { } -} + }; + + + var $exports = ss.module('test', null, + { + IMarker: [ IMarker ], + ISerializable: [ ISerializable ], + IRunnable: [ IRunnable ], + MyObject: [ MyObject, MyObject$, null, ss.IDisposable ], + Foo: [ Foo, Foo$, null, IMarker, ISerializable, IRunnable ], + MyObject2: [ MyObject2, MyObject2$, MyObject, IRunnable ] + }); -test.MyObject.registerClass('test.MyObject', null, ss.IDisposable); -test.MyObject2.registerClass('test.MyObject2', test.MyObject, test.IRunnable); -test.Foo.registerClass('test.Foo', null, test.IMarker, test.ISerializable, test.IRunnable); + return $exports; +}); diff --git a/tests/TestCases/Type/Interfaces/Code.cs b/tests/TestCases/Type/Interfaces/Code.cs index 2616cecc5..9cf97de84 100644 --- a/tests/TestCases/Type/Interfaces/Code.cs +++ b/tests/TestCases/Type/Interfaces/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { diff --git a/tests/TestCases/Type/Modules/Baseline.txt b/tests/TestCases/Type/Modules/Baseline.txt new file mode 100644 index 000000000..8d957f368 --- /dev/null +++ b/tests/TestCases/Type/Modules/Baseline.txt @@ -0,0 +1,26 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + // App.Dummy + + function Dummy() { + } + var Dummy$ = { + + }; + + + var $exports = ss.module('test', null, + { + Dummy: [ Dummy, Dummy$, null ] + }); + + alert('Hello Startup'); + window.addEventListener('load', function(e) { + alert('Loaded'); + }, false); + + return $exports; +}); diff --git a/tests/TestCases/Type/Modules/Code.cs b/tests/TestCases/Type/Modules/Code.cs new file mode 100644 index 000000000..d0b1b1b13 --- /dev/null +++ b/tests/TestCases/Type/Modules/Code.cs @@ -0,0 +1,30 @@ +using System; +using System.Html; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + +[ScriptModule] +internal static class Startup { + + static Startup() { + Window.Alert("Hello Startup"); + } +} + +namespace App { + +#if INCLUDE_EXPORT + public class Dummy { } +#endif + + [ScriptModule] + internal static class Main { + + static Main() { + Window.AddEventListener("load", delegate(ElementEvent e) { + Window.Alert("Loaded"); + }, false); + } + } +} diff --git a/tests/TestCases/Type/Modules/ZeroExportsBaseline.txt b/tests/TestCases/Type/Modules/ZeroExportsBaseline.txt new file mode 100644 index 000000000..30018a182 --- /dev/null +++ b/tests/TestCases/Type/Modules/ZeroExportsBaseline.txt @@ -0,0 +1,12 @@ +"use strict"; + +define('test', ['ss'], function(ss) { + var $global = this; + + alert('Hello Startup'); + window.addEventListener('load', function(e) { + alert('Loaded'); + }, false); + + return $exports; +}); diff --git a/tests/TestCases/Type/Namespaces/Baseline.txt b/tests/TestCases/Type/Namespaces/Baseline.txt index 5a6b1ac68..7461b53b9 100644 --- a/tests/TestCases/Type/Namespaces/Baseline.txt +++ b/tests/TestCases/Type/Namespaces/Baseline.txt @@ -1,95 +1,99 @@ -Type.registerNamespace('TypeTests.Sub1.Sub2'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// TypeTests.Sub1.Sub2.MyClass +define('test', ['ss'], function(ss) { + var $global = this; -TypeTests.Sub1.Sub2.MyClass = function TypeTests_Sub1_Sub2_MyClass() { - var yc = new TypeTests.Sub1.YourClass(); + // TypeTests.Sub1.Sub2.MyClass + + function MyClass() { + var yc = new YourClass(); yc.run(); -} + } + var MyClass$ = { + }; -Type.registerNamespace('TypeTests.Sub1'); -//////////////////////////////////////////////////////////////////////////////// -// TypeTests.Sub1.YourClass + // TypeTests.Sub1.YourClass -TypeTests.Sub1.YourClass = function TypeTests_Sub1_YourClass() { -} -TypeTests.Sub1.YourClass.prototype = { - - run: function TypeTests_Sub1_YourClass$run() { + function YourClass() { + } + var YourClass$ = { + run: function() { } -} - + }; -Type.registerNamespace('TypeTests'); -//////////////////////////////////////////////////////////////////////////////// -// TypeTests.YourClass + // TypeTests.YourClass1 -TypeTests.YourClass = function TypeTests_YourClass() { -} + function YourClass1() { + } + var YourClass1$ = { + }; -Type.registerNamespace('MyApp.Foo'); -//////////////////////////////////////////////////////////////////////////////// -// MyApp.Foo.MyClass + // MyApp.Foo.MyClassF -MyApp.Foo.MyClass = function MyApp_Foo_MyClass() { -} + function MyClassF() { + } + var MyClassF$ = { + }; -Type.registerNamespace('MyApp'); -//////////////////////////////////////////////////////////////////////////////// -// MyApp.Test + // MyApp.Test -MyApp.Test = function MyApp_Test() { - var c = new TypeTests.Sub1.Sub2.MyClass(); -} + function Test() { + var c = new MyClass(); + } + var Test$ = { + }; -Type.registerNamespace('MyCompany'); -//////////////////////////////////////////////////////////////////////////////// -// MyCompany.Utility + // MyCompany.Utility -MyCompany.Utility = function MyCompany_Utility() { -} -MyCompany.Utility.prototype = { - - run: function MyCompany_Utility$run() { + function Utility() { + } + var Utility$ = { + run: function() { } -} - + }; -Type.registerNamespace('MyCompany.MyProduct'); -//////////////////////////////////////////////////////////////////////////////// -// MyCompany.MyProduct.Utility + // MyCompany.MyProduct.UtilityP -MyCompany.MyProduct.Utility = function MyCompany_MyProduct_Utility() { -} + function UtilityP() { + } + var UtilityP$ = { + }; -Type.registerNamespace('MyCompany.MyProduct.MyComponent'); -//////////////////////////////////////////////////////////////////////////////// -// MyCompany.MyProduct.MyComponent.Component + // MyCompany.MyProduct.MyComponent.Component -MyCompany.MyProduct.MyComponent.Component = function MyCompany_MyProduct_MyComponent_Component() { - var u = new MyCompany.Utility(); + function Component() { + var u = new Utility(); u.run(); -} + } + var Component$ = { + + }; + + + var $exports = ss.module('test', null, + { + MyClass: [ MyClass, MyClass$, null ], + YourClass: [ YourClass, YourClass$, null ], + YourClass1: [ YourClass1, YourClass1$, null ], + MyClassF: [ MyClassF, MyClassF$, null ], + Test: [ Test, Test$, null ], + Utility: [ Utility, Utility$, null ], + UtilityP: [ UtilityP, UtilityP$, null ], + Component: [ Component, Component$, null ] + }); -TypeTests.Sub1.Sub2.MyClass.registerClass('TypeTests.Sub1.Sub2.MyClass'); -TypeTests.Sub1.YourClass.registerClass('TypeTests.Sub1.YourClass'); -TypeTests.YourClass.registerClass('TypeTests.YourClass'); -MyApp.Foo.MyClass.registerClass('MyApp.Foo.MyClass'); -MyApp.Test.registerClass('MyApp.Test'); -MyCompany.Utility.registerClass('MyCompany.Utility'); -MyCompany.MyProduct.Utility.registerClass('MyCompany.MyProduct.Utility'); -MyCompany.MyProduct.MyComponent.Component.registerClass('MyCompany.MyProduct.MyComponent.Component'); + return $exports; +}); diff --git a/tests/TestCases/Type/Namespaces/Code.cs b/tests/TestCases/Type/Namespaces/Code.cs index 2c2fb0f68..1904ff743 100644 --- a/tests/TestCases/Type/Namespaces/Code.cs +++ b/tests/TestCases/Type/Namespaces/Code.cs @@ -25,13 +25,13 @@ public void Run() { namespace TypeTests { - public class YourClass { + public class YourClass1 { } } namespace MyApp.Foo { - public class MyClass { + public class MyClassF { } } @@ -58,7 +58,7 @@ public void Run() { namespace MyCompany.MyProduct { - public class Utility { + public class UtilityP { } } diff --git a/tests/TestCases/Type/Nullable/Baseline.txt b/tests/TestCases/Type/Nullable/Baseline.txt index d0014eccd..139768a83 100644 --- a/tests/TestCases/Type/Nullable/Baseline.txt +++ b/tests/TestCases/Type/Nullable/Baseline.txt @@ -1,32 +1,40 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.App +define('test', ['ss'], function(ss) { + var $global = this; -test.App = function test_App() { -} -test.App.prototype = { - - method: function test_App$method() { - var i = 10; - var b = true; - var flag; - var num; - var num2; - var num3 = 100; - var xyz = false; - var ch; - var hasValue = ss.isValue(xyz) || ss.isValue(num3); - var num3_ = num3; - var f = (ss.isValue(flag)) ? flag : true; - xyz = true; - num2 = 10; - num = 1; - var boolVal = (flag || false); - var textVal = (ch || ''); - var numVal = (num3 || 0); + // TypeTests.App + + function App() { + } + var App$ = { + method: function() { + var i = 10; + var b = true; + var flag; + var num; + var num2; + var num3 = 100; + var xyz = false; + var ch; + var hasValue = ss.isValue(xyz) || ss.isValue(num3); + var num3_ = num3; + var f = (ss.isValue(flag)) ? flag : true; + xyz = true; + num2 = 10; + num = 1; + var boolVal = (flag || false); + var textVal = (ch || ''); + var numVal = (num3 || 0); } -} + }; + + + var $exports = ss.module('test', null, + { + App: [ App, App$, null ] + }); -test.App.registerClass('test.App'); + return $exports; +}); diff --git a/tests/TestCases/Type/Nullable/Code.cs b/tests/TestCases/Type/Nullable/Code.cs index 3701ba0b4..7efde2a84 100644 --- a/tests/TestCases/Type/Nullable/Code.cs +++ b/tests/TestCases/Type/Nullable/Code.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { diff --git a/tests/TestCases/Type/Partials/Baseline.txt b/tests/TestCases/Type/Partials/Baseline.txt index 5474356d1..11d256e6c 100644 --- a/tests/TestCases/Type/Partials/Baseline.txt +++ b/tests/TestCases/Type/Partials/Baseline.txt @@ -1,130 +1,75 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.IMyInterface +define('test', ['ss'], function(ss) { + var $global = this; -test.IMyInterface = function() { }; -test.IMyInterface.prototype = { - start : null, - Stop : null, - resume : null -} -test.IMyInterface.registerInterface('test.IMyInterface'); + // TypeTests.IMyInterface + function IMyInterface() { } -//////////////////////////////////////////////////////////////////////////////// -// test.EmptyClass -test.EmptyClass = function test_EmptyClass() { -} + // TypeTests.EmptyClass + function EmptyClass() { + } + var EmptyClass$ = { -//////////////////////////////////////////////////////////////////////////////// -// test._singleMemberClass + }; -test._singleMemberClass = function test__singleMemberClass() { -} -test._singleMemberClass.prototype = { - - run: function test__singleMemberClass$run() { - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// test.DerivedMemberClass -test.DerivedMemberClass = function test_DerivedMemberClass() { - test.DerivedMemberClass.initializeBase(this); -} + // TypeTests.SingleMemberClass - -//////////////////////////////////////////////////////////////////////////////// -// test.MergedMembersClass - -test.MergedMembersClass = function test_MergedMembersClass() { -} -test.MergedMembersClass.prototype = { - foo: false, - bar: null, - - testMethod: function test_MergedMembersClass$testMethod() { - return null; + function SingleMemberClass() { + } + var SingleMemberClass$ = { + run: function() { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.DerivedMergedMembersClass + // TypeTests.MergedMembersClass -test.DerivedMergedMembersClass = function test_DerivedMergedMembersClass() { - test.DerivedMergedMembersClass.initializeBase(this); - this.name = this.bar + this.bar + 'Name'; -} -test.DerivedMergedMembersClass.prototype = { - name: null, - value: null, - - testMethod: function test_DerivedMergedMembersClass$testMethod() { - return null; - }, - - testMethod2: function test_DerivedMergedMembersClass$testMethod2() { - return this.get_item('foo'); - }, - - someMethod: function test_DerivedMergedMembersClass$someMethod() { - var e1 = document.getElementById(this.bar); - var e2 = document.getElementById(this.name); - var e3 = document.getElementById(this.bar); - var s = this.testMethod() + test.DerivedMergedMembersClass.callBaseMethod(this, 'testMethod'); - }, - get_item: function test_DerivedMergedMembersClass$get_item(s) { - return s; + function MergedMembersClass() { + this.foo = false; + } + var MergedMembersClass$ = { + testMethod: function() { + return null; } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass + // TypeTests.MyClass -test.MyClass = function test_MyClass() { -} -test.MyClass.prototype = { - - start: function test_MyClass$start() { + function MyClass() { + } + var MyClass$ = { + start: function() { }, - - Stop: function test_MyClass$Stop() { + Stop: function() { }, - - resume: function test_MyClass$resume() { + resume: function() { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test._someClass + // TypeTests.SomeClass -test._someClass = function test__someClass() { -} -test._someClass.prototype = { - - close: function test__someClass$close() { + function SomeClass() { + } + var SomeClass$ = { + close: function() { }, - - _cancel: function test__someClass$_cancel() { + _cancel: function() { }, - - run: function test__someClass$run() { + run: function() { } -} + }; -//////////////////////////////////////////////////////////////////////////////// -// test.App + // TypeTests.App -test.App = function test_App() { + function App() { var s; s.run(); var d; @@ -134,14 +79,62 @@ test.App = function test_App() { mc.start(); mc.Stop(); mc.resume(); -} + } + var App$ = { + + }; + + + // TypeTests.DerivedMemberClass + function DerivedMemberClass() { + SingleMemberClass.call(this); + } + var DerivedMemberClass$ = { -test.EmptyClass.registerClass('test.EmptyClass'); -test._singleMemberClass.registerClass('test._singleMemberClass'); -test.DerivedMemberClass.registerClass('test.DerivedMemberClass', test._singleMemberClass); -test.MergedMembersClass.registerClass('test.MergedMembersClass'); -test.DerivedMergedMembersClass.registerClass('test.DerivedMergedMembersClass', test.MergedMembersClass); -test.MyClass.registerClass('test.MyClass', null, test.IMyInterface); -test._someClass.registerClass('test._someClass'); -test.App.registerClass('test.App'); + }; + + + // TypeTests.DerivedMergedMembersClass + + function DerivedMergedMembersClass() { + MergedMembersClass.call(this); + this.name = this.bar + this.bar + 'Name'; + } + var DerivedMergedMembersClass$ = { + testMethod: function() { + return null; + }, + testMethod2: function() { + return this.get_item('foo'); + }, + someMethod: function() { + var e1 = document.getElementById(this.bar); + var e2 = document.getElementById(this.name); + var e3 = document.getElementById(this.bar); + var s = this.testMethod() + MergedMembersClass.prototype.testMethod.call(this); + }, + get_item: function(s) { + return s; + } + }; + + + var $exports = ss.module('test', + { + SingleMemberClass: [ SingleMemberClass, SingleMemberClass$, null ], + SomeClass: [ SomeClass, SomeClass$, null ] + }, + { + IMyInterface: [ IMyInterface ], + EmptyClass: [ EmptyClass, EmptyClass$, null ], + MergedMembersClass: [ MergedMembersClass, MergedMembersClass$, null ], + MyClass: [ MyClass, MyClass$, null, IMyInterface ], + App: [ App, App$, null ], + DerivedMemberClass: [ DerivedMemberClass, DerivedMemberClass$, SingleMemberClass ], + DerivedMergedMembersClass: [ DerivedMergedMembersClass, DerivedMergedMembersClass$, MergedMembersClass ] + }); + + + return $exports; +}); diff --git a/tests/TestCases/Type/Partials/Code1.cs b/tests/TestCases/Type/Partials/Code1.cs index e6ca81a5f..543671c74 100644 --- a/tests/TestCases/Type/Partials/Code1.cs +++ b/tests/TestCases/Type/Partials/Code1.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { @@ -49,8 +48,10 @@ public string TestMethod2() { public interface IMyInterface { void Start(); - [PreserveCase] + + [ScriptName(PreserveCase = true)] void Stop(); + void Resume(); } @@ -69,12 +70,12 @@ public void Run() { public partial class MyClass { - [PreserveCase] + [ScriptName(PreserveCase = true)] public void Resume() { } } - [Imported] + [ScriptImport] internal partial class ImportedClass { } diff --git a/tests/TestCases/Type/Records/Baseline.txt b/tests/TestCases/Type/Records/Baseline.txt index d1c96ccc8..102a2ba16 100644 --- a/tests/TestCases/Type/Records/Baseline.txt +++ b/tests/TestCases/Type/Records/Baseline.txt @@ -1,19 +1,29 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.Point +define('test', ['ss'], function(ss) { + var $global = this; -test.$create_Point = function test_Point(x, y) { - var $o = { }; + // TypeTests.Point + + function Point(x, y) { + var $o = {}; $o.x = x; $o.y = y; return $o; -} + } + + + // TypeTests.Pair + function Pair() { return {}; } -//////////////////////////////////////////////////////////////////////////////// -// test.Pair -test.$create_Pair = function test_Pair() { return {}; } + var $exports = ss.module('test', null, + { + Point: Point, + Pair: Pair + }); + return $exports; +}); diff --git a/tests/TestCases/Type/Records/Code.cs b/tests/TestCases/Type/Records/Code.cs index c4dc87fcb..64ca6a33f 100644 --- a/tests/TestCases/Type/Records/Code.cs +++ b/tests/TestCases/Type/Records/Code.cs @@ -2,11 +2,11 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { - public sealed class Point : Record { + [ScriptObject] + public sealed class Point { public int x; public int y; @@ -16,7 +16,8 @@ public Point(int x, int y) { } } - public sealed class Pair : Record { + [ScriptObject] + public sealed class Pair { public object first; public object second; } diff --git a/tests/TestCases/Type/ScriptNamespaces/AppAssemblyInfo.cs b/tests/TestCases/Type/ScriptNamespaces/AppAssemblyInfo.cs deleted file mode 100644 index 0b34758e9..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppAssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -// AssemblyInfo.cs -// -// Assembly Metadata -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("My.App")] -[assembly: AssemblyDescription("MyApp")] -[assembly: ScriptAssembly("App")] -[assembly: ScriptNamespace("MA")] diff --git a/tests/TestCases/Type/ScriptNamespaces/AppBaseline.txt b/tests/TestCases/Type/ScriptNamespaces/AppBaseline.txt deleted file mode 100644 index b4aa6d17e..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppBaseline.txt +++ /dev/null @@ -1,65 +0,0 @@ -Type.registerNamespace('MAF'); - -Type.registerNamespace('MA'); - -Type.registerNamespace('Test'); - -//////////////////////////////////////////////////////////////////////////////// -// MAF.AppFeature - -MAF.AppFeature = function MAF_AppFeature(name) { - this._name = name; - this._feature = new MLF.Feature(name); -} -MAF.AppFeature.prototype = { - _name: null, - _feature: null, - - get_name: function MAF_AppFeature$get_name() { - return this._name; - }, - set_name: function MAF_AppFeature$set_name(value) { - this._name = value; - return value; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// MA.MyApp - -MA.MyApp = function MA_MyApp(name, appFeatureName, libName, libFeatureName) { - this._name = name; - this._appfeature = new MAF.AppFeature(appFeatureName); - this._lib = new ML.MyLib('lib1', libName); - this._lib.set_feature(new MLF.Feature(libFeatureName)); -} -MA.MyApp.prototype = { - _name: null, - _appfeature: null, - _lib: null, - - get_name: function MA_MyApp$get_name() { - return this._name; - }, - - get_lib: function MA_MyApp$get_lib() { - return this._lib; - }, - set_lib: function MA_MyApp$set_lib(value) { - this._lib = value; - return value; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Test.Foo - -Test.Foo = function Test_Foo() { -} - - -MAF.AppFeature.registerClass('MAF.AppFeature'); -MA.MyApp.registerClass('MA.MyApp'); -Test.Foo.registerClass('Test.Foo'); diff --git a/tests/TestCases/Type/ScriptNamespaces/AppFeature.cs b/tests/TestCases/Type/ScriptNamespaces/AppFeature.cs deleted file mode 100644 index 5d400b007..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppFeature.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using My.Lib; - -namespace My.App { - [ScriptNamespace("MAF")] - public class AppFeature { - string _name; - Feature _feature; - - public string Name { - get { return _name; } - set { _name = value; } - } - - public AppFeature(string name) { - _name = name; - _feature = new Feature(name); - } - } -} - - diff --git a/tests/TestCases/Type/ScriptNamespaces/AppFoo.1.cs b/tests/TestCases/Type/ScriptNamespaces/AppFoo.1.cs deleted file mode 100644 index 7c5186043..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppFoo.1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; -using My.Lib; - -namespace My.App { - - public partial class Foo { - } -} diff --git a/tests/TestCases/Type/ScriptNamespaces/AppFoo.2.cs b/tests/TestCases/Type/ScriptNamespaces/AppFoo.2.cs deleted file mode 100644 index 4c722f254..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppFoo.2.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using My.Lib; - -namespace My.App { - - [ScriptNamespace("Test")] - public partial class Foo { - } -} diff --git a/tests/TestCases/Type/ScriptNamespaces/AppMyApp.cs b/tests/TestCases/Type/ScriptNamespaces/AppMyApp.cs deleted file mode 100644 index 19a8b434d..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/AppMyApp.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using My.Lib; - -namespace My.App { - - public sealed class MyApp { - - private string _name; - private AppFeature _appfeature; - private MyLib _lib; - - public string Name { - get { return _name; } - } - - public MyLib Lib { - get { return _lib; } - set { _lib = value; } - } - - public MyApp(string name, string appFeatureName, string libName, string libFeatureName) { - _name = name; - _appfeature = new AppFeature(appFeatureName); - _lib = new MyLib("lib1", libName); - _lib.Feature = new Feature(libFeatureName); - } - } -} diff --git a/tests/TestCases/Type/ScriptNamespaces/Lib.dll b/tests/TestCases/Type/ScriptNamespaces/Lib.dll deleted file mode 100644 index 7f3c1a4e7..000000000 Binary files a/tests/TestCases/Type/ScriptNamespaces/Lib.dll and /dev/null differ diff --git a/tests/TestCases/Type/ScriptNamespaces/Library.bat b/tests/TestCases/Type/ScriptNamespaces/Library.bat deleted file mode 100644 index 479316237..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/Library.bat +++ /dev/null @@ -1 +0,0 @@ -csc.exe /t:library /noconfig /nologo /nostdlib /r:..\..\..\..\bin\Debug\mscorlib.dll /out:Lib.dll Library*.cs diff --git a/tests/TestCases/Type/ScriptNamespaces/LibraryAssemblyInfo.cs b/tests/TestCases/Type/ScriptNamespaces/LibraryAssemblyInfo.cs deleted file mode 100644 index f8716a28d..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/LibraryAssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("My.Lib")] -[assembly: AssemblyDescription("MyLib")] -[assembly: ScriptAssembly("Lib")] -[assembly: ScriptNamespace("ML")] diff --git a/tests/TestCases/Type/ScriptNamespaces/LibraryBaseline.txt b/tests/TestCases/Type/ScriptNamespaces/LibraryBaseline.txt deleted file mode 100644 index a1f473456..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/LibraryBaseline.txt +++ /dev/null @@ -1,50 +0,0 @@ -Type.registerNamespace('MLF'); - -Type.registerNamespace('ML'); - -//////////////////////////////////////////////////////////////////////////////// -// MLF.Feature - -MLF.Feature = function MLF_Feature(name) { - this._name = name; -} -MLF.Feature.prototype = { - _name: null, - - get_name: function MLF_Feature$get_name() { - return this._name; - }, - set_name: function MLF_Feature$set_name(value) { - this._name = value; - return value; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// ML.MyLib - -ML.MyLib = function ML_MyLib(name, featureName) { - this._name = name; - this._feature = new MLF.Feature(featureName); -} -ML.MyLib.prototype = { - _name: null, - _feature: null, - - get_name: function ML_MyLib$get_name() { - return this._name; - }, - - get_feature: function ML_MyLib$get_feature() { - return this._feature; - }, - set_feature: function ML_MyLib$set_feature(value) { - this._feature = value; - return value; - } -} - - -MLF.Feature.registerClass('MLF.Feature'); -ML.MyLib.registerClass('ML.MyLib'); diff --git a/tests/TestCases/Type/ScriptNamespaces/LibraryFeature.cs b/tests/TestCases/Type/ScriptNamespaces/LibraryFeature.cs deleted file mode 100644 index fd362e263..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/LibraryFeature.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace My.Lib { - [ScriptNamespace("MLF")] - public class Feature { - string _name; - - public string Name { - get { return _name; } - set { _name = value; } - } - - public Feature(string name) { - _name = name; - } - } -} diff --git a/tests/TestCases/Type/ScriptNamespaces/LibraryMyLib.cs b/tests/TestCases/Type/ScriptNamespaces/LibraryMyLib.cs deleted file mode 100644 index 220bfedaf..000000000 --- a/tests/TestCases/Type/ScriptNamespaces/LibraryMyLib.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace My.Lib { - - public sealed class MyLib { - private string _name; - private Feature _feature; - - public MyLib(string name, string featureName) { - _name = name; - _feature = new Feature(featureName); - } - - public string Name { - get { return _name; } - } - - public Feature Feature { - get { return _feature; } - set { _feature = value; } - } - } -} diff --git a/tests/TestCases/Type/UsingAlias/Baseline.txt b/tests/TestCases/Type/UsingAlias/Baseline.txt index fec6f793a..4ad21c1b2 100644 --- a/tests/TestCases/Type/UsingAlias/Baseline.txt +++ b/tests/TestCases/Type/UsingAlias/Baseline.txt @@ -1,13 +1,25 @@ -Type.registerNamespace('test'); +"use strict"; -//////////////////////////////////////////////////////////////////////////////// -// test.MyClass +define('test', ['ss'], function(ss) { + var $global = this; -test.MyClass = function test_MyClass() { + // TypeTests.MyClass + + function MyClass() { var body = document.body; var head = document.getElementsByTagName('head')[0]; head.appendChild(body); -} + } + var MyClass$ = { + + }; + + + var $exports = ss.module('test', null, + { + MyClass: [ MyClass, MyClass$, null ] + }); -test.MyClass.registerClass('test.MyClass'); + return $exports; +}); diff --git a/tests/TestCases/Type/UsingAlias/Code.cs b/tests/TestCases/Type/UsingAlias/Code.cs index b4510d699..c479ca736 100644 --- a/tests/TestCases/Type/UsingAlias/Code.cs +++ b/tests/TestCases/Type/UsingAlias/Code.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace TypeTests { diff --git a/tests/TestCases/Validation/ConflictingTypes/Code.cs b/tests/TestCases/Validation/ConflictingTypes/Code.cs index d51b1b728..14b9b1c04 100644 --- a/tests/TestCases/Validation/ConflictingTypes/Code.cs +++ b/tests/TestCases/Validation/ConflictingTypes/Code.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] namespace ValidationTests { diff --git a/tests/TestCases/Validation/CreateInstance/Code.cs b/tests/TestCases/Validation/CreateInstance/Code.cs index 466ad9fde..f503f9ef8 100644 --- a/tests/TestCases/Validation/CreateInstance/Code.cs +++ b/tests/TestCases/Validation/CreateInstance/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/Exceptions/Code.cs b/tests/TestCases/Validation/Exceptions/Code.cs index cf8de7a90..90250447e 100644 --- a/tests/TestCases/Validation/Exceptions/Code.cs +++ b/tests/TestCases/Validation/Exceptions/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/ImplicitEnums/Code.cs b/tests/TestCases/Validation/ImplicitEnums/Code.cs index 88676860a..2a609dd84 100644 --- a/tests/TestCases/Validation/ImplicitEnums/Code.cs +++ b/tests/TestCases/Validation/ImplicitEnums/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/InlineScript/Code.cs b/tests/TestCases/Validation/InlineScript/Code.cs index 738742e99..5ee3257a6 100644 --- a/tests/TestCases/Validation/InlineScript/Code.cs +++ b/tests/TestCases/Validation/InlineScript/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { @@ -13,6 +13,7 @@ public void Test(int arg) { string scriptTemplate = "alert({0} + {1})"; Script.Literal(scriptTemplate, a, a); + Script.Literal("alert({name:{0}})", "aaa"); } } } diff --git a/tests/TestCases/Validation/Keywords/Code.cs b/tests/TestCases/Validation/Keywords/Code.cs index 8c5d9e092..8140ab316 100644 --- a/tests/TestCases/Validation/Keywords/Code.cs +++ b/tests/TestCases/Validation/Keywords/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/Modules/Code.cs b/tests/TestCases/Validation/Modules/Code.cs new file mode 100644 index 000000000..be804c28a --- /dev/null +++ b/tests/TestCases/Validation/Modules/Code.cs @@ -0,0 +1,22 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + + +namespace ValidationTests { + + [ScriptModule] + public static class A { + } + + [ScriptModule] + internal static class B { + + static B() { + } + + public static void Foo() { + } + } +} diff --git a/tests/TestCases/Validation/NestedTypes/Code.cs b/tests/TestCases/Validation/NestedTypes/Code.cs index fdb94f884..b745728b7 100644 --- a/tests/TestCases/Validation/NestedTypes/Code.cs +++ b/tests/TestCases/Validation/NestedTypes/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/Overloads/Code.cs b/tests/TestCases/Validation/Overloads/Code.cs index 9649431aa..e0113a56f 100644 --- a/tests/TestCases/Validation/Overloads/Code.cs +++ b/tests/TestCases/Validation/Overloads/Code.cs @@ -2,19 +2,16 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { public abstract class Test { - [AlternateSignature] public static extern void DoSomething(); - [AlternateSignature] public extern void Invoke(Action successCallback); - [AlternateSignature] public extern void Invoke(Action successCallback, Action errorCallback); public static void Invoke(Action successCallback, Action errorCallback, object context) { diff --git a/tests/TestCases/Validation/Properties/Code.cs b/tests/TestCases/Validation/Properties/Code.cs index 1ac164236..952ce78b3 100644 --- a/tests/TestCases/Validation/Properties/Code.cs +++ b/tests/TestCases/Validation/Properties/Code.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/Records/Code.cs b/tests/TestCases/Validation/Records/Code.cs new file mode 100644 index 000000000..2aac1050e --- /dev/null +++ b/tests/TestCases/Validation/Records/Code.cs @@ -0,0 +1,36 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + + +namespace ValidationTests { + + [ScriptObject] + public class A { + } + + [ScriptObject] + internal sealed class B : Object { + } + + [ScriptObject] + internal sealed class C { + + static C() { + } + } + + [ScriptObject] + internal sealed class D { + + public D() { + } + + public int Value { + get { + return 0; + } + } + } +} diff --git a/tests/TestCases/Validation/ScriptExtension/Code.cs b/tests/TestCases/Validation/ScriptExtension/Code.cs new file mode 100644 index 000000000..2702ff49c --- /dev/null +++ b/tests/TestCases/Validation/ScriptExtension/Code.cs @@ -0,0 +1,19 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: ScriptAssembly("test")] + + +namespace ValidationTests { + + [ScriptExtension("")] + public static class A { + } + + [ScriptExtension("$global")] + public static class B { + + static B() { + } + } +} diff --git a/tests/TestCases/Validation/Unsupported/Code1.cs b/tests/TestCases/Validation/Unsupported/Code1.cs index 7b745ae34..c185b2947 100644 --- a/tests/TestCases/Validation/Unsupported/Code1.cs +++ b/tests/TestCases/Validation/Unsupported/Code1.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestCases/Validation/Unsupported/Code2.cs b/tests/TestCases/Validation/Unsupported/Code2.cs index edfac2735..328f846da 100644 --- a/tests/TestCases/Validation/Unsupported/Code2.cs +++ b/tests/TestCases/Validation/Unsupported/Code2.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; [assembly: ScriptAssembly("test")] -[assembly: ScriptNamespace("test")] + namespace ValidationTests { diff --git a/tests/TestSite/Bases.htm b/tests/TestSite/Bases.htm new file mode 100644 index 000000000..a90ed09b5 --- /dev/null +++ b/tests/TestSite/Bases.htm @@ -0,0 +1,45 @@ + + + + Bases + + + + + +

                          Test Results

                          +

                          +

                          +
                            +
                            + + + + + + + + + diff --git a/tests/TestSite/Code/OOP.cs b/tests/TestSite/Code/OOP.cs new file mode 100644 index 000000000..7891e84ef --- /dev/null +++ b/tests/TestSite/Code/OOP.cs @@ -0,0 +1,260 @@ +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using Test; + +[assembly:ScriptAssembly("oop")] + +namespace Test { + + public interface IMammal { + } + + public interface IPet { + + string Name { + get; + } + + string Owner { + get; + } + } + + public class Animal { + + private string _species; + + public Animal(string species) { + _species = species; + } + + public string Species { + get { + return _species; + } + } + + public virtual string Live(int i) { + return "[" + i + "] ..."; + } + + public virtual string Die() { + return "..."; + } + } + + public class Cat : Animal, IMammal { + + public Cat() : base("Cat") { + } + + public virtual string Speak() { + return "meow"; + } + + public override string Die() { + return base.Die(); + } + } +} + +namespace Test.More { + + public interface ICharacter { + } + + public class Garfield : Cat, IPet, ICharacter { + + public string Name { + get { + return "Garfield"; + } + } + + public string Owner { + get { + return "Jon"; + } + } + + public override string Speak() { + return base.Speak() + "\r\n" + + "Translation: " + + "I am fat, lazy, and cynical, but still, a favorite cat..."; + } + + public override string Live(int i) { + return base.Live(i) + " zzz"; + } + } + + public class Comic { + + private string _name; + private ICharacter _star; + + public Comic(string name, ICharacter star) { + _name = name; + _star = star; + } + + public string Name { + get { + return _name; + } + } + + public ICharacter Star { + get { + return _star; + } + } + } +} + +namespace Test.Misc { + + public interface IObject { + } + + public class Zoo { + } +} + + +namespace Test.Bases { + + // A series of classes with different combinations of overrides at different + // levels in the class hierarchy. Tests issues #379, #384 as applied to properties, + // methods, and index operators. + + public class C1 { + private string _valueA = "A"; + + public virtual string PropertyA { + get { + return _valueA + "-PC1"; + } + set { + _valueA = value + "+PC1"; + } + } + + public virtual string MethodA() { + return _valueA + "-MC1"; + } + + public virtual string this[int key] { + get { + return _valueA + "-" + key.ToString() + "IC1"; + } + set { + _valueA = value + "+" + key.ToString() + "IC1"; + } + } + } + + public class C2 : C1 { + public override string PropertyA { + get { + return base.PropertyA + "-PC2"; + } + set { + base.PropertyA = value + "+PC2"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC2"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC2"; + } + set { + base[key] = value + "+" + key.ToString() + "IC2"; + } + } + } + + public class C3 : C2 { + public override string PropertyA { + get { + return base.PropertyA + "-PC3"; + } + set { + base.PropertyA = value + "+PC3"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC3"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC3"; + } + set { + base[key] = value + "+" + key.ToString() + "IC3"; + } + } + } + + public class C4 : C3 { + // intentionally skip this generation of overrides + } + + public class C5 : C4 { + public override string PropertyA { + get { + return base.PropertyA + "-PC5"; + } + set { + base.PropertyA = value + "+PC5"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC5"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC5"; + } + set { + base[key] = value + "+" + key.ToString() + "IC5"; + } + } + } + + public class TestCase { + + public static string RunTest(C1 x) { + string output = ""; + string delim = ","; + + // Test getter, method, and index (should accumulate outward through bases) + output = x.PropertyA + + delim + x.MethodA() + + delim + x[99]; + + // Test property setter (should accumulate inward and outward through bases) + + x.PropertyA = "X"; + output += delim + x.PropertyA; + + // Test index setter (should accumulate inward and outward through bases) + + x[88] = "Y"; + output += delim + x[99]; + + return output; + } + + } + +} diff --git a/tests/TestSite/Date.htm b/tests/TestSite/Date.htm new file mode 100644 index 000000000..452230259 --- /dev/null +++ b/tests/TestSite/Date.htm @@ -0,0 +1,38 @@ + + + + Date + + + + + +

                            Test Results

                            +

                            +

                            +
                              +
                              + + + + + + diff --git a/tests/TestSite/Delegates.htm b/tests/TestSite/Delegates.htm new file mode 100644 index 000000000..f0b38a66a --- /dev/null +++ b/tests/TestSite/Delegates.htm @@ -0,0 +1,182 @@ + + + + Delegates + + + + + +

                              Test Results

                              +

                              +

                              +
                                +
                                + + + + + + diff --git a/tests/TestSite/Dictionary.htm b/tests/TestSite/Dictionary.htm new file mode 100644 index 000000000..8c9bc516c --- /dev/null +++ b/tests/TestSite/Dictionary.htm @@ -0,0 +1,56 @@ + + + + Dictionary + + + + + +

                                Test Results

                                +

                                +

                                +
                                  +
                                  + + + + + + diff --git a/tests/TestSite/Enumerator.htm b/tests/TestSite/Enumerator.htm new file mode 100644 index 000000000..05e0dfef2 --- /dev/null +++ b/tests/TestSite/Enumerator.htm @@ -0,0 +1,110 @@ + + + + Enumerator + + + + + +

                                  Test Results

                                  +

                                  +

                                  +
                                    +
                                    + + + + + + + diff --git a/tests/TestSite/Globals.htm b/tests/TestSite/Globals.htm new file mode 100644 index 000000000..d4f6ced20 --- /dev/null +++ b/tests/TestSite/Globals.htm @@ -0,0 +1,41 @@ + + + + Global + + + + + +

                                    Test Results

                                    +

                                    +

                                    +
                                      +
                                      + + + + + diff --git a/tests/TestSite/Loader.htm b/tests/TestSite/Loader.htm new file mode 100644 index 000000000..4193cd1cb --- /dev/null +++ b/tests/TestSite/Loader.htm @@ -0,0 +1,73 @@ + + + + Loader + + + + + +

                                      Test Results

                                      +

                                      +

                                      +
                                        +
                                        + + + + + + + + + diff --git a/tests/TestSite/LoaderChain.htm b/tests/TestSite/LoaderChain.htm new file mode 100644 index 000000000..f7ae5f7ae --- /dev/null +++ b/tests/TestSite/LoaderChain.htm @@ -0,0 +1,42 @@ + + + + LoaderChain + + + + + +

                                        Test Results

                                        +

                                        +

                                        +
                                          +
                                          + + + + + + + + + + diff --git a/tests/TestSite/LoaderCombined.htm b/tests/TestSite/LoaderCombined.htm new file mode 100644 index 000000000..8cc4469a4 --- /dev/null +++ b/tests/TestSite/LoaderCombined.htm @@ -0,0 +1,41 @@ + + + + LoaderCombined + + + + + +

                                          Test Results

                                          +

                                          +

                                          +
                                            +
                                            + + + + + + + + + diff --git a/tests/TestSite/LoaderConfig.htm b/tests/TestSite/LoaderConfig.htm new file mode 100644 index 000000000..eaaa4a371 --- /dev/null +++ b/tests/TestSite/LoaderConfig.htm @@ -0,0 +1,75 @@ + + + + LoaderConfig + + + + + +

                                            Test Results

                                            +

                                            +

                                            +
                                              +
                                              + + + + + + + + + diff --git a/tests/TestSite/LoaderNonAMD.htm b/tests/TestSite/LoaderNonAMD.htm new file mode 100644 index 000000000..c595b6f25 --- /dev/null +++ b/tests/TestSite/LoaderNonAMD.htm @@ -0,0 +1,41 @@ + + + + LoaderNonAMD + + + + + +

                                              Test Results

                                              +

                                              +

                                              +
                                                +
                                                + + + + + + + + + + + diff --git a/tests/TestSite/Observable.htm b/tests/TestSite/Observable.htm new file mode 100644 index 000000000..9c62c9861 --- /dev/null +++ b/tests/TestSite/Observable.htm @@ -0,0 +1,140 @@ + + + + Observable + + + + + +

                                                Test Results

                                                +

                                                +

                                                +
                                                  +
                                                  + + + + + + + diff --git a/tests/CoreLib/QUnit.css b/tests/TestSite/QUnit/QUnit.css similarity index 100% rename from tests/CoreLib/QUnit.css rename to tests/TestSite/QUnit/QUnit.css diff --git a/tests/CoreLib/QUnit.js b/tests/TestSite/QUnit/QUnit.js similarity index 100% rename from tests/CoreLib/QUnit.js rename to tests/TestSite/QUnit/QUnit.js diff --git a/tests/CoreLib/QUnitExt.js b/tests/TestSite/QUnit/QUnitExt.js similarity index 64% rename from tests/CoreLib/QUnitExt.js rename to tests/TestSite/QUnit/QUnitExt.js index fa1d73b9a..d69f420bb 100644 --- a/tests/CoreLib/QUnitExt.js +++ b/tests/TestSite/QUnit/QUnitExt.js @@ -20,6 +20,24 @@ QUnit.done = function(failures, total) { appendLog('\r\nCompleted; ' + 'failures = ' + failures + '; total = ' + total); + + if (window.location.protocol === 'file:') { + return; + } + + var logUrl = '/log/' + ((failures === 0) ? 'success' : 'failure'); + var xhr = new XMLHttpRequest(); + if ((failures === 0) && (location.search !== '?debug')) { + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + window.open('', '_self', ''); + window.close(); + } + }; + } + xhr.open('POST', logUrl, /* async */ false); + xhr.setRequestHeader('Content-Type', 'text/plain'); + xhr.send(logData); } QUnit.testStart = function(name) { @@ -28,6 +46,7 @@ QUnit.testDone = function(name, failures, total) { appendLog(' Test Done: ' + name + '; failures = ' + failures + '; total = ' + total); + appendLog(''); } QUnit.moduleStart = function(name, testEnv) { @@ -38,6 +57,8 @@ QUnit.moduleDone = function(name, failures, total) { if (name === currentModule) { appendLog('Module Done: ' + name + '; failures = ' + failures + '; total = ' + total + '\r\n'); + appendLog(''); + appendLog(''); } currentModule = null; } diff --git a/tests/TestSite/Queue.htm b/tests/TestSite/Queue.htm new file mode 100644 index 000000000..345929fc7 --- /dev/null +++ b/tests/TestSite/Queue.htm @@ -0,0 +1,119 @@ + + + + Queue + + + + + +

                                                  Test Results

                                                  +

                                                  +

                                                  +
                                                    +
                                                    + + + + + + + diff --git a/tests/TestSite/Scripts/A.js b/tests/TestSite/Scripts/A.js new file mode 100644 index 000000000..81cc4499a --- /dev/null +++ b/tests/TestSite/Scripts/A.js @@ -0,0 +1,3 @@ +define('A', ['ss'], function(ss) { + return { $name: 'A', $dep: ss }; +}); diff --git a/tests/TestSite/Scripts/AB.js b/tests/TestSite/Scripts/AB.js new file mode 100644 index 000000000..eb987690d --- /dev/null +++ b/tests/TestSite/Scripts/AB.js @@ -0,0 +1,7 @@ +define('A', ['ss'], function(ss) { + return { $name: 'A', $dep: ss }; +}); + +define('B', ['A'], function(a) { + return { $name: 'B', $dep: a }; +}); diff --git a/tests/TestSite/Scripts/B.js b/tests/TestSite/Scripts/B.js new file mode 100644 index 000000000..5e7c970c6 --- /dev/null +++ b/tests/TestSite/Scripts/B.js @@ -0,0 +1,3 @@ +define('B', ['A'], function(a) { + return { $name: 'B', $dep: a }; +}); diff --git a/tests/TestSite/Scripts/C.js b/tests/TestSite/Scripts/C.js new file mode 100644 index 000000000..8cfdb5805 --- /dev/null +++ b/tests/TestSite/Scripts/C.js @@ -0,0 +1 @@ +window.c = { "script": 'c' }; diff --git a/tests/TestSite/Stack.htm b/tests/TestSite/Stack.htm new file mode 100644 index 000000000..f89e352e5 --- /dev/null +++ b/tests/TestSite/Stack.htm @@ -0,0 +1,88 @@ + + + + Stack + + + + + +

                                                    Test Results

                                                    +

                                                    +

                                                    +
                                                      +
                                                      + + + + + + + diff --git a/tests/TestSite/String.htm b/tests/TestSite/String.htm new file mode 100644 index 000000000..7adba8c55 --- /dev/null +++ b/tests/TestSite/String.htm @@ -0,0 +1,122 @@ + + + + String + + + + + +

                                                      Test Results

                                                      +

                                                      +

                                                      +
                                                        +
                                                        + + + + + + diff --git a/tests/TestSite/StringBuilder.htm b/tests/TestSite/StringBuilder.htm new file mode 100644 index 000000000..e214ae227 --- /dev/null +++ b/tests/TestSite/StringBuilder.htm @@ -0,0 +1,72 @@ + + + + StringBuilder + + + + + +

                                                        Test Results

                                                        +

                                                        +

                                                        +
                                                          +
                                                          + + + + + + + diff --git a/tests/TestSite/Tasks.htm b/tests/TestSite/Tasks.htm new file mode 100644 index 000000000..3020e4f4e --- /dev/null +++ b/tests/TestSite/Tasks.htm @@ -0,0 +1,297 @@ + + + + Tasks + + + + + +

                                                          Test Results

                                                          +

                                                          +

                                                          +
                                                            +
                                                            + + + + + + + diff --git a/tests/TestSite/TypeSystem.htm b/tests/TestSite/TypeSystem.htm new file mode 100644 index 000000000..646575c02 --- /dev/null +++ b/tests/TestSite/TypeSystem.htm @@ -0,0 +1,149 @@ + + + + TypeSystem + + + + + +

                                                            Test Results

                                                            +

                                                            +

                                                            +
                                                              +
                                                              + + + + + + + + + diff --git a/tests/ScriptSharp/ScriptSharp.csproj b/tests/Tests.csproj similarity index 90% rename from tests/ScriptSharp/ScriptSharp.csproj rename to tests/Tests.csproj index a080e9d10..9f4afb319 100644 --- a/tests/ScriptSharp/ScriptSharp.csproj +++ b/tests/Tests.csproj @@ -42,11 +42,14 @@ False - ..\..\bin\Debug\ScriptSharp.dll + ..\bin\Debug\ScriptSharp.dll False - ..\..\bin\Debug\ScriptSharp.Build.dll + ..\bin\Debug\ScriptSharp.Build.dll + + + ..\bin\Debug\ScriptSharp.Testing.dll @@ -56,7 +59,10 @@ + + + diff --git a/tests/Tests.sln b/tests/Tests.sln new file mode 100644 index 000000000..cff4bb476 --- /dev/null +++ b/tests/Tests.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests.csproj", "{0E3485F3-D66D-4907-BDB9-D61D34F97538}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{37D238E7-539B-497A-98D7-760DAFCF6527}" + ProjectSection(SolutionItems) = preProject + Tests.testsettings = Tests.testsettings + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E3485F3-D66D-4907-BDB9-D61D34F97538}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/ScriptSharp.testsettings b/tests/Tests.testsettings similarity index 100% rename from tests/ScriptSharp.testsettings rename to tests/Tests.testsettings diff --git a/tests/ScriptSharp/TypeTests.cs b/tests/TypeTests.cs similarity index 68% rename from tests/ScriptSharp/TypeTests.cs rename to tests/TypeTests.cs index ee60c48ad..05018cd26 100644 --- a/tests/ScriptSharp/TypeTests.cs +++ b/tests/TypeTests.cs @@ -16,7 +16,6 @@ public sealed class TypeTests : CompilationTest { public void TestClasses() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -24,7 +23,6 @@ public void TestClasses() { public void TestDelegates() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -32,7 +30,6 @@ public void TestDelegates() { public void TestEnumerator() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -40,7 +37,6 @@ public void TestEnumerator() { public void TestEnums() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -48,7 +44,6 @@ public void TestEnums() { public void TestGlobals() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -64,7 +59,6 @@ public void TestImported() { public void TestInterfaces() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -72,15 +66,27 @@ public void TestInterfaces() { public void TestNamespaces() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } + [TestMethod] + public void TestModules() { + RunTest((c) => { + c.AddReference("Script.Web.dll"). + AddSource("Code.cs"); + c.Options.Defines = new string[] { "INCLUDE_EXPORT" }; + }); + + RunTest((c) => { + c.AddReference("Script.Web.dll"). + AddSource("Code.cs"); + }, "ZeroExportsBaseline.txt"); + } + [TestMethod] public void TestNullable() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } @@ -90,7 +96,6 @@ public void TestPartials() { c.AddReference("Script.Web.dll"). AddSource("Code1.cs"). AddSource("Code2.cs"); - c.Options.DebugFlavor = true; }); } @@ -98,36 +103,14 @@ public void TestPartials() { public void TestRecords() { RunTest((c) => { c.AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } - [TestMethod] - public void TestScriptNamespaces() { - RunTest((c) => { - c.AddSource("LibraryAssemblyInfo.cs"). - AddSource("LibraryFeature.cs"). - AddSource("LibraryMyLib.cs"); - c.Options.DebugFlavor = true; - }, "LibraryBaseline.txt"); - - RunTest((c) => { - c.AddReference("Lib.dll"). - AddSource("AppAssemblyInfo.cs"). - AddSource("AppFeature.cs"). - AddSource("AppMyApp.cs"). - AddSource("AppFoo.1.cs"). - AddSource("AppFoo.2.cs"); - c.Options.DebugFlavor = true; - }, "AppBaseline.txt"); - } - [TestMethod] public void TestUsingAlias() { RunTest((c) => { c.AddReference("Script.Web.dll"). AddSource("Code.cs"); - c.Options.DebugFlavor = true; }); } } diff --git a/tests/ScriptSharp/ValidationTests.cs b/tests/ValidationTests.cs similarity index 75% rename from tests/ScriptSharp/ValidationTests.cs rename to tests/ValidationTests.cs index 1d79daf07..1d608b69e 100644 --- a/tests/ScriptSharp/ValidationTests.cs +++ b/tests/ValidationTests.cs @@ -16,9 +16,7 @@ public sealed class ValidationTests : CompilationTest { [TestMethod] public void TestConflictingTypes() { string expectedErrors = - "The type 'test.App' conflicts with another existing type with the same full name. " + - "This might be because a referenced assembly uses the same type, or you have multiple " + - "types with the same name across namespaces mapped to the same script namespace. "; + "The type 'OtherTests.App' conflicts with with 'ValidationTests.App' as they have the same name. "; Compilation compilation = CreateCompilation(); compilation.AddSource("Code.cs"); @@ -116,7 +114,8 @@ public void TestImplicitEnums() { [TestMethod] public void TestInlineScript() { string expectedErrors = - "The argument to Script.Literal must be a constant string. Code.cs(15, 28)"; + "The argument to Script.Literal must be a constant string. Code.cs(15, 28)" + Environment.NewLine + + "The argument to Script.Literal must be a valid String.Format string. Code.cs(16, 28)"; Compilation compilation = CreateCompilation(); compilation.AddSource("Code.cs"); @@ -162,6 +161,31 @@ public void TestKeywords() { } } + [TestMethod] + public void TestModules() { + string expectedErrors = + "ScriptModule attribute can only be set on internal static classes. Code.cs(9, 5)" + Environment.NewLine + + "Classes marked with ScriptModule attribute should only have a static constructor. Code.cs(19, 9)"; + + Compilation compilation = CreateCompilation(); + compilation.AddSource("Code.cs"); + + bool result = compilation.Execute(); + Assert.IsFalse(result, "Expected compilation to fail."); + + Assert.IsTrue(compilation.HasErrors, "Expected compilation to fail with errors."); + if (String.CompareOrdinal(compilation.ErrorMessages, expectedErrors) != 0) { + Console.WriteLine("Expected Errors:"); + Console.WriteLine(expectedErrors); + Console.WriteLine(); + Console.WriteLine("Actual Errors:"); + Console.WriteLine(compilation.ErrorMessages); + Console.WriteLine(); + + Assert.Fail("Unexpected errors."); + } + } + [TestMethod] public void TestNestedTypes() { string expectedErrors = @@ -191,8 +215,8 @@ public void TestNestedTypes() { public void TestOverloads() { string expectedErrors = "Extern methods used to declare alternate signatures should have a corresponding non-extern implementation as well. Code.cs(11, 9)" + Environment.NewLine + - "The implemenation method and associated alternate signature methods should have the same access type. Code.cs(14, 9)" + Environment.NewLine + - "The implemenation method and associated alternate signature methods should have the same access type. Code.cs(17, 9)"; + "The implemenation method and associated alternate signature methods should have the same access type. Code.cs(13, 9)" + Environment.NewLine + + "The implemenation method and associated alternate signature methods should have the same access type. Code.cs(15, 9)"; Compilation compilation = CreateCompilation(); compilation.AddSource("Code.cs"); @@ -237,6 +261,58 @@ public void TestProperties() { } } + [TestMethod] + public void TestRecords() { + string expectedErrors = + "ScriptObject attribute can only be set on sealed classes. Code.cs(9, 5)" + Environment.NewLine + + "Classes marked with ScriptObject must not derive from another class or implement interfaces. Code.cs(13, 5)" + Environment.NewLine + + "Classes marked with ScriptObject attribute should only have a constructor and field members. Code.cs(20, 9)" + Environment.NewLine + + "Classes marked with ScriptObject attribute should only have a constructor and field members. Code.cs(30, 9)"; + + Compilation compilation = CreateCompilation(); + compilation.AddSource("Code.cs"); + + bool result = compilation.Execute(); + Assert.IsFalse(result, "Expected compilation to fail."); + + Assert.IsTrue(compilation.HasErrors, "Expected compilation to fail with errors."); + if (String.CompareOrdinal(compilation.ErrorMessages, expectedErrors) != 0) { + Console.WriteLine("Expected Errors:"); + Console.WriteLine(expectedErrors); + Console.WriteLine(); + Console.WriteLine("Actual Errors:"); + Console.WriteLine(compilation.ErrorMessages); + Console.WriteLine(); + + Assert.Fail("Unexpected errors."); + } + } + + [TestMethod] + public void TestScriptExtension() { + string expectedErrors = + "ScriptExtension attribute declaration must specify the object being extended. Code.cs(9, 5)" + Environment.NewLine + + "Classes marked with ScriptExtension attribute should only have methods. Code.cs(16, 9)"; + + Compilation compilation = CreateCompilation(); + compilation.AddSource("Code.cs"); + + bool result = compilation.Execute(); + Assert.IsFalse(result, "Expected compilation to fail."); + + Assert.IsTrue(compilation.HasErrors, "Expected compilation to fail with errors."); + if (String.CompareOrdinal(compilation.ErrorMessages, expectedErrors) != 0) { + Console.WriteLine("Expected Errors:"); + Console.WriteLine(expectedErrors); + Console.WriteLine(); + Console.WriteLine("Actual Errors:"); + Console.WriteLine(compilation.ErrorMessages); + Console.WriteLine(); + + Assert.Fail("Unexpected errors."); + } + } + [TestMethod] public void TestUnsupported() { string expectedErrors1 = diff --git a/tools/Preprocessor/Application.cs b/tools/Preprocessor/Application.cs index 58e12ba6e..f24cbdfec 100644 --- a/tools/Preprocessor/Application.cs +++ b/tools/Preprocessor/Application.cs @@ -4,14 +4,12 @@ // using System; -using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.IO; namespace ScriptSharp { - internal sealed class Application : IStreamResolver, IErrorHandler { + public sealed class Application : IStreamResolver, IErrorHandler { private static readonly string AboutTextFormat = @" Script# Preprocessor v{0} (Script minimizer/merger) @@ -33,7 +31,7 @@ If minimization is turned on you can add /stripCommentsOnly (implies /noMin) /d - Allows you to define one or more additional preprocessor variables. /crlf - Use Windows-style line breaks -/input - Specifies the input .jsa file (required) +/input - Specifies the input .js file (required) /output - Specifies the output .js file (required) /? - Shows usage information."; @@ -123,7 +121,6 @@ private string GetAboutString() { return String.Format(AboutTextFormat, versionInfo); } - [STAThread] public static int Main(string[] args) { Application app = new Application(args); bool success = app.Execute(); diff --git a/tools/Preprocessor/CommandLine.cs b/tools/Preprocessor/CommandLine.cs index 28e421b9e..496acaf6b 100644 --- a/tools/Preprocessor/CommandLine.cs +++ b/tools/Preprocessor/CommandLine.cs @@ -1,5 +1,5 @@ // CommandLine.cs -// Script#/Common +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; -using System.Globalization; using System.IO; namespace ScriptSharp { diff --git a/tools/Preprocessor/FileInputStreamSource.cs b/tools/Preprocessor/FileInputStreamSource.cs index 7c28e26a7..da4e28779 100644 --- a/tools/Preprocessor/FileInputStreamSource.cs +++ b/tools/Preprocessor/FileInputStreamSource.cs @@ -1,5 +1,5 @@ // FileInputStreamSource.cs -// Script#/Common +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -9,7 +9,7 @@ namespace ScriptSharp { - internal class FileInputStreamSource : IStreamSource { + internal sealed class FileInputStreamSource : IStreamSource { private string _path; private string _name; diff --git a/tools/Preprocessor/FileOutputStreamSource.cs b/tools/Preprocessor/FileOutputStreamSource.cs index ea87a0ea9..4c5a155e7 100644 --- a/tools/Preprocessor/FileOutputStreamSource.cs +++ b/tools/Preprocessor/FileOutputStreamSource.cs @@ -1,5 +1,5 @@ // FileOutputStreamSource.cs -// Script#/Common +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -9,7 +9,7 @@ namespace ScriptSharp { - internal class FileOutputStreamSource : IStreamSource { + internal sealed class FileOutputStreamSource : IStreamSource { private string _path; private string _name; diff --git a/tools/Preprocessor/IErrorHandler.cs b/tools/Preprocessor/IErrorHandler.cs index 789045d3e..1c2b9844e 100644 --- a/tools/Preprocessor/IErrorHandler.cs +++ b/tools/Preprocessor/IErrorHandler.cs @@ -1,5 +1,5 @@ // IErrorHandler.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -7,7 +7,7 @@ namespace ScriptSharp { - public interface IErrorHandler { + internal interface IErrorHandler { void ReportError(string errorMessage, string location); } diff --git a/tools/Preprocessor/IScriptInfo.cs b/tools/Preprocessor/IScriptInfo.cs deleted file mode 100644 index e913464e9..000000000 --- a/tools/Preprocessor/IScriptInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -// IScriptInfo.cs -// Script#/Core/ScriptSharp -// This source code is subject to terms and conditions of the Apache License, Version 2.0. -// - -using System; -using System.IO; - -namespace ScriptSharp { - - internal interface IScriptInfo { - - string GetValue(string name); - } -} diff --git a/tools/Preprocessor/IStreamResolver.cs b/tools/Preprocessor/IStreamResolver.cs index b88002f6c..cf61302e3 100644 --- a/tools/Preprocessor/IStreamResolver.cs +++ b/tools/Preprocessor/IStreamResolver.cs @@ -1,5 +1,5 @@ // IStreamResolver.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -8,7 +8,7 @@ namespace ScriptSharp { - public interface IStreamResolver { + internal interface IStreamResolver { IStreamSource ResolveInclude(IStreamSource baseStream, string includePath); } diff --git a/tools/Preprocessor/IStreamSource.cs b/tools/Preprocessor/IStreamSource.cs index 74aa4e792..bf8ccc8f2 100644 --- a/tools/Preprocessor/IStreamSource.cs +++ b/tools/Preprocessor/IStreamSource.cs @@ -1,5 +1,5 @@ // IStreamSource.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -8,7 +8,7 @@ namespace ScriptSharp { - public interface IStreamSource { + internal interface IStreamSource { string FullName { get; diff --git a/tools/Preprocessor/Preprocessor.csproj b/tools/Preprocessor/Preprocessor.csproj index 6abad217c..92a350636 100644 --- a/tools/Preprocessor/Preprocessor.csproj +++ b/tools/Preprocessor/Preprocessor.csproj @@ -44,7 +44,6 @@ - diff --git a/tools/Preprocessor/Preprocessor/CondenserTextReader.cs b/tools/Preprocessor/Preprocessor/CondenserTextReader.cs index 1295be2b1..a2ccbef20 100644 --- a/tools/Preprocessor/Preprocessor/CondenserTextReader.cs +++ b/tools/Preprocessor/Preprocessor/CondenserTextReader.cs @@ -1,11 +1,9 @@ // CondenserTextReader.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // using System; -using System.Collections; -using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/tools/Preprocessor/Preprocessor/PreprocessorException.cs b/tools/Preprocessor/Preprocessor/PreprocessorException.cs index e6cf68676..dff0a652b 100644 --- a/tools/Preprocessor/Preprocessor/PreprocessorException.cs +++ b/tools/Preprocessor/Preprocessor/PreprocessorException.cs @@ -1,5 +1,5 @@ // PreprocessorException.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // diff --git a/tools/Preprocessor/Preprocessor/PreprocessorTextReader.cs b/tools/Preprocessor/Preprocessor/PreprocessorTextReader.cs index ab754c356..4e6268ae2 100644 --- a/tools/Preprocessor/Preprocessor/PreprocessorTextReader.cs +++ b/tools/Preprocessor/Preprocessor/PreprocessorTextReader.cs @@ -1,5 +1,5 @@ // PreprocessorTextReader.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using ScriptSharp; namespace ScriptSharp.Preprocessor { @@ -18,7 +17,6 @@ internal sealed class PreprocessorTextReader : TextReader { private IStreamSource _source; private IStreamResolver _includeResolver; - private IScriptInfo _scriptInfo; private Dictionary _definedVariables; private Stack _activeInstructions; @@ -36,12 +34,11 @@ internal sealed class PreprocessorTextReader : TextReader { private TextReader _includeTextReader; private int _includeLineCounter; - public PreprocessorTextReader(IStreamSource source, ICollection predefinedVariables, IStreamResolver includeResolver, IScriptInfo scriptInfo) { + public PreprocessorTextReader(IStreamSource source, ICollection predefinedVariables, IStreamResolver includeResolver) { Debug.Assert(source != null); _source = source; _includeResolver = includeResolver; - _scriptInfo = scriptInfo; _definedVariables = new Dictionary(); _activeInstructions = new Stack(); @@ -152,31 +149,7 @@ private string GetNextLine() { isActive = currentInstruction.IsActive; } - if (trimmedLine.StartsWith("##")) { - if (isActive == false) { - line = null; - } - if (line != null) { - line = ProcessSingleLineInstruction(trimmedLine); - } - } - else if (trimmedLine.StartsWith("#include[as-is] ")) { - if (isActive == false) { - line = null; - } - - if (line != null) { - _currentLine = line; - if (_includeResolver != null) { - ProcessIncludeInstruction(trimmedLine, /* skipPreprocessing */ true); - line = null; - } - else { - RaiseError("Includes are not supported in this file."); - } - } - } - else if (trimmedLine.StartsWith("#include ")) { + if (trimmedLine.StartsWith("#include ")) { if (isActive == false) { line = null; } @@ -185,7 +158,7 @@ private string GetNextLine() { _currentLine = line; if (_includeResolver != null) { if (_includeStream == null) { - ProcessIncludeInstruction(trimmedLine, /* skipPreprocessing */ false); + ProcessIncludeInstruction(trimmedLine); line = null; } else { @@ -218,7 +191,7 @@ private string GetNextLine() { } } - return ProcessInlineInstruction(line); + return line; } public bool Initialize(TextWriter skipPreprocessingWriter) { @@ -278,7 +251,7 @@ public override int Peek() { return ch; } - private void ProcessIncludeInstruction(string instructionLine, bool skipPreprocessing) { + private void ProcessIncludeInstruction(string instructionLine) { Debug.Assert(_includeStream == null); Debug.Assert(_includeTextReader == null); @@ -301,17 +274,6 @@ private void ProcessIncludeInstruction(string instructionLine, bool skipPreproce if (_includeStream != null) { _includeTextReader = new StreamReader(_includeStream); _includeLineCounter = 0; - - if (skipPreprocessing) { - string includeText = _includeTextReader.ReadToEnd(); - _skipPreprocessingWriter.Write(includeText); - - _include.CloseStream(_includeStream); - _includeTextReader = null; - _includeStream = null; - - included = true; - } } } } @@ -328,84 +290,6 @@ private void ProcessIncludeInstruction(string instructionLine, bool skipPreproce } } - private string ProcessInlineInstruction(string line) { - if (String.IsNullOrEmpty(line)) { - return line; - } - - int inlineInstructionIndex; - - // Processes inline instructions within the line such as - // ... #= XYZ ## ... - inlineInstructionIndex = line.IndexOf("#="); - while (inlineInstructionIndex >= 0) { - int variableEndIndex; - string variable = ParseInstructionVariable(line, inlineInstructionIndex + 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '#=' instruction."); - continue; - } - - string value = _scriptInfo.GetValue(variable); - if (value == null) { - RaiseError("Unknown variable name, '" + variable + "' after '#=' instruction."); - continue; - } - - int inlineInstructionEndIndex = line.IndexOf("##", variableEndIndex); - if (inlineInstructionEndIndex < 0) { - RaiseError("Invalid instruction. Missing ending '##' after '#='."); - continue; - } - - if (line.Length > inlineInstructionEndIndex + 2) { - line = line.Substring(0, inlineInstructionIndex) + value + line.Substring(inlineInstructionEndIndex + 2); - } - else { - line = line.Substring(0, inlineInstructionIndex) + value; - } - - inlineInstructionIndex = line.IndexOf("#="); - } - - // Processes inline instructions within the line such as - // ... #? DEBUG ... ## ... - inlineInstructionIndex = line.IndexOf("#?"); - while (inlineInstructionIndex >= 0) { - int variableEndIndex; - string variable = ParseInstructionVariable(line, inlineInstructionIndex + 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '#?' instruction."); - continue; - } - - int inlineInstructionEndIndex = line.IndexOf("##", variableEndIndex); - if (inlineInstructionEndIndex < 0) { - RaiseError("Invalid instruction. Missing ending '##' after '#?'."); - continue; - } - - if (_definedVariables.ContainsKey(variable)) { - int scriptIndex = variableEndIndex + 1; - if (line.Length > scriptIndex) { - line = line.Remove(inlineInstructionEndIndex, 2); - line = line.Remove(inlineInstructionIndex, variableEndIndex - inlineInstructionIndex); - } - else { - RaiseError("No script was present on the line after the '##' instruction."); - } - } - else { - // Update the line to be everything except for the inline instruction - line = line.Remove(inlineInstructionIndex, inlineInstructionEndIndex - inlineInstructionIndex + 2); - } - - inlineInstructionIndex = line.IndexOf("#?"); - } - - return line; - } - private void ProcessInstruction(string instructionLine) { int dummy; if (instructionLine.StartsWith("#define ")) { @@ -482,28 +366,6 @@ private void ProcessInstruction(string instructionLine) { } } - private string ProcessSingleLineInstruction(string instructionLine) { - string scriptLine = null; - - int variableEndIndex; - string variable = ParseInstructionVariable(instructionLine, 2, out variableEndIndex); - if (variable == null) { - RaiseError("Variable name was missing after '##' instruction."); - } - - if (_definedVariables.ContainsKey(variable)) { - int scriptIndex = variableEndIndex + 1; - if (instructionLine.Length > scriptIndex) { - scriptLine = instructionLine.Substring(scriptIndex); - } - else { - RaiseError("No script was present on the line after the '##' instruction."); - } - } - - return scriptLine; - } - private void RaiseError(string errorMessage) { RaiseError(errorMessage, null); } diff --git a/tools/Preprocessor/PreprocessorOptions.cs b/tools/Preprocessor/PreprocessorOptions.cs index 394b005a2..30bf1d72e 100644 --- a/tools/Preprocessor/PreprocessorOptions.cs +++ b/tools/Preprocessor/PreprocessorOptions.cs @@ -1,5 +1,5 @@ // PreprocessorOptions.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -14,7 +14,7 @@ namespace ScriptSharp { /// /// Script# pre-processor options. /// - public sealed class PreprocessorOptions { + internal sealed class PreprocessorOptions { private ICollection _preprocessorVariables; private IStreamSource _sourceFile; diff --git a/tools/Preprocessor/Properties/AssemblyInfo.cs b/tools/Preprocessor/Properties/AssemblyInfo.cs index 9cf9073a4..af0f7acfc 100644 --- a/tools/Preprocessor/Properties/AssemblyInfo.cs +++ b/tools/Preprocessor/Properties/AssemblyInfo.cs @@ -16,6 +16,6 @@ [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.7.0.0")] -[assembly: AssemblyFileVersion("0.7.4.0")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: CLSCompliant(true)] diff --git a/tools/Preprocessor/ScriptPreprocessor.cs b/tools/Preprocessor/ScriptPreprocessor.cs index 430f9816d..177f35d28 100644 --- a/tools/Preprocessor/ScriptPreprocessor.cs +++ b/tools/Preprocessor/ScriptPreprocessor.cs @@ -1,5 +1,5 @@ // ScriptSharpPreprocessor.cs -// Script#/Core/ScriptSharp +// Script#/Tools/Preprocessor // This source code is subject to terms and conditions of the Apache License, Version 2.0. // @@ -11,22 +11,12 @@ namespace ScriptSharp { - public sealed class ScriptPreprocessor { + internal sealed class ScriptPreprocessor { - private IScriptInfo _scriptInfo; private IStreamResolver _includeResolver; private IErrorHandler _errorHandler; - public ScriptPreprocessor() - : this(null, null, null) { - } - - public ScriptPreprocessor(IStreamResolver includeResolver, IErrorHandler errorHandler) - : this(includeResolver, errorHandler, null) { - } - - internal ScriptPreprocessor(IStreamResolver includeResolver, IErrorHandler errorHandler, IScriptInfo scriptInfo) { - _scriptInfo = scriptInfo; + public ScriptPreprocessor(IStreamResolver includeResolver, IErrorHandler errorHandler) { _includeResolver = includeResolver; _errorHandler = errorHandler; } @@ -41,8 +31,7 @@ public void Preprocess(PreprocessorOptions options) { outputWriter = new StreamWriter(outputStream); preprocessor = new PreprocessorTextReader(options.SourceFile, options.PreprocessorVariables, - _includeResolver, - _scriptInfo); + _includeResolver); TextReader contentReader = preprocessor; if (options.Minimize) { diff --git a/tools/bin/sspp.exe b/tools/bin/sspp.exe index 41f7b8943..d946bd36b 100644 Binary files a/tools/bin/sspp.exe and b/tools/bin/sspp.exe differ diff --git a/tools/ext/AjaxMin.dll b/tools/ext/AjaxMin.dll new file mode 100644 index 000000000..e4dd2cf6a Binary files /dev/null and b/tools/ext/AjaxMin.dll differ