Git Product home page Git Product logo

manawave's People

Contributors

github-actions[bot] avatar ryuuart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

manawave's Issues

Expose Cloned HTML to Hooks

There may be use cases where cloned HTML will need to be operated on by some external library or function. Other use cases also include support for event handling and other operations on the raw DOM. We can expose the raw HTML for selection, usage, or modification for folks who need to use libraries or other JavaScript to add customized behavior to the clones.

Add Item Status

Items have unique statuses defining events / triggers that occur over playback.

Separate render and logic in TickerItem

Right now, both are intermingled in TickerItem which really should be a common interface between both. What I propose is to create a RenderItem and LogicItem for the Item and extend off those base classes. This may change, but the overall goal is to be able to separate what should be logical or render operations.

For example, setting the style of a DOM Element, to me, counts as a render since it updates on the screen. A position that's tracked separately will then be used to update the style of the DOM element. This is a logical operation. The reason why we're being more explicit about this is because right now, updating position also clashes with trying to discern the logic of things.

We're basically trying to solve this problem.

Animate a TickerSystem

I have all the parts to build up a System now. It serves as an intersection point for different responsibilities that essentially animate and output the system.

CSS affects the slider itself

Users can create custom CSS on the slider and depending on if it's a flexbox or something, it'll break. We want to make sure that CSS can't leak and affect the behavior of the slider.

Playback

Allow fine grain control to slider like play and pause.

  • Play
  • Pause

Animation

Can't have a Billboard Ticker if it doesn't animate. An animation controller is necessary to animate TickerItem. It's important to note that animation only refers to the ability to animate given a TickerItem. The scope is only towards basic animations and nothing more like looping TickerItem or other advanced functionality.

Migrate to Vite

Why? Because it's unknown how Parcel interacts with other components that use Vite, and also because I personally feel it gives more control. Also, because WDIO uses Vite in their browser runner so to keep the codebase more concise and unified, going to move to Vite.

Start basic documentation

So folks can begin to use the library for their stuff.

Also to set up this repository on their system.

Remove a selection of TickerItems

Given an HTMLElement or id, remove the TickerItem. Also add the ability to remove a list of TickerElement too that should be in a separate function.

Add a way to decorate System

Right now, implementing System relies on coding specific yet repetitive logic to test the current state of playback and other stuff. It's pretty error-prone to rely on making sure each of those variables are manually guarded and implemented. Instead, we should bake or "decorate" this behavior in anything that needs it so if there are bugs, it's not distributed across all System.

Allow AnimationController to use systems

Typically in a physics simulation, you pass it time and deltaTime to advance the simulation and state. Our interactive / dynamic TickerSystem, while not a physics simulation, does rely on time to advance its state and behavior. We want to move from using AnimationObjects to a registration system. The AnimationController becomes a singleton which pools all update and draw calls in the render loop (this is more performant). The registration would register systems one-by-one. The render loop would then go through each system and apply relevant update and render (this sounds like what a queue would do) to progress state.

This would likely eliminate AnimationObject. I actually felt like it was parallelizing TickerItem regardless and confused what is responsible for what. This functionality would be replaced with #30.

We'd probably create a System superclass with relevant draw and update calls. TickerSystem would extend this base class.

AnimationController would turn into singleton, using static for most operations

Add playback control

Depends on #44 .
It should be possible to start, stop, play, and pause a given system or the whole AnimationController. It should be possible to define what happens for each operation in the System but also retain the logic and state provided by AnimationPlayer.

Layout a list of items

Given measurements, create a container of items that can be operated on. This is going to be used to store and contain TickerItem more logically. The naming and convention is more logically aligned with what is happening on the DOM.

Select TickerItems

Currently there's no way to retrieve and analyze a subset of TickerItem from the TickerSystem.

Migrate CSS to Vite CSS Modules

It seems that Vite supports CSS modules and that would be much better than the custom injection script that is run. Mostly because it would be unlikely that users use the same CSS class names.

Refactor

Currently, there's a lot of code smells and it's needed to reshape and organize the code.

Optimize resize

Right now, resize involves completely deinitializing and re-initializing the entire Billboard. This can
layer up fast, especially in nested Billboard situations. We should split from a complete hard reset, and only do work that is necessary during a resize. Right now, I see dimension measurement and adding new TickerItem to be the main issues here.

Refactor layoutGrid to take a GridOption

Basically, the only thing we're laying out and is unique to every element is its position. The dimensions are fixed and shared across all objects. That's why we instead move the width and height into a GridOption object.

No JS initialization

Right now, if you're not using a web-component, you need to use JS to initialize the Billboard. This breaks a layer of immersion and magic with just writing HTML to make marquees just work. You should only need to include the script tag and everything else should just follow. I'm suggesting adding in a data tag on the div to just make it work from the HTML.

