Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
303 commits
Select commit Hold shift + click to select a range
f32e418
fix more tsc issues
mcselle Jan 13, 2025
42047c9
deleted duplicated knockout typings
mcselle Jan 13, 2025
21df852
Moved Computed Types to packages/computed/types
mcselle Jan 13, 2025
0eac0bb
removed duplication
mcselle Jan 13, 2025
2d7062f
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 13, 2025
57bc24d
ifnotBehaviors tsc fixed
Auge19 Jan 13, 2025
7d4c442
withBehaviors fixed tsc
Auge19 Jan 13, 2025
b68fea7
ConditionalBindingHandler fixed tsc
Auge19 Jan 13, 2025
e937c18
else fixed tsc
Auge19 Jan 13, 2025
874514f
ifUnless tsc fixed
Auge19 Jan 13, 2025
6a0bdc9
with fixed tsc
Auge19 Jan 13, 2025
3608713
Moved types to package observabel
mcselle Jan 13, 2025
c78c758
added imports and added function to observable interface
mcselle Jan 13, 2025
5eaddd7
fixing tsc errors
mcselle Jan 13, 2025
949fce4
ts) fix errors - Found 158 errors in 31 files.
phillipc Jan 13, 2025
da0e02e
ts) fixes
phillipc Jan 13, 2025
b1f3b5a
ConditionalBindingHandler
Auge19 Jan 14, 2025
b07e22a
optionsBehaviors fixed tsc
Auge19 Jan 14, 2025
052db22
usingBehaviors fixed tsc
Auge19 Jan 14, 2025
2a212a5
dummyTemplateEngine fixed tsc
Auge19 Jan 14, 2025
09fff65
textinput fixed tsc, removed some Legacy IE Support => simply does no…
Auge19 Jan 14, 2025
52dd5e8
tsc error fixes
mcselle Jan 14, 2025
fe10cdd
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 14, 2025
0539723
componentBindingBehaviors fixed tsc
Auge19 Jan 14, 2025
25a5623
dummyTemplateEngine fixed tsc
Auge19 Jan 14, 2025
47f1a95
foreachBehaviors fixed tsc
Auge19 Jan 14, 2025
f17d603
templatingBehaviors fixed tsc
Auge19 Jan 14, 2025
68c692a
nativeTemplateEngine fixed tsc
Auge19 Jan 14, 2025
e971a07
templateEngine fixed tsc
Auge19 Jan 14, 2025
66b058b
templateSources fixed tsc
Auge19 Jan 14, 2025
77c7534
templating fixed tsc
Auge19 Jan 14, 2025
c54464b
asyncBehaviors fixed tsc
Auge19 Jan 14, 2025
4199362
computedObservableBehaviors fixed tsc
Auge19 Jan 14, 2025
6b65549
proxyBehavior fixed tsc
Auge19 Jan 14, 2025
0be6364
computed fixed tsc
Auge19 Jan 14, 2025
599b59c
mappingHelperBehaviors fixed tsc
Auge19 Jan 14, 2025
b1d53fa
BindingStringProviderBehaviors fixed tsc
Auge19 Jan 14, 2025
4d070f3
attributeInterpolationSpec fixed tsc
Auge19 Jan 14, 2025
8d660a6
AttributeMustacheProvider fixed tsc
Auge19 Jan 14, 2025
4dd0c3e
test fix
mcselle Jan 14, 2025
70aedb2
ComponentABCBehaviors fixed
Auge19 Jan 14, 2025
8781b75
jsxBehaviors fixed tsc
Auge19 Jan 14, 2025
81a0f4b
parserBehaviors fixed tsc
Auge19 Jan 14, 2025
c332264
loaderRegistryBehaviors fixed tsc
Auge19 Jan 14, 2025
374010f
LegacyBindingHandler fixed tsc
Auge19 Jan 14, 2025
9db040a
Merge branch 'knockout:main' into strong_typed
phillipc Jan 14, 2025
d077cee
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 14, 2025
e9c5bc2
eachBehavior fixed tsc over tsconfig
Auge19 Jan 14, 2025
36c3e87
eachBehavior fixed tsc
Auge19 Jan 14, 2025
2dd14b3
proxy fixed tsc
Auge19 Jan 14, 2025
20a71df
loaderRegistryBehaviors fixed tsc
Auge19 Jan 14, 2025
2f61cbc
subscribable fixed tsc
Auge19 Jan 14, 2025
1d6ee1e
NativeProviderBehaviors fixed tsc
Auge19 Jan 14, 2025
5325ed6
fix failure message
phillipc Jan 14, 2025
c8b3687
remove esModuleInterop
phillipc Jan 15, 2025
d9409a8
observable fixed tsc
Auge19 Jan 15, 2025
7fdeac4
forgot one tsc error
Auge19 Jan 15, 2025
c46b663
review changes | removed testNode in spec fixed types
mcselle Jan 15, 2025
bafc2ee
remove line break
phillipc Jan 15, 2025
3cb5653
code review | removed testNode
mcselle Jan 15, 2025
349f964
ts) remove testnode declaration
phillipc Jan 15, 2025
e539dc9
remove duplicated declaration: it's global
phillipc Jan 15, 2025
0b78eb9
code review | optional parameter
mcselle Jan 15, 2025
76784ff
code review | optional param
mcselle Jan 15, 2025
34d6676
code review | Timeout type set
mcselle Jan 15, 2025
f7b97de
optional parameter
mcselle Jan 15, 2025
b395db2
set functions as const to remove runtime error after bundling. Functi…
Auge19 Jan 17, 2025
d32f283
Merge remote-tracking branch 'origin/github_actions' into strong_type…
phillipc Jan 17, 2025
1687ffe
action) switch on tsc check
phillipc Jan 17, 2025
186f3db
ts) mv globale "options" to options.ts
phillipc Jan 17, 2025
3c2889b
ts) mv global defs
phillipc Jan 17, 2025
3ddfe8a
ts) mv globales to tko
phillipc Jan 17, 2025
aa514d0
ts) mv globales to TKO
phillipc Jan 17, 2025
aa5c0fb
ts) mv globals
phillipc Jan 17, 2025
9ea2eaf
ts) mv typings
phillipc Jan 17, 2025
f92a010
add return type
phillipc Jan 17, 2025
5386572
ts) fix review findings
phillipc Jan 20, 2025
faf6e56
types for bind
Auge19 Jan 20, 2025
1cda6b0
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 20, 2025
7965be7
types for binding.component
Auge19 Jan 20, 2025
79c7f85
ts) switching type to avoid down casts
phillipc Jan 20, 2025
b8d6680
ts) remove down cast
phillipc Jan 20, 2025
7757821
Merge branch 'knockout:main' into strong_typed
phillipc Jan 20, 2025
5e3deda
merge .d.ts into global
Auge19 Jan 21, 2025
1f0fb42
ts) add test cases
phillipc Jan 21, 2025
c0bb24e
moved util typings into corrosponding functions
mcselle Jan 21, 2025
594efcd
applied typings from global.d.ts => defaultLoader
mcselle Jan 22, 2025
1695010
aplly typings of global.d.ts to files
Auge19 Jan 22, 2025
3dfc00a
set bindingcontext in constructor function
Auge19 Jan 22, 2025
f39fb0b
typings for nativeTemplateEngine
mcselle Jan 22, 2025
15b27e7
comment unused tests
mcselle Jan 22, 2025
550a3f5
templateEngine moved
mcselle Jan 22, 2025
3edbcb9
first step setting type for bindingContext
Auge19 Jan 22, 2025
b6e4948
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 22, 2025
b806758
applied BindingContextExtendCallback as type
Auge19 Jan 22, 2025
70d10e1
add types to bindinghandler
Auge19 Jan 22, 2025
b1cb101
set context as any
Auge19 Jan 22, 2025
7d72037
utils arraychange update
mcselle Jan 22, 2025
9557972
Moved typings into arrayToDomNodeChildren
mcselle Jan 22, 2025
795ea72
review | applyBindings types
mcselle Jan 23, 2025
a3b89ea
review | componentBindingBehaviors removed unnecessary undefined
mcselle Jan 23, 2025
6de9e96
review | changed HTMLElement To Node ?
mcselle Jan 23, 2025
9b2b587
review | removed Function
mcselle Jan 23, 2025
59f4f4e
review | jsxobserver formatted + JSX interface bindingContext useing …
mcselle Jan 23, 2025
3db4b52
types for computed and subscribable from global
Auge19 Jan 23, 2025
d2a9d01
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 23, 2025
b153f3c
update observable types
Auge19 Jan 23, 2025
cc6b36b
add types to observablearray
Auge19 Jan 23, 2025
ab408be
ts) correct some types
phillipc Jan 24, 2025
7b649f3
ts) delete portet d.ts types / fix loaders and registry
phillipc Jan 24, 2025
a1807b9
ts) port templating types / order globales
phillipc Jan 24, 2025
067a46c
ts) add comment
phillipc Jan 24, 2025
a91603d
review | more types some formatting
mcselle Jan 24, 2025
3b55d6a
review | nativeprovider type
mcselle Jan 24, 2025
3202a5d
review | removed yarn.lock
mcselle Jan 24, 2025
be57808
review | better type
mcselle Jan 24, 2025
0c464c5
adjusted import path
Auge19 Jan 24, 2025
2127974
set types to dataprovider
Auge19 Jan 24, 2025
0682e9d
review | more types in foreach
mcselle Jan 24, 2025
b240067
add types to providers
Auge19 Jan 24, 2025
544572a
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 24, 2025
5196ab5
set types to virtualprovider
Auge19 Jan 24, 2025
b9f0238
ts) some type corrections
phillipc Jan 26, 2025
f3a3950
set types to disposal
Auge19 Jan 27, 2025
0e28005
ts) Provider: HTMLElement | Node -> to Element
phillipc Jan 27, 2025
b596be2
ts) remove wrong import
phillipc Jan 27, 2025
3756af4
ts) extend BaseExtendersType interface
phillipc Jan 27, 2025
49341b8
undo signature change
Auge19 Jan 27, 2025
289dd4f
set type for mappingInvocations
Auge19 Jan 27, 2025
b10a721
handler is optional
Auge19 Jan 27, 2025
e8a2c1a
enable IE 8 and 9 support again
Auge19 Jan 27, 2025
6400abb
ts) the interface "ProviderParamsInput" must be global
phillipc Jan 27, 2025
44868d3
ts) no static dependency to AttributeMustacheProvider |and TextMustac…
phillipc Jan 27, 2025
d78868f
ts) remove mocha from src
phillipc Jan 27, 2025
d486835
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 27, 2025
a0f6478
ts) fix import
phillipc Jan 27, 2025
e51d20d
remove any
Auge19 Jan 27, 2025
74e783d
Merge branch 'strong_typed' of https://github.com/Auge19/tko into str…
Auge19 Jan 27, 2025
3cedcfd
add types to async
Auge19 Jan 27, 2025
5b5c411
add types to event
Auge19 Jan 27, 2025
9f414cb
simplyfied testnode
Auge19 Jan 27, 2025
56eea9d
fixed tsc
Auge19 Jan 27, 2025
0e83f16
ts) bindingprovider is typed
phillipc Jan 27, 2025
fffce59
mv code
phillipc Jan 27, 2025
6470a54
ts) please, no ts-ignore / IE8 to 9 may not have worked
phillipc Jan 27, 2025
c48c110
rm obsolete comment
phillipc Jan 27, 2025
a5756b4
ts) fix import
phillipc Jan 27, 2025
21406d5
set types to textInputBehaviour
Auge19 Jan 28, 2025
3daf3ca
review | Bindinghandler typings
mcselle Jan 28, 2025
b7b294b
use ReturnType<typeof setTimeout>;
phillipc Jan 28, 2025
8f92625
fix: isInputElement -> isInput
phillipc Jan 28, 2025
ce1f543
ts) remove unused imports
phillipc Jan 28, 2025
e391b71
hasFocus fix
Auge19 Jan 30, 2025
83c2337
Merge commit 'e391b71b40c2065771bc7ccd21ac581825fb0ace' into strong_t…
mcselle Jan 30, 2025
2127388
ts) jsx-constructor properties
phillipc Jan 30, 2025
0238738
Merge branch 'main' into strong_typed
phillipc Jan 30, 2025
b7e9f99
format) spaces after merging
phillipc Jan 31, 2025
2e14bc9
add test-case for focus
phillipc Jan 31, 2025
aee30b1
add testcase for hasfocus
phillipc Feb 3, 2025
0dd2b7c
add expect to test-case
phillipc Feb 3, 2025
36d3650
debugging) add debugging-configs for vscode
phillipc Feb 4, 2025
4251b56
fix | HasFocus wont fire in certain scenarios
mcselle Feb 4, 2025
d3f04d7
test) fix test-case for electron
phillipc Feb 5, 2025
201947f
test) remove logs
phillipc Feb 5, 2025
5263172
fix) options.jquery declaration
phillipc Feb 17, 2025
d74cdb0
ts) reduce some global defs
phillipc Feb 22, 2025
4f005ab
ts) some changes after the childNodes/children discussion #202
phillipc Feb 22, 2025
97cd855
ts) Type-Only Import
phillipc Feb 23, 2025
9960425
ts) use import type / reduce global-def
phillipc Feb 23, 2025
195c2c7
ts) reduce global via import type
phillipc Feb 23, 2025
80881ff
ts) solution for adding type-defs to subscribable
phillipc Feb 23, 2025
b7e24df
ts) remove global-defs / use any
phillipc Feb 24, 2025
734627a
ts) reduce globals. jQuery isn't overwritten. jQueryInstance can be r…
phillipc Feb 24, 2025
49c9f0b
ts) add a option to generation d.ts-Files (PoC)
phillipc Feb 26, 2025
80683fb
typo
phillipc Feb 26, 2025
21c7978
ts) fix tsc error in builder-usages
phillipc Feb 27, 2025
7bff82a
ts) add type to bindingContext-Factory, use generics
phillipc Mar 1, 2025
d749194
ts) some fixes after review
phillipc Mar 3, 2025
16988c5
ts) consistent params handover
phillipc Mar 3, 2025
65a697b
Merge branch 'knockout:main' into strong_typed
phillipc Mar 3, 2025
489914c
ts) sync with #207
phillipc Mar 3, 2025
b8e996f
ts) revert to childNodes
phillipc Mar 3, 2025
b620b3a
ts) some reverts to childNodes
phillipc Mar 4, 2025
fec5a16
Merge branch 'knockout:main' into strong_typed
phillipc Mar 4, 2025
695f9d1
Merge branch 'knockout:main' into strong_typed
phillipc Mar 5, 2025
2ec5641
ts) use lamda to get input element from dom
phillipc Mar 5, 2025
956c6d5
ts) BUILD_VERSION as const
phillipc Mar 5, 2025
9d7ffb3
ts) better stack trace with named functions
phillipc Mar 5, 2025
56d6ada
ts) typings
M-Kirchhoff Mar 6, 2025
b6bf565
ts) var to let in test-cases
phillipc Mar 6, 2025
87def81
ts) safer fallback
phillipc Mar 6, 2025
08cd09e
ts) better assertions
phillipc Mar 7, 2025
e5378b7
update readme for a better look
phillipc Mar 8, 2025
c389803
readme) updates / revert electron-deps
phillipc Mar 8, 2025
76797d2
readme) add debugging hint
phillipc Mar 9, 2025
53983f8
ts) fix two type-def-errors in observable (subprop/value as T) / add …
phillipc Mar 9, 2025
8026d3b
ts) make input const
phillipc Mar 15, 2025
115c20a
ts) var to const
phillipc Mar 15, 2025
099dbc8
ts) use generic
phillipc Mar 15, 2025
8af848a
ts) fix CustomBindingGlobalProperties
phillipc Mar 18, 2025
28374d5
ts) make all options clearly defined
phillipc Mar 18, 2025
4b7d465
ts) add comment
phillipc Mar 18, 2025
65fc07c
ts) mark deprecated
phillipc Mar 18, 2025
067ca29
ts) add missing whitespace
phillipc Mar 18, 2025
ce60c96
ts) some fixes
phillipc Mar 18, 2025
067f9a5
ts) import order
phillipc Mar 18, 2025
fa3b059
ts) move type KnockoutStatic
phillipc Mar 18, 2025
401906f
ts) add KnockoutStatic
phillipc Mar 20, 2025
f5ae75d
ts) some stylistic fixes
phillipc Apr 2, 2025
4eed926
ts) imports and DataBind-closure
phillipc Apr 2, 2025
18196a8
ts) import order
phillipc Apr 2, 2025
7708a76
ts) order imports
phillipc Apr 2, 2025
45aae25
ts) change import for better type-defs
phillipc Apr 2, 2025
cd93508
ts) better type for bindingParts
phillipc Apr 2, 2025
0ec3e8e
ts) add brackets
phillipc Apr 2, 2025
b18da95
style) some typos
phillipc Apr 16, 2025
3775986
ts) re-add skipped tests
phillipc Apr 16, 2025
351e115
style) add underscore on unused variables
phillipc Apr 21, 2025
22120d0
ts) better typeinfo for ConditionalBindingHandler
phillipc Apr 21, 2025
3c39698
style) remove unneeded semicolons
phillipc Apr 21, 2025
07f7c05
ts) define isWriteable
phillipc Apr 21, 2025
04a8d35
ts) optimized returntype
phillipc Apr 21, 2025
81980b7
ts) object + interface = class
phillipc Apr 21, 2025
7c083fe
ts) some type corrections after review
phillipc Apr 24, 2025
dfdbe3e
Merge remote-tracking branch 'tko_base/main' into strong_typed
phillipc Jun 15, 2025
b45f0bb
ts) fix tsc warnings after sync with main
phillipc Jun 15, 2025
9483079
fix) imports
phillipc Nov 28, 2025
14c053d
bump) update typescript, lerna, esbuild and fs-extra
phillipc Nov 28, 2025
72eff31
Merge branch 'strong_typed' into strong_typed_fixes
phillipc Nov 28, 2025
b66a7f2
Merge remote-tracking branch 'origin/strong_typed' into strong_typed_…
phillipc Nov 28, 2025
e37814e
Merge pull request #4 from Auge19/strong_typed_fixes
phillipc Nov 28, 2025
c7d3bea
Merge remote-tracking branch 'tko_base/main' into strong_typed
phillipc Nov 29, 2025
b9c5144
Update packages/bind/src/bindingContext.ts
phillipc Dec 5, 2025
5a030f4
Update packages/bind/src/BindingHandler.ts
phillipc Dec 5, 2025
556672b
TS) beforeRemove as method
phillipc Dec 5, 2025
c42136f
credits) move
phillipc Dec 5, 2025
8854d04
Update packages/utils/src/object.ts
phillipc Dec 5, 2025
84d67df
Update packages/bind/src/BindingHandler.ts
phillipc Dec 5, 2025
f773449
ts) remove regions
phillipc Dec 5, 2025
da365b6
ts) to const
phillipc Dec 5, 2025
2fcb189
Update .gitignore
phillipc Dec 5, 2025
63c2c40
refactor) update Knockout type references to use KnockoutInstance -> …
phillipc Dec 6, 2025
c43c9e3
test) move definition out of loop
phillipc Dec 6, 2025
e102ca5
fix) small type fixes from @M-Kirchhoff
phillipc Dec 6, 2025
55e3a4b
fix) remove unnecessary non-null assertion in valuesToAdd assignment
phillipc Dec 6, 2025
705183e
Update changelog
phillipc Dec 6, 2025
a5cc2fa
changelog) add reviewer
phillipc Dec 6, 2025
83dc2cd
fix) adjust formatting and add getter/setter for getBindingHandler in…
phillipc Dec 6, 2025
e265058
ts) enhance utils type definitions and arrange tests with null-arrays
phillipc Dec 6, 2025
e7c4719
fix) resolved some comments
phillipc Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/run-tsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ jobs:

- name: Run tsc
run: npx tsc
continue-on-error: true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ coverage/
*-debug.log
*-error.log

.vscode
.vscode/extensions.json
!.vscode/launch.json
.vscode/settings.json
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to Karma-Chrome",
"sourceMaps": true,
// "restart": true,
// "timeout":180000,
"port": 9222,
"webRoot": "${workspaceFolder}"
}
]
}
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
For TODO between alpha and release, see https://github.com/knockout/tko/issues/1

## Next
## 💪 Next
- #202 Make TKO more type-safe @mcselle, @Auge19, @phillipc, @M-Kirchhoff, @brianmhunt
- #194 fix userAgent typo in IE check @phillipc
- #196 fix `**` operator precedence @mcselle
- #195 add docker container for headless tests, upgrade packages, README fixes @Auge19
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ ci:
lint:
$(NPX) standard

tsc:
$(NPX) tsc

dts:
$(NPX) tsc --build tsconfig.dts.json

docker-build:
$(DOCKER) build . --tag tko

Expand Down
93 changes: 63 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,91 @@

# TKO (“Technical Knockout”)

[![npm version](https://badge.fury.io/js/tko.svg)](https://badge.fury.io/js/tko)
[![npm version](https://badge.fury.io/js/@tko%2Fbuild.reference.svg)](https://badge.fury.io/js/@tko%2Fbuild.reference)
[![Join the chat at https://gitter.im/knockout/tko](https://badges.gitter.im/knockout/tko.svg)](https://gitter.im/knockout/tko?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Circle CI](https://circleci.com/gh/knockout/tko.svg?style=shield)](https://circleci.com/gh/knockout/tko)
[![Coverage Status](https://coveralls.io/repos/knockout/tko/badge.svg?branch=master&service=github)](https://coveralls.io/github/knockout/tko?branch=master)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

[![Check 'Main' (build+tsc)](https://github.com/knockout/tko/actions/workflows/run-tsc.yml/badge.svg)](https://github.com/knockout/tko/actions/workflows/run-tsc.yml)
[![Coverage Status](https://coveralls.io/repos/knockout/tko/badge.svg?branch=master&service=github)](https://coveralls.io/github/knockout/tko?branch=master)
[![Circle CI](https://circleci.com/gh/knockout/tko.svg?style=shield)](https://circleci.com/gh/knockout/tko)
<!-- [![Sauce Test Status](https://saucelabs.com/browser-matrix/tko.svg)](https://saucelabs.com/u/tko) -->

**TKO** houses the monorepo of [Knockout](https://github.com/knockout/knockout).
TKO, or Technical Knockout, is a JavaScript web framework for data binding and templating. It is a fork of the original Knockout.js, which was created to enhance and modernize the framework while maintaining its core principles. TKO and Knockout implement the [MVVM pattern](http://en.wikipedia.org/wiki/Model_View_ViewModel) (a modern variant of MVC) as a zero-dependency and small sized library. TKO makes it easy to create rich, desktop-like user interfaces with JavaScript/Typescript and HTML. It uses *observers* to automatically keep your UI in sync with an underlying data model, along with a powerful and extensible set of *declarative bindings* to enable productive development.

TKO aims to provide developers with a more robust, modular, and maintainable codebase in [Typescript](https://www.typescriptlang.org/), making it easier to build rich, responsive, and maintainable web applications.



## Getting Started

To install use one of the usual package managers e.g.

- $ `yarn add @tko/build.reference`
- $ `npm install @tko/build.reference`
- $ `pnpm install @tko/build.reference`


Over CDN

- Reference Build: https://cdn.jsdelivr.net/npm/@tko/[email protected]/dist/build.reference.min.js
- Reference Build: https://cdn.jsdelivr.net/npm/@tko/build.reference/dist/build.reference.min.js

For more details, see

* TKO - Documentation (https://tko.io)
* Knockout - Documentation (http://knockoutjs.com/documentation/introduction.html)
* Online examples at [http://knockoutjs.com/examples/](http://knockoutjs.com/examples/)
* Stackoverflow https://stackoverflow.com/questions/tagged/knockout.js

## Knockout Build

The Knockout build has some backwards compatibility that is not in the reference build. See the build differences, here: https://tko.io/3to4

It's available as `@tko/build.knockout`, and over CDN:

- Knockout Build https://cdn.jsdelivr.net/npm/@tko/build.knockout@4.0.0-alpha8/dist/build.knockout.min.js
- Knockout Build https://cdn.jsdelivr.net/npm/@tko/build.knockout/dist/build.knockout.min.js

### Using the Monorepo

| Command | Effect |
| ------- | ------ |
| $ `git clone [email protected]:knockout/tko` | Clone the repository. |
| $ `npm install -g yarn` | Ensure yarn is globally available |
| $ `yarn` | Install local node packages and link tko modules |
| $ `make` | **Currently TKO use a make file** |
| $ `yarn test` | Run all tests. See below. |
| $ `yarn watch` | Run all tests and watch for changes. See below. |
| $ `yarn build` | Build tko\[.module\]\[.es6\]\[.min\].js files, where `.es6` version has not been transpiled |
| $ `npm install` | Ensure that all packages available |
| $ `make` | **Currently TKO use a make file** / no scripts at package.json |
| $ `make test` | Run all tests with electron. See below. |
| $ `make test-headless` | Run all tests with chromium. See below. |
| $ `lerna publish` | Bump versions and publish to npm registry |

Checkout `package.json => scripts` for more commands that can be executed with `yarn {command}`.
Checkout the `Makefile` for more commands that can be executed with `make {command}`.

In each individual `packages/*/` directory, you can also run (presuming `rollup` and `karma` are installed globally):
In each individual `packages/*/` directory, you can also run:

| Command | Effect |
| --- | --- |
| $ `karma COMMAND ../../karma.conf.js [--once]` | Test the local package, where COMMAND is e.g. `start` or `run` |
| $ `rollup -c ../../rollup.config.js` | Build the package into the local `dist/` |
| $ `make test-debug` | Runs all tests in the current package in debug- and watch-mode: Attach vscode, set a breakpoint, press save and debug |

#### Testing with `yarn test` and `yarn watch`

### NEW
### Testing

Start tests with electron: `make test`

Start tests with headless-chrome: `make test-headless`

### OLD

The `yarn test` and `yarn watch` commands can be used in the root directory, where it will run across all tests, or alternatively in any `packages/*/` directory to run tests
specific to that package.
The test setup has naturally grown and been ported from knockout.js. Some tests use Jasmine 1.3, newer ones use Mocha, Chai and Sinon. Karma is used as test runner rather as test pipeline

Optional arguments to `yarn test` include:
Other options:

- `--sauce` — use Sauce Labs to test a variety of platforms; requires an account at Sauce Labs and `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` to be set in the environment.
- `--noStartConnect` — Do not start a new Sauce Connect proxy instance for every
test; requires that Sauce Connect be already running.
- `make ci` — use Sauce Labs to test a variety of platforms; requires an account at Sauce Labs and `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` to be set in the environment.

#### `visual.html`
#### `visual.html` (possibly outdated)

Note that running `karma` or `rollup` will create a `visual.html` file that shows the proportional size of imports into each package.
Note that running `karma` will create a `visual.html` file that shows the proportional size of imports into each package.

### Objectives
## Objectives

TKO aims to become a base for future versions of Knockout. The objectives include:

- Modularization into ES6 and separate projects, with compilation using an ES6 compiler like [Rollup](http://rollupjs.org/). This solves several problems with Knockout, including:
- Modularization into ES6 and separate projects, with compilation using an ES6 compiler like [Esbuild](https://esbuild.github.io/). This solves several problems with Knockout, including:
- Some folks want to roll-their-own with e.g. removing components
- Compilation is now with Closure compiler, which is actually transliterating – meaning the *debug* and *minified* versions have different code paths (mostly in the form of things exposed in *debug* being missing in the *minified* version)
- The compilation of Knockout is just concatenation, leading to difficulties with maintainance, severance, and replacement
Expand All @@ -90,6 +96,27 @@ TKO aims to become a base for future versions of Knockout. The objectives inclu
- What should be simple plugins (e.g. binding handlers or providers) are complex, including:
- Built-ins have first-class access to quite a bit of good Knockout code, but plugins generally have second-class access and often have to duplicate Knockout internals
- Quality plugins have lots of boilerplate for compilation, release, documentation, and testing
- Type-safe with Typescript
- CSP compliant
- JSX/TSX support

## Overview of the development stack

- **make** -> Build tasks
- **npm** -> Node Package Manager
- **esbuild** -> ts/js compiler and bundler
- **lerna** -> mono-repo build-chain

---

- Test-Runner -> Karma
- Test-Environment -> electron and headless-chrome
- TDD/BDD-Frameworks ->
- Jasmine 1.3
- Mocha + Chai
- sinon (Mocks)
- Testing-Cloud-Service -> sauce
- standard -> Code-Style (outdated for typescript)

## Some WSL tricks

Expand Down Expand Up @@ -118,10 +145,16 @@ There's an [issue for that](https://github.com/knockout/tko/issues/1).

MIT license - [http://www.opensource.org/licenses/mit-license.php.](http://www.opensource.org/licenses/mit-license.php)

## Credits
- Knockout Type Definitions by: [Maxime LUCE](https://github.com/SomaticIT), [Michael Best](https://github.com/mbest)
- https://github.com/knockout/knockout/blob/master/build/types/knockout.d.ts#L404
- Team-Project: https://github.com/knockout
- http://knockoutjs.com / [Steve Sanderson](https://github.com/SteveSanderson), [Michael Best](https://github.com/mbest)

## Shout Outs

<div>
<a href='http://browserstack.com'>
<img height=150px src='https://p3.zdusercontent.com/attachment/1015988/gTNrZ9vPjL8ThUHOWP7ucklJi?token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..HkCKDttXKDSGFoV5uaMPQA.ha9NDy63mjLKFcyNeib70TCkqfY0dcwiFwDYpZ8s5h75o-e1_cLjPAHlOUEwvKAbfMUaa1XpOL5F9AQd_B4iyc6JbgvKoKBxxe12aaOdfWFccP7r9iQ2Os6myiqBpP79prDXqFPMSAkF8ybzhVqCnWzxmK-Wvkbav-DGPZm3oS2IPD9ueIvf46bggFsikQhf1pjS5fgmzo07yi9Cf5SzA8zIKAjKX1RKQeFXOhBwxRfh_5SbJprfEZMnKBnGuO_qzP2fsK3BvxbyBKpIEWFdnA.t10i3BbyEpGtFVgyGbvQfw' alt='Browser Stack' />
Browser Stack
</a>
<div>
21 changes: 12 additions & 9 deletions builds/knockout/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { functionRewrite } from '@tko/utils.functionrewrite'

import { options as defaultOptions } from '@tko/utils'

declare const BUILD_VERSION: string

/**
* expressionRewriting is deprecated in TKO because we have our own JS
* parser now. This is here only for legacy compatibility.
Expand All @@ -29,23 +31,24 @@ const expressionRewriting = {
preProcessBindings: s => dataBindProvider.preProcessBindings(s)
}

const provider = new MultiProvider({providers: [
new ComponentProvider(),
dataBindProvider,
new VirtualProvider(),
new AttributeProvider()
]})

const builder = new Builder({
filters,
provider: new MultiProvider({
providers: [
new ComponentProvider(),
dataBindProvider,
new VirtualProvider(),
new AttributeProvider()
]
}),
provider,
bindings: [
coreBindings,
templateBindings,
ifBindings,
componentBindings,
{ each: foreachBindings.foreach }
],
extenders: {},
filters,
options: {
bindingGlobals: defaultOptions.global,
bindingStringPreparsers: [functionRewrite]
Expand Down
4 changes: 4 additions & 0 deletions builds/reference/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ import { createElement, Fragment } from '@tko/utils.jsx'

import { overloadOperator } from '@tko/utils.parser'

declare const BUILD_VERSION: string

/** Overload "evil twins" with strict equivalents */
overloadOperator('==', (a, b) => a === b)
overloadOperator('!=', (a, b) => a !== b)

const builder = new Builder({
filters,
extenders: {},
options: {},
provider: new MultiProvider({
providers: [
new ComponentProvider(),
Expand Down
66 changes: 66 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/// <reference types="jasmine" />
/// <reference types="jquery" />

//export {} allows redefining window module
export { };

declare global {

// Below just informs IDE and/or TS-compiler (it's set in `.js` file).
interface Window {
DEBUG: boolean
amdRequire: any
require: any
jQuery: JQueryStatic
innerShiv // TODO: For IE<9.. we could also remove it
}

//Jasmine and Mocha define duplicated functions, is a problem for the type system
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

Copy link
Member Author

@phillipc phillipc Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how it works for now. Jasmine 1.3 is old and there aren't many tests in Mocha. Perhaps a facade that redirects Jasmine 1.3 to Mocha/Chai is a future solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, those or playwright.dev or bun.sh. They're pretty tightly tied to Jasmine right now, so it'd be an effort, but homogenizing the runner would help a lot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A current version 5.6 of Jasmine is probably the simplest solution. Although a lot has changed here too. Jest is also similar. In my opinion, Playwright is more like browser automation for e2e testing. It is a very good replacement for Selenium.

//This namespace merges the jasmine namespace to correct same tsc warnings
namespace jasmine {

function setNodeText(node, text: string): void
var Spec: any;
function getGlobal(): any;
var updateInterval: number
function resolve(promise: Promise<boolean>)
function prepareTestNode() : HTMLElement
function nodeText(node)
var Clock: Clock
function getEnv(): any;

var FakeTimer: any
var undefined: undefined
var browserSupportsProtoAssignment: any
var ieVersion: any

var Matchers: Matchers

interface Matchers<T> {
toContainText(expected: string, ignoreSpaces: boolean): boolean
toHaveOwnProperties(expectedProperties: any): boolean
toHaveTexts(expectedTexts: any): boolean
toHaveValues(expectedValues: any): boolean
toHaveCheckedStates(expectedValues: any): boolean
toThrowContaining(expected: any): boolean
toEqualOneOf(expectedPossibilities: any): boolean
toContainHtml(expectedHtml: any, postProcessCleanedHtml: any): boolean
toHaveSelectedValues(expectedValues: any): boolean
toContainHtml(expectedValues: any): boolean
toHaveNodeTypes(expectedTypes: any): boolean
toContainHtmlElementsAndText(expectedHtml: any): boolean
}

interface Clock {
mockScheduler: any
}

interface Spy {
reset(): any
}
}

interface SymbolConstructor {
observable?: Symbol;
}
}
Loading