@torpor/view 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/{ServerSlotRender-AWF3bD5B.d.cts → ServerSlotRender-t1sOutne.d.cts} +1 -1
- package/dist/{ServerSlotRender-AWF3bD5B.d.ts → ServerSlotRender-t1sOutne.d.ts} +1 -1
- package/dist/{chunk-GO2L324Q.js → chunk-T6JGCJ5T.js} +5 -2
- package/dist/chunk-T6JGCJ5T.js.map +1 -0
- package/dist/compile.cjs +42 -31
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.d.cts +1 -0
- package/dist/compile.d.ts +1 -0
- package/dist/compile.js +42 -31
- package/dist/compile.js.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/ssr.cjs +4 -1
- package/dist/ssr.cjs.map +1 -1
- package/dist/ssr.d.cts +2 -2
- package/dist/ssr.d.ts +2 -2
- package/dist/ssr.js +1 -1
- package/dist/ssr.js.map +1 -1
- package/package.json +6 -6
- package/scripts/buildTestOutput.ts +2 -121
- package/src/compile/build/client/buildAddFragment.ts +1 -1
- package/src/compile/build/client/buildAwaitNode.ts +1 -1
- package/src/compile/build/client/buildComponentNode.ts +1 -1
- package/src/compile/build/client/buildControlNode.ts +1 -1
- package/src/compile/build/client/buildElementNode.ts +7 -1
- package/src/compile/build/client/buildForNode.ts +1 -1
- package/src/compile/build/client/buildFragment.ts +1 -1
- package/src/compile/build/client/buildFragmentText.ts +7 -1
- package/src/compile/build/client/buildHeadNode.ts +1 -1
- package/src/compile/build/client/buildHtmlNode.ts +1 -1
- package/src/compile/build/client/buildIfNode.ts +1 -1
- package/src/compile/build/client/buildMount.ts +1 -1
- package/src/compile/build/client/buildNode.ts +1 -1
- package/src/compile/build/client/buildReplaceNode.ts +1 -1
- package/src/compile/build/client/buildRootNode.ts +1 -1
- package/src/compile/build/client/buildRun.ts +1 -1
- package/src/compile/build/client/buildScriptNode.ts +1 -1
- package/src/compile/build/client/buildSlotNode.ts +1 -1
- package/src/compile/build/client/buildSwitchNode.ts +1 -1
- package/src/compile/build/client/buildTextNode.ts +1 -1
- package/src/compile/build/client/replaceForVarNames.ts +1 -1
- package/src/compile/build/server/buildServerAwaitNode.ts +1 -1
- package/src/compile/build/server/buildServerComponentNode.ts +1 -1
- package/src/compile/build/server/buildServerControlNode.ts +1 -1
- package/src/compile/build/server/buildServerElementNode.ts +9 -1
- package/src/compile/build/server/buildServerForNode.ts +1 -1
- package/src/compile/build/server/buildServerHtmlNode.ts +1 -1
- package/src/compile/build/server/buildServerIfNode.ts +1 -1
- package/src/compile/build/server/buildServerNode.ts +5 -1
- package/src/compile/build/server/buildServerReplaceNode.ts +1 -1
- package/src/compile/build/server/buildServerRootNode.ts +5 -1
- package/src/compile/build/server/buildServerScriptNode.ts +1 -1
- package/src/compile/build/server/buildServerSlotNode.ts +1 -1
- package/src/compile/build/server/buildServerSpecialNode.ts +1 -1
- package/src/compile/build/server/buildServerSwitchNode.ts +1 -1
- package/src/compile/build/server/buildServerTextNode.ts +1 -1
- package/src/compile/build/utils/isFullyReactive.ts +1 -1
- package/src/compile/build/utils/isReactive.ts +1 -1
- package/src/compile/build/utils/isReactiveAttribute.ts +1 -1
- package/src/compile/parse/addSpaceElement.ts +4 -1
- package/src/compile/parse/parseCode.ts +4 -0
- package/src/compile/parse/parseControl.ts +4 -1
- package/src/compile/parse/parseImports.ts +1 -1
- package/src/compile/parse/parseMarkup.ts +1 -1
- package/src/compile/parse/parseStyles.ts +1 -1
- package/src/compile/parse/scopeStyles.ts +13 -21
- package/src/compile/parse/slottifyChildNodes.ts +1 -1
- package/src/compile/parse/utils/addError.ts +5 -1
- package/src/compile/parse/utils/consumeUntil.ts +1 -1
- package/src/compile/parse/utils/isAlphaNumeric.ts +1 -1
- package/src/compile/parse/utils/isAlphaNumericChar.ts +1 -1
- package/src/compile/parse/utils/isSpace.ts +1 -1
- package/src/compile/parse/utils/isSpaceChar.ts +1 -1
- package/src/compile/types/nodes/TemplateNode.ts +3 -0
- package/src/compile/utils/Builder.ts +3 -3
- package/src/compile/utils/trimEnd.ts +1 -1
- package/src/compile/utils/trimMatched.ts +1 -1
- package/src/compile/utils/trimQuotes.ts +1 -1
- package/src/compile/utils/trimStart.ts +1 -1
- package/src/compile/utils/trimStartAndEnd.ts +1 -1
- package/src/compile/utils/voidTags.ts +1 -1
- package/src/debug/printHtml.ts +1 -1
- package/src/motion/animate.ts +1 -1
- package/src/render/$mount.ts +1 -1
- package/src/render/$run.ts +1 -1
- package/src/render/$serverMount.ts +1 -1
- package/src/render/$serverRun.ts +1 -1
- package/src/render/$stream.ts +1 -1
- package/src/render/addAnimation.ts +1 -1
- package/src/render/addEvent.ts +1 -1
- package/src/render/addFragment.ts +1 -1
- package/src/render/applyProps.ts +1 -1
- package/src/render/clearRange.ts +1 -1
- package/src/render/createComment.ts +1 -1
- package/src/render/createElement.ts +1 -1
- package/src/render/createFragment.ts +1 -1
- package/src/render/createText.ts +1 -1
- package/src/render/flushMountEffects.ts +1 -1
- package/src/render/getClasses.ts +4 -1
- package/src/render/hydrate.ts +1 -1
- package/src/render/hydrateRoot.ts +1 -1
- package/src/render/mount.ts +1 -1
- package/src/render/moveRange.ts +1 -1
- package/src/render/popRange.ts +1 -1
- package/src/render/runControl.ts +1 -1
- package/src/render/runControlBranch.ts +1 -1
- package/src/render/runList.ts +1 -1
- package/src/render/runListItems.ts +1 -1
- package/src/render/setAttribute.ts +1 -1
- package/src/render/setDynamicElement.ts +1 -1
- package/src/watch/proxyGet.ts +1 -1
- package/src/watch/removeEffect.ts +1 -1
- package/src/watch/runEffect.ts +1 -1
- package/src/watch/symbols.ts +1 -1
- package/src/watch/trackEffect.ts +1 -1
- package/src/watch/transferEffects.ts +1 -1
- package/src/watch/triggerEffects.ts +1 -1
- package/test/bench/components/output/Bench-client.ts +0 -204
- package/test/bench/components/output/Bench-server.ts +0 -130
- package/test/bench/components/temp/Bench-client-5fee290225ae4771aa847360006123671e8f17f1.ts +208 -0
- package/test/bench/components/temp/Bench-server-00cefa588803c01ca4f2741c595e4f045cdd101e.ts +130 -0
- package/test/build-server/components/{output/IfNested-client.ts → temp/IfNested-client-979db97eea5b4595550b9b46f297f3fbc31796d2.ts} +11 -0
- package/test/buildHtml.ts +1 -1
- package/test/buildOutputFiles.ts +47 -12
- package/test/class/class.test.ts +29 -6
- package/test/class/components/Class.torp +15 -1
- package/test/class/components/output/Class-client.ts +10 -6
- package/test/class/components/output/Class-server.ts +1 -1
- package/test/class/components/temp/{Class-client-600bf865c14f1052d24e1c79242f837aaf5ae5e8.ts → Class-client-8c3f9e0257cc2b687e9bb7106cccbab94a4b5adf.ts} +10 -6
- package/test/class/components/temp/Class-server-2218c3284845fdab80d1a41ebace9a9e2ddd6fc1.ts +17 -0
- package/test/component/components/temp/Header-client-ac151eea86e3f6b058fab101661e13ae73864968.ts +34 -0
- package/test/component/components/temp/Header-server-4f10f2332f3ca7a097517cfb938ab1e6f31d68ac.ts +17 -0
- package/test/console/components/temp/{Console-client-254d7d4799471401334d698b1631ab1cb5b70558.ts → Console-client-2f206752ce59e59fba9bb91263b4102fd515951e.ts} +1 -1
- package/test/console/components/temp/Console-server-b4b15f7a0d1d2b50d87bad4870e1b8d368707c04.ts +17 -0
- package/test/globalSetup.ts +1 -1
- package/test/helpers.ts +6 -2
- package/test/hydrateComponent.ts +1 -1
- package/test/importComponent.ts +12 -40
- package/test/mountComponent.ts +5 -1
- package/test/party/components/temp/AnswerButton-client-243454cd7bf84c648f244b3587e60d01a0401039.ts +33 -0
- package/test/party/components/temp/AnswerButton-server-938e46c1d2510ea37454854ef527e4aa64eb8e52.ts +16 -0
- package/test/party/components/temp/FunnyButton-client-2e6bec8259065b5bc9ae16d1ca93dd1bd0c56b7c.ts +40 -0
- package/test/party/components/temp/FunnyButton-server-e8ab55e47c735f7e42c55d2b7504dfa4190a1b40.ts +32 -0
- package/test/party/components/temp/Time-client-7ba4ca9322af2cb88a873c812fc776760c337c64.ts +47 -0
- package/test/party/components/temp/Time-server-08f66c7f3f32b13de06d75fe679cf58b5727c473.ts +31 -0
- package/test/party/components/temp/UserProfile-client-938bcef20a2555de22aca939022a32742ac5e729.ts +51 -0
- package/test/party/components/temp/UserProfile-server-9df5c59b8797fa67c479bc76450104d45e6076f9.ts +22 -0
- package/test/party/components/temp/UserProfileContext-client-93211cdba795b8baf926f60f5b17da90701743b3.ts +44 -0
- package/test/party/components/temp/UserProfileContext-server-cf58767df1e2d1dde919f59de73cdd9764bbc006.ts +20 -0
- package/test/slots/components/temp/Article-client-741f94eab2e96655f4c9d69ccd7d9c7cc998f4ce.ts +41 -0
- package/test/slots/components/temp/Article-server-a6bd47a621cc213db4313eb775a52246541dd203.ts +28 -0
- package/test/slots/components/temp/Header-client-e2e1e7d60b48b0841cd0c20224f520330ca96458.ts +38 -0
- package/test/slots/components/temp/Header-server-1c195508a91c32822da22a08576c8a30c9070636.ts +22 -0
- package/test/slots/components/temp/List-client-0659d999cfb48b865fe5b8aaaf2a4ddac3a8a8b6.ts +76 -0
- package/test/slots/components/temp/List-server-4b76485a259d054187edad8aa691d80ac918ad86.ts +25 -0
- package/test/special-component/components/temp/BigTitle-client-881a9f84876fb3f6d994736edb253b96e71de926.ts +32 -0
- package/test/special-component/components/temp/BigTitle-server-9efc738f5eb131a4b859c4a99a8e255d93834e9a.ts +20 -0
- package/test/special-component/components/temp/SmallTitle-client-25b3097b7ae47848dd82967403faf7745fc43388.ts +32 -0
- package/test/special-component/components/temp/SmallTitle-server-fc105db9a91b83644d67e049ce583a3d1a61f50c.ts +20 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +7 -2
- package/vitest.config.ts +2 -2
- package/dist/chunk-GO2L324Q.js.map +0 -1
- package/test/bench/components/temp/Bench-client-3efcd3b6c03c7a51368df3b8b1bdf2e7fa722432.ts +0 -126
- package/test/build-server/components/IfNested.d.ts +0 -18
- package/test/class/components/temp/Class-server-082505b03612c762384ffff329472db3f55b8097.ts +0 -17
- /package/test/build-server/components/{output/IfNested-server.ts → temp/IfNested-server-3c4e4b6f2162c0906cef685830219b9ea9ee985c.ts} +0 -0
package/test/importComponent.ts
CHANGED
|
@@ -1,47 +1,19 @@
|
|
|
1
|
-
import fg from "fast-glob";
|
|
2
|
-
import crypto from "node:crypto";
|
|
3
1
|
import fs from "node:fs";
|
|
4
2
|
import path from "node:path";
|
|
3
|
+
import { buildFiles } from "./buildOutputFiles";
|
|
5
4
|
|
|
6
|
-
export default async function importComponent(componentPath: string, suffix: string) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
path.join(path.dirname(componentPath), "output", path.basename(componentPath)) +
|
|
10
|
-
`-${suffix}.ts`;
|
|
11
|
-
const hash = await hashFileContents(sourceFile);
|
|
12
|
-
const destPath = path.join(path.dirname(componentPath), "temp");
|
|
13
|
-
const destFile = path.join(destPath, `${path.basename(componentPath)}-${suffix}-${hash}.ts`);
|
|
14
|
-
if (!fs.existsSync(destFile)) {
|
|
15
|
-
//console.log(`${sourceFile} has changed, copying new version`);
|
|
5
|
+
export default async function importComponent(componentPath: string, suffix: string): Promise<any> {
|
|
6
|
+
if (!componentPath.endsWith(".torp")) componentPath += ".torp";
|
|
7
|
+
await buildFiles(componentPath);
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
await fg(`${path.basename(componentPath)}-${suffix}-*.ts`, {
|
|
24
|
-
absolute: true,
|
|
25
|
-
cwd: path.resolve(destPath),
|
|
26
|
-
})
|
|
27
|
-
).forEach((f) => fs.unlinkSync(f));
|
|
28
|
-
|
|
29
|
-
//fs.copyFileSync(sourceFile, destFile);
|
|
30
|
-
const source = fs
|
|
31
|
-
.readFileSync(sourceFile, "utf8")
|
|
32
|
-
.replaceAll(/import (.+?) from ['"]\.\/(.+?)['"]/g, 'import $1 from "../output/$2"');
|
|
33
|
-
fs.writeFileSync(destFile, source);
|
|
9
|
+
const destFolder = path.join(path.dirname(componentPath), "temp");
|
|
10
|
+
let destFile = fs
|
|
11
|
+
.readdirSync(destFolder)
|
|
12
|
+
.find((f) => f.startsWith(`${path.basename(componentPath, ".torp")}-${suffix}-`));
|
|
13
|
+
if (!destFile) {
|
|
14
|
+
throw new Error("Component file not found");
|
|
34
15
|
}
|
|
35
|
-
|
|
36
|
-
}
|
|
16
|
+
destFile = path.join(destFolder, destFile);
|
|
37
17
|
|
|
38
|
-
|
|
39
|
-
function hashFileContents(path: string): Promise<string> {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
const hash = crypto.createHash("sha1");
|
|
42
|
-
const stream = fs.createReadStream(path);
|
|
43
|
-
stream.on("error", (err) => reject(err));
|
|
44
|
-
stream.on("data", (chunk) => hash.update(chunk));
|
|
45
|
-
stream.on("end", () => resolve(hash.digest("hex")));
|
|
46
|
-
});
|
|
18
|
+
return (await import(destFile)).default;
|
|
47
19
|
}
|
package/test/mountComponent.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import mount from "../src/render/mount";
|
|
2
2
|
import { type Component } from "../src/types/Component";
|
|
3
3
|
|
|
4
|
-
export default function mountComponent(
|
|
4
|
+
export default function mountComponent(
|
|
5
|
+
container: HTMLElement,
|
|
6
|
+
component: Component,
|
|
7
|
+
state?: any,
|
|
8
|
+
): void {
|
|
5
9
|
container.ownerDocument.body.appendChild(container);
|
|
6
10
|
mount(container, component, state);
|
|
7
11
|
}
|
package/test/party/components/temp/AnswerButton-client-243454cd7bf84c648f244b3587e60d01a0401039.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
2
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
3
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
4
|
+
import t_event from "../../../../src/render/addEvent";
|
|
5
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
6
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
7
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
8
|
+
|
|
9
|
+
export default function AnswerButton(
|
|
10
|
+
$parent: ParentNode,
|
|
11
|
+
$anchor: Node | null,
|
|
12
|
+
$props: any,
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
$context?: Record<PropertyKey, any>,
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
$slots?: Record<string, SlotRender>
|
|
17
|
+
) {
|
|
18
|
+
$props ??= {};
|
|
19
|
+
|
|
20
|
+
/* User interface */
|
|
21
|
+
const t_fragments: DocumentFragment[] = [];
|
|
22
|
+
|
|
23
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<div> <button>YES</button> <button>NO</button> </div>`);
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const t_div_1 = t_root(t_fragment_0) as HTMLDivElement;
|
|
26
|
+
const t_button_1 = t_next(t_child(t_div_1)) as HTMLElement;
|
|
27
|
+
const t_button_2 = t_next(t_next(t_button_1)) as HTMLElement;
|
|
28
|
+
t_event(t_button_1, "click", $props.onYes);
|
|
29
|
+
t_event(t_button_2, "click", $props.onNo);
|
|
30
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
31
|
+
t_next(t_div_1);
|
|
32
|
+
|
|
33
|
+
}
|
package/test/party/components/temp/AnswerButton-server-938e46c1d2510ea37454854ef527e4aa64eb8e52.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
|
|
3
|
+
export default function AnswerButton(
|
|
4
|
+
$props: any,
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
$context?: Record<PropertyKey, any>,
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
$slots?: Record<string, ServerSlotRender>
|
|
9
|
+
) {
|
|
10
|
+
|
|
11
|
+
/* User interface */
|
|
12
|
+
let $output = "";
|
|
13
|
+
$output += `<div> <button>YES</button> <button>NO</button> </div>`;
|
|
14
|
+
|
|
15
|
+
return $output;
|
|
16
|
+
}
|
package/test/party/components/temp/FunnyButton-client-2e6bec8259065b5bc9ae16d1ca93dd1bd0c56b7c.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
2
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
3
|
+
import t_anchor from "../../../../src/render/nodeAnchor";
|
|
4
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
5
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
6
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
7
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
8
|
+
|
|
9
|
+
export default function FunnyButton(
|
|
10
|
+
$parent: ParentNode,
|
|
11
|
+
$anchor: Node | null,
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
$props?: Record<PropertyKey, any>,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
$context?: Record<PropertyKey, any>,
|
|
16
|
+
$slots?: Record<string, SlotRender>
|
|
17
|
+
) {
|
|
18
|
+
|
|
19
|
+
/* User interface */
|
|
20
|
+
const t_fragments: DocumentFragment[] = [];
|
|
21
|
+
|
|
22
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<button style=" background: rgba(0, 0, 0, 0.4); color: #fff; padding: 10px 20px; font-size: 30px; border: 2px solid #fff; margin: 8px; transform: scale(0.9); box-shadow: 4px 4px rgba(0, 0, 0, 0.4); transition: transform 0.2s cubic-bezier(0.34, 1.65, 0.88, 0.925) 0s; outline: 0; "> <!> </button>`);
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const t_button_1 = t_root(t_fragment_0) as HTMLElement;
|
|
25
|
+
const t_slot_anchor_1 = t_anchor(t_next(t_child(t_button_1))) as HTMLElement;
|
|
26
|
+
if ($slots && $slots["_"]) {
|
|
27
|
+
$slots["_"](t_button_1, t_slot_anchor_1, undefined, $context)
|
|
28
|
+
} else {
|
|
29
|
+
const t_fragment_1 = t_fragment($parent.ownerDocument!, t_fragments, 1, ` <span>No content found</span> `);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const t_root_1 = t_root(t_fragment_1);
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
const t_text_1 = t_next(t_next(t_root_1));
|
|
34
|
+
t_add_fragment(t_fragment_1, t_button_1, t_slot_anchor_1);
|
|
35
|
+
t_next(t_text_1);
|
|
36
|
+
}
|
|
37
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
38
|
+
t_next(t_button_1);
|
|
39
|
+
|
|
40
|
+
}
|
package/test/party/components/temp/FunnyButton-server-e8ab55e47c735f7e42c55d2b7504dfa4190a1b40.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
|
|
3
|
+
export default function FunnyButton(
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
$props?: Record<PropertyKey, any>,
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
$context?: Record<PropertyKey, any>,
|
|
8
|
+
$slots?: Record<string, ServerSlotRender>
|
|
9
|
+
) {
|
|
10
|
+
|
|
11
|
+
/* User interface */
|
|
12
|
+
let $output = "";
|
|
13
|
+
$output += `<button style="
|
|
14
|
+
background: rgba(0, 0, 0, 0.4);
|
|
15
|
+
color: #fff;
|
|
16
|
+
padding: 10px 20px;
|
|
17
|
+
font-size: 30px;
|
|
18
|
+
border: 2px solid #fff;
|
|
19
|
+
margin: 8px; transform: scale(0.9);
|
|
20
|
+
box-shadow: 4px 4px rgba(0, 0, 0, 0.4);
|
|
21
|
+
transition: transform 0.2s cubic-bezier(0.34, 1.65, 0.88, 0.925) 0s;
|
|
22
|
+
outline: 0;
|
|
23
|
+
"> <![>`;
|
|
24
|
+
if ($slots && $slots["_"]) {
|
|
25
|
+
$output += $slots["_"](undefined, $context);
|
|
26
|
+
} else {
|
|
27
|
+
$output += ` <span>No content found</span> `;
|
|
28
|
+
}
|
|
29
|
+
$output += `<!]><!> </button>`;
|
|
30
|
+
|
|
31
|
+
return $output;
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import $run from "../../../../src/render/$run";
|
|
2
|
+
import $watch from "../../../../src/render/$watch";
|
|
3
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
4
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
5
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
6
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
7
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
8
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
9
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
10
|
+
|
|
11
|
+
export default function Time(
|
|
12
|
+
$parent: ParentNode,
|
|
13
|
+
$anchor: Node | null,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
$props?: Record<PropertyKey, any>,
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
$context?: Record<PropertyKey, any>,
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
$slots?: Record<string, SlotRender>
|
|
20
|
+
) {
|
|
21
|
+
|
|
22
|
+
let $state = $watch({
|
|
23
|
+
time: new Date().toLocaleTimeString()
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
$run(() => {
|
|
27
|
+
const timer = setInterval(() => {
|
|
28
|
+
$state.time = new Date().toLocaleTimeString();
|
|
29
|
+
}, 1000);
|
|
30
|
+
|
|
31
|
+
return () => clearInterval(timer);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/* User interface */
|
|
35
|
+
const t_fragments: DocumentFragment[] = [];
|
|
36
|
+
|
|
37
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<p>#</p>`);
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
const t_p_1 = t_root(t_fragment_0) as HTMLElement;
|
|
40
|
+
const t_text_1 = t_child(t_p_1);
|
|
41
|
+
$run(function setTextContent() {
|
|
42
|
+
t_text_1.textContent = `Current time: ${t_fmt($state.time)}`;
|
|
43
|
+
});
|
|
44
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
45
|
+
t_next(t_p_1);
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import $run from "../../../../src/render/$serverRun";
|
|
2
|
+
import $watch from "../../../../src/render/$serverWatch";
|
|
3
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
4
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
5
|
+
|
|
6
|
+
export default function Time(
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
$props?: Record<PropertyKey, any>,
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
$context?: Record<PropertyKey, any>,
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
$slots?: Record<string, ServerSlotRender>
|
|
13
|
+
) {
|
|
14
|
+
let $state = $watch({
|
|
15
|
+
time: new Date().toLocaleTimeString()
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
$run(() => {
|
|
19
|
+
const timer = setInterval(() => {
|
|
20
|
+
$state.time = new Date().toLocaleTimeString();
|
|
21
|
+
}, 1000);
|
|
22
|
+
|
|
23
|
+
return () => clearInterval(timer);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/* User interface */
|
|
27
|
+
let $output = "";
|
|
28
|
+
$output += `<p>Current time: ${t_fmt($state.time)}</p>`;
|
|
29
|
+
|
|
30
|
+
return $output;
|
|
31
|
+
}
|
package/test/party/components/temp/UserProfile-client-938bcef20a2555de22aca939022a32742ac5e729.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import $run from "../../../../src/render/$run";
|
|
2
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
3
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
4
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
5
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
6
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
7
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
8
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
9
|
+
|
|
10
|
+
export default function UserProfile(
|
|
11
|
+
$parent: ParentNode,
|
|
12
|
+
$anchor: Node | null,
|
|
13
|
+
$props: {
|
|
14
|
+
name: string,
|
|
15
|
+
age: number,
|
|
16
|
+
favoriteColors: string[],
|
|
17
|
+
isAvailable: boolean
|
|
18
|
+
},
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
$context?: Record<PropertyKey, any>,
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
$slots?: Record<string, SlotRender>
|
|
23
|
+
) {
|
|
24
|
+
$props ??= {};
|
|
25
|
+
|
|
26
|
+
/* User interface */
|
|
27
|
+
const t_fragments: DocumentFragment[] = [];
|
|
28
|
+
|
|
29
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<div> <p>#</p> <p>#</p> <p>#</p> <p>#</p> </div>`);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const t_div_1 = t_root(t_fragment_0) as HTMLDivElement;
|
|
32
|
+
const t_text_1 = t_child(t_next(t_child(t_div_1)));
|
|
33
|
+
const t_text_2 = t_child(t_next(t_next(t_next(t_child(t_div_1)))));
|
|
34
|
+
const t_text_3 = t_child(t_next(t_next(t_next(t_next(t_next(t_child(t_div_1)))))));
|
|
35
|
+
const t_text_4 = t_child(t_next(t_next(t_next(t_next(t_next(t_next(t_next(t_child(t_div_1)))))))));
|
|
36
|
+
$run(function setTextContent() {
|
|
37
|
+
t_text_1.textContent = `My name is ${t_fmt($props.name)}!`;
|
|
38
|
+
});
|
|
39
|
+
$run(function setTextContent() {
|
|
40
|
+
t_text_2.textContent = `My age is ${t_fmt($props.age)}!`;
|
|
41
|
+
});
|
|
42
|
+
$run(function setTextContent() {
|
|
43
|
+
t_text_3.textContent = `My favourite colors are ${t_fmt($props.favouriteColors.join(", "))}!`;
|
|
44
|
+
});
|
|
45
|
+
$run(function setTextContent() {
|
|
46
|
+
t_text_4.textContent = `I am ${t_fmt($props.isAvailable ? "available" : "not available")}`;
|
|
47
|
+
});
|
|
48
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
49
|
+
t_next(t_div_1);
|
|
50
|
+
|
|
51
|
+
}
|
package/test/party/components/temp/UserProfile-server-9df5c59b8797fa67c479bc76450104d45e6076f9.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
3
|
+
|
|
4
|
+
export default function UserProfile(
|
|
5
|
+
$props: {
|
|
6
|
+
name: string,
|
|
7
|
+
age: number,
|
|
8
|
+
favoriteColors: string[],
|
|
9
|
+
isAvailable: boolean
|
|
10
|
+
},
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
$context?: Record<PropertyKey, any>,
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
$slots?: Record<string, ServerSlotRender>
|
|
15
|
+
) {
|
|
16
|
+
|
|
17
|
+
/* User interface */
|
|
18
|
+
let $output = "";
|
|
19
|
+
$output += `<div> <p>My name is ${t_fmt($props.name)}!</p> <p>My age is ${t_fmt($props.age)}!</p> <p>My favourite colors are ${t_fmt($props.favouriteColors.join(", "))}!</p> <p>I am ${t_fmt($props.isAvailable ? "available" : "not available")}</p> </div>`;
|
|
20
|
+
|
|
21
|
+
return $output;
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import $run from "../../../../src/render/$run";
|
|
2
|
+
import $watch from "../../../../src/render/$watch";
|
|
3
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
4
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
5
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
6
|
+
import t_event from "../../../../src/render/addEvent";
|
|
7
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
8
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
9
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
10
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
11
|
+
|
|
12
|
+
export default function UserProfileContext(
|
|
13
|
+
$parent: ParentNode,
|
|
14
|
+
$anchor: Node | null,
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
$props?: Record<PropertyKey, any>,
|
|
17
|
+
$context?: Record<PropertyKey, any>,
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
$slots?: Record<string, SlotRender>
|
|
20
|
+
) {
|
|
21
|
+
$context = Object.assign({}, $context);
|
|
22
|
+
|
|
23
|
+
$context.user = $watch($context.user);
|
|
24
|
+
|
|
25
|
+
/* User interface */
|
|
26
|
+
const t_fragments: DocumentFragment[] = [];
|
|
27
|
+
|
|
28
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<div> <h2>My Profile</h2> <p>#</p> <p>#</p> <button> Update username to Jane </button> </div>`);
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
const t_div_1 = t_root(t_fragment_0) as HTMLDivElement;
|
|
31
|
+
const t_text_1 = t_child(t_next(t_next(t_next(t_child(t_div_1)))));
|
|
32
|
+
const t_text_2 = t_child(t_next(t_next(t_next(t_next(t_next(t_child(t_div_1)))))));
|
|
33
|
+
const t_button_1 = t_next(t_next(t_next(t_next(t_next(t_next(t_next(t_child(t_div_1)))))))) as HTMLElement;
|
|
34
|
+
$run(function setTextContent() {
|
|
35
|
+
t_text_1.textContent = `Username: ${t_fmt($context.user.username)}`;
|
|
36
|
+
});
|
|
37
|
+
$run(function setTextContent() {
|
|
38
|
+
t_text_2.textContent = `Email: ${t_fmt($context.user.email)}`;
|
|
39
|
+
});
|
|
40
|
+
t_event(t_button_1, "click", () => ($context.user.username = "Jane"));
|
|
41
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
42
|
+
t_next(t_div_1);
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import $watch from "../../../../src/render/$serverWatch";
|
|
2
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
3
|
+
import t_fmt from "../../../../src/render/formatText";
|
|
4
|
+
|
|
5
|
+
export default function UserProfileContext(
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
$props?: Record<PropertyKey, any>,
|
|
8
|
+
$context?: Record<PropertyKey, any>,
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
$slots?: Record<string, ServerSlotRender>
|
|
11
|
+
) {
|
|
12
|
+
$context = Object.assign({}, $context);
|
|
13
|
+
$context.user = $watch($context.user);
|
|
14
|
+
|
|
15
|
+
/* User interface */
|
|
16
|
+
let $output = "";
|
|
17
|
+
$output += `<div> <h2>My Profile</h2> <p>Username: ${t_fmt($context.user.username)}</p> <p>Email: ${t_fmt($context.user.email)}</p> <button> Update username to Jane </button> </div>`;
|
|
18
|
+
|
|
19
|
+
return $output;
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
2
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
3
|
+
import t_anchor from "../../../../src/render/nodeAnchor";
|
|
4
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
5
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
6
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
7
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
8
|
+
|
|
9
|
+
export default function Article(
|
|
10
|
+
$parent: ParentNode,
|
|
11
|
+
$anchor: Node | null,
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
$props?: Record<PropertyKey, any>,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
$context?: Record<PropertyKey, any>,
|
|
16
|
+
$slots?: Record<string, SlotRender>
|
|
17
|
+
) {
|
|
18
|
+
|
|
19
|
+
/* User interface */
|
|
20
|
+
const t_fragments: DocumentFragment[] = [];
|
|
21
|
+
|
|
22
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<section> <h2> <!> </h2> <!> <!> </section>`);
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const t_section_1 = t_root(t_fragment_0) as HTMLElement;
|
|
25
|
+
const t_slot_parent_1 = t_next(t_child(t_section_1)) as HTMLElement;
|
|
26
|
+
const t_slot_anchor_1 = t_anchor(t_next(t_child(t_slot_parent_1))) as HTMLElement;
|
|
27
|
+
if ($slots && $slots["header"]) {
|
|
28
|
+
$slots["header"](t_slot_parent_1, t_slot_anchor_1, undefined, $context)
|
|
29
|
+
}
|
|
30
|
+
const t_slot_anchor_2 = t_anchor(t_next(t_next(t_slot_parent_1))) as HTMLElement;
|
|
31
|
+
if ($slots && $slots["_"]) {
|
|
32
|
+
$slots["_"](t_section_1, t_slot_anchor_2, undefined, $context)
|
|
33
|
+
}
|
|
34
|
+
const t_slot_anchor_3 = t_anchor(t_next(t_next(t_slot_anchor_2))) as HTMLElement;
|
|
35
|
+
if ($slots && $slots["footer"]) {
|
|
36
|
+
$slots["footer"](t_section_1, t_slot_anchor_3, undefined, $context)
|
|
37
|
+
}
|
|
38
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
39
|
+
t_next(t_section_1);
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
|
|
3
|
+
export default function Article(
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
$props?: Record<PropertyKey, any>,
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
$context?: Record<PropertyKey, any>,
|
|
8
|
+
$slots?: Record<string, ServerSlotRender>
|
|
9
|
+
) {
|
|
10
|
+
|
|
11
|
+
/* User interface */
|
|
12
|
+
let $output = "";
|
|
13
|
+
$output += `<section> <h2> <![>`;
|
|
14
|
+
if ($slots && $slots["header"]) {
|
|
15
|
+
$output += $slots["header"](undefined, $context);
|
|
16
|
+
}
|
|
17
|
+
$output += `<!]><!> </h2> <![>`;
|
|
18
|
+
if ($slots && $slots["_"]) {
|
|
19
|
+
$output += $slots["_"](undefined, $context);
|
|
20
|
+
}
|
|
21
|
+
$output += `<!]><!> <![>`;
|
|
22
|
+
if ($slots && $slots["footer"]) {
|
|
23
|
+
$output += $slots["footer"](undefined, $context);
|
|
24
|
+
}
|
|
25
|
+
$output += `<!]><!> </section>`;
|
|
26
|
+
|
|
27
|
+
return $output;
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
2
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
3
|
+
import t_anchor from "../../../../src/render/nodeAnchor";
|
|
4
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
5
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
6
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
7
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
8
|
+
|
|
9
|
+
export default function Header(
|
|
10
|
+
$parent: ParentNode,
|
|
11
|
+
$anchor: Node | null,
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
$props?: Record<PropertyKey, any>,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
$context?: Record<PropertyKey, any>,
|
|
16
|
+
$slots?: Record<string, SlotRender>
|
|
17
|
+
) {
|
|
18
|
+
|
|
19
|
+
/* User interface */
|
|
20
|
+
const t_fragments: DocumentFragment[] = [];
|
|
21
|
+
|
|
22
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<h2> <!> </h2>`);
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const t_h2_1 = t_root(t_fragment_0) as HTMLElement;
|
|
25
|
+
const t_slot_anchor_1 = t_anchor(t_next(t_child(t_h2_1))) as HTMLElement;
|
|
26
|
+
if ($slots && $slots["_"]) {
|
|
27
|
+
$slots["_"](t_h2_1, t_slot_anchor_1, undefined, $context)
|
|
28
|
+
} else {
|
|
29
|
+
const t_fragment_1 = t_fragment($parent.ownerDocument!, t_fragments, 1, ` Default header... `);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const t_text_1 = t_root(t_fragment_1);
|
|
32
|
+
t_add_fragment(t_fragment_1, t_h2_1, t_slot_anchor_1);
|
|
33
|
+
t_next(t_text_1);
|
|
34
|
+
}
|
|
35
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
36
|
+
t_next(t_h2_1);
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
|
|
3
|
+
export default function Header(
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
$props?: Record<PropertyKey, any>,
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
$context?: Record<PropertyKey, any>,
|
|
8
|
+
$slots?: Record<string, ServerSlotRender>
|
|
9
|
+
) {
|
|
10
|
+
|
|
11
|
+
/* User interface */
|
|
12
|
+
let $output = "";
|
|
13
|
+
$output += `<h2> <![>`;
|
|
14
|
+
if ($slots && $slots["_"]) {
|
|
15
|
+
$output += $slots["_"](undefined, $context);
|
|
16
|
+
} else {
|
|
17
|
+
$output += ` Default header... `;
|
|
18
|
+
}
|
|
19
|
+
$output += `<!]><!> </h2>`;
|
|
20
|
+
|
|
21
|
+
return $output;
|
|
22
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import $run from "../../../../src/render/$run";
|
|
2
|
+
import $watch from "../../../../src/render/$watch";
|
|
3
|
+
import { type ListItem } from "../../../../src/types/ListItem";
|
|
4
|
+
import { type SlotRender } from "../../../../src/types/SlotRender";
|
|
5
|
+
import t_add_fragment from "../../../../src/render/addFragment";
|
|
6
|
+
import t_anchor from "../../../../src/render/nodeAnchor";
|
|
7
|
+
import t_child from "../../../../src/render/nodeChild";
|
|
8
|
+
import t_fragment from "../../../../src/render/getFragment";
|
|
9
|
+
import t_list_item from "../../../../src/render/newListItem";
|
|
10
|
+
import t_next from "../../../../src/render/nodeNext";
|
|
11
|
+
import t_pop_range from "../../../../src/render/popRange";
|
|
12
|
+
import t_push_range from "../../../../src/render/pushRange";
|
|
13
|
+
import t_range from "../../../../src/render/newRange";
|
|
14
|
+
import t_root from "../../../../src/render/nodeRoot";
|
|
15
|
+
import t_run_list from "../../../../src/render/runList";
|
|
16
|
+
|
|
17
|
+
export default function List(
|
|
18
|
+
$parent: ParentNode,
|
|
19
|
+
$anchor: Node | null,
|
|
20
|
+
$props: Record<PropertyKey, any>,
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
$context?: Record<PropertyKey, any>,
|
|
23
|
+
$slots?: Record<string, SlotRender>
|
|
24
|
+
) {
|
|
25
|
+
$props ??= {};
|
|
26
|
+
|
|
27
|
+
/* User interface */
|
|
28
|
+
const t_fragments: DocumentFragment[] = [];
|
|
29
|
+
|
|
30
|
+
const t_fragment_0 = t_fragment($parent.ownerDocument!, t_fragments, 0, `<ul> <!> </ul>`);
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
const t_ul_1 = t_root(t_fragment_0) as HTMLElement;
|
|
33
|
+
const t_for_anchor_1 = t_anchor(t_next(t_child(t_ul_1))) as HTMLElement;
|
|
34
|
+
|
|
35
|
+
/* @for */
|
|
36
|
+
let t_for_range_1 = t_range();
|
|
37
|
+
t_run_list(
|
|
38
|
+
t_for_range_1,
|
|
39
|
+
t_ul_1,
|
|
40
|
+
t_for_anchor_1,
|
|
41
|
+
function createNewItems() {
|
|
42
|
+
let t_new_items: ListItem[] = [];
|
|
43
|
+
for (let item of $props.items) {
|
|
44
|
+
t_new_items.push(t_list_item({ item }));
|
|
45
|
+
/*t_new_items.push({
|
|
46
|
+
data: { item }
|
|
47
|
+
});*/
|
|
48
|
+
}
|
|
49
|
+
return t_new_items;
|
|
50
|
+
},
|
|
51
|
+
function createListItem(t_item, t_before) {
|
|
52
|
+
let t_old_range_1 = t_push_range(t_item, true);
|
|
53
|
+
const t_fragment_1 = t_fragment($parent.ownerDocument!, t_fragments, 1, ` <li> <!> </li> `);
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
const t_root_1 = t_root(t_fragment_1);
|
|
56
|
+
const t_slot_parent_1 = t_next(t_root_1) as HTMLElement;
|
|
57
|
+
const t_slot_anchor_1 = t_anchor(t_next(t_child(t_slot_parent_1))) as HTMLElement;
|
|
58
|
+
const t_sprops_1 = $watch({});
|
|
59
|
+
$run(function setProp() {
|
|
60
|
+
t_sprops_1["item"] = t_item.data.item;
|
|
61
|
+
});
|
|
62
|
+
if ($slots && $slots["_"]) {
|
|
63
|
+
$slots["_"](t_slot_parent_1, t_slot_anchor_1, t_sprops_1, $context)
|
|
64
|
+
}
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const t_text_1 = t_next(t_slot_parent_1);
|
|
67
|
+
t_add_fragment(t_fragment_1, t_ul_1, t_before);
|
|
68
|
+
t_next(t_text_1);
|
|
69
|
+
t_pop_range(t_old_range_1);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
t_add_fragment(t_fragment_0, $parent, $anchor);
|
|
74
|
+
t_next(t_ul_1);
|
|
75
|
+
|
|
76
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ServerSlotRender } from "../../../../src/types/ServerSlotRender";
|
|
2
|
+
|
|
3
|
+
export default function List(
|
|
4
|
+
$props: Record<PropertyKey, any>,
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
$context?: Record<PropertyKey, any>,
|
|
7
|
+
$slots?: Record<string, ServerSlotRender>
|
|
8
|
+
) {
|
|
9
|
+
|
|
10
|
+
/* User interface */
|
|
11
|
+
let $output = "";
|
|
12
|
+
$output += `<ul> <![>`;
|
|
13
|
+
for (let item of $props.items) {
|
|
14
|
+
$output += `<!^> <li> <![>`;
|
|
15
|
+
const t_sprops_1: any = {};
|
|
16
|
+
t_sprops_1["item"] = item;
|
|
17
|
+
if ($slots && $slots["_"]) {
|
|
18
|
+
$output += $slots["_"](t_sprops_1, $context);
|
|
19
|
+
}
|
|
20
|
+
$output += `<!]><!> </li> `;
|
|
21
|
+
}
|
|
22
|
+
$output += `<!]><!> </ul>`;
|
|
23
|
+
|
|
24
|
+
return $output;
|
|
25
|
+
}
|