Giter VIP home page Giter VIP logo

trrackjs's People

Contributors

domoritz avatar jakewags avatar kirangadhave avatar semantic-release-bot avatar thinkh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trrackjs's Issues

Add note about versions

Hi, I have been using the library and it is working well! However I was initially confused that the docs home page says the docs are for "Trrack v2" but the NPM package linked from the README is @trrack/core which has the latest version of v1.3.0. I was unsure if I was looking at the wrong docs/package.

With further investigation it seems that v1 vs. v2 refers to @visdesignlab/trrack vs. @trrack/core. A note about this would make it more clear.

Wrong counter action function in react-trrack-example

Steps to reproduce

  1. Clone repo
  2. Run yarn dev:all
  3. Check console output

Observed behavior

[...rack-example] ERROR in ./apps/react-trrack-example/src/app/store/trrack.ts:46:7
[...rack-example] TS2345: Argument of type '(add: number) => { type: string; payload: number; meta: { hasSideEffects: boolean; }; }' is not assignable to parameter of type 'TrrackActionFunction<"increment-counter", string, any, number> | StateChangeFunction<number, number>'.
[...rack-example]   Type '(add: number) => { type: string; payload: number; meta: { hasSideEffects: boolean; }; }' is not assignable to type 'TrrackActionFunction<"increment-counter", string, any, number>'.
[...rack-example]     Property 'undo' is missing in type '{ type: string; payload: number; meta: { hasSideEffects: boolean; }; }' but required in type '{ do?: { payload: number; type: "increment-counter"; } | undefined; undo: { payload: any; type: string; }; }'.
[...rack-example]     44 |     const incrementCounter = reg.register(
[...rack-example]     45 |       'increment-counter',
[...rack-example]   > 46 |       (add: number) => {
[...rack-example]        |       ^^^^^^^^^^^^^^^^^^
[...rack-example]     47 |         setCounter((c) => c + add);
[...rack-example]     48 |         return {
[...rack-example]     49 |           type: 'decrement-counter',
[...rack-example] 
[...rack-example] ERROR in ./apps/react-trrack-example/src/app/store/trrack.ts:60:7
[...rack-example] TS2345: Argument of type '(sub: number) => { type: string; payload: number; meta: { hasSideEffects: boolean; }; }' is not assignable to parameter of type 'StateChangeFunction<number, number> | TrrackActionFunction<"decrement-counter", string, any, number>'.
[...rack-example]   Type '(sub: number) => { type: string; payload: number; meta: { hasSideEffects: boolean; }; }' is not assignable to type 'StateChangeFunction<number, number>'.
[...rack-example]     Type '{ type: string; payload: number; meta: { hasSideEffects: boolean; }; }' is not assignable to type 'number'.
[...rack-example]     58 |     const decrementCounter = reg.register(
[...rack-example]     59 |       'decrement-counter',
[...rack-example]   > 60 |       (sub: number) => {
[...rack-example]        |       ^^^^^^^^^^^^^^^^^^
[...rack-example]     61 |         setCounter((c) => c - sub);
[...rack-example]     62 |         return {
[...rack-example]     63 |           type: 'increment-counter',
[...rack-example] 
[...rack-example] Found 2 errors in 339 ms.

The action functions for incrementCounter and decrementCounter are probably not up-to-date with the most recent typings.

Expected behavior

The examples should compile without errors.

Add flag to to determine if currentChange is triggered by node traversal or node addition.

What
It would be useful to be able to conveniently determine if currentChange was triggered by node traversal (undo/redo/click on trrackViz) vs a user action causing a new node to be added to the track tree. This could be added as an argument in the currentChange callback, or property on the trrack object returned by initializeTrrack.

Why
My current approach to handling provenance with vue/pinia is to subscribe to changes on the pinia store then call the relevant prov.apply(...) function to update the trrack state. Then of prov.currentChange is triggered. Now we get to the branching logic.

  • Case 1: If we have a new node, we know this was triggered from a store update, so we don't want to make any changes to the store.
  • Case 2: If we move to an existing node, that means we must update the pinia store to update the ui.

Workaround
Right now, I have a working solution:

const prov = initializeTrrack(...);
const nodeIds = new Set<string>([prov.root.id]);
prov.currentChange(() => {
    const provNodeId = prov.current.id;
    if (nodeIds.has(prov.current.id)) {
        // update pinia state based on trrack state
    } else {
        // do nothing
    }
    nodeIds.add(provNodeId);
});

So far, this appears to be working. I'm not sure how this will work with URL state sharing — it may require some updates, i.e. adding all of the state node ids on initial load probably.

Auto generate typedocs

The TrrackJS docs page has usage examples and some conceptual explanations. We need an API + Types reference auto-generated from the code using typedoc or something similar.

@JackWilb @bbollen23 will appreciate any input on this. I have used typedoc earlier, and most of the code has JSDoc-style comments.

Expose the api to add/remove metadata and artifacts to trrack nodes

We have the types and the metadata attributes on the nodes. We don't expose a function to add/remove/set these.

Metadata is the ONLY change allowed in an already created node. To keep the provenance of metadata changes, the metadata attribute should have the following data structure:

type MetadataObject<T> = {
	timestamp: string;
	value: T
}

type Metadata<T> = Array<MetadataObject<T>>

The API should provide the following:

  • Add new metadata to the node. Only take the metadata as input, and generate timestamps internally.
  • Get available metadata types
  • Get the latest metadata of a type
  • Get all metadata of a type
  • Get all metadata

Implement a similar API for artifacts. Artifacts can be used to store arbitrary objects/object URLs like screenshots, etc.

Implement search API

Function which takes a search term and metadata keys to search and returns a list of all nodes or node IDs whose keys match the search terms. This will be paired with a search bar and updates to trrackvis in a separate issue there.

Groups and annotations should also be searchable.

Improve branding on docs page

The documentation page should have a

  • university of utah
  • visualization design lab
  • nsf logo

on each page in the footer.

The about page should also mention SCI and Kahlert School of Computing.

Undo-as-delete feature

Consider adding an undo-as-delete default feature to cull the unnecessary branches.

https://idl.cs.washington.edu/files/2008-GraphicalHistories-InfoVis

We can limit the delete interaction to hide rather than remove it from the history. This can help reduce the clutter. Refer to the paper above for some techniques and considerations for implementing such a feature.

TODO:

  • create a plan of action on how undo-as-delete will work.
  • changes to the API
  • defaults

Trrack users in nodes

The user who made a specific change should be trracked. Easiest way to implement this is probably to have the implementer provide a username as a string argument to the action call.

Measure performance / storage impact of #64 and #65

Set up a benchmarking suite for calculating storage size for user studies (probably from reVisit).

A script to traverse the provenance and update the state for each node according to different frequencies of checkpoints (#65) and using the new diff mechanism (#64).

Add screenshot functionality for long-term provenance

This should be a function that takes a DOM node to screenshot and arguments related to when to screenshot. A config should be provided to choose which actions trigger screenshots. Either default include all or exclude all and provide a list of action keys which are exceptions to the overall rule. Once ephemeral nodes are added, they should not be included in the count before next screenshot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.