@paroicms/content-loading-plugin 0.3.0 → 0.4.0
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.
|
@@ -5,12 +5,12 @@ exports.getPartials = getPartials;
|
|
|
5
5
|
exports.toLeafId = toLeafId;
|
|
6
6
|
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
7
7
|
const public_anywhere_lib_1 = require("@paroicms/public-anywhere-lib");
|
|
8
|
-
async function makeSearch(
|
|
8
|
+
async function makeSearch(service, query, req, res) {
|
|
9
9
|
const { q, language, limit, start, tpl } = query;
|
|
10
10
|
const words = q.split(/\s+/).filter((word) => word.length >= 2);
|
|
11
11
|
if (words.length === 0)
|
|
12
12
|
return { total: 0 };
|
|
13
|
-
await
|
|
13
|
+
await service.renderSearchPartials({
|
|
14
14
|
req,
|
|
15
15
|
res,
|
|
16
16
|
language,
|
|
@@ -20,7 +20,7 @@ async function makeSearch(ctx, query, req, res) {
|
|
|
20
20
|
templateName: tpl,
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
async function getPartials(
|
|
23
|
+
async function getPartials(service, req, res, params, labeledById) {
|
|
24
24
|
const documentId = params["children-of"];
|
|
25
25
|
const parentId = (0, public_anywhere_lib_1.parseSectionId)(documentId);
|
|
26
26
|
const labeledByTermId = (0, data_formatters_lib_1.isDef)(labeledById) ? toLeafId(labeledById) : undefined;
|
|
@@ -30,7 +30,7 @@ async function getPartials(ctx, req, res, params, labeledById) {
|
|
|
30
30
|
offset: params.start,
|
|
31
31
|
limit: params.limit,
|
|
32
32
|
};
|
|
33
|
-
await
|
|
33
|
+
await service.renderChildPartials({
|
|
34
34
|
req,
|
|
35
35
|
res,
|
|
36
36
|
params: payload,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/content-loading-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Content loading plugin for ParoiCMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paroicms",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@paroicms/public-server-lib": "0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
35
|
-
"@paroicms/public-server-lib": "0.
|
|
34
|
+
"@paroicms/public-anywhere-lib": "0.8.0",
|
|
35
|
+
"@paroicms/public-server-lib": "0.14.0",
|
|
36
36
|
"@solid-primitives/i18n": "~2.1.1",
|
|
37
37
|
"@solidjs/router": "~0.14.1",
|
|
38
38
|
"@types/node": "~20.14.8",
|
|
@@ -148,11 +148,7 @@ function K(e) {
|
|
|
148
148
|
if (!e.fn) return;
|
|
149
149
|
oe(e);
|
|
150
150
|
const t = se;
|
|
151
|
-
bt(
|
|
152
|
-
e,
|
|
153
|
-
e.value,
|
|
154
|
-
t
|
|
155
|
-
);
|
|
151
|
+
bt(e, e.value, t);
|
|
156
152
|
}
|
|
157
153
|
function bt(e, t, n) {
|
|
158
154
|
let r;
|
|
@@ -284,13 +280,10 @@ function ye(e) {
|
|
|
284
280
|
function Et(e, t) {
|
|
285
281
|
return function(r) {
|
|
286
282
|
let s;
|
|
287
|
-
return _(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}, $e(() => r.children))),
|
|
292
|
-
void 0
|
|
293
|
-
), s;
|
|
283
|
+
return _(() => s = I(() => (w.context = {
|
|
284
|
+
...w.context,
|
|
285
|
+
[e]: r.value
|
|
286
|
+
}, $e(() => r.children))), void 0), s;
|
|
294
287
|
};
|
|
295
288
|
}
|
|
296
289
|
function A(e, t) {
|
|
@@ -339,28 +332,24 @@ function Ct(...e) {
|
|
|
339
332
|
t = t || !!o && me in o, e[a] = typeof o == "function" ? (t = !0, E(o)) : o;
|
|
340
333
|
}
|
|
341
334
|
if (t)
|
|
342
|
-
return new Proxy(
|
|
343
|
-
{
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (c !== void 0) return c;
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
has(a) {
|
|
351
|
-
for (let o = e.length - 1; o >= 0; o--)
|
|
352
|
-
if (a in he(e[o])) return !0;
|
|
353
|
-
return !1;
|
|
354
|
-
},
|
|
355
|
-
keys() {
|
|
356
|
-
const a = [];
|
|
357
|
-
for (let o = 0; o < e.length; o++)
|
|
358
|
-
a.push(...Object.keys(he(e[o])));
|
|
359
|
-
return [...new Set(a)];
|
|
335
|
+
return new Proxy({
|
|
336
|
+
get(a) {
|
|
337
|
+
for (let o = e.length - 1; o >= 0; o--) {
|
|
338
|
+
const c = he(e[o])[a];
|
|
339
|
+
if (c !== void 0) return c;
|
|
360
340
|
}
|
|
361
341
|
},
|
|
362
|
-
|
|
363
|
-
|
|
342
|
+
has(a) {
|
|
343
|
+
for (let o = e.length - 1; o >= 0; o--)
|
|
344
|
+
if (a in he(e[o])) return !0;
|
|
345
|
+
return !1;
|
|
346
|
+
},
|
|
347
|
+
keys() {
|
|
348
|
+
const a = [];
|
|
349
|
+
for (let o = 0; o < e.length; o++) a.push(...Object.keys(he(e[o])));
|
|
350
|
+
return [...new Set(a)];
|
|
351
|
+
}
|
|
352
|
+
}, Rt);
|
|
364
353
|
const n = {}, r = /* @__PURE__ */ Object.create(null);
|
|
365
354
|
for (let a = e.length - 1; a >= 0; a--) {
|
|
366
355
|
const o = e[a];
|
|
@@ -394,25 +383,17 @@ function D(e) {
|
|
|
394
383
|
const t = e.keyed, n = E(() => e.when, void 0, {
|
|
395
384
|
equals: (r, s) => t ? r === s : !r == !s
|
|
396
385
|
});
|
|
397
|
-
return E(
|
|
398
|
-
()
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
)
|
|
409
|
-
) : s;
|
|
410
|
-
}
|
|
411
|
-
return e.fallback;
|
|
412
|
-
},
|
|
413
|
-
void 0,
|
|
414
|
-
void 0
|
|
415
|
-
);
|
|
386
|
+
return E(() => {
|
|
387
|
+
const r = n();
|
|
388
|
+
if (r) {
|
|
389
|
+
const s = e.children;
|
|
390
|
+
return typeof s == "function" && s.length > 0 ? I(() => s(t ? r : () => {
|
|
391
|
+
if (!I(n)) throw Lt("Show");
|
|
392
|
+
return e.when;
|
|
393
|
+
})) : s;
|
|
394
|
+
}
|
|
395
|
+
return e.fallback;
|
|
396
|
+
}, void 0, void 0);
|
|
416
397
|
}
|
|
417
398
|
function Pt(e, t, n) {
|
|
418
399
|
let r = n.length, s = t.length, i = r, a = 0, o = 0, c = t[s - 1].nextSibling, l = null;
|
|
@@ -560,11 +541,7 @@ function we(e, t, n, r) {
|
|
|
560
541
|
else if (l === "function")
|
|
561
542
|
if (r) {
|
|
562
543
|
for (; typeof o == "function"; ) o = o();
|
|
563
|
-
s = we(
|
|
564
|
-
e,
|
|
565
|
-
Array.isArray(o) ? o : [o],
|
|
566
|
-
Array.isArray(c) ? c : [c]
|
|
567
|
-
) || s;
|
|
544
|
+
s = we(e, Array.isArray(o) ? o : [o], Array.isArray(c) ? c : [c]) || s;
|
|
568
545
|
} else
|
|
569
546
|
e.push(o), s = !0;
|
|
570
547
|
else {
|