Skip to content
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

The KUTE Execution Context (KEC) is not exported #125

Open
rob-smallshire opened this issue Oct 8, 2024 · 1 comment
Open

The KUTE Execution Context (KEC) is not exported #125

rob-smallshire opened this issue Oct 8, 2024 · 1 comment

Comments

@rob-smallshire
Copy link

I was not able to plug-in a new Component/Animation at run-time without building my own distribution because the Kute Execution Context (KEC) is not exported in the KUTE namespace. According to your own code and the example. onStart functions should register the property-updating function in the KEC, but for this to happen, the KEC needs to be available.

I worked around this by modifying your exported KUTE object to include KEC,

const KUTE = {
  Animation,
  Components,

  // Tween Interface
  Tween,
  fromTo,
  to,
  // Tween Collection
  TweenCollection,
  allFromTo,
  allTo,
  // Tween Interface

  Objects,
  Util,
  CubicBezier,
  Easing,
  Render,
  Interpolate: interpolate,
  Process,
  Internals: internals,
  Selector: selector,
  Version,
  KEC  // <<< ADDED.
};

export { KUTE as default };

and then qualified my references to KEC with KUTE in the definition of my onStart function for my component:

import KUTE from "./kute.mjs";

// ...

function onStartComponent(tweenProp, value) {
    if (!KUTE.KEC[tweenProp] && this.valuesEnd[tweenProp]) {
        KUTE.KEC[tweenProp] = (elem, a, b, v) => {
            const iParams = interpolateViewBox(a, b, v);
            elem.setAttribute('viewBox', joinViewBox(iParams));
        };
    }
}


const componentFunctions = {
    prepareStart: prepareComponentCurrentValue,
    prepareProperty: prepareComponentValue,
    onStart: onStartComponent
}

/ ...
@thednp
Copy link
Owner

thednp commented Oct 8, 2024

I haven't had the time to check on KUTE.js in the last couple of months, last time I was, it was a beginning of a Typescript rework, which had an unfortunate ending caused by loss of data. The KEC is attached to the Window object by one of the core functions, but I wonder, are you trying to integrate with some SSR framework?

I'm thinking of a full rework to easily integrate any framework and/or headless systems. I'm open to any suggestion!!
Thanks ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants