Publish npm package for manywidgets core frontend functions?

Open
#20 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, typescript

Research direction

Start by examining the existing manywidgets/core frontend helpers and the custom-widget usage shown in notebooks/situation_room/app.js. Determine the smallest npm package surface that lets ESM widgets import those helpers without vendoring; done means the package is published and a custom widget can consume the supported imports, while the broader base-class API remains a separate design question.

Written by the indexing model from the issue text.

Description

Right now we publish a PyPi package for manywidgets to use the exported widgets in notebooks.

However, if one is making a custom widget with writing one's own ESM module, there is no way to easily import functions from manywidgets/core in the frontend code for useful helpers, etc. that you probably want for your widget.

This results in ugly "vendoring in" of functions that one needs, like https://github.com/developmentseed/manywidgets-playground/blob/main/notebooks/situation_room/app.js#L11

Ideally, we'd be able to just import these from manywidgets some-how on the frontend. Going further, we might want to re-architect a bit to make it more natural to create custom widgets based on the manywidgets "core" - like develop a base-class that can be inherited from instead of helper functions - probably needs a bit of thinking through.

Without a good solution to this, the story around authoring your own custom widgets that play well with manywidgets is a little bit awkward - you likely need to copy-paste in some functions from the manywidgets code, etc.

@dzole0311 would really appreciate your thoughts on this one - I think I'll play around with a couple of ideas - I think as a first step maybe just publishing the npm package and importing the helpers would at least avoid needing to vendor things in, and then perhaps a subsequent step to design the API around making custom widgets a bit better - conceptually it seems like it would be nice to be able to just extend like a Manywidget base-class on the frontend.

Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developmentseed/manywidgets

All issues in developmentseed/manywidgets

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.