Git Product home page Git Product logo

Comments (3)

lifeart avatar lifeart commented on May 25, 2024

In general, we need a way to figure out is specific DOM node contain any modifiers or not, including some basic modifier metadata. I think we could look at modifierManager API. Here is how we may implement it:

type ModifierMetadata = {
   name: 'boka-toka',
   fileLocation: '/user/ember/app/modifiers/boka-toka.ts',
   args: { positional: unknown[], named: Record<string, unknown> }
}

globalThis.modifiersForNodes = new WeakMap<HTMLElement, ModifierMetadata>;

ModifierManager {
   installModifier(element: HTMLNode, modifierFunction, metadata) {
       globalThis.modifiersForNodes.add(element, metadata);
       return modifierFunction(metadata);
   }
}

Ember inspector part:

Once we resolve render tree, we had every components and it's children. Basically, we need to filter-out DOM nodes, belonging to each component. After we could patch existing render tree with component-like structure.

const modifierMeta = modifiersForNodes(node);

return {
  id: 'scj092s232e',
  args: modifierMeta.args,
  instance: null,
  name: modifierMeta.name,
  type: 'modifier',
  isInRemote: false,
  template: modifierMeta.fileLocation,
  children: [],
  bounds: {
    firstNode: node, lastNode: node, parentElement: node.parentElement
  }

}

as addition, we could expose HTMLElements with modifiers as type="node" and have modifiers as arguments on specific component type.

from ember-inspector.

Related Issues (20)

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.