developmentseed / developmentseed/manywidgets

Publish npm package for manywidgets core frontend functions?

Open
#20 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.