@uniweb/core 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/block.js +20 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "jest": "^29.7.0"
31
31
  },
32
32
  "dependencies": {
33
- "@uniweb/semantic-parser": "1.1.1"
33
+ "@uniweb/semantic-parser": "1.1.2"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
package/src/block.js CHANGED
@@ -77,20 +77,26 @@ export default class Block {
77
77
  ? blockData.subsections.map((block, i) => new Block(block, `${id}_${i}`, this.page))
78
78
  : []
79
79
 
80
- // Inline child blocks (from @ component references in markdown)
81
- if (blockData.inlineChildren?.length > 0) {
82
- const start = this.childBlocks.length
83
- for (let i = 0; i < blockData.inlineChildren.length; i++) {
84
- const ref = blockData.inlineChildren[i]
80
+ // Insets inline @-referenced components positioned in content flow
81
+ this.insets = []
82
+ const insetData = blockData.insets
83
+ if (insetData?.length > 0) {
84
+ for (let i = 0; i < insetData.length; i++) {
85
+ const ref = insetData[i]
86
+ const description = ref.description || ''
85
87
  const child = new Block(
86
- { type: ref.type, params: ref.params || {}, content: {}, stableId: ref.refId },
87
- `${id}_${start + i}`,
88
+ {
89
+ type: ref.type,
90
+ params: ref.params || {},
91
+ content: { title: description },
92
+ stableId: ref.refId,
93
+ },
94
+ `${id}_inset_${i}`,
88
95
  this.page
89
96
  )
90
97
  child.inline = true
91
98
  child.refId = ref.refId
92
- child.alt = ref.alt || ''
93
- this.childBlocks.push(child)
99
+ this.insets.push(child)
94
100
  }
95
101
  }
96
102
 
@@ -283,14 +289,15 @@ export default class Block {
283
289
  }
284
290
 
285
291
  /**
286
- * Get an inline child block by its refId
287
- * @param {string} refId - The reference ID (e.g., 'inline_0')
292
+ * Get an inset block by its refId
293
+ * @param {string} refId - The reference ID (e.g., 'inset_0')
288
294
  * @returns {Block|null}
289
295
  */
290
- getInlineChild(refId) {
291
- return this.childBlocks.find(c => c.refId === refId) || null
296
+ getInset(refId) {
297
+ return this.insets.find(c => c.refId === refId) || null
292
298
  }
293
299
 
300
+
294
301
  /**
295
302
  * Get child block renderer from runtime
296
303
  */