Giter Club home page Giter Club logo

viewscript-runtime's Introduction

I'm building ViewScript, a tool for rapidly launching simple web apps.

viewscript-runtime's People

Contributors

alexyuly avatar

Watchers

 avatar  avatar

viewscript-runtime's Issues

Handle mapping a collection of data to elements

  • Make sure we remove event listeners when their HTML elements are removed. See class ElementEventPublisher
  • Also provide a way to handle filtering.
  • Add methods on ArrayField:
    • filter an array item -> Boolean
    • map an array item -> Any Data

Methods

Methods are members of a model bound to another method or a field, with a return type (data) and an optional parameter type (data or function), which are referenced by inputs.

Support controlled inputs?

Should we support controlled inputs, like React? Most likely this is useful in many cases so yes we should.

Structures

Prerequisite for #11

The groundwork for structures is in place, but their children need to be dynamic (fields)

Support Optional Fields

Proposal:

Allow Field["value"] to be null. This indicates a private, empty field; as opposed to a value of undefined, which is already allowed, and which indicates a public field, whose value will come from the parent element.

Update Readme's Goals and Motivation Sections

  • Talk more about the goal of helping app developers working in product-led orgs, especially with complex domains
  • Talk about the goal of 100% control, coverage, visibility into the full domain and range of your apps

[add] Fields can be optional

Add functionality to the Field type, such that the value of a Field instance is optional when the Field instance is provided to a Let or Take instance.

Actions

export type Action<Parameter extends Model = Model> = Node<"action"> & {
  parameter?: Named & Field<Parameter>;
  steps: Array<ActionPointer | Exception | StreamPointer>;
};
export type ActionPointer<Parameter extends Model = Model> =
  Node<"actionPointer"> & {
    actionPath: Array<string>;
    argument?: Field<Parameter>;
  };
export type Model<Name extends string = string> = Node<"model"> &
  Named<Name> & {
    members: Record<string, Field | Method | Action>;
  };
export type Atom = Node<"atom"> & {
  tagName: string;
  properties: Record<string, Action | Field>;
};
export type Organism<T extends View = View> = Node<"organism"> & {
  viewName: T["name"];
  properties: {
    [Key in keyof T["members"]]?: T["members"][Key] extends Stream<infer Event>
      ? Action<Event>
      : T["members"][Key];
  };
};

Models

  • Define models
    • they have child fields
    • they can have methods: (argument?) => new field
    • they can have actions: (argument?) => side effect on this field
  • Create fields of models

Decide if initialized fields can be connected to data sources

Currently, this will throw an error about "private fields".

Does this make sense?

(How) do we want to handle "optional" properties? With a special case, i.e. public fields with an initializer? Or, let all view fields be publicly set by parent elements?

Exceptions

export type Exception = Node<"exception"> & {
  condition: Field<Model<"Boolean">>;
  steps?: Array<ActionPointer | Exception | StreamPointer>;
};

Multiple arguments in calls and expressions

to help support calling native actions and methods on window

for example calls to window.fetch which pass a URL and options

the calls to setTimeout and setInterval in the example in #23

[fix] Let second type argument should work as expected

In TodoListApp.d.ts:

I want to update completed: Let<BooleanModel>; to `completed: Let<BooleanModel, false>;

However, the second type argument of Let causes an error in all cases except void. Something is broken about how DataType works, but I don't know what.

Handle events from streams

  • In the Bridge, the interface for this should be a function of the event type returning an output
  • In the Runtime, parameterized actions will receive events as arguments from streams
    • (How) do we translate JavaScript DOM events into ViewScript models?

Tasks and Operations

A task has a contract with outputs and data (like a view), and also actions.

Additionally, a task calls its own stop and start actions:

  • stop runs just before a task 1) shuts down or 2) receives an updated contract.
  • start runs just after a task 1) starts up or 2) receives an updated contract.

Here's an example task which defines a timer (to be implemented for v0.5)...

export Timer = task {
  looping: boolean or false
  paused: boolean or false
  period: number
  time: output

  id = 0
  stop = window.(clearTimeout id)
  start = do {
    when paused do nothing
    when looping do id.(setTo window.(setInterval time period))
    id.(setTo window.(setTimeout time period))
  }
}

An operation is a new instance of a task, for example:

myTimer = Timer {
  looping = true
  period = 1000
  time = window.console.(log "The timer went off again!")
}

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.