@uniweb/kit 0.7.0 → 0.7.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Standard component library for Uniweb foundations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"fuse.js": "^7.0.0",
|
|
47
47
|
"shiki": "^3.0.0",
|
|
48
48
|
"tailwind-merge": "^2.6.0",
|
|
49
|
-
"@uniweb/core": "0.5.
|
|
49
|
+
"@uniweb/core": "0.5.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -66,7 +66,7 @@ function renderList(items, ordered = false) {
|
|
|
66
66
|
/**
|
|
67
67
|
* Render a single content node
|
|
68
68
|
*/
|
|
69
|
-
function RenderNode({ node, ...props }) {
|
|
69
|
+
function RenderNode({ node, block, ...props }) {
|
|
70
70
|
if (!node) return null
|
|
71
71
|
|
|
72
72
|
const { type, attrs, content } = node
|
|
@@ -203,7 +203,7 @@ function RenderNode({ node, ...props }) {
|
|
|
203
203
|
return (
|
|
204
204
|
<blockquote className="border-l-4 border-gray-300 pl-4 italic text-gray-600 my-4">
|
|
205
205
|
{content?.map((child, i) => (
|
|
206
|
-
<RenderNode key={i} node={child} />
|
|
206
|
+
<RenderNode key={i} node={child} block={block} />
|
|
207
207
|
))}
|
|
208
208
|
</blockquote>
|
|
209
209
|
)
|
|
@@ -239,6 +239,19 @@ function RenderNode({ node, ...props }) {
|
|
|
239
239
|
return <Divider type={attrs?.type} className="my-6" />
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
case 'inline_child_placeholder': {
|
|
243
|
+
const refId = attrs?.refId
|
|
244
|
+
if (!block || !refId) return null
|
|
245
|
+
|
|
246
|
+
const childBlock = block.getInlineChild(refId)
|
|
247
|
+
if (!childBlock) return null
|
|
248
|
+
|
|
249
|
+
const ChildBlocks = childBlock.getChildBlockRenderer()
|
|
250
|
+
if (!ChildBlocks) return null
|
|
251
|
+
|
|
252
|
+
return <ChildBlocks blocks={[childBlock]} as="div" />
|
|
253
|
+
}
|
|
254
|
+
|
|
242
255
|
case 'button': {
|
|
243
256
|
const href = attrs?.href || '#'
|
|
244
257
|
const label = extractText(node) || attrs?.label || 'Button'
|
|
@@ -286,7 +299,7 @@ function RenderNode({ node, ...props }) {
|
|
|
286
299
|
return (
|
|
287
300
|
<>
|
|
288
301
|
{content.map((child, i) => (
|
|
289
|
-
<RenderNode key={i} node={child} />
|
|
302
|
+
<RenderNode key={i} node={child} block={block} />
|
|
290
303
|
))}
|
|
291
304
|
</>
|
|
292
305
|
)
|
|
@@ -302,7 +315,7 @@ function RenderNode({ node, ...props }) {
|
|
|
302
315
|
* @param {Array|Object} props.content - Content to render (array of nodes or single node)
|
|
303
316
|
* @param {string} [props.className] - Additional CSS classes
|
|
304
317
|
*/
|
|
305
|
-
export function Render({ content, className, ...props }) {
|
|
318
|
+
export function Render({ content, block, className, ...props }) {
|
|
306
319
|
if (!content) return null
|
|
307
320
|
|
|
308
321
|
const nodes = Array.isArray(content) ? content : [content]
|
|
@@ -310,7 +323,7 @@ export function Render({ content, className, ...props }) {
|
|
|
310
323
|
return (
|
|
311
324
|
<div className={cn('space-y-4', className)} {...props}>
|
|
312
325
|
{nodes.map((node, i) => (
|
|
313
|
-
<RenderNode key={i} node={node} />
|
|
326
|
+
<RenderNode key={i} node={node} block={block} />
|
|
314
327
|
))}
|
|
315
328
|
</div>
|
|
316
329
|
)
|