coralite 0.6.8 → 0.6.9

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/changelog.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 🎁 Release notes (`v0.6.9`)
2
+
3
+ ## Changes
4
+ - e79d7c9 (HEAD -> main, tag: v0.6.9, origin/main) fix: aggregation limit is offset by offset - (*[Thomas David](https://codeberg.org/tjdavid)*)
5
+ - 6f8253f test: cover nested document root components - (*[Thomas David](https://codeberg.org/tjdavid)*)
6
+ - 77d0e36 feat: create nested custom elements on document root - (*[Thomas David](https://codeberg.org/tjdavid)*)
7
+ - 2c176e5 chore: update changelog - (*[Thomas David](https://codeberg.org/tjdavid)*)
8
+ - f5a3639 chore: version bump - (*[Thomas David](https://codeberg.org/tjdavid)*)
9
+
10
+ ## Metadata
11
+ ```
12
+ This version -------- v0.6.9
13
+ Previous version ---- v0.6.8
14
+ Total commits ------- 5
15
+ ```
1
16
  # 🎁 Release notes (`v0.6.8`)
2
17
 
3
18
  ## Changes
@@ -62,18 +62,23 @@ export async function aggregate (options, values, components, document) {
62
62
  let startIndex = 0
63
63
  let endIndex = pages.length
64
64
 
65
- if (options.limit && options.limit < pages.length) {
66
- endIndex = options.limit
67
- }
68
-
69
65
  if (options.offset) {
70
66
  if (options.offset > endIndex) {
71
- startIndex = endIndex - 1
67
+ startIndex = endIndex
72
68
  } else {
73
69
  startIndex = options.offset
74
70
  }
75
71
  }
76
72
 
73
+ if (options.limit) {
74
+ const limit = options.limit + startIndex
75
+
76
+ if (limit < endIndex) {
77
+ endIndex = limit
78
+ }
79
+ }
80
+
81
+
77
82
  for (let i = startIndex; i < endIndex; i++) {
78
83
  const page = pages[i]
79
84
  const meta = parseHTMLMeta(page.content)
package/lib/parse.js CHANGED
@@ -643,6 +643,27 @@ export async function createComponent ({
643
643
  if (!slotNodes.length) {
644
644
  // set default content
645
645
  slotNodes = slot.element.children || []
646
+ } else {
647
+ const startIndex = slotNodes.length - 1
648
+
649
+ for (let i = startIndex; i > -1; i--) {
650
+ const node = slotNodes[i]
651
+ const component = components[node.name]
652
+
653
+ if (component) {
654
+ const component = await createComponent({
655
+ id: node.name,
656
+ values,
657
+ element: node,
658
+ components,
659
+ document
660
+ })
661
+
662
+ if (component) {
663
+ slotNodes.splice(i, 1, ...component.children)
664
+ }
665
+ }
666
+ }
646
667
  }
647
668
 
648
669
  // replace slot element with content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coralite",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "HTML modules static site generator",
5
5
  "main": "./lib/coralite.js",
6
6
  "type": "module",