lpghatguy / armature Goto Github PK
View Code? Open in Web Editor NEWNot maintained! Check out React! -- ES2015 + decorator simple component model
License: MIT License
Not maintained! Check out React! -- ES2015 + decorator simple component model
License: MIT License
Right now, the tag name for a component is used as the unique identifier for the type of component. This is mostly okay for entirely custom components, but using existing tag names is a problem. I ran into this when building wrapper components for Armature for elements like input
and button
.
Back in the day, when Armature was called Circular and it was being inside of an existing application infrastructure, all state was mixed in with the components themselves.
Since then, component state has moved to being inside the $state
property and as such won't clash with the names of Armature. Methods are another deal altogether, but having method names differing with only a dollar sign would be confusing anyway, so I'm not too worried about that
It'd be nice to have events for when components are parented/unparented to hook into events.
Right now, $hydrate
is called on every call to $reify
. It's the only reasonable place to attach handlers to the root element.
Without keeping state in the component, there's no way to ensure that event listeners won't be doubly-attached to the root element of the component. That's no good!
Some elements don't have inner HTML, like img
and input
. I'd like them to be available to be root components still without unnecessarily setting their innerHTML
property.
Maybe this isn't actually a problem!
This would eliminate the need for a polyfill. object-assign
is also a very small module!
As it stands, the same method can create or retrieve a child component.
This is a cool trick in templating sans backing logic, but it complicates code where the creation and display of child components is isolated.
TypeScript 2.0 is going to introduce this
-typing. Components right now look like this:
const view = (component: Component) => `
view code
`;
With this new capability, a more consistent name (this
) could be used at the expense of using the longer function syntax:
function view(this: Component) {
return `
view code
`;
}
armature
is taken on npm, even though I really like the name!
Some possibilities:
Right now, static methods like $for
don't inherit the same helpful typing constraints as the default Component constructor because static methods can't reference class type constraints.
Additionally, $for
always returns an object of type Component
instead of this
because of microsoft/TypeScript#5863.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.