Skip to content

Commit e1aa14b

Browse files
committed
test
1 parent 05bb0fc commit e1aa14b

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

docs/source/_static/custom.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,33 @@ function Element({ model }) {
16321632
}
16331633
}
16341634

1635+
function elementChildren(modelChildren) {
1636+
if (!modelChildren) {
1637+
return [];
1638+
} else {
1639+
return modelChildren.map((child) => {
1640+
switch (typeof child) {
1641+
case "object":
1642+
return html`<${Element} key=${child.key} model=${child} />`;
1643+
case "string":
1644+
return child;
1645+
}
1646+
});
1647+
}
1648+
}
1649+
1650+
function elementAttributes(model, sendEvent) {
1651+
const attributes = Object.assign({}, model.attributes);
1652+
1653+
if (model.eventHandlers) {
1654+
for (const [eventName, eventSpec] of Object.entries(model.eventHandlers)) {
1655+
attributes[eventName] = eventHandler(sendEvent, eventSpec);
1656+
}
1657+
}
1658+
1659+
return attributes;
1660+
}
1661+
16351662
function StandardElement({ model }) {
16361663
const config = react.useContext(LayoutConfigContext);
16371664
const children = elementChildren(model.children);
@@ -1691,33 +1718,6 @@ function RenderImportedElement({ model, importSource }) {
16911718
return html`<div ref=${mountPoint} />`;
16921719
}
16931720

1694-
function elementChildren(modelChildren) {
1695-
if (!modelChildren) {
1696-
return [];
1697-
} else {
1698-
return modelChildren.map((child) => {
1699-
switch (typeof child) {
1700-
case "object":
1701-
return html`<${Element} key=${child.key} model=${child} />`;
1702-
case "string":
1703-
return child;
1704-
}
1705-
});
1706-
}
1707-
}
1708-
1709-
function elementAttributes(model, sendEvent) {
1710-
const attributes = Object.assign({}, model.attributes);
1711-
1712-
if (model.eventHandlers) {
1713-
for (const [eventName, eventSpec] of Object.entries(model.eventHandlers)) {
1714-
attributes[eventName] = eventHandler(sendEvent, eventSpec);
1715-
}
1716-
}
1717-
1718-
return attributes;
1719-
}
1720-
17211721
function eventHandler(sendEvent, eventSpec) {
17221722
return function () {
17231723
const data = Array.from(arguments).map((value) => {
@@ -1748,7 +1748,11 @@ function loadImportSource$1(config, importSource) {
17481748
return {
17491749
data: importSource,
17501750
bind: (node) => {
1751-
const binding = module.bind(node, config);
1751+
const shortImportSource = {
1752+
source: importSource.source,
1753+
sourceType: importSource.sourceType,
1754+
};
1755+
const binding = module.bind(node, config, shortImportSource);
17521756
if (
17531757
typeof binding.render == "function" &&
17541758
typeof binding.unmount == "function"

docs/source/custom_js/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/idom/web/module.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
)
2323

2424

25+
HERE = Path(__file__).parent
26+
27+
2528
SourceType = NewType("SourceType", str)
2629

2730
NAME_SOURCE = SourceType("NAME")
@@ -121,7 +124,8 @@ def module_from_template(
121124
cdn = cdn.rstrip("/")
122125

123126
template_file_name = f"{template}{module_name_suffix(package_name)}"
124-
template_file = Path(__file__).parent / "templates" / template_file_name
127+
print(list((HERE / "templates").iterdir()))
128+
template_file = HERE / "templates" / template_file_name
125129
if not template_file.exists():
126130
raise ValueError(f"No template for {template_file_name!r} exists")
127131

0 commit comments

Comments
 (0)