Comments (4)
That doesn't seem very much profitable for now defining aspects in html: that is part of hyperspect, and in a way similar to custom elements, we can define them as
defineAspect('name', function (el) {})
$`<div name=${props}>
</div>`
quite weird that we pass props directly to aspect, but they're assigned to element. What about name clash etc?
h`<div ${el => {}}></div>` - that's fine and logical, aspect takes single element, but
h`<div ${el => {}}=${props}></div>` - here it's weird to assign props to element. In fact, that's not the same as h`<div x=${props}/>` - here `x` is assigned to element, which is fine, but with anonymous aspect there's no props. We could pass props as a second argument as
h`<div ${(el, props) => {}}=${props}></div>`, but that would break function convention and be just wrong. Better h`<div ${el => { /* You have props here anyways */ }}></div>`
from spect.
The question of adding content is relevant, see https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML.
There are 4 ways we may want to insert the html:
html('#el:beforebegin', code)
html('#el:afterbegin', code)
html('#el:beforeend', code)
html('#el:afterend', code)
but these aren't much useful for non-selector element, or that will be a shallow pseudo html(':beforebegin', code)
. In fact, these pseudos are redundant, it's enough to have just two: before and after. But - besides - that is too custom selector. Also - unclear how to order children.
Should be hooks-like well-established mechanism.
from spect.
! it must be as natural and full-featured as reducers. How?!
{a: 1, b: 2, c, children: {x}, parent, ...rest}
=== <a=1 b=2 c ...rest><x></a>
[{a}, {b}, {c}, ...rest]
=== <a><b><c><...rest>?
// rough doodle
state => {a: 1, ...state}
state => <a=1 ...state/>
[a, b, c] === <><a><b><c></>
<...rest>
is possible only for main-aspect elements to define spread of main reality aspect. But in fact that is <children=...elements>
-like. So.
What's the name of rest spread for html elements?
. Fragment === collection of elements. Array === collection of elements.
wrapping: <div><...></div>
prepending: <div/><...>
appending: <...><div>
That is INCREDIBLY elegant, very similar to react's fragment tag.
How to pick nodes from html by name / index?
// insert element by the placeholder like that.
<div><#abc><x><...></div>
OMG. That is rediscovery. HMTL reducers.
from spect.
Noble. Good.
from spect.
Related Issues (20)
- h: cache element by stack instead of creating anew HOT 1
- h: drop parser, use htm HOT 2
- v β f, v. Shaving off API, v as proxy HOT 6
- operators HOT 1
- 0b HOT 1
- v ~~as proxy~~ as observable HOT 1
- v: access multiarg values as [0], [1] etc. HOT 1
- $ β selector-collection HOT 2
- h: keyed. Why not morphing? HOT 3
- v(v0, v1, v2) - observables as args HOT 1
- $: pseudos? HOT 1
- h/$ - a nice way to convert data to template? HOT 2
- add Github Corner to spect.ly and fix typo HOT 2
- v23: animevents-only $ HOT 1
- 23.0: API reconsiderations, half-a-year later
- $: stop infinite recursion HOT 1
- $: first run flickers
- $(parent, β> childβ)
- h: lists; diff algo is underused. Possible syntax HOT 1
- spect@24 breaks integration tests with subscribable-things HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spect.