-
Notifications
You must be signed in to change notification settings - Fork 12
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
DCE and html modules imports #82
Comments
I believe it should be possible to import in a declarative manner in HTML (no JS) multiple components with a single statement. Also, I believe that relative links (src and href attributes) defined in custom element should link to resources relative to the custom element file, and not to the file that includes the custom element. For example, if in edit: I suggested |
DCE modular development & distributable libs - implementation notes. @mildred ,
true, if the tags would be the subject for export from the package/lib. Thinking aloud... For syntax similar to proposed by you <custom-element>
<custom-element src="lib#id1" tag="tag-1"></custom-element>
<tag-1></tag-1> ... <tag-1></tag-1>
</custom-element> would become <custom-element>
<custom-element src="lib#id1" ></custom-element> ... <custom-element src="lib#id1" ></custom-element>
</custom-element> which is obviously verbose, but would be even more verbose for inline defined DCE. The multiple imports meant to match the exported DCE (tags?) with locally used tags. Something like key-value pairs. <custom-element>
<import-tags src="lib" tag-1="lib-tag" tag-2="another-tag"></import-tags>
<!-- translated to -->
<custom-element tag="tag-1" src="lib#lib-tag" ></custom-element>
<custom-element tag="tag-2" src="lib#another-tag" ></custom-element>
</custom-element> have to think about the tag names as the subject for export. |
I was more thinking around the lines of defunct HTML imports where there would be a |
right, that is the concept which is materialized by But when it came to actual library development with multiple components just load external template into local tag is not sufficient. Besides, the import via |
This is a conversation teaser, would be implemented in @epa-wg/custom-element, as TypeScript plugin to render typings and IDE support, as NPM module build target.
Goals
Provide functional pairing to JS modules imports with import default, particular/list of DCE , DCE tags mapping to local context.
DCE exports compatible with imports by JS/TS code, DCE class as subject for export for further inheritance, use, registering tag, etc.
As DCE works only on markup level, import semantics would be in registering of imported CE class to locally scoped registry.
When DCE imported as a tag in HTML, it should have full support as a code source with ability to jump to definition, docs on tag and parameters( name, description, def value, doc links ), validation on allowed/prohibited, attributes, attributes value by type.
Syntax
parity with JS import:
CE JS:
import MyElement from "./my-element.js"
DCE from JS:
import MyElement from "./my-element.html"
DCE from DCE
CE from DCE
While JS import always expect the class as resolved module value, the DCE is
content-type
sensitive. If defined as attribute, it treates as a hint for build transformation.application/javascript
would resolve module as CE, others would be treated as DCE DOM sources (SVG, HTML, XSLT,...)CE JS:
import {Element1, Element2 } from "./my-element.js"
DCE from JS:
import {"id-1" as Element1, "id-2" as Element2} from "./my-element.html"
id is used for imported HTML as
tag
assumes to use registry, while import in JS does not use it.DCE from DCE
implementation notes
#id
defined.The text was updated successfully, but these errors were encountered: