@gravito/signal 2.0.0 → 3.0.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @gravito/signal
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @gravito/core@1.2.1
9
+ - @gravito/stream@1.0.3
10
+ - @gravito/prism@3.0.1
11
+
12
+ ## 3.0.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @gravito/core@1.2.0
18
+ - @gravito/prism@3.0.0
19
+ - @gravito/stream@1.0.2
20
+
3
21
  ## 2.0.0
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,28 @@
1
+ import "./chunk-EBO3CZXG.mjs";
2
+
3
+ // src/renderers/ReactRenderer.ts
4
+ var ReactRenderer = class {
5
+ constructor(component, props, deps = {}) {
6
+ this.component = component;
7
+ this.props = props;
8
+ this.deps = deps;
9
+ }
10
+ async render(data) {
11
+ const createElement = this.deps.createElement ?? (await import("react")).createElement;
12
+ const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
13
+ const mergedProps = { ...this.props, ...data };
14
+ const element = createElement(this.component, mergedProps);
15
+ const html = renderToStaticMarkup(element);
16
+ const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
17
+ return {
18
+ html: fullHtml,
19
+ text: this.stripHtml(html)
20
+ };
21
+ }
22
+ stripHtml(html) {
23
+ return html.replace(/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi, "").replace(/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
24
+ }
25
+ };
26
+ export {
27
+ ReactRenderer
28
+ };
@@ -0,0 +1,31 @@
1
+ import "./chunk-EBO3CZXG.mjs";
2
+
3
+ // src/renderers/VueRenderer.ts
4
+ var VueRenderer = class {
5
+ constructor(component, props, deps = {}) {
6
+ this.component = component;
7
+ this.props = props;
8
+ this.deps = deps;
9
+ }
10
+ async render(data) {
11
+ const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
12
+ const h = this.deps.h ?? (await import("vue")).h;
13
+ const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4W4FI7YG.mjs")).renderToString;
14
+ const mergedProps = { ...this.props, ...data };
15
+ const app = createSSRApp({
16
+ render: () => h(this.component, mergedProps)
17
+ });
18
+ const html = await renderToString(app);
19
+ const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
20
+ return {
21
+ html: fullHtml,
22
+ text: this.stripHtml(html)
23
+ };
24
+ }
25
+ stripHtml(html) {
26
+ return html.replace(/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi, "").replace(/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
27
+ }
28
+ };
29
+ export {
30
+ VueRenderer
31
+ };