github manzt/anywidget v0.2.0

latest releases: create-anywidget@0.7.3, create-anywidget@0.7.2, @anywidget/types@0.2.0...
18 months ago

Minor Changes

  • feat: auto-create (and watch) FileContents for valid file paths (#79)

    import anywidget
    import traitlets
    
    class Counter(anywidget.AnyWidget):
        _esm = "index.js"
        value = traitlets.Int(0).tag(sync=True)

    If a file path for an existing file is detected for _esm or _css,
    the contents will be read from disk automatically. If the resolved
    path is not in site-packages (i.e., likely a development install), a
    background thread will start watching for file changes and push updates
    to the front end.

  • feat: add anywidget/types to npm package to allow opt-in strictness (#80)

    // @ts-check
    
    /** @type {import("anywidget/types").Render<{ value: number }>} */
    export function render(view) {
      let value = view.model.get("value");
      //^ ? `number`
    
      view.model.set("value", "not-a-number");
      // Error: Argument of type 'string' is not assignable to parameter of type 'number'. [2345]
    }

Don't miss a new anywidget release

NewReleases is sending notifications on new releases.