There should also be a way to disable this behavior. We want this library to not create ANY side effects on the rest of the system. We want a Ticker to be just as self contained as the HTML version.

Allow slider destruction

There should be a way to turn on and off the slider without being destructive to its original elements.

There's also a difference between pausing, creating, and destroying.

Update Example Pages

The example pages are meant to test the Ticker naively outside the contexts of Tests and source code — as if we're using the library live in a bunch of contexts. Right now, these example pages are a bit stiff and unable to express this intention, so they need to be updated.

Test ClearContent clears everything

Test Base.clearContent should only clear the relevant content. If everything should be removed, there should be a method called "clearAll".

Implement safe off-screen render

Right now, dimensions are needed to position and layout TickerItem. It's currently done by adding the TickerItem directly into Ticker, appending it onto the DOM at some far off position(-9999, -9999). This makes sense, but will eventually turn into tech debt if there is a screen large enough to visualize the "far-off" position.

Add override hook

There should be a way to overlay and build on the default animation and position.

Add more properties on TickerItem

Right now, we only have position to query and observe the TickerSystem and its TickerItem. I'm proposing more properties like lifetime and timeCreated as another. This will let methods like TickerSystem.queryByCondition() to be more flexible.

Slider is not responsive

If there needs to be an update or refresh for any reason depending on dimensional changes, there's no mechanism to handle that change in state.

Add new TickerItems

Add functionality for TickerSystem to add a new TickerItem. It shouldn't be visible until loaded, and if Ticker is loaded, then it should directly be added into the Ticker. Also, should be able to add a list of TickerItems in a separate function.

Refactor concerns

Right now, we have one object that handles too much. We need to start splitting functionality and concerns to make sure our code is readable, predictable, and extensible.

Should pause offscreen

Performance is immediately an issue with these Tickers animating so many things at once. A good performance optimization is to only run updates only if a Ticker is in the viewport. This will need to IntersectionObserver be integrated into the TickerSystem. It basically should call the pause() function appropriately.

Optimize Measurement during Ticker Initialization

There is major layout thrashing during the initialization phase of the Ticker. We need to offset measurement to occur only during initialization or resize. Resize will likely be handled in another issue.

Elements in Template leaks state

This was revealed when you use a nested webcomponent Billboard. It seems that logic in that webcomponent is leaked to the rest of its cloned descendants. We need a way to ensure that when cloning occurs, state remains separate no matter if it's because Billboard webcomponents share state or some other library share state.

Graceful degradation

This has already been done in a previous rewrite, but now we need to do it again in this rewrite.

You should be able to return the Ticker to its original, unanimated state if desired.

refactor

Long story short, the code knotted itself so it's hard to go forwards. Rewrite time!

I realized… after trying to mess with the architecture some more, it might be not do-able. There is too little usability and configuration allowed by this architecture :/ I think it's going to need to go RIGHT BACK TO THE DRAWING BOARD… at least most of the logic is already done I guess… it's not exactly ideal if you must know.

I hate re-doing stuff like this, but there are several problems with my codebase.

  1. using builder to create more problems rather than solve one
  2. state introduces unnecessary overhead and again, doesn't serve a purpose but to just exist
  3. there is unncecessary data-flow causing the codebase to splinter and work against each other instead of a modular cohesive unit
  4. the codebase is inflexible, making a regression break things heavily
  5. new requirements were discovered while working on the codebase… I think I should've spent more time thinking about the various uses of this, not that I knew ahead of time lol

Responsiveness

Currently, when the window is resized, it breaks responsiveness. Resize operations should not affect the marquee, but it does. Since I plan on restarting this entire project over to use paths instead of a CSS dimension hack, this feature can be supported by either destroying the ticker and restarting it (maybe a debounce is required), or by recalculating and reinitializing the ticker.

Refactor onStart and onUpdate

These are currently very heavy and should compose of parts more. Even the code is more verbose, it's more important that responsibilities are separated.

Reset codebase

Right now, this will either be my 3rd, 4th or 5th rewrite of this code. This time, I know exactly where things are supposed to go, so it should go very smoothly this time. I have the MVP, I just need to move from inheritance to composition codebase. I'm doing mostly because I feel uncomfortable with slapping together a codebase and allowing it to be contributed on. There's a lot of noise in it, and I'd like to reduce that noise into a clear, concise voice. This final reset will be documented and properly unit tested.

Fix Webdriver PageObject Clear Functions

Right now, each test wipes out the document body, including webdriver's additional scripts and configuration. It may be preventing webdriver to work properly and hinders the debugging experience.

Accurate cloning

Right now, the cloned amount is hard-coded and should be declaratively reacted. For the first phase of this task, the focus should be on differing static widths. Likely multiple marquees of different lengths and elements of different sizes would need to be created and explored here.

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.