pax_global_header00006660000000000000000000000064135603546270014525gustar00rootroot0000000000000052 comment=aad712123b2a9f5373d2eeb71cd63227fe5c7bd8 knockout-3.5.1/000077500000000000000000000000001356035462700133705ustar00rootroot00000000000000knockout-3.5.1/.gitignore000066400000000000000000000002401356035462700153540ustar00rootroot00000000000000*.suo *.swp *.csproj.user bin obj *.pdb _ReSharper* *.ReSharper.user *.ReSharper desktop.ini .eprj perf/* *.orig *.bak .DS_Store npm-debug.log node_modules distknockout-3.5.1/.npmignore000066400000000000000000000003171356035462700153700ustar00rootroot00000000000000# Only package the build output for npm. Developers who want sources/tests can get them from the KO repo. * !build/output/knockout-latest.js !build/output/knockout-latest.debug.js !build/types/knockout.d.ts knockout-3.5.1/.travis.yml000066400000000000000000000001261356035462700155000ustar00rootroot00000000000000language: node_js node_js: - "node" before_install: - npm install -g typescript knockout-3.5.1/Gruntfile.js000066400000000000000000000157121356035462700156730ustar00rootroot00000000000000/*global module:false*/ module.exports = function(grunt) { var _ = grunt.util._; // Project configuration grunt.initConfig({ // Metadata pkg: grunt.file.readJSON('package.json'), fragments: './build/fragments/', banner: '/*!\n' + ' * Knockout JavaScript library v<%= pkg.version %>\n' + ' * (c) The Knockout.js team - <%= pkg.homepage %>\n' + ' * License: <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>)\n' + ' */\n\n', checktrailingspaces: { main: { src: [ "**/*.{js,html,css,bat,ps1,sh}", "!build/output/**", "!node_modules/**" ], filter: 'isFile' } }, build: { debug: './build/output/knockout-latest.debug.js', min: './build/output/knockout-latest.js' }, dist: { debug: './dist/knockout.debug.js', min: './dist/knockout.js' }, test: { phantomjs: 'spec/runner.phantom.js', node: 'spec/runner.node.js' }, testtypes: { global: "spec/types/global", module: "spec/types/module" } }); grunt.registerTask('clean', 'Clean up output files.', function (target) { var output = grunt.config('build'); var files = [ output.debug, output.min ]; var options = { force: (target == 'force') }; _.forEach(files, function (file) { if (grunt.file.exists(file)) grunt.file.delete(file, options); }); return !this.errorCount; }); var trailingSpaceRegex = /[ ]$/; grunt.registerMultiTask('checktrailingspaces', 'checktrailingspaces', function() { var matches = []; this.files[0].src.forEach(function(filepath) { var content = grunt.file.read(filepath), lines = content.split(/\r*\n/); lines.forEach(function(line, index) { if (trailingSpaceRegex.test(line)) { matches.push([filepath, (index+1), line].join(':')); } }); }); if (matches.length) { grunt.log.error("The following files have trailing spaces that need to be cleaned up:"); grunt.log.writeln(matches.join('\n')); return false; } }); function getReferencedSources(sourceReferencesFilename) { // Returns the array of filenames referenced by a file like source-references.js var result; global.knockoutDebugCallback = function(sources) { result = sources; }; eval(grunt.file.read(sourceReferencesFilename)); return result; } function getCombinedSources() { var fragments = grunt.config('fragments'), sourceFilenames = [ fragments + 'extern-pre.js', fragments + 'amd-pre.js', getReferencedSources(fragments + 'source-references.js'), fragments + 'amd-post.js', fragments + 'extern-post.js' ], flattenedSourceFilenames = Array.prototype.concat.apply([], sourceFilenames), combinedSources = flattenedSourceFilenames.map(function(filename) { return grunt.file.read('./' + filename); }).join(''); return combinedSources.replace('##VERSION##', grunt.config('pkg.version')); } function buildDebug(output) { var source = []; source.push(grunt.config('banner')); source.push('(function(){\n'); source.push('var DEBUG=true;\n'); source.push(getCombinedSources()); source.push('})();\n'); grunt.file.write(output, source.join('').replace(/\r\n/g, '\n')); } function buildMin(output, done) { var cc = require('closure-compiler'); var options = { compilation_level: 'ADVANCED_OPTIMIZATIONS', output_wrapper: '(function() {%output%})();' }; grunt.log.write('Compiling...'); cc.compile('/**@const*/var DEBUG=false;' + getCombinedSources(), options, function (err, stdout, stderr) { if (err) { grunt.log.error(err); done(false); } else { grunt.log.ok(); grunt.file.write(output, (grunt.config('banner') + stdout).replace(/\r\n/g, '\n')); done(true); } }); } grunt.registerMultiTask('build', 'Build', function() { if (!this.errorCount) { var output = this.data; if (this.target === 'debug') { buildDebug(output); } else if (this.target === 'min') { buildMin(output, this.async()); } } return !this.errorCount; }); grunt.registerMultiTask('test', 'Run tests', function () { var done = this.async(); grunt.util.spawn({ cmd: this.target, args: [this.data] }, function (error, result, code) { if (code === 127 /*not found*/) { grunt.verbose.error(result.stderr); // ignore this error done(true); } else { grunt.log.writeln(result.stdout); if (error) grunt.log.error(result.stderr); done(!error); } } ); }); grunt.registerMultiTask('testtypes', 'Run types tests', function () { var done = this.async(), target = this.target; grunt.util.spawn({ cmd: "tsc", args: ["-p", this.data] }, function (error, result, code) { grunt.log.writeln(result.stdout); if (error) grunt.log.error(result.stderr); else grunt.log.ok("Knockout TypeScript " + target + " types validated!"); done(!error); } ); }); grunt.registerTask('dist', function() { var version = grunt.config('pkg.version'), buildConfig = grunt.config('build'), distConfig = grunt.config('dist'); grunt.file.copy(buildConfig.debug, distConfig.debug); grunt.file.copy(buildConfig.min, distConfig.min); console.log('To publish, run:'); console.log(' git add bower.json'); console.log(' git add -f ' + distConfig.debug); console.log(' git add -f ' + distConfig.min); console.log(' git checkout head'); console.log(' git commit -m \'Version ' + version + ' for distribution\''); console.log(' git tag -a v' + version + ' -m \'Add tag v' + version + '\''); console.log(' git checkout master'); console.log(' git push origin --tags'); }); // Default task. grunt.registerTask('default', ['clean', 'checktrailingspaces', 'build', 'test', 'testtypes']); }; knockout-3.5.1/LICENSE000066400000000000000000000022651356035462700144020ustar00rootroot00000000000000The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php Copyright (c) 2010 Steven Sanderson, the Knockout.js team, and other contributors http://knockoutjs.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. knockout-3.5.1/README.md000066400000000000000000000051101356035462700146440ustar00rootroot00000000000000# Knockout **Knockout** is a JavaScript [MVVM](http://en.wikipedia.org/wiki/Model_View_ViewModel) (a modern variant of MVC) library that makes it easier to create rich, desktop-like user interfaces with JavaScript and HTML. It uses *observers* to make your UI automatically stay in sync with an underlying data model, along with a powerful and extensible set of *declarative bindings* to enable productive development. ## Getting started [![Join the chat at https://gitter.im/knockout/knockout](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/knockout/knockout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) **Totally new to Knockout?** The most fun place to start is the [online interactive tutorials](http://learn.knockoutjs.com/). For more details, see * Documentation on [the project's website](http://knockoutjs.com/documentation/introduction.html) * Online examples at [http://knockoutjs.com/examples/](http://knockoutjs.com/examples/) ## Downloading Knockout You can [download released versions of Knockout](http://knockoutjs.com/downloads/) from the project's website. For Node.js developers, Knockout is also available from [npm](https://npmjs.org/) - just run `npm install knockout`. ## Building Knockout from sources If you prefer to build the library yourself: 1. **Clone the repo from GitHub** ```sh git clone https://github.com/knockout/knockout.git cd knockout ``` 2. **Acquire build dependencies.** Make sure you have [Node.js](http://nodejs.org/) installed on your workstation. This is only needed to _build_ Knockout from sources. Knockout itself has no dependency on Node.js once it is built (it works with any server technology or none). Now run: ```sh npm install -g grunt-cli npm install ``` The first `npm` command sets up the popular [Grunt](http://gruntjs.com/) build tool. You might need to run this command with `sudo` if you're on Linux or Mac OS X, or in an Administrator command prompt on Windows. The second `npm` command fetches the remaining build dependencies. 3. **Run the build tool** ```sh grunt ``` Now you'll find the built files in `build/output/`. ## Running the tests If you have [phantomjs](http://phantomjs.org/download.html) installed, then the `grunt` script will automatically run the specification suite and report its results. Or, if you want to run the specs in a browser (e.g., for debugging), simply open `spec/runner.html` in your browser. ## License MIT license - [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) knockout-3.5.1/bower.json000066400000000000000000000006741356035462700154100ustar00rootroot00000000000000{ "name": "knockout", "homepage": "http://knockoutjs.com/", "description": "Knockout makes it easier to create rich, responsive UIs with JavaScript", "main": "dist/knockout.js", "moduleType": [ "amd", "globals", "node" ], "keywords": [ "knockout", "mvvm", "mvc", "spa" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", "spec", "build/output" ] } knockout-3.5.1/build/000077500000000000000000000000001356035462700144675ustar00rootroot00000000000000knockout-3.5.1/build/fragments/000077500000000000000000000000001356035462700164555ustar00rootroot00000000000000knockout-3.5.1/build/fragments/amd-post.js000066400000000000000000000000051356035462700205320ustar00rootroot00000000000000})); knockout-3.5.1/build/fragments/amd-pre.js000066400000000000000000000011001356035462700203300ustar00rootroot00000000000000(function(factory) { // Support three module loading scenarios if (typeof define === 'function' && define['amd']) { // [1] AMD anonymous module define(['exports', 'require'], factory); } else if (typeof exports === 'object' && typeof module === 'object') { // [2] CommonJS/Node.js factory(module['exports'] || exports); // module.exports is for Node.js } else { // [3] No module loader (plain "); }; var buildFolderPath = getPathToScriptTagSrc(debugFileName); window.knockoutDebugCallback = function (scriptUrls) { for (var i = 0; i < scriptUrls.length; i++) referenceScript(buildFolderPath + scriptUrls[i]); }; referenceScript(buildFolderPath + sourcesReferenceFile); })(); knockout-3.5.1/build/output/000077500000000000000000000000001356035462700160275ustar00rootroot00000000000000knockout-3.5.1/build/output/.gitignore000066400000000000000000000000541356035462700200160ustar00rootroot00000000000000knockout-latest.js knockout-latest.debug.js knockout-3.5.1/build/output/.npmignore000066400000000000000000000001431356035462700200240ustar00rootroot00000000000000# This file is needed, because otherwise the .gitignore causes npm not to package the build output knockout-3.5.1/build/types/000077500000000000000000000000001356035462700156335ustar00rootroot00000000000000knockout-3.5.1/build/types/knockout.d.ts000066400000000000000000001125621356035462700202710ustar00rootroot00000000000000// Type definitions for Knockout v3.5.0 // Project: http://knockoutjs.com // Definitions by: Maxime LUCE , Michael Best export as namespace ko; //#region subscribables/subscribable.js export type SubscriptionCallback = (this: TTarget, val: T) => void; export type MaybeSubscribable = T | Subscribable; export interface Subscription { dispose(): void; disposeWhenNodeIsRemoved(node: Node): void; } type Flatten = T extends Array ? U : T; export interface SubscribableFunctions extends Function { init>(instance: S): void; notifySubscribers(valueToWrite?: T, event?: string): void; subscribe(callback: SubscriptionCallback>, TTarget>, callbackTarget: TTarget, event: "arrayChange"): Subscription; subscribe(callback: SubscriptionCallback, callbackTarget: TTarget, event: "beforeChange" | "spectate" | "awake"): Subscription; subscribe(callback: SubscriptionCallback, callbackTarget: TTarget, event: "asleep"): Subscription; subscribe(callback: SubscriptionCallback, callbackTarget?: TTarget, event?: "change"): Subscription; subscribe(callback: SubscriptionCallback, callbackTarget: TTarget, event: string): Subscription; extend(requestedExtenders: ObservableExtenderOptions): this; extend>(requestedExtenders: ObservableExtenderOptions): S; getSubscriptionsCount(event?: string): number; } export interface Subscribable extends SubscribableFunctions { } export const subscribable: { new (): Subscribable; fn: SubscribableFunctions; }; export function isSubscribable(instance: any): instance is Subscribable; //#endregion //#region subscribables/observable.js export type MaybeObservable = T | Observable; export interface ObservableFunctions extends Subscribable { equalityComparer(a: T, b: T): boolean; peek(): T; valueHasMutated(): void; valueWillMutate(): void; } export interface Observable extends ObservableFunctions { (): T; (value: T): any; } export function observable(value: T): Observable; export function observable(value: null): Observable /** No initial value provided, so implicitly includes `undefined` as a possible value */ export function observable(): Observable export module observable { export const fn: ObservableFunctions; } export function isObservable(instance: any): instance is Observable; export function isWriteableObservable(instance: any): instance is Observable; export function isWritableObservable(instance: any): instance is Observable; //#endregion //#region subscribables/observableArray.js export type MaybeObservableArray = T[] | ObservableArray; export interface ObservableArrayFunctions extends ObservableFunctions { //#region observableArray/generalFunctions /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. If omitted, all items after start are included */ slice(start: number, end?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. * @param deleteCount The number of elements to remove. Defaults to removing everything after `start` * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount?: number, ...items: T[]): T[]; /** * Removes the last value from the array and returns it. */ pop(): T; /** * Adds a new item to the end of array. * @param items Items to be added */ push(...items: T[]): number; /** * Removes the first value from the array and returns it. */ shift(): T; /** * Inserts a new item at the beginning of the array. * @param items Items to be added */ unshift(...items: T[]): number; /** * Reverses the order of the array and returns the observableArray. * Modifies the underlying array. */ reverse(): this; /** * Sorts the array contents and returns the observableArray. * Modifies the underlying array. */ sort(compareFunction?: (left: T, right: T) => number): this; //#endregion //#region observableArray/koSpecificFunctions /** * Returns a reversed copy of the array. * Does not modify the underlying array. */ reversed(): T[]; /** * Returns a reversed copy of the array. * Does not modify the underlying array. */ sorted(compareFunction?: (left: T, right: T) => number): T[]; /** * Replaces the first value that equals oldItem with newItem * @param oldItem Item to be replaced * @param newItem Replacing item */ replace(oldItem: T, newItem: T): void; /** * Removes all values that equal item and returns them as an array. * @param item The item to be removed */ remove(item: T): T[]; /** * Removes all values and returns them as an array. * @param removeFunction A function used to determine true if item should be removed and fasle otherwise */ remove(removeFunction: (item: T) => boolean): T[]; /** * Removes all values and returns them as an array. */ removeAll(): T[]; /** * Removes all values that equal any of the supplied items * @param items Items to be removed */ removeAll(items: T[]): T[]; // Ko specific Usually relevant to Ruby on Rails developers only /** * Finds any objects in the array that equal someItem and gives them a special property called _destroy with value true. * Usually only relevant to Ruby on Rails development * @param item Items to be marked with the property. */ destroy(item: T): void; /** * Finds any objects in the array filtered by a function and gives them a special property called _destroy with value true. * Usually only relevant to Ruby on Rails development * @param destroyFunction A function used to determine which items should be marked with the property. */ destroy(destroyFunction: (item: T) => boolean): void; /** * Gives a special property called _destroy with value true to all objects in the array. * Usually only relevant to Ruby on Rails development */ destroyAll(): void; /** * Finds any objects in the array that equal supplied items and gives them a special property called _destroy with value true. * Usually only relevant to Ruby on Rails development * @param items */ destroyAll(items: T[]): void; //#endregion } export interface ObservableArray extends Observable, ObservableArrayFunctions { (value: T[] | null | undefined): this; } export function observableArray(): ObservableArray; export function observableArray(initialValue: T[]): ObservableArray; export module observableArray { export const fn: ObservableArrayFunctions; } export function isObservableArray(instance: any): instance is ObservableArray; //#endregion //#region subscribables/dependendObservable.js export type ComputedReadFunction = Subscribable | Observable | Computed | ((this: TTarget) => T); export type ComputedWriteFunction = (this: TTarget, val: T) => void; export type MaybeComputed = T | Computed; export interface ComputedFunctions extends Subscribable { // It's possible for a to be undefined, since the equalityComparer is run on the initial // computation with undefined as the first argument. This is user-relevant for deferred computeds. equalityComparer(a: T | undefined, b: T): boolean; peek(): T; dispose(): void; isActive(): boolean; getDependenciesCount(): number; getDependencies(): Subscribable[]; } export interface Computed extends ComputedFunctions { (): T; (value: T): this; } export interface PureComputed extends Computed { } export interface ComputedOptions { read?: ComputedReadFunction; write?: ComputedWriteFunction; owner?: TTarget; pure?: boolean; deferEvaluation?: boolean; disposeWhenNodeIsRemoved?: Node; disposeWhen?: () => boolean; } export function computed(options: ComputedOptions): Computed; export function computed(evaluator: ComputedReadFunction): Computed; export function computed(evaluator: ComputedReadFunction, evaluatorTarget: TTarget): Computed; export function computed(evaluator: ComputedReadFunction, evaluatorTarget: TTarget, options: ComputedOptions): Computed; export module computed { export const fn: ComputedFunctions; } export function pureComputed(options: ComputedOptions): PureComputed; export function pureComputed(evaluator: ComputedReadFunction): PureComputed; export function pureComputed(evaluator: ComputedReadFunction, evaluatorTarget: TTarget): PureComputed; export function isComputed(instance: any): instance is Computed; export function isPureComputed(instance: any): instance is PureComputed; //#endregion //#region subscribables/dependencyDetection.js export interface ComputedContext { getDependenciesCount(): number; getDependencies(): Subscribable[]; isInitial(): boolean; registerDependency(subscribable: Subscribable): void; } export const computedContext: ComputedContext; /** * Executes a function and returns the result, while disabling depdendency tracking * @param callback - the function to execute without dependency tracking * @param callbackTarget - the `this` binding for `callback` * @param callbackArgs - the args to provide to `callback` */ export function ignoreDependencies( callback: (this: Target, ...args: Args) => Return, callbackTarget?: Target, callbackArgs?: Args ): Return; //#endregion //#region subscribables/extenders.js export type RateLimitMethod = (callback: () => void, timeout: number, options: any) => (() => void); export interface RateLimitOptions { timeout: number; method?: "notifyAtFixedRate" | "notifyWhenChangesStop" | RateLimitMethod; [option: string]: any; } export interface ExtendersOptions { trackArrayChanges: true | utils.CompareArraysOptions; throttle: number; rateLimit: number | RateLimitOptions; deferred: true; notify: "always" | any; } export interface Extender { (target: T, options: O): T; } type AsExtenders = { [P in keyof T]: Extender } export interface Extenders extends AsExtenders> { [name: string]: Extender; } export interface ObservableExtenderOptions extends Partial> { } export const extenders: Extenders; //#endregion //#region subscribables/mappingHelpers.js type Unwrapped = T extends ko.Subscribable ? R : T extends Record ? { [P in keyof T]: Unwrapped } : T; export function toJS(rootObject: T): Unwrapped; export function toJSON(rootObject: any, replacer?: Function, space?: number): string; //#endregion //#region subscribables/observableUtils.js export function when(predicate: ComputedReadFunction, callback: SubscriptionCallback, context?: TTarget): Subscription; export function when(predicate: ComputedReadFunction): Promise; //#endregion //#region binding/bindingAttributeSyntax.js export type BindingAccessors = { [name: string]: Function; }; export interface AllBindings { (): any; get(name: string): any; get(name: string): T; has(name: string): boolean; } export type BindingHandlerControlsDescendant = { controlsDescendantBindings: boolean; } export type BindingHandlerAddBinding = (name: string, value: any) => void; export interface BindingHandler { after?: string[]; init?: (element: any, valueAccessor: () => T, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext) => void | BindingHandlerControlsDescendant; update?: (element: any, valueAccessor: () => T, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext) => void; options?: any; preprocess?: (value: string | undefined, name: string, addBinding: BindingHandlerAddBinding) => string | undefined | void; } export interface BindingHandlers { [name: string]: BindingHandler; } export interface BindingContext { ko: any; // typeof ko; [name: string]: any; $parent?: any; $parents: any[]; $root: any; $data: T; $rawData: T | Observable; $index?: Observable; $parentContext?: BindingContext; $component?: any; extend(properties: object): BindingContext; extend(properties: (self: BindingContext) => object): BindingContext; createChildContext(dataItem: T | Observable, dataItemAlias?: string, extendCallback?: BindingContextExtendCallback): BindingContext; createChildContext(accessor: () => T | Observable, dataItemAlias?: string, extendCallback?: BindingContextExtendCallback): BindingContext; createChildContext(dataItem: T | Observable, options: BindingChildContextOptions): BindingContext; createChildContext(accessor: () => T | Observable, options: BindingChildContextOptions): BindingContext; } export interface BindingChildContextOptions { as?: string; extend?: BindingContextExtendCallback; noChildContext?: boolean; } export function applyBindings(bindingContext: T | BindingContext): void; export function applyBindings(bindingContext: T | BindingContext, rootNode: Node | null, extendCallback?: BindingContextExtendCallback): void; export function applyBindingsToDescendants(bindingContext: T | BindingContext, rootNode?: Node): void; export function applyBindingsToNode(node: Node, bindings: object | (() => object), viewModel: T | BindingContext): void; export function applyBindingAccessorsToNode(node: Node, bindings: BindingAccessors | (() => BindingAccessors), viewModel: T | BindingContext): void; export function dataFor(node: Node): T; export function contextFor(node: Node): BindingContext; export const bindingHandlers: BindingHandlers; export function getBindingHandler(handler: string): BindingHandler; export type BindingContextExtendCallback = (self: BindingContext, parentContext: BindingContext | null, dataItem: T) => void; export module bindingEvent { export function subscribe(node: Node, event: "childrenComplete" | "descendantsComplete", callback: (node: Node) => void, callbackContext?: any): Subscription; export function startPossiblyAsyncContentBinding(node: Element, bindingContext: BindingContext): BindingContext; } //#endregion //#region binding/bindingProvider.js export interface BindingOptions { valueAccessors?: boolean; bindingParams?: boolean; } export interface IBindingProvider { nodeHasBindings(node: Node): boolean; getBindings?(node: Node, bindingContext: BindingContext): object; getBindingAccessors(node: Node, bindingContext: BindingContext): BindingAccessors; preprocessNode?(node: Node): Node[] | undefined; } export class bindingProvider implements IBindingProvider { nodeHasBindings(node: Node): boolean; getBindings(node: Node, bindingContext: BindingContext): object; getBindingAccessors(node: Node, bindingContext: BindingContext): BindingAccessors; getBindingsString(node: Node, bindingContext?: BindingContext): string; parseBindingsString(bindingsString: string, bindingContext: BindingContext, node: Node): object; parseBindingsString(bindingsString: string, bindingContext: BindingContext, node: Node, options: BindingOptions): object | BindingAccessors; static instance: IBindingProvider; } //#endregion //#region binding/expressionRewriting.js export module expressionRewriting { export interface KeyValue { key?: string; value?: string; unknown?: string; } export interface TwoWayBindings { [name: string]: boolean | string; } export const bindingRewriteValidators: any[]; export function parseObjectLiteral(objectLiteralString: string): KeyValue[]; export function preProcessBindings(bindingsString: string, bindingOptions?: BindingOptions): string; export function preProcessBindings(keyValueArray: KeyValue[], bindingOptions?: BindingOptions): string; export const _twoWayBindings: TwoWayBindings; } //#endregion //#region binding/selectExtensions.js export module selectExtensions { export function readValue(element: HTMLElement): any; export function writeValue(element: HTMLElement, value?: any, allowUnset?: boolean): void; } //#endregion //#region binding/defaultBindings/ export interface BindingHandlers { // Controlling text and appearance visible: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; hidden: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; text: { init(): BindingHandlerControlsDescendant; update(element: Node, valueAccessor: () => MaybeSubscribable): void; }; html: { init(): BindingHandlerControlsDescendant; update(element: Node, valueAccessor: () => MaybeSubscribable): void; }; class: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; css: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; style: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; attr: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; // Control Flow foreach: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; if: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; ifnot: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; with: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; let: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; using: { init(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; // Working with form fields event: { init(element: HTMLElement, valueAccessor: () => object, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): void; }; click: { init(element: HTMLElement, valueAccessor: () => Function, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): void; }; submit: { init(element: HTMLElement, valueAccessor: () => Function, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): void; }; enable: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; disable: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; value: { after: string[]; init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; update(...args: any[]): void; // Keep for backwards compatibility with code that may have wrapped value binding }; textInput: { init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; }; textinput: { preprocess(value: string | undefined, name: string, addBinding: BindingHandlerAddBinding): void; }; hasfocus: { init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; hasFocus: { init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; checked: { after: string[]; init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; }; checkedValue: { update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; options: { init(element: HTMLElement): BindingHandlerControlsDescendant; update(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; }; selectedOptions: { after: string[]; init(element: HTMLElement, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings): void; update(element: HTMLElement, valueAccessor: () => MaybeSubscribable): void; }; uniqueName: { init(element: HTMLElement, valueAccessor: () => boolean): void; }; } export interface VirtualElementsAllowedBindings { text: boolean; foreach: boolean; if: boolean; ifnot: boolean; with: boolean; let: boolean; using: boolean; } //#endregion //#region binding/editDetection/compareArrays.js export module utils { export interface ArrayChange { status: "added" | "deleted" | "retained"; value: T; index: number; moved?: number; } export type ArrayChanges = ArrayChange[]; export interface CompareArraysOptions { dontLimitMoves?: boolean; sparse?: boolean; } export function compareArrays(a: T[], b: T[]): ArrayChanges; export function compareArrays(a: T[], b: T[], dontLimitMoves: boolean): ArrayChanges; export function compareArrays(a: T[], b: T[], options: CompareArraysOptions): ArrayChanges; } //#endregion //#region binding/editDetection/arrayToDomNodeChildren.js export module utils { export type MappingFunction = (valueToMap: T, index: number, nodes: Node[]) => Node[]; export type MappingAfterAddFunction = (arrayEntry: T, nodes: Node[], index: Observable) => Node[]; export type MappingHookFunction = (nodes: Node[], index: number, arrayEntry: T) => void; export interface MappingOptions { dontLimitMoves?: boolean; beforeMove?: MappingHookFunction; beforeRemove?: MappingHookFunction; afterAdd?: MappingHookFunction; afterMove?: MappingHookFunction; afterRemove?: MappingHookFunction; } export function setDomNodeChildrenFromArrayMapping(domNode: Node, array: T[], mapping: MappingFunction, options?: MappingOptions, callbackAfterAddingNodes?: MappingAfterAddFunction): void; } //#endregion //#region templating/templating.js export interface TemplateOptions { afterRender?: (elements: Node[], dataItem: T) => void; templateEngine?: templateEngine; } export interface TemplateForeachOptions extends TemplateOptions, utils.MappingOptions { as?: string; includeDestroyed?: boolean; } export interface BindingTemplateOptions extends TemplateOptions, utils.MappingOptions { name?: string | ((val: any) => string); nodes?: Node[]; if?: boolean; ifnot?: boolean; data?: any; foreach?: any[]; as?: string; includeDestroyed?: boolean; } export interface BindingHandlers { template: { init(element: Node, valueAccessor: () => MaybeSubscribable): BindingHandlerControlsDescendant; update(element: Node, valueAccessor: () => MaybeSubscribable, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): void; }; } export interface VirtualElementsAllowedBindings { template: boolean; } export function renderTemplate(template: string | Node | (() => string | Node)): string; export function renderTemplate(template: string | Node | (() => string | Node), dataOrBindingContext: T | BindingContext | null | undefined, options?: TemplateOptions | null | undefined): string; export function renderTemplate(template: string | Node | (() => string | Node), dataOrBindingContext: T | BindingContext | null | undefined, options: TemplateOptions | null | undefined, targetNodeOrNodeArray: Node | Node[], renderMode?: "replaceChildren" | "replaceNode" | "ignoreTargetNode"): Computed; export function setTemplateEngine(templateEngine: templateEngine | undefined): void; //#endregion //#region templating/templateEngine.js export abstract class templateEngine { allowTemplateRewriting: boolean; abstract renderTemplateSource(templateSource: TemplateSource, bindingContext: BindingContext, options: TemplateOptions, templateDocument?: Document): Node[]; createJavaScriptEvaluatorBlock(script: string): string; makeTemplateSource(template: string | Node, templateDocument?: Document): TemplateSource; renderTemplate(template: string | Node, bindingContext: BindingContext, options: TemplateOptions, templateDocument?: Document): Node[]; isTemplateRewritten(template: string | Node, templateDocument?: Document): boolean; rewriteTemplate(template: string | Node, rewriterCallback: (val: string) => string, templateDocument?: Document): void; } //#endregion //#region templating/templateSources.js export interface TemplateSource { text(): string; text(valueToWrite: string): void; data(key: string): any; data(key: string): T; data(key: string, valueToWrite: T): void; nodes?: { (): Node; (valueToWrite: Node): void; }; } export module templateSources { export class domElement implements TemplateSource { constructor(element: Node); text(): string; text(valueToWrite: string): void; data(key: string): any; data(key: string): T; data(key: string, valueToWrite: T): void; nodes(): Node; nodes(valueToWrite: Node): void; } export class anonymousTemplate extends domElement { constructor(element: Node); } } //#endregion //#region templating/native/nativeTemplateEngine.js export class nativeTemplateEngine extends templateEngine { renderTemplateSource(templateSource: TemplateSource, bindingContext: BindingContext, options: TemplateOptions, templateDocument?: Document): Node[]; } //#endregion //#region templating/jquery.tmpl/jqueryTmplTemplateEngine.js export class jqueryTmplTemplateEngine extends templateEngine { renderTemplateSource(templateSource: TemplateSource, bindingContext: BindingContext, options: TemplateOptions, templateDocument?: Document): Node[]; createJavaScriptEvaluatorBlock(script: string): string; addTemplate(templateName: string, templateMarkup: string): void; } //#endregion //#region components/componentBinding.js export interface BindingHandlers { component: { init(element: Node, valueAccessor: () => MaybeSubscribable<{ name: any; params: any; }>, allBindings: AllBindings, viewModel: any, bindingContext: BindingContext): BindingHandlerControlsDescendant; }; } export interface VirtualElementsAllowedBindings { component: boolean; } //#endregion //#region components/customElements.js export module components { export function getComponentNameForNode(node: Node): string; } //#endregion //#region components/defaultLoader.js export module components { export interface ViewModelConstructor { new(params?: ViewModelParams): ViewModel; } export interface ViewModel { dispose?: () => void; koDescendantsComplete?: (node: Node) => void; } export interface ViewModelParams { [name: string]: any; } export interface ComponentInfo { element: Node; templateNodes: Node[]; } export type CreateViewModel = (params: ViewModelParams, componentInfo: ComponentInfo) => ViewModel; export interface Component { template: Node[]; createViewModel?: CreateViewModel; } export interface ViewModelStatic { instance: any; } export interface ViewModelFactory { createViewModel: CreateViewModel; } export interface TemplateElement { element: string | Node; } export type ViewModelConfig = ViewModelConstructor | ViewModelStatic | ViewModelFactory; export type TemplateConfig = string | Node[] | DocumentFragment | TemplateElement; export interface RequireConfig { require: string; } export interface Config { require?: string; viewModel?: RequireConfig | ViewModelConfig | any; template?: RequireConfig | TemplateConfig | any; synchronous?: boolean; } export function register(componentName: string, config: Config | object): void; export function unregister(componentName: string): void; export function isRegistered(componentName: string): boolean; export interface Loader { getConfig?(componentName: string, callback: (config: Config | object) => void): void; loadComponent?(componentName: string, config: Config | object, callback: (component: Component | null) => void): void; loadTemplate?(componentName: string, config: TemplateConfig | any, callback: (resolvedTemplate: Node[] | null) => void): void; loadViewModel?(componentName: string, config: ViewModelConfig | any, callback: (resolvedViewModel: CreateViewModel | null) => void): void; } export const loaders: Loader[]; export interface DefaultLoader extends Loader { getConfig(componentName: string, callback: (config: Config | object) => void): void; loadComponent(componentName: string, config: Config, callback: (component: Component) => void): void; loadTemplate(componentName: string, config: TemplateConfig, callback: (resolvedTemplate: Node[]) => void): void; loadViewModel(componentName: string, config: ViewModelConfig, callback: (resolvedViewModel: CreateViewModel) => void): void; } export const defaultLoader: DefaultLoader; } //#endregion //#region components/loaderRegistry.js export module components { export function get(componentName: string, callback: (definition: Component, config: Config) => void): string; export function clearCachedDefinition(componentName: string): void; } //#endregion //#region virtualElements.js export interface VirtualElementsAllowedBindings { [name: string]: boolean; } export module virtualElements { export const allowedBindings: VirtualElementsAllowedBindings; export function childNodes(node: Node): Node[]; export function emptyNode(node: Node): void; export function firstChild(node: Node): Node; export function insertAfter(node: Node, nodeToInsert: Node, insertAfterNode: Node): void; export function nextSibling(node: Node): Node; export function prepend(node: Node, nodeToPrepend: Node): void; export function setDomNodeChildren(node: Node, childNodes: Node[]): void; } //#endregion //#region memoization.js export module memoization { export function memoize(callback: (val: any) => void): Node[]; export function unmemoize(memoId: string, callbackParams: any[]): void; export function unmemoizeDomNodeAndDescendants(domNode: Node, extraCallbackParamsArray: any[]): void; export function parseMemoText(memoText: string): string; } //#endregion //#region options.js export interface Options { deferUpdates: boolean; useOnlyNativeEvents: boolean; createChildContextWithAs: boolean; foreachHidesDestroyed: boolean; } export const options: Options; //#endregion //#region tasks.js export module tasks { export var scheduler: (callback: () => any) => void; export function schedule(callback: () => any): number; export function cancel(handle: number): void; export function runEarly(): void; } //#endregion //#region utils.js export module utils { export interface PostJsonOptions { params?: object; includeFields?: string[]; submitter?: (form: HTMLFormElement) => void; } export function addOrRemoveItem(array: MaybeObservableArray, value: T, included?: boolean): T[]; export function arrayForEach(array: T[], action: (item: T, index: number) => void, actionOwner?: any): void; export function arrayFirst(array: T[], predicate: (item: T, index: number) => boolean, predicateOwner?: any): T; export function arrayFilter(array: T[], predicate: (item: T, index: number) => boolean, predicateOwner?: any): T[]; export function arrayGetDistinctValues(array: T[]): T[]; export function arrayIndexOf(array: MaybeObservableArray, item: T): number; export function arrayMap(array: T[], mapping: (item: T, index: number) => U, mappingOwner?: any): U[]; export function arrayPushAll(array: MaybeObservableArray, valuesToPush: T[]): T[]; export function arrayRemoveItem(array: MaybeObservableArray, itemToRemove: T): void; export function extend(target: T, source: U): T & U; export const fieldsIncludedWithJsonPost: Array; export function getFormFields(form: HTMLFormElement, fieldName: string | RegExp): any[]; export function objectForEach(obj: object, action: (key: string, value: any) => void): void; export function objectForEach(obj: { [key: string]: T }, action: (key: string, value: T) => void): void; export function peekObservable(value: MaybeSubscribable): T; export function postJson(urlOrForm: string | HTMLFormElement, data: MaybeSubscribable, options?: PostJsonOptions): void; export function parseJson(jsonString: string): any; export function parseJson(jsonString: string): T; export function range(min: MaybeSubscribable, max: MaybeSubscribable): number[]; export function registerEventHandler(element: Element, eventType: string, handler: EventListener): void; export function setTextContent(element: Node, textContent: MaybeSubscribable): void; export function stringifyJson(data: MaybeSubscribable, replacer?: Function, space?: string | number): string; export function toggleDomNodeCssClass(node: Element, className: string, shouldHaveClass?: boolean): void; export function triggerEvent(element: Element, eventType: string): void; export function unwrapObservable(value: MaybeSubscribable): T; } export function unwrap(value: MaybeSubscribable): T; export function onError(error: Error): void; //#endregion //#region utils.domData.js export module utils { export module domData { export function get(node: Node, key: string): T; export function set(node: Node, key: string, value: T): void; export function clear(node: Node): boolean; } } //#endregion //#region utils.domNodeDisposal.js export module utils { export module domNodeDisposal { export function addDisposeCallback(node: Node, callback: (node: Node) => void): void; export function removeDisposeCallback(node: Node, callback: (node: Node) => void): void; export function cleanExternalData(node: Node): void; } } export function cleanNode(node: Node): typeof node; export function removeNode(node: Node): void; //#endregion //#region utils.domManipulation.js export module utils { export function parseHtmlFragment(html: string, documentContext?: Document): Node[]; export function setHtml(node: Node, html: MaybeSubscribable): void; } //#endregion //#region version.js export const version: string; //#endregion knockout-3.5.1/build/types/tsconfig.json000066400000000000000000000005401356035462700203410ustar00rootroot00000000000000{ "compilerOptions": { "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ "module": "umd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "strict": true, /* Enable all strict type-checking options. */ } }knockout-3.5.1/dist/000077500000000000000000000000001356035462700143335ustar00rootroot00000000000000knockout-3.5.1/dist/knockout.debug.js000066400000000000000000011552731356035462700176310ustar00rootroot00000000000000/*! * Knockout JavaScript library v3.5.1 * (c) The Knockout.js team - http://knockoutjs.com/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ (function(){ var DEBUG=true; (function(undefined){ // (0, eval)('this') is a robust way of getting a reference to the global object // For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023 var window = this || (0, eval)('this'), document = window['document'], navigator = window['navigator'], jQueryInstance = window["jQuery"], JSON = window["JSON"]; if (!jQueryInstance && typeof jQuery !== "undefined") { jQueryInstance = jQuery; } (function(factory) { // Support three module loading scenarios if (typeof define === 'function' && define['amd']) { // [1] AMD anonymous module define(['exports', 'require'], factory); } else if (typeof exports === 'object' && typeof module === 'object') { // [2] CommonJS/Node.js factory(module['exports'] || exports); // module.exports is for Node.js } else { // [3] No module loader (plain

Goodbye

"; ko.applyBindings({ sometext: 'hello' }, testNode); expect(testNode).toContainHtml('

replaced

replaced

'); }); it('

Goodbye

"; ko.applyBindings({ sometext: 'hello' }, testNode); expect(testNode).toContainHtml('

replaced

replaced

'); }); it('