@studiocms/html 0.1.0-beta.27 → 0.1.0-beta.29

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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The HTML renderer configuration for StudioCMS.
3
+ *
4
+ * This renderer is responsible for handling HTML content within StudioCMS,
5
+ * utilizing shared configuration options for sanitization and rendering.
6
+ *
7
+ * (StudioCMS can technically already render HTML out of the box,
8
+ * but will error without any renderer configured for HTML content types.)
9
+ */
10
+ declare const renderer: {
11
+ name: string;
12
+ sanitizeOpts: {
13
+ allowElements?: string[] | undefined;
14
+ blockElements?: string[] | undefined;
15
+ dropElements?: string[] | undefined;
16
+ allowAttributes?: Record<string, string[]> | undefined;
17
+ dropAttributes?: Record<string, string[]> | undefined;
18
+ allowComponents?: boolean | undefined;
19
+ allowCustomElements?: boolean | undefined;
20
+ allowComments?: boolean | undefined;
21
+ } | undefined;
22
+ };
23
+ export default renderer;
@@ -0,0 +1,9 @@
1
+ import { shared } from "../lib/shared.js";
2
+ const renderer = {
3
+ name: "@studiocms/html",
4
+ sanitizeOpts: shared.htmlConfig?.sanitize
5
+ };
6
+ var render_default = renderer;
7
+ export {
8
+ render_default as default
9
+ };
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ function studiocmsHTML(options) {
33
33
  identifier: "studiocms/html",
34
34
  label: "HTML",
35
35
  pageContentComponent: resolve("./components/editor.astro"),
36
- rendererComponent: resolve("./components/renderer.astro")
36
+ rendererComponent: resolve("./components/render.js")
37
37
  }
38
38
  ]
39
39
  });
@@ -2,7 +2,6 @@ const symbol = Symbol.for("@studiocms/html");
2
2
  const shared = (
3
3
  // @ts-expect-error
4
4
  globalThis[symbol] || // @ts-expect-error
5
- // biome-ignore lint/suspicious/noAssignInExpressions: This is a valid use case for assignment in expressions.
6
5
  (globalThis[symbol] = {
7
6
  htmlConfig: void 0
8
7
  })
package/dist/virtual.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  declare module 'virtual:studiocms/plugins/renderers' {
2
- export const studiocms_html: typeof import('./components/renderer.astro').default;
2
+ export const studiocms_html: typeof import('./components/render.js').default;
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiocms/html",
3
- "version": "0.1.0-beta.27",
3
+ "version": "0.1.0-beta.29",
4
4
  "description": "Add HTML Support to your StudioCMS project with ease!",
5
5
  "author": {
6
6
  "name": "withstudiocms",
@@ -53,13 +53,16 @@
53
53
  "default": "./dist/virtual.d.js"
54
54
  },
55
55
  "./editor": "./dist/components/editor.astro",
56
- "./renderer": "./dist/components/renderer.astro"
56
+ "./renderer": {
57
+ "types": "./dist/components/render.d.ts",
58
+ "default": "./dist/components/render.js"
59
+ }
57
60
  },
58
61
  "type": "module",
59
62
  "dependencies": {
60
- "astro-integration-kit": "^0.19.0",
63
+ "astro-integration-kit": "^0.19.1",
61
64
  "codemirror": "5.65.19",
62
- "katex": "^0.16.22",
65
+ "katex": "^0.16.25",
63
66
  "suneditor": "^2.47.8"
64
67
  },
65
68
  "devDependencies": {
@@ -68,9 +71,9 @@
68
71
  },
69
72
  "peerDependencies": {
70
73
  "astro": "^5.12.9",
71
- "effect": "^3.17.14",
74
+ "effect": "^3.19.0",
72
75
  "vite": "^6.3.4",
73
- "studiocms": "0.1.0-beta.27"
76
+ "studiocms": "0.1.0-beta.29"
74
77
  },
75
78
  "scripts": {
76
79
  "build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
@@ -1,25 +0,0 @@
1
- ---
2
- import { createRenderer } from 'studiocms:component-registry/runtime';
3
- import type { SSRResult } from 'astro';
4
- import type { PluginPageTypeRendererProps } from 'studiocms/types';
5
- import { shared } from '../lib/shared.js';
6
-
7
- // @ts-expect-error - $$result is a global variable injected by Astro during compilation and not a editor-known variable
8
- const ssrResult: SSRResult = $$result;
9
-
10
- // Define render function
11
- const render = await createRenderer(ssrResult, shared.htmlConfig?.sanitize);
12
-
13
- interface Props extends PluginPageTypeRendererProps {}
14
-
15
- // Get default content
16
- const { defaultContent } = Astro.props.data;
17
-
18
- // Get content to render
19
- const contentToRender = defaultContent?.content || '<h1>Error: No content found</h1>';
20
-
21
- // Render content
22
- const renderedContent = await render(contentToRender);
23
- ---
24
-
25
- <Fragment set:html={renderedContent} />