From 3514badae47b6f52b8ad231f8682a3c733f2f18b Mon Sep 17 00:00:00 2001 From: dpiercey Date: Mon, 15 Apr 2024 10:54:08 -0700 Subject: [PATCH] feat: support client reorder attribute --- README.md | 13 +++++ .../renders.expected/loading.0.html | 16 ++++++ .../renders.expected/loading.1.html | 32 ++++++++++++ .../renders.expected/loading.2.html | 26 ++++++++++ .../ssr-stream-client-reorder/embed.marko | 11 ++++ .../ssr-stream-client-reorder/index.marko | 18 +++++++ .../micro-frame/__tests__/server.test.ts | 5 ++ src/components/micro-frame/marko-tag.json | 7 +++ .../micro-frame-component/node.marko | 51 +++++++++++++------ .../micro-frame-component/web.component.ts | 15 ++++-- 10 files changed, 173 insertions(+), 21 deletions(-) create mode 100644 src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.0.html create mode 100644 src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.1.html create mode 100644 src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.2.html create mode 100644 src/components/micro-frame/__tests__/fixtures/ssr-stream-client-reorder/embed.marko create mode 100644 src/components/micro-frame/__tests__/fixtures/ssr-stream-client-reorder/index.marko diff --git a/README.md b/README.md index 48f6617..c61c09a 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,19 @@ Optional `style` attribute which works the same way as [Marko style attribute](h ``` +## `client-reorder` + +Similar to the [ tag client-reorder attribute](https://markojs.com/docs/core-tags/#await) this tells the micro-frame to avoid blocking content later in the document. + +> Note when this is used the micro-frame will be buffered instead of streamed and inserted once it's ready. + +```marko + + +``` + # Communicating between host and child Communicating with the embedded application happens primarily in one of two ways, either you want to do a full reload of and get new HTML, or you want to orchestrate a client side rendered update. diff --git a/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.0.html b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.0.html new file mode 100644 index 0000000..cc7aeeb --- /dev/null +++ b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.0.html @@ -0,0 +1,16 @@ +
+ Host app +
+
+ + Loading... + +
+
+ Host footer +
\ No newline at end of file diff --git a/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.1.html b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.1.html new file mode 100644 index 0000000..a935c68 --- /dev/null +++ b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.1.html @@ -0,0 +1,32 @@ +
+ Host app +
+
+ + Loading... + +
+
+ Host footer +
+ + \ No newline at end of file diff --git a/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.2.html b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.2.html new file mode 100644 index 0000000..54d1417 --- /dev/null +++ b/src/components/micro-frame/__tests__/__snapshots__/ssr-client-reorder-loading/renders.expected/loading.2.html @@ -0,0 +1,26 @@ +
+ Host app +
+
+
+

+ Hello +

+

+ World +

+
+
+
+ Host footer +
+