@riebeckite/honox 0.0.18 → 0.0.19

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.
@@ -1,3 +1,4 @@
1
+ import type { ContentBodySlot, ContentBodySlots } from "@riebeckite/core";
1
2
  export type PrimitiveChildren = unknown;
2
3
  export type PrimitiveProps = {
3
4
  children?: PrimitiveChildren;
@@ -12,6 +13,9 @@ export type ArticleProps = PrimitiveProps & {
12
13
  "data-slot"?: string;
13
14
  };
14
15
  export type ArticleLayoutProps = PrimitiveProps & {
16
+ /**
17
+ * @deprecated Render aside content as children instead.
18
+ */
15
19
  aside?: PrimitiveChildren;
16
20
  };
17
21
  export type ArticleHeaderProps = (PrimitiveClassProps & {
@@ -24,6 +28,10 @@ export type ArticleHeaderProps = (PrimitiveClassProps & {
24
28
  children?: PrimitiveChildren;
25
29
  });
26
30
  export type ArticleContentProps = (PrimitiveClassProps & {
31
+ /**
32
+ * @deprecated Render Markdown HTML with `ArticleBody` inside an
33
+ * `ArticleContent` shell instead.
34
+ */
27
35
  html: string;
28
36
  children?: never;
29
37
  "data-slot"?: string;
@@ -44,5 +52,32 @@ export declare function ArticleLayout(props: ArticleLayoutProps): import("hono/j
44
52
  export declare function ArticleHeader(props: ArticleHeaderProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
45
53
  export declare function ArticleMeta(props: ArticleMetaProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
46
54
  export declare function ArticleContent(props: ArticleContentProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
55
+ export type ArticleBodyProps = PrimitiveClassProps & {
56
+ html: string;
57
+ };
58
+ export type ContentSlotProps = PrimitiveClassProps & {
59
+ slots?: ContentBodySlots;
60
+ name: ContentBodySlot;
61
+ };
62
+ /**
63
+ * Whether a body slot holds renderable content.
64
+ *
65
+ * A slot is absent when its source map is missing, the value is missing, or
66
+ * the value is whitespace-only. This is the same check `ContentSlot` uses.
67
+ */
68
+ export declare function hasSlot(slots: ContentBodySlots | undefined, name: ContentBodySlot): boolean;
69
+ /**
70
+ * Renders a Plugin-provided body slot fragment at the position the Site chose.
71
+ *
72
+ * The Site owns placement; this primitive owns the lookup, empty handling, and
73
+ * HTML injection. It renders nothing when the slot is absent or blank.
74
+ */
75
+ export declare function ContentSlot(props: ContentSlotProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
76
+ /**
77
+ * Renders Markdown-produced HTML as the canonical article body.
78
+ *
79
+ * Owns the `.rb-article-content` Stable Hook so Sites never hand-write it.
80
+ */
81
+ export declare function ArticleBody(props: ArticleBodyProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
47
82
  export declare function ArticleFooter(props: ArticleFooterProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
48
83
  export declare function Sidebar(props: SidebarProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
@@ -68,6 +68,32 @@ function ArticleContent(props) {
68
68
  }
69
69
  return /* @__PURE__ */ jsx("div", { class: className, "data-slot": dataSlot, children: props.children });
70
70
  }
71
+ function hasSlot(slots, name) {
72
+ return Boolean(slots?.[name]?.trim());
73
+ }
74
+ function ContentSlot(props) {
75
+ const html = props.slots?.[props.name];
76
+ if (!html?.trim()) {
77
+ return null;
78
+ }
79
+ return /* @__PURE__ */ jsx(
80
+ "div",
81
+ {
82
+ "data-slot": props.name,
83
+ class: joinClassNames(props.class, props.className) || void 0,
84
+ dangerouslySetInnerHTML: { __html: html }
85
+ }
86
+ );
87
+ }
88
+ function ArticleBody(props) {
89
+ return /* @__PURE__ */ jsx(
90
+ "div",
91
+ {
92
+ class: joinClassNames("rb-article-content", props.class, props.className),
93
+ dangerouslySetInnerHTML: { __html: props.html }
94
+ }
95
+ );
96
+ }
71
97
  function ArticleFooter(props) {
72
98
  return /* @__PURE__ */ jsx(
73
99
  "footer",
@@ -92,10 +118,13 @@ function joinClassNames(...classNames) {
92
118
  }
93
119
  export {
94
120
  Article,
121
+ ArticleBody,
95
122
  ArticleContent,
96
123
  ArticleFooter,
97
124
  ArticleHeader,
98
125
  ArticleLayout,
99
126
  ArticleMeta,
100
- Sidebar
127
+ ContentSlot,
128
+ Sidebar,
129
+ hasSlot
101
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "esbuild": "^0.28.2",
31
31
  "hono": "^4.12.25",
32
32
  "vite": "^8.0.9",
33
- "@riebeckite/core": "0.0.18"
33
+ "@riebeckite/core": "0.0.19"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsx": "^4.22.4",
37
- "@riebeckite/test": "0.0.18"
37
+ "@riebeckite/test": "0.0.19"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"