-
Notifications
You must be signed in to change notification settings - Fork 378
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
Template/part proposals - Naming for DOM Parts API #902
Comments
Drive by: |
Did you consider "marker" or "insertion point" or some such? |
point might be a good terminology to use here given we already have boundary points for Maybe mutation points or manipulation points? Perhaps replacement points? |
I like mutation points. Ties it right back to mutation observers and the mutation algorithms in general. |
Perhaps something like |
|
Maybe keep it short like WeakRef.: DOMRef |
|
I like the concept of |
Has this reached consensus? So the new names will be: interface Ref {...};
interface NodeRef : Ref {...};
interface AttributeRef : NodeRef {...};
interface ChildNodeRef : NodeRef {...};
interface PropertyRef : NodeRef {...};
interface CustomRef : NodeRef {...};
interface RefGroup {...}; Should a PR be raised to alter the proposed spec to reflect this? |
I don't think we've reached any consensus yet. I'm not certain that Ref is a good suffix here. We're not really referencing a node per se. It's really a reference to a specific location of DOM tree. |
Re: "binding," mentioned in the initial post: doesn't this typically refer to associating referenceable names with things, not anonymous representations? (e.g. "the name foo is bound in this scope") I can see how the concept might be generalized to "placeholder", but I think the name-association association is pretty strong for that word? Of those mentioned so far, "mutation point" seems strongest to me. I'd throw position out there as a candidate too, e.g. as DOMPosition. The advantage of "position" over "point" from my POV is that "point" might be too suggestive of absolute pixel coordinates as opposed to junctures in a DOM tree. |
To be clear, we don't want to use the prefix Building on points as @rniwa suggested in #902 (comment) still seems reasonable to me. |
mutation position seems okay and it's probably less confusing than point, which has much greater association with graphics like a point on a line, a plane, or in a 3D space. But |
So do we have consensus for the following? interface MutationPosition {...};
interface NodeMutationPosition : MutationPosition {...};
interface AttributeMutationPosition : NodeMutationPosition {...};
interface ChildNodeMutationPosition : NodeMutationPosition {...};
interface PropertyMutationPosition : NodeMutationPosition {...};
interface CustomMutationPosition : NodeMutationPosition {...};
interface MutationPositionGroup {...}; |
Field is conventional name used in printf, by @developit in htm as template literal part and in other places. interface Field {...};
interface NodeField : Field {...};
interface AttributeField : Field {...};
interface ChildNodeField : NodeField {...};
interface PropertyField : Field {...};
interface CustomField : Field {...};
interface FieldGroup {...}; Alternatives:
interface Param {...};
interface NodeParam : Param {...};
interface AttributeParam : Param {...};
interface ChildNodeParam : NodeParam {...};
interface PropertyParam : Param {...};
interface CustomParam : Param {...};
interface Params {...}; |
Not sure if what we're going for here is what makes since relative the DOM/API/Other spec or the end user. As an end user, personally, I'd expect words like "placeholder", "variable", "param", "prop". As mentioned above In VueJS particularly, based on context and the action being performed,
In Laravel's Blade, In order, I'd personally vote for : "interpolation", "placeholder", "binding". interpolationnoun
|
@VicGUTT you (and others in this thread) might be interested in https://w3ctag.github.io/design-principles/#naming-is-hard. |
Nice ressource and guidelines ! |
I believe my suggestions above ("interpolation", "placeholder", "binding") do not infringe the guideline.
Albeit // ...
interface NodeInterpolation : Interpolation {...};
interface AttributeInterpolation : Interpolation {...};
// ... So, "placeholder" and "binding" are left :) // ...
interface NodePlaceholder : Placeholder {...};
interface AttributePlaceholder : Placeholder {...};
// ... // ...
interface NodeBinding : Binding {...};
interface AttributeBinding : Binding {...};
// ... |
@VicGUTT, to me “placeholder” suggests something that appears (conceptually or presentationally) in place of something else which is absent, pending, or inapplicable. I don’t know for sure if most other folks also expect the word to refer to this, but existing APIs seem to: as used in OffscreenCanvas (placeholder canvases), HTML form elements (placeholder content attributes), and CSS pseudos corresponding to the last ( |
@bathos I agree with your point, although I had to "twist my brain" to get the semantical differences. But still, I believe "placeholder" to at least be the closest concept so far. Seeing Doing a quick reading throught the proposal again does present "placeholder" as not being too far-fetched:
Here I read: something that can be replaced by something else
Here I read: something that can be replaced somewhere
Here I read: "a unit" of something that can change That saidGoing throught the Ember.js and Angular examples provided in the proposal, a couple similarly defining terms have come up, namely: Other common and related terms:
Other common terms in the same realm:
FinallyIn my opinion, if we're going for something that represents the concept of:
Otherwise, I'd fall into using common terminology found in userland implementations. |
I’m unattached to any of what’s been suggested so far and agree none of em are perfect, but I’m afraid I would say this is by far the furthest from describing what it is. Where the others are too general to communicate what it means immediately, this communicates that it’s something else entirely. |
Could someone elaborate on the need to separate From "evolutionary architecture/design" prospective at this stage better to keep minimal/common interface and only when it appears to be needed, extend. No need so far? Drop it. Also if/when |
They need to be separate interfaces as they perform different operations on a node. AttributePart would represent an AttributeNode's value, and as such should always be a string. If you were to build this yourself it would likely use |
don't want to poke the bear here but it seemed initially strange that a location, point, or position could have multiple child nodes associated with it. it feels very singular without much contents but yea I guess this is highly subjective.
From the new ones in this thread Maybe something more in the lines of Range and Fragment. Just throwing out some ideas: edited (removed slices, frames, clusters, sets) favorite but naming colliding with CSS parts DOM parts interface ChildPart;
interface ChildNodePart;
interface AttrPart; alternatives DOM partials interface ChildPartial;
interface ChildNodePartial;
interface AttrPartial; DOM fields interface ChildField;
interface ChildNodeField;
interface AttrField; random ideas DOM segments interface ChildSegment;
interface AttrSegment; DOM blocks interface ChildBlock;
interface AttrBlock; |
@luwes I named it I don't think any name is going to be perfect here. I suspect the names that are generic enough to apply to to attributes, children, properties, etc; specific enough to refer to a place but not a specific Node; and short enough to be nice and convenient; will end up being very general and likely collide with other concepts: "part", "range", "point" and so on. If we did have to live with some potential collision with other concepts, I think "part" still has a lot going for it on other aspects. |
I guess the question there is whether the qualifying word describes the part’s own position or the nature of its possible content. If it’s the latter, ChildrenPart (or FragmentPart?) might be clearer, but if it’s the former, ChildPart is, I think: it is the only “part” whose position is that of “a child node”. AttrPart (as opposed to, say, AttrValuePart) seems to be named consistently with ChildPart in Lit’s API and I think this is sensible. Re random ideas: -1 for “frame” because it’s the userland/public API term for (something like) “browsing context” in many APIs (HTMLIFrameElement, client.frameType, window.frames, etc) but 👀 for “block” which, afaik, is “unused” [edit: found “CSSLayerBlockRule” but still, looks like low risk of ambiguity]. |
@bathos yes, I agree with frame. it's not a good fit, also reading it again now it sounds weirder. if there is a need to diverge from it does have a collision with the string templates concept of partials in Mustache, Handlebars etc. but not sure that is all bad. |
It occurred to me that we have another term that we used in lit-html around this concept: "marker". I'm not sure if that conveys the active nature of the API we're talking about. Would it make sense for a marker to have a value or to be updated (even though it stays int he same place)? In lit-html a marker is just what we use in the DOM to mark the location of a part. |
FAST uses "marker" terminology as well. We also use the term "placeholder". Other terms we use that are related include "behavior" and "directive". In FAST parlance:
|
WCCG had their spring F2F in which this was discussed. Present members of WCCG identified an action item to take the topic of DOM Parts and break it out into extended discussions. You can read the full notes of the discussion (#978 (comment)) in which this was discussed, heading entitled "DOM Parts API". As this issue pertains to DOM parts, I'd like to call out that #999 has been raised for extended discussions and this topic may be discussed during those sessions. |
In our virtual F2F breakout discussion for DOM Parts API, naming for the new APIs,
Part
, could cause confusion with CSS Shadow Parts.Current Proposal: DOM Parts
Naming alternatives to the
Parts API
:Location
can be an alternative toPart
since they point to locations in the DOM where mutation can happen.The API becomes:
binding
.Frameworks like Angular and Vue uses
binding
to mark a place in an element where application data is inserted.What do you guys think?
@EisenbergEffect @caridy @JanMiksovsky @rniwa @hober @justinfagnani @mfreed7
The text was updated successfully, but these errors were encountered: