@studiocms/html 0.1.0-beta.26 → 0.1.0-beta.28

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @studiocms/html Plugin
2
2
 
3
+ [![codecov](https://codecov.io/github/withstudiocms/studiocms/graph/badge.svg?token=RN8LT1O5E2&component=studiocms_html)](https://codecov.io/github/withstudiocms/studiocms)
4
+
3
5
  Add HTML support to StudioCMS
4
6
 
5
7
  ## Usage
@@ -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
  });
@@ -5,7 +5,7 @@ export declare const symbol: symbol;
5
5
  * initialized as a new object with a `htmlConfig` property.
6
6
  *
7
7
  * @remarks
8
- * The `@ts-ignore` comments are used to suppress TypeScript errors related to the use of
8
+ * The `@ts-expect-error` comments are used to suppress TypeScript errors related to the use of
9
9
  * the global scope and assignment within expressions. The `biome-ignore` comment is used
10
10
  * to suppress linting errors for the same reason.
11
11
  */
@@ -1,8 +1,7 @@
1
1
  const symbol = Symbol.for("@studiocms/html");
2
2
  const shared = (
3
- // @ts-ignore
4
- globalThis[symbol] || // @ts-ignore
5
- // biome-ignore lint/suspicious/noAssignInExpressions: This is a valid use case for assignment in expressions.
3
+ // @ts-expect-error
4
+ globalThis[symbol] || // @ts-expect-error
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.26",
3
+ "version": "0.1.0-beta.28",
4
4
  "description": "Add HTML Support to your StudioCMS project with ease!",
5
5
  "author": {
6
6
  "name": "withstudiocms",
@@ -53,14 +53,17 @@
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",
63
- "suneditor": "^2.47.7"
65
+ "katex": "^0.16.25",
66
+ "suneditor": "^2.47.8"
64
67
  },
65
68
  "devDependencies": {
66
69
  "@types/codemirror": "5.60.16",
@@ -68,13 +71,14 @@
68
71
  },
69
72
  "peerDependencies": {
70
73
  "astro": "^5.12.9",
71
- "effect": "^3.17.13",
74
+ "effect": "^3.18.4",
72
75
  "vite": "^6.3.4",
73
- "studiocms": "0.1.0-beta.26"
76
+ "studiocms": "0.1.0-beta.28"
74
77
  },
75
78
  "scripts": {
76
79
  "build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
77
80
  "dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png,d.ts}'",
81
+ "test": "vitest",
78
82
  "typecheck": "tspc -p tsconfig.tspc.json"
79
83
  }
80
84
  }
@@ -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} />