Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@starbeam/interfaces

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@starbeam/interfaces - npm Package Compare versions

Comparing version 0.8.10-unstable.9203102 to 0.8.10-unstable.0ad7df5

LICENSE.md

12

.eslintrc.json
{
"root": false,
"overrides": [
{
"extends": ["plugin:@starbeam/tight"],
"files": ["index.ts", "src/**/*.ts"],
"parserOptions": {
"project": "tsconfig.json"
}
}
]
"root": true,
"extends": ["plugin:@starbeam-dev/library:recommended"]
}
{
"name": "@starbeam/interfaces",
"version": "0.8.10-unstable.9203102",
"type": "module",
"main": "index.ts",
"types": "index.ts",
"version": "0.8.10-unstable.0ad7df5",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
"default": "./index.ts"
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.cjs"
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam": {

@@ -26,13 +17,14 @@ "source": "ts",

},
"scripts": {
"test:lint": "eslint \"index.ts\" \"src/**/*.ts\"",
"test:types": "tsc -b"
},
"dependencies": {
"@domtree/any": "workspace:^",
"@starbeam/shared": "1.3.8-unstable.9203102"
"@starbeam/shared": "1.3.8-unstable.0ad7df5",
"@domtree/any": "^0.9.3"
},
"devDependencies": {
"@starbeam-dev/build-support": "workspace:*"
"@starbeam-dev/compile": "^1.0.2",
"@starbeam-dev/eslint-plugin": "^1.0.4"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:types": "tsc -b"
}
}
}

@@ -18,4 +18,5 @@ import type { TAG } from "@starbeam/shared";

/**
* Cell is the fundamental mutable reactive value. All subscriptions in Starbeam are ultimately
* subscriptions to cells, and all mutations in Starbeam are ultimately mutations to cells.
* Cell is the fundamental mutable reactive value. All subscriptions in
* Starbeam are ultimately subscriptions to cells, and all mutations in
* Starbeam are ultimately mutations to cells.
*/

@@ -32,12 +33,15 @@ export interface CellTag extends TagMethods {

/**
* Formula is a reactive that has *dynamic* children. This means that you can't cache the children
* (or subscribe directly to them), because they may change. This is different from delegates, which
* are guaranteed to have the same set of children forever.
* Formula is a reactive that has *dynamic* children. This means that you can't
* cache the children (or subscribe directly to them), because they may change.
* This is different from delegates, which are guaranteed to have the same set
* of children forever.
*
* Composite reactives must notify the timeline when their children have changed.
* Composite reactives must notify the timeline when their children have
* changed.
*
* A subscription to a composite reactive is a subscription to its current children, as of the last
* time the timeline was notified of changes to the composite's children. Whenever the timeline is
* notified of a change to the composite's children, it removes subscriptions from any stale
* dependencies and adds subscriptions to any new dependencies.
* A subscription to a composite reactive is a subscription to its current
* children, as of the last time the timeline was notified of changes to the
* composite's children. Whenever the timeline is notified of a change to the
* composite's children, it removes subscriptions from any stale dependencies
* and adds subscriptions to any new dependencies.
*/

@@ -74,9 +78,11 @@ export interface FormulaTag extends TagMethods {

/**
* Delegate is a reactive that represents one or more reactives, but that set of reactives cannot
* change. This allows you to cache the value of the `delegate` property, and it also allows you to
* subscribe directly to the delegate's targets.
* Delegate is a reactive that represents one or more reactives, but that set
* of reactives cannot change. This allows you to cache the value of the
* `delegate` property, and it also allows you to subscribe directly to the
* delegate's targets.
*
* In practice, when you subscribe to a delegate, the timeline subscribes directly to the delegate's
* targets. This means that delegates don't need to know when their value changes, and don't need to
* notify the timeline when their targets change.
* In practice, when you subscribe to a delegate, the timeline subscribes
* directly to the delegate's targets. This means that delegates don't need to
* know when their value changes, and don't need to notify the timeline when
* their targets change.
*/

@@ -90,12 +96,14 @@ export interface DelegateTag extends TagMethods {

/**
* Static is a reactive that is guaranteed not to change. This means that you can cache the value of
* the static reactive and don't need to include it in composite children. All validation semantics
* act as if static reactives were not present.
* Static is a reactive that is guaranteed not to change. This means that you
* can cache the value of the static reactive and don't need to include it in
* composite children. All validation semantics act as if static reactives were
* not present.
*
* If a formula or delegate has only static children, it is also static. Even though a formula's
* children can change, if the formula's *only* children are static, then the formula can never
* invalidate, and therefore it, itself, is treated as static.
* If a formula or delegate has only static children, it is also static. Even
* though a formula's children can change, if the formula's *only* children are
* static, then the formula can never invalidate, and therefore it, itself, is
* treated as static.
*
* TODO: Do we need a separate fundamental type for pollable formulas, which can get new
* dependencies even if they never invalidate?
* TODO: Do we need a separate fundamental type for pollable formulas, which
* can get new dependencies even if they never invalidate?
*/

@@ -108,9 +116,11 @@ export interface StaticTag extends TagMethods {

/**
* A tag validates a reactive value. The behavior of a tags is defined in relation to reads and
* writes of the reactive value they represent. Tags model **value composition** (and functional
* composition), not a more general algebra.
* A tag validates a reactive value. The behavior of a tags is defined in
* relation to reads and writes of the reactive value they represent. Tags
* model **value composition** (and functional composition), not a more general
* algebra.
*
* In other words, it doesn't make sense to think about the composition of tags abstracted from the
* values they represent. Attempting to think about tags this way makes them seem more general than
* they are, and that generality breaks system invariants derived from value composition.
* In other words, it doesn't make sense to think about the composition of tags
* abstracted from the values they represent. Attempting to think about tags
* this way makes them seem more general than they are, and that generality
* breaks system invariants derived from value composition.
*/

@@ -122,5 +132,6 @@ export type Tag = CellTag | FormulaTag | DelegateTag | StaticTag;

*
* A subscription to a formula is a dynamic subscription to its current dependencies.
* A subscription to a delegate is equivalent to subscribing to its (stable) targets.
* A subscription to a static is equivalent to subscribing to nothing.
* A subscription to a formula is a dynamic subscription to its current
* dependencies. A subscription to a delegate is equivalent to subscribing to
* its (stable) targets. A subscription to a static is equivalent to
* subscribing to nothing.
*/

@@ -127,0 +138,0 @@ export type SubscriptionTarget = CellTag | FormulaTag;

@@ -39,6 +39,3 @@ import type { CallStack } from "./debug/call-stack.js";

*/
readonly mark: (
cell: CellTag,
mark: (revision: Timestamp) => void
) => void;
readonly mark: (cell: CellTag, mark: (revision: Timestamp) => void) => void;
/**

@@ -78,36 +75,2 @@ * Indicate that the value associated with the given tag has been consumed.

readonly start: () => () => TagSnapshot;
/**
* Register a finalization handler for the given object. The finalization
* handler will be called when the object is explicitly finalized, or when
* a linked parent object is finalized.
*
* The return value of `onFinalize` is a function that can be called to
* remove the finalization handler.
*
* A finalization handler will only ever be called at most once. If the
* finalization handler is removed before the object is finalized, it will
* not be called.
*/
readonly onFinalize: (object: object, callback: Unsubscribe) => Unsubscribe;
/**
* Link two objects together. When the parent object is finalized, the child
* object will also be finalized.
*
* The return value of `link` is a function that can be called to remove the
* link. This is useful for objects that can move between parents, but should
* still be automatically finalized when the final parent is finalized.
*/
readonly link: (parent: object, child: object) => Unsubscribe;
/**
* Explicitly finalize the given object. This will call any finalization
* handlers that have been registered for the object, and will also finalize
* any linked children (recursively).
*
* Finalization handlers run synchronously, so you can rely on them to run
* before replacing a finalized object with a new object.
*/
readonly finalize: (object: object) => void;
}

@@ -114,0 +77,0 @@

@@ -1,3 +0,1 @@

import type { UNINITIALIZED } from "@starbeam/shared";
import type { Description } from "./debug/description.js";

@@ -29,15 +27,18 @@ import type { Timestamp } from "./timestamp.js";

/**
* Formula is a reactive that has *dynamic* children. This means that you can't cache the children
* (or subscribe directly to them), because they may change. This is different from delegates, which
* are guaranteed to have the same set of children forever.
* Formula is a reactive that has *dynamic* children. This means that you can't
* cache the children (or subscribe directly to them), because they may change.
* This is different from delegates, which are guaranteed to have the same set
* of children forever.
*
* Composite reactives must notify the timeline when their children have changed.
* Composite reactives must notify the timeline when their children have
* changed.
*
* A subscription to a composite reactive is a subscription to its current children, as of the last
* time the timeline was notified of changes to the composite's children. Whenever the timeline is
* notified of a change to the composite's children, it removes subscriptions from any stale
* dependencies and adds subscriptions to any new dependencies.
* A subscription to a composite reactive is a subscription to its current
* children, as of the last time the timeline was notified of changes to the
* composite's children. Whenever the timeline is notified of a change to the
* composite's children, it removes subscriptions from any stale dependencies
* and adds subscriptions to any new dependencies.
*
* TODO: Do we need a separate fundamental type for non-cached formulas, which can get new
* dependencies even if they never invalidate?
* TODO: Do we need a separate fundamental type for non-cached formulas, which
* can get new dependencies even if they never invalidate?
*/

@@ -47,14 +48,16 @@ export interface FormulaTag {

readonly description?: Description | undefined;
readonly dependencies: UNINITIALIZED | (() => readonly CellTag[]);
readonly dependencies: undefined | (() => readonly CellTag[]);
}
/**
* A tag validates a reactive value. The behavior of a tags is defined in relation to reads and
* writes of the reactive value they represent. Tags model **value composition** (and functional
* composition), not a more general algebra.
* A tag validates a reactive value. The behavior of a tags is defined in
* relation to reads and writes of the reactive value they represent. Tags
* model **value composition** (and functional composition), not a more general
* algebra.
*
* In other words, it doesn't make sense to think about the composition of tags abstracted from the
* values they represent. Attempting to think about tags this way makes them seem more general than
* they are, and that generality breaks system invariants derived from value composition.
* In other words, it doesn't make sense to think about the composition of tags
* abstracted from the values they represent. Attempting to think about tags
* this way makes them seem more general than they are, and that generality
* breaks system invariants derived from value composition.
*/
export type Tag = CellTag | FormulaTag;

@@ -26,7 +26,7 @@ import type { TAG } from "@starbeam/shared";

/**
* A `TaggedReactive` object is a reactive object that has a `Tag` (which is used
* to validate it) and a `read` function that can be used to read the current
* value of the object.
* A `TaggedReactive` object is a reactive object that has a `Tag` (which is
* used to validate it) and a `read` function that can be used to read the
* current value of the object.
*/
export interface TaggedReactive<T = unknown, I extends Tag = Tag>
export interface TaggedReactive<out T = unknown, I extends Tag = Tag>
extends Tagged<I> {

@@ -33,0 +33,0 @@ readonly read: () => T;

@@ -11,7 +11,1 @@ export interface Timestamp {

}
export interface TimestampStatics {
now: () => Timestamp;
max: (...timestamps: Timestamp[]) => Timestamp;
debug: (timestamp: Timestamp) => { at: number };
}

@@ -5,10 +5,10 @@ {

"composite": true,
"types": ["../../env.d.ts"],
"declaration": true,
"declarationDir": "../../../dist/types",
"declarationMap": true,
"outDir": "../../../dist/packages",
"types": ["../../env"]
"emitDeclarationOnly": true
},
"exclude": ["dist/**/*"],
"include": ["index.ts", "./src/**/*.ts", "./src/**/*.d.ts"]
"include": ["index.ts", "./src/**/*.ts", "./src/**/*.d.ts"],
"exclude": ["dist/**/*"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc