The @swim/core framework provides a lightweight, portable, dependency-free,
and strongly typed baseline on which to build higher level libraries.
@swim/core forms the foundation on which the
@swim/mesh
multiplexed streaming WARP framework, and the
@swim/ui
and @swim/ux
real-time user interface toolkits, are built. @swim/core is a part of the broader
@swim/system framework.
The @swim/core umbrella package depends on, and re-exports, the following
component libraries:
@swim/util
(npm,
doc) –
ordering, equality, and hashing; type conversions; iterators; builders;
maps; caches; and assertions.
@swim/codec
(npm,
doc) –
incremental I/O; functional parsers and writers; display, debug, and
diagnostic formatters; and Unicode and binary codecs.
@swim/collections
(npm,
doc) –
immutable, structure sharing collections, including B-trees and S-trees
(sequence trees).
@swim/structure
(npm,
doc) –
generic structured data model, with support for selectors, expressions,
and lambda functions. Used as a common abstract syntax tree for Recon,
JSON, XML, and other data languages.
@swim/streamlet
(npm,
doc) –
stateful, streaming component model for application componets that
continuously consume input state from streaming inlets, and continuously
produce output state on streaming outlets.
@swim/dataflow
(npm,
doc) –
compiler from @swim/structure expressions to live-updated data models.
@swim/recon
(npm,
doc) –
object notation with attributes, like if JSON and XML had a baby.
@swim/math
(npm,
doc) –
mathematical and geometric structures and operators.
@swim/time
(npm,
doc) –
date-time, time zone, and time interval data types,
with strptime/strftime-style parsers and formatters.
@swim/uri
(npm,
doc) –
rich object model for working with Uniform Resource Identifiers and URI
subcomponents, including an efficient and safe codec for parsing and
writing compliant URI strings.
For an npm-managed project, npm install @swim/core to make it a dependency.
TypeScript sources will be installed into node_modules/@swim/core/main.
Transpiled JavaScript and TypeScript definition files install into
node_modules/@swim/core/lib/main. And a pre-built UMD script, which
bundles all @swim/core component libraries, can be found in
node_modules/@swim/core/dist/main/swim-core.js.
Alternatively, the standalone swim-system.js script may be loaded
from the Swim CDN, which bundles @swim/core together with all other
@swim/system
frameworks.
@swim/core can be imported as an ES6 module from TypeScript and other
ES6-compatible environments. All component libraries are re-exported by
the umbrella @swim/core module.
When loaded by a web browser, the swim-core.js script adds all component
library exports to the global swim namespace.
The swim-system.js script also adds all @swim/core component library
exports to the global swim namespace, making it a drop-in replacement
for swim-core.js when additional @swim/system frameworks are needed.
@swim/core
The @swim/core framework provides a lightweight, portable, dependency-free, and strongly typed baseline on which to build higher level libraries. @swim/core forms the foundation on which the @swim/mesh multiplexed streaming WARP framework, and the @swim/ui and @swim/ux real-time user interface toolkits, are built. @swim/core is a part of the broader @swim/system framework.
Framework
The @swim/core umbrella package depends on, and re-exports, the following component libraries:
strptime
/strftime
-style parsers and formatters.@swim/core has no external dependencies.
Installation
npm
For an npm-managed project,
npm install @swim/core
to make it a dependency. TypeScript sources will be installed intonode_modules/@swim/core/main
. Transpiled JavaScript and TypeScript definition files install intonode_modules/@swim/core/lib/main
. And a pre-built UMD script, which bundles all @swim/core component libraries, can be found innode_modules/@swim/core/dist/main/swim-core.js
.Browser
Browser applications can load
swim-core.js
directly from the Swim CDN.<script src="https://cdn.swim.ai/js/latest/swim-core.js"></script>
Alternatively, the standalone
swim-system.js
script may be loaded from the Swim CDN, which bundles @swim/core together with all other @swim/system frameworks.<script src="https://cdn.swim.ai/js/latest/swim-system.js"></script>
Usage
ES6/TypeScript
@swim/core can be imported as an ES6 module from TypeScript and other ES6-compatible environments. All component libraries are re-exported by the umbrella
@swim/core
module.import * as swim from "@swim/core";
CommonJS/Node.js
@swim/core can also be used as a CommonJS module in Node.js applications. All component libraries are re-exported by the umbrella
@swim/core
module.var swim = require("@swim/core");
Browser
When loaded by a web browser, the
swim-core.js
script adds all component library exports to the globalswim
namespace.The
swim-system.js
script also adds all @swim/core component library exports to the globalswim
namespace, making it a drop-in replacement forswim-core.js
when additional @swim/system frameworks are needed.