-
Notifications
You must be signed in to change notification settings - Fork 11
Running PR for V1 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Includes a split in the evaluation middleware for improved flexibility.
Moving towards a flatter state structure.
* Add component evaluation * Remove transforms * Clean up evaluation comms - no longer a single action
This allows for no triggering of updates and infinte loops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random comments!
import { Middleware } from './types'; | ||
import { DEFINE_COMPONENT_SPEC, DEFINE_COMPONENT } from './components/types'; | ||
|
||
const triggerEvaluateMiddleware: Middleware = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also be able to trigger evaluation manually.
That looks awesome!!! Thank you so much @rowanc1 for working on it, I'm convinced So I'm not a great js coder, I'm kind of stuck in the era before node.js, so I'm going to give my perspective as a user, not as a developer as this is over the top of my head :-) For the runtime state and exposition of The change of About the removal of About About
Would be generic and simple enough to use, although a bit redundant. If it could be set as an attribute (eg: About the rest, such as the store package renaming, it's over my head so I can't say anything ;-) However as an almost naive user, I fear that the transition to typescript will require compilation the library with node, so could you confirm whether Thank you so much again for your amazing work! :D |
Thanks so much @lrq3000 for the feedback, really helpful.
<ink-range bind="icare" min="1" max="5"></ink-range>
<span visible="icare > 3">
This is visible if you really<span visible="icare > 4"> really</span> care!
</span>
I will update this thread again soon as I make some progress. Thanks again for the feedback/usage! |
* remove dictionary type * Standardize the interface to shortcuts * funcOnly --> has {func, value} to define properties * InkVarSpec * Variable can get accessed/set like a component
* InkAction, InkButton, InkSwitch, InkVisible * Variables now act like components (using same code) * Better formatting and variable parsing
- Do not export the middleware if importing from node
That looks awesome! The new widgets are very welcome additions! Sorry if I may sound over excited in all my posts here, but really the library was already awesome before, and now it's getting even better! Thank you so much for all your work on it! Yes for sure if I succeed in using ink-components with Brython I will gladly provide you with a sample :-) Furthermore, Brython doesn't have native support for widgets (nor widgets provided by charting libraries such as Bokeh, although the Bokeh charts can be used), so that's why ink-components can be a great complement for data analysts who want to quickly make interactive charts! Here are a few additional suggestions/comments:
|
Also as soon as you compile a javascript version of the new branch I will gladly test it out (since I don't know how to compile typescript) ;-) |
- export lit-element and html out of basic - important for inheritance downstream - moved provider to the runtime - display not shows in the light-dom - style fixes for slider - visible element is now just toggling the hidden attribute - important for textContent (e.g. in ink-equation) - fix build of TS for ink-basic for import down stream
Just some other running thoughts: The idea of binding to a variable should give you other things, like the format, description which is actually nice. (e.g. hover tooltips for explaining a variable?) I was trying to do a conditionally written math equation that updates --- and I could not write the format in the variable when also wanting to conditionally change things. So I might be going back on the transform piece for displays. :) Anyways, small changes. I took @lrq3000's advice and went with an @lrq3000 I like I will try to get things published by mid-next week (hopefully sooner?!) to start playing with them. Thanks in advance for your help! (Also, the enthusiasm is always welcome ... 🚀) |
heya - a quick question from me. I think we discussed before but I don't remember where it ended. I wonder if there are ways to bridge the widget-y components and their values with the What I am imagining here is something like "a person uses Python to generate a number, and produce a sliding widget that controls the number's value, and then uses an ink-js component to display that number in the text somewhere". Does that make sense? |
Hey @choldgraf, one of the main motivations behind this work was to make the components work with other environments. I have pulled out all of the state manipulation code into a runtime package, so I think it should now be (relatively) straight forward to connect it into the Jupyter ecosystem. I actually gave a scipy lightning talk about this sort of idea in (gosh) 2015: https://www.youtube.com/watch?v=xf3A6fA77XA I am sure things have been updated a lot since then, but I think we could figure it out. :) I think what likely has the most potential is to bring these components inside of the markdown cells (which can have raw HTML, and in future can perhaps be supported by myst directives), and then have some sort of bridge between jupyter and ink. This would basically bring the widgets layer into the prose. I think the tricky part would be naming the variables -- probably something like your |
- Wrap state in "ink". Helps with merging with other states. - Better show that evaluation is using eval (dangerous) - Trigger evaluate on removal of components as well! - Expose evaluate actions to other packages
- Better minimal styling on range slider - Throttle the range slider events. - Remove silly string formatting and put it in var. - Dynamic now has "after" property which is set with innerText - Slot is now hidden - No cleaning of dist folder. - Export components from package
- equation has an editing property to show the slot. - Now works better with textContent - dist folder is not deleted on rebuild - Components exported, package name fixed
🤩
most definitely haha
Agreed - it would be great if you could, e.g., create a widget slider with ipywidgets, and have it connected to text in a markdown cell somehow (with a two-way connection, tangle-style). Wanna direct your attention to this issue: jupyterlab/jupyterlab#272 which I think might be a nice way for jupyter lab to support a more extensible flavor of markdown that packages could easily build on top of. Maybe you have thoughts there? |
- No user select on COPY in code - No whitespace in dynamic - Better imports in tests
- Moved to @iooxa/ink-article
I have created separate repositories for each of the packages, leaving this PR a bit of a shell. :) I will continue to update this repository, I see it being a pulling together of relevant other packages (chart, cv, etc.) with decent default styles. And those pieces are not yet complete! As such I am going to leave this PR open, and reference the various other packages. I have published everything to npm, @lrq3000 that means if you want to play with it that would be awesome. I reworked one of your examples here: Two packages that you can get: Some of my next tasks are to do a first pass on documentation and probably get the charting into a decent state. |
Initial chart refactor is complete here: I haven't deployed quite yet, there are some problems with the The new updates made this refactor pretty solid, and cut back a ton of code. |
I am closing this PR and will merge in the @iooxa/article PR #14. I will release these and write up some release notes in the next few hours. I have put some work into a website at https://iooxa.dev. Still needs some love on the responsiveness, but getting there. :) |
Fixed! :) curvenote/curvenote-dev@9eaed9f Thanks! |
Progress
store
andbasic
eslint
)!There are a few suggested breaking changes on
name/value/bind
as well astransform
on the display component. I would be curious on hearing from @lrq3000 or @J2thearo on these changes to see if they make sense!New Basic Components
Working with material web components to bring new components!
<ink-switch>
- material UI switch<ink-checkbox>
- material UI checkbox<ink-radio>
- material UI radio<ink-select>
- material UI select box New Component: Dropdown Selector #9<ink-input>
- material UI textarea<ink-visible>
- Div that makes things invisible on demandChanges to Ink Article
<article>
<aside>
for both asides and callouts.<aside class="callout info">
<ink-code>
and<ink-demo>
have been moved over<ink-equation>
is ported, and works a lot better on the rendering side (no more 1-frame lag)<figure>
iooxa/ink-article#3<ink-ref>
)? And a numbered attribute? iooxa/ink-article#6Charting
I would like to get this merged and then can move on to the chart library -- it is a different animal and needs some love.
Resume
Similar to charting, this should likely be mostly CSS? Different library, out of scope of this PR.
User-defined functions
Runtime State
I have moved to a single redux store to manage the state. This is split up into
{variables, components}
the low-level interface looks like:A version of this will be exposed in the window as
ink
so that you can get/set variables in other programs which is needed for more control: (e.g. see #12 #10).Creating a new component
I have added a base-class
BaseComponent
that does the generic registering and unregistering of the component as well as a class wrapper@withInk
that injects properties that you define in aComponentSpec
and give the relevant setters/getters for properties and events as well as playing nice with lit-element. The basics of this new setup gets the boiler-plate from 74 --> 18 lines of code (~25% of the size). The@withInk
wrapper I think is also more accessible (to debug etc.) than what I had before.Breaking Changes
Name/Value/Bind
There are a couple of issues with the previous naming conventions. It was is not specific enough for multiple event types (hover, drag, click, etc.) and there is no option for being able to add named components. This could be very helpful to react to events when a component enters the screen, show the
component.min
value, etc. The previousname
attribute was used to set:value="${name}"
andbind="{[name]: value}"
which amounted to two way binding in the component. This was a handy shortcut and I think it should stay, however, be renamed tobind
now that events are explicitly named.name
for components will now be used for the actual name of the component (should be unique in that scope)events
, which will allow components to have multiple types of eventsbind
is used as the default event type on components that allow it.Previous version:
Changes to:
This is equivalent to:
Action / Button
The
bind
syntax doesn't make sense for theink-action
andink-button
components, it should really be an event and there isn't a value to "bind" to. This should change to:click
to return an event transform object.Transform
transform
should remain on thedisplay
component. This can be done in a single call in the:value
function:<ink-display :value="fullName.split(' ')[0]">
. I do think that it should remain in thedynamic
as thevalue
is different than how you might display the variable.Questions
store
package be called runtime? Would be similar to svelte, observable, idyll, etc.ink-components
on github/npm for the main package. So packages are@iooxa/runtime
etc.ink-article
work is really just CSS, these should probably be removed as WebComponents. e.g.ink-aside
-->aside
ink-article
-->article
as these are standard HTML components.callout
? update: I think this should be anaside
with a class. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/asideink-p
andink-a
, these are really common attributes and when parsing (e.g. SEO) have semantic meaning. Thevisible
attribute is the main use case for these so that they react to changes inink
and the<ink-a>
might have to be different? There could be something that is added that looks at the dom and toggles these on/off based on the state?<a is="ink-a">
, but that is not supported by Safari. 😞 (and because of that lit-element doesn't support it either). Update: This could be done by wrapping the<a>
in a custom component.ink-preview
format
so that you can define it once (right now this is set onbind
if it is defined in the spec).Outstanding Work
/src
into appropriate packagesSee #11