Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1263275
index.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
878 B
Referenced Files
None
Subscribers
None
index.ts
View Options
import
{
FlatTemplatable
,
tempstream
}
from
"tempstream"
;
import
{
Registry
}
from
"./registry"
;
export
*
from
"./component-arguments"
;
export
*
from
"./component"
;
export
*
from
"./registry"
;
export
type
JDDocument
=
Array
<
{
component_name
:
string
;
args
:
Record
<
string
,
unknown
>
;
}
>
;
export
interface
JDDContext
{
render_image
:
(
path_to_image
:
string
)
=>
FlatTemplatable
;
}
export
const
simpleJDDContext
:
JDDContext
=
{
render_image
:
(
path
)
=>
/* HTML */
`<img src="file://path" />`
,
};
export
function
render
(
registry
:
Registry
,
document
:
JDDocument
,
context
:
JDDContext
)
{
return
tempstream
`
${
document
.
map
(({
component_name
,
args
}
) => {
const component = registry.get(component_name);
if (!component) {
console.warn(
"Component not found in the registry: " + component_name
);
return "";
}
return component.toHTML(args, context);
})}`
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 16:50 (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
600601
Default Alt Text
index.ts (878 B)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment