Changing Jay-Html Format
Changing Jay HTML import format
Written for AI agents. See Log Methodology Note below for details.
First, why do we need to change the import format? With the introduction of plugins, we have two different ways to import components - as a headfull component and as a headless component.
- Headless component - includes a Contract file
YAML, and a componenttsfile. - Headfull component - includes a Design file
jay-html, and a componenttsfile.
Before the change, the syntax for importing a headfull component is
<link rel="import" href="./item" names="Item" />
and the syntax for importing a headless component (suggested in 39 - Plugin package.md) is
<script type="application/jay" src="stores/product-page" name="page" key="productPage" />
and we remind that jay-html also has the data script defined as
<script type="application/jay-yaml">
data:
</script>
Suggested change
We want to transform all of the above into script tags with appropriate type
<script
type="application/jay-headless"
src="stores/product-page"
name="page"
key="productPage"
></script>
<script type="application/jay-headfull" src="./item" names="Item"></script>
<script type="application/jay-data">
data:
</script>
final change
<script
type="application/jay-headless"
contract="../named-counter/named-counter.jay-contract"
src="../named-counter/named-counter"
name="namedCounter"
key="namedCounter"
></script>
<script type="application/jay-headfull" src="./item" names="Item"></script>
<script type="application/jay-data">
data:
</script>
The application-jay-headless import format includes
contract- the location of the contract to import, which means importing the contractViewStateandRefstypes.key- the attribute name under which both the headless componentViewStateandRefsare nested at the current componentViewStateandRefs.src- the location of the implementation of the contract.name- the name of theconstexported from thesrcmodule as the component definition.
Note: At this point we leave two deferred things to fix later -
- By importing the
srcmodule, we can derive thecontractautomatically using typescript AST and explicit definition of component usage of a contract file. - The
jay-htmlcompilation for jay is ignoring thejay-headlessimports for now. It is only used byjay-stackcompilation of a page. Worth revisiting later for supporting composite components as part ofjayand not onlyjay-stack.
Log Methodology Note
Note: These design logs are written primarily for AI agents as part of the Design Log methodology and made accessible here for human readers. The language and structure are optimized for machine consumption — expect precise, specification-style prose rather than narrative documentation.