content-engine-lib 1.0.6 → 1.0.7
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/dist/index.d.ts +4 -1
- package/dist/index.es.js +112 -111
- package/dist/index.umd.js +1 -1
- package/dist/u/types/index.d.ts +1 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const y = () => ({
|
|
2
2
|
set: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
3
|
-
const
|
|
4
|
-
return (t == "x" ?
|
|
3
|
+
const r = Math.random() * 16 | 0;
|
|
4
|
+
return (t == "x" ? r : r & 3 | 8).toString(16);
|
|
5
5
|
})
|
|
6
6
|
}), x = async () => ({
|
|
7
7
|
f: {
|
|
@@ -13,82 +13,82 @@ const y = () => ({
|
|
|
13
13
|
try {
|
|
14
14
|
if (!t.el_id)
|
|
15
15
|
throw new Error("[el_id] is required");
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
16
|
+
const r = t.name, e = document.getElementById(t.el_id);
|
|
17
|
+
if (!e)
|
|
18
18
|
throw new Error("[el_id] is invalid");
|
|
19
|
-
((
|
|
20
|
-
const a = (
|
|
21
|
-
((
|
|
22
|
-
const i =
|
|
19
|
+
((s) => {
|
|
20
|
+
const a = (n) => {
|
|
21
|
+
((f) => {
|
|
22
|
+
const i = f.getAttribute("data-ce");
|
|
23
23
|
if (!i)
|
|
24
24
|
return;
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
for (const l of
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
for (const o of
|
|
31
|
-
|
|
25
|
+
const u = JSON.parse(i).filter((l) => l?.k.startsWith("t-"));
|
|
26
|
+
if (u.length != 0)
|
|
27
|
+
for (const l of u) {
|
|
28
|
+
const _ = l.k, d = l.v.split(" ");
|
|
29
|
+
if (_ == `t-${r}-class`)
|
|
30
|
+
for (const o of d)
|
|
31
|
+
f.classList.add(o);
|
|
32
32
|
else
|
|
33
|
-
for (const o of
|
|
34
|
-
|
|
33
|
+
for (const o of d)
|
|
34
|
+
f.classList.remove(o);
|
|
35
35
|
}
|
|
36
|
-
})(
|
|
36
|
+
})(n);
|
|
37
37
|
};
|
|
38
|
-
for (const
|
|
39
|
-
a(
|
|
40
|
-
a(
|
|
41
|
-
})(
|
|
42
|
-
} catch (
|
|
43
|
-
const
|
|
44
|
-
throw console.log(
|
|
38
|
+
for (const n of s.getElementsByTagName("*"))
|
|
39
|
+
a(n);
|
|
40
|
+
a(s);
|
|
41
|
+
})(e);
|
|
42
|
+
} catch (r) {
|
|
43
|
+
const e = `err: [theme] ${r}`;
|
|
44
|
+
throw console.log(e), e;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
function b(t,
|
|
49
|
-
let
|
|
48
|
+
function b(t, r = 1e3) {
|
|
49
|
+
let e = {
|
|
50
50
|
cnt: 0
|
|
51
51
|
};
|
|
52
|
-
return new Promise((
|
|
52
|
+
return new Promise((s) => {
|
|
53
53
|
const a = () => {
|
|
54
|
-
console.log(`[setInterval] is running.. [count=${
|
|
54
|
+
console.log(`[setInterval] is running.. [count=${e.cnt}]`);
|
|
55
55
|
try {
|
|
56
|
-
t() && (clearInterval(
|
|
56
|
+
t() && (clearInterval(n), s());
|
|
57
57
|
} catch {
|
|
58
|
-
console.log(`warn: [wait_until] ignoring the exception in setInterval and will check again after [interval=${
|
|
58
|
+
console.log(`warn: [wait_until] ignoring the exception in setInterval and will check again after [interval=${r}]`);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
},
|
|
60
|
+
e.cnt += 1;
|
|
61
|
+
}, n = setInterval(() => {
|
|
62
62
|
a();
|
|
63
|
-
},
|
|
63
|
+
}, r);
|
|
64
64
|
a();
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
let E = class {
|
|
68
68
|
listeners = {};
|
|
69
|
-
on = (
|
|
70
|
-
off = (
|
|
71
|
-
this.listeners[
|
|
69
|
+
on = (r, e) => ((this.listeners[r] ||= []).push(e), () => this.off(r, e));
|
|
70
|
+
off = (r, e) => {
|
|
71
|
+
this.listeners[r] = this.listeners[r]?.filter((s) => s !== e);
|
|
72
72
|
};
|
|
73
73
|
/** Sequential execution (await each listener) */
|
|
74
|
-
emit = async (
|
|
75
|
-
for (const
|
|
76
|
-
await
|
|
74
|
+
emit = async (r, ...e) => {
|
|
75
|
+
for (const s of this.listeners[r] ?? [])
|
|
76
|
+
await s(...e);
|
|
77
77
|
};
|
|
78
78
|
/** Parallel execution (await all listeners) */
|
|
79
|
-
emitParallel = async (
|
|
79
|
+
emitParallel = async (r, ...e) => {
|
|
80
80
|
await Promise.all(
|
|
81
|
-
(this.listeners[
|
|
81
|
+
(this.listeners[r] ?? []).map((s) => s(...e))
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
84
|
//Error-safe emit
|
|
85
|
-
emitSafe = async (
|
|
86
|
-
for (const
|
|
85
|
+
emitSafe = async (r, ...e) => {
|
|
86
|
+
for (const s of this.listeners[r] ?? [])
|
|
87
87
|
try {
|
|
88
|
-
await
|
|
88
|
+
await s(...e);
|
|
89
89
|
} catch (a) {
|
|
90
90
|
this.listeners.error?.forEach(
|
|
91
|
-
(
|
|
91
|
+
(n) => n(a)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -129,16 +129,16 @@ let c = {
|
|
|
129
129
|
// <any>[], // [`text`,`table`,`editor`]
|
|
130
130
|
l: {},
|
|
131
131
|
set: async (t) => {
|
|
132
|
-
const
|
|
133
|
-
for (const [
|
|
134
|
-
const a =
|
|
135
|
-
let i = a[
|
|
136
|
-
const
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
132
|
+
const r = t?.lib || [];
|
|
133
|
+
for (const [e, s] of r.entries()) {
|
|
134
|
+
const a = s, n = `${a.name}:${t.run_from}`, f = `${t.run_from}_src`;
|
|
135
|
+
let i = a[f];
|
|
136
|
+
const m = `${t.run_from}_src`;
|
|
137
|
+
let u = t?.lazy_lib?.[m] || null;
|
|
138
|
+
if (u && (u = u.replace("{*}", `${a.name}`)), console.log(`_lazy_src: ${u}`), console.log(`_src: ${i}`), c.lib.l.hasOwnProperty(`${n}`) == !1) {
|
|
139
139
|
if (/^[a-zA-Z0-9]/.test(i) && i.includes("/") == !1 && c.lib.inbuilt_lib.indexOf(`${a.name}`) === -1)
|
|
140
|
-
if (
|
|
141
|
-
i =
|
|
140
|
+
if (u)
|
|
141
|
+
i = u;
|
|
142
142
|
else
|
|
143
143
|
throw `[lib-name=${a.name},lib-src=${i}] not allowed or available in in-build mode. Need to use lazy-lib config.`;
|
|
144
144
|
if (i.startsWith("./") || i.startsWith("../")) {
|
|
@@ -147,7 +147,7 @@ let c = {
|
|
|
147
147
|
/* webpackIgnore: true */
|
|
148
148
|
`${i}`
|
|
149
149
|
);
|
|
150
|
-
c.lib.l[`${
|
|
150
|
+
c.lib.l[`${n}`] = {
|
|
151
151
|
lib: l,
|
|
152
152
|
src: i
|
|
153
153
|
};
|
|
@@ -158,7 +158,7 @@ let c = {
|
|
|
158
158
|
/* webpackIgnore: true */
|
|
159
159
|
`${i}`
|
|
160
160
|
);
|
|
161
|
-
c.lib.l[`${
|
|
161
|
+
c.lib.l[`${n}`] = {
|
|
162
162
|
lib: l,
|
|
163
163
|
src: i
|
|
164
164
|
};
|
|
@@ -168,9 +168,9 @@ let c = {
|
|
|
168
168
|
console.log(await c.lib.get_all({}));
|
|
169
169
|
},
|
|
170
170
|
get: async (t) => {
|
|
171
|
-
let
|
|
172
|
-
const
|
|
173
|
-
return c.lib.l.hasOwnProperty(`${
|
|
171
|
+
let r = null;
|
|
172
|
+
const e = `${t.name}:${t.run_from}`;
|
|
173
|
+
return c.lib.l.hasOwnProperty(`${e}`) == !1 && await c.lib.set({
|
|
174
174
|
lib: [
|
|
175
175
|
{
|
|
176
176
|
renderer_src: t.name,
|
|
@@ -181,39 +181,40 @@ let c = {
|
|
|
181
181
|
],
|
|
182
182
|
run_from: t.run_from,
|
|
183
183
|
lazy_lib: t.lazy_lib
|
|
184
|
-
}),
|
|
184
|
+
}), r = c.lib.l[`${e}`], r;
|
|
185
185
|
},
|
|
186
186
|
get_all: async (t) => c.lib.l
|
|
187
187
|
},
|
|
188
188
|
path: {
|
|
189
189
|
set: (t) => {
|
|
190
|
-
let
|
|
191
|
-
const
|
|
192
|
-
if (t.src.indexOf("://localhost") !== -1 || t.src.indexOf("://127.0.0.1") !== -1 || (
|
|
193
|
-
for (const [a,
|
|
194
|
-
let
|
|
195
|
-
if (
|
|
196
|
-
return `${
|
|
190
|
+
let r = "", e = "";
|
|
191
|
+
const s = t.src.split("/");
|
|
192
|
+
if (t.src.indexOf("://localhost") !== -1 || t.src.indexOf("://127.0.0.1") !== -1 || (e = "/dist"), s.indexOf(t.type) !== -1)
|
|
193
|
+
for (const [a, n] of s.entries()) {
|
|
194
|
+
let f = a == 0 ? "" : "/";
|
|
195
|
+
if (r += `${f}${n}`, n == t.type)
|
|
196
|
+
return `${r}${e}${t.name}`;
|
|
197
197
|
}
|
|
198
198
|
else
|
|
199
|
-
for (const [a,
|
|
200
|
-
let
|
|
201
|
-
if (
|
|
202
|
-
return `${
|
|
199
|
+
for (const [a, n] of s.entries()) {
|
|
200
|
+
let f = a == 0 ? "" : "/";
|
|
201
|
+
if (r += `${f}${n}`, n == "src")
|
|
202
|
+
return `${r}${e}${t.name}`;
|
|
203
203
|
}
|
|
204
|
-
return `${
|
|
204
|
+
return `${r}${e}${t.name}`;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t) => {
|
|
209
|
-
const
|
|
209
|
+
const r = await x();
|
|
210
210
|
return await c.lib.set({ lib: t.lib, run_from: "renderer", lazy_lib: t.lazy_lib }), {
|
|
211
|
-
set: async (
|
|
212
|
-
console.log("--renderer [set]");
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
let a =
|
|
216
|
-
r:
|
|
211
|
+
set: async (e) => {
|
|
212
|
+
console.log("--renderer [set]"), e.return = e?.return || {}, e.return.r = e?.return?.r || "full";
|
|
213
|
+
const s = new $();
|
|
214
|
+
s.start();
|
|
215
|
+
let a = e.data?.value?.l || e.data.l, n = {
|
|
216
|
+
r: null,
|
|
217
|
+
//``
|
|
217
218
|
style: "",
|
|
218
219
|
head: "",
|
|
219
220
|
// `<test>head-1</test>`
|
|
@@ -221,14 +222,14 @@ const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t
|
|
|
221
222
|
//total:_l.length,
|
|
222
223
|
benchmark: null
|
|
223
224
|
};
|
|
224
|
-
return await (async () => {
|
|
225
|
+
return e.return.r == "full" ? n.r = "" : n.r = [], await (async () => {
|
|
225
226
|
for (const i of a) {
|
|
226
|
-
const
|
|
227
|
+
const m = await await c.lib.get({ name: i.type, run_from: "renderer", lazy_lib: t.lazy_lib }), l = await (await m.lib.index({
|
|
227
228
|
f: {
|
|
228
|
-
name: (
|
|
229
|
-
get_lib: async (
|
|
230
|
-
set_theme: async (
|
|
231
|
-
path: (
|
|
229
|
+
name: (_) => r.f.name({ id: i.id, name: _ }),
|
|
230
|
+
get_lib: async (_) => await await c.lib.get({ name: _.name, run_from: _.run_from, lazy_lib: t.lazy_lib }),
|
|
231
|
+
set_theme: async (_) => await (await g()).set(_),
|
|
232
|
+
path: (_) => c.path.set({ src: m.src, type: i.type, name: _ }),
|
|
232
233
|
//set..
|
|
233
234
|
uuid: () => y().set(),
|
|
234
235
|
wait_until: b
|
|
@@ -241,35 +242,35 @@ const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t
|
|
|
241
242
|
}
|
|
242
243
|
/*_$cb*/
|
|
243
244
|
);
|
|
244
|
-
|
|
245
|
+
e?.return?.r == "full" ? n.r += l?.r || "" : n.r.push(l?.r || ""), n.style += l?.style || "", n.head += l?.head || "";
|
|
245
246
|
}
|
|
246
|
-
})(),
|
|
247
|
+
})(), s.stop(), n.benchmark = s.result(), n;
|
|
247
248
|
}
|
|
248
249
|
};
|
|
249
250
|
}, W = async (t) => {
|
|
250
|
-
const
|
|
251
|
+
const r = await x();
|
|
251
252
|
return await c.lib.set({ lib: t.lib, run_from: "hydrator", lazy_lib: t.lazy_lib }), {
|
|
252
|
-
set: async (
|
|
253
|
+
set: async (e) => {
|
|
253
254
|
console.log("--hydrator [set]");
|
|
254
|
-
const
|
|
255
|
-
|
|
255
|
+
const s = new $();
|
|
256
|
+
s.start();
|
|
256
257
|
let a = {
|
|
257
258
|
r: "",
|
|
258
259
|
style: ""
|
|
259
|
-
},
|
|
260
|
+
}, n = {
|
|
260
261
|
style_id: `${y().set()}_stl`
|
|
261
|
-
},
|
|
262
|
+
}, f = e.data?.value?.l || e.data.l;
|
|
262
263
|
const i = async () => {
|
|
263
|
-
for (const
|
|
264
|
-
const
|
|
264
|
+
for (const m of f) {
|
|
265
|
+
const u = await await c.lib.get({ name: m.type, run_from: "hydrator", lazy_lib: t.lazy_lib }), l = u.lib, _ = h(), w = _.on, d = await (await l.index({
|
|
265
266
|
/**@my module can use it to set custom variables. */
|
|
266
267
|
my: {},
|
|
267
268
|
//NOTE: We cannot add or use any variable of this object, It's reserved for module.
|
|
268
269
|
f: {
|
|
269
|
-
name: (o) =>
|
|
270
|
+
name: (o) => r.f.name({ id: m.id, name: o }),
|
|
270
271
|
get_lib: async (o) => await await c.lib.get({ name: o.name, run_from: o.run_from, lazy_lib: t.lazy_lib }),
|
|
271
272
|
set_theme: async (o) => await (await g()).set(o),
|
|
272
|
-
path: (o) => c.path.set({ src:
|
|
273
|
+
path: (o) => c.path.set({ src: u.src, type: m.type, name: o }),
|
|
273
274
|
//set..
|
|
274
275
|
uuid: () => y().set(),
|
|
275
276
|
wait_until: b,
|
|
@@ -282,7 +283,7 @@ const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t
|
|
|
282
283
|
})).set(
|
|
283
284
|
{
|
|
284
285
|
data: {
|
|
285
|
-
curr:
|
|
286
|
+
curr: m
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
/*_$cb*/
|
|
@@ -290,19 +291,19 @@ const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t
|
|
|
290
291
|
T("msg", async (o) => {
|
|
291
292
|
try {
|
|
292
293
|
if (Object.keys(o.where || {}).length == 0) {
|
|
293
|
-
await
|
|
294
|
+
await _.emit("msg", o);
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
296
297
|
} catch {
|
|
297
298
|
}
|
|
298
299
|
try {
|
|
299
|
-
if (
|
|
300
|
-
await
|
|
300
|
+
if (m?.[o.where?.key || ""] == o.where?.value) {
|
|
301
|
+
await _.emit("msg", o);
|
|
301
302
|
return;
|
|
302
303
|
}
|
|
303
304
|
} catch {
|
|
304
305
|
}
|
|
305
|
-
}), a.style +=
|
|
306
|
+
}), a.style += d.style;
|
|
306
307
|
}
|
|
307
308
|
};
|
|
308
309
|
await b(
|
|
@@ -310,19 +311,19 @@ const p = h(), k = h(), T = p.on, R = p.emit, O = k.emit, I = k.on, P = async (t
|
|
|
310
311
|
50
|
|
311
312
|
), await i();
|
|
312
313
|
try {
|
|
313
|
-
((
|
|
314
|
-
const
|
|
315
|
-
|
|
314
|
+
((m) => {
|
|
315
|
+
const u = document.getElementById(`${n.style_id}`);
|
|
316
|
+
u && u.remove();
|
|
316
317
|
const l = document.createElement("style");
|
|
317
|
-
l.id = `${
|
|
318
|
+
l.id = `${n.style_id}`, l.innerHTML = `${a.style}`, m.appendChild(l);
|
|
318
319
|
})(document.head);
|
|
319
|
-
} catch (
|
|
320
|
-
console.log(`${
|
|
320
|
+
} catch (m) {
|
|
321
|
+
console.log(`${m}, Failed to set style..`);
|
|
321
322
|
}
|
|
322
|
-
return
|
|
323
|
+
return s.stop(), {
|
|
323
324
|
//style_id:_ins.style_id,
|
|
324
325
|
//total:_l.length,
|
|
325
|
-
benchmark:
|
|
326
|
+
benchmark: s.result()
|
|
326
327
|
};
|
|
327
328
|
}
|
|
328
329
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(_=typeof globalThis<"u"?globalThis:_||self,h(_["content-engine-lib"]={}))})(this,(function(_){"use strict";const h=()=>({set:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const n=Math.random()*16|0;return(t=="x"?n:n&3|8).toString(16)})}),g=async()=>({f:{name:t=>`${t.name}${t.id}`}}),x=async()=>({set:async t=>{console.log("--theme");try{if(!t.el_id)throw new Error("[el_id] is required");const n=t.name,e=document.getElementById(t.el_id);if(!e)throw new Error("[el_id] is invalid");(s=>{const a=r=>{(d=>{const i=d.getAttribute("data-ce");if(!i)return;const u=JSON.parse(i).filter(l=>l?.k.startsWith("t-"));if(u.length!=0)for(const l of u){const f=l.k,b=l.v.split(" ");if(f==`t-${n}-class`)for(const o of b)d.classList.add(o);else for(const o of b)d.classList.remove(o)}})(r)};for(const r of s.getElementsByTagName("*"))a(r);a(s)})(e)}catch(n){const e=`err: [theme] ${n}`;throw console.log(e),e}}});function w(t,n=1e3){let e={cnt:0};return new Promise(s=>{const a=()=>{console.log(`[setInterval] is running.. [count=${e.cnt}]`);try{t()&&(clearInterval(r),s())}catch{console.log(`warn: [wait_until] ignoring the exception in setInterval and will check again after [interval=${n}]`)}e.cnt+=1},r=setInterval(()=>{a()},n);a()})}let T=class{listeners={};on=(n,e)=>((this.listeners[n]||=[]).push(e),()=>this.off(n,e));off=(n,e)=>{this.listeners[n]=this.listeners[n]?.filter(s=>s!==e)};emit=async(n,...e)=>{for(const s of this.listeners[n]??[])await s(...e)};emitParallel=async(n,...e)=>{await Promise.all((this.listeners[n]??[]).map(s=>s(...e)))};emitSafe=async(n,...e)=>{for(const s of this.listeners[n]??[])try{await s(...e)}catch(a){this.listeners.error?.forEach(r=>r(a))}}};const y=()=>new T;class ${startTime;endTime;isRunning;constructor(){this.startTime=0,this.endTime=0,this.isRunning=!1}start(){if(this.isRunning)throw new Error("Benchmark has already started.");this.startTime=performance.now(),this.isRunning=!0}stop(){if(!this.isRunning)throw new Error("Benchmark hasn't started.");this.endTime=performance.now(),this.isRunning=!1}result(){if(this.isRunning)throw new Error("Benchmark is still running.");return{time_taken_ms:(this.endTime-this.startTime).toFixed(4)}}}console.log("content-engine-lib");let c={lib:{inbuilt_lib:[],l:{},set:async t=>{const n=t?.lib||[];for(const[e,s]of n.entries()){const a=s,r=`${a.name}:${t.run_from}`,d=`${t.run_from}_src`;let i=a[d];const m=`${t.run_from}_src`;let u=t?.lazy_lib?.[m]||null;if(u&&(u=u.replace("{*}",`${a.name}`)),console.log(`_lazy_src: ${u}`),console.log(`_src: ${i}`),c.lib.l.hasOwnProperty(`${r}`)==!1){if(/^[a-zA-Z0-9]/.test(i)&&i.includes("/")==!1&&c.lib.inbuilt_lib.indexOf(`${a.name}`)===-1)if(u)i=u;else throw`[lib-name=${a.name},lib-src=${i}] not allowed or available in in-build mode. Need to use lazy-lib config.`;if(i.startsWith("./")||i.startsWith("../")){const l=await import(`${i}`);c.lib.l[`${r}`]={lib:l,src:i}}if(i.startsWith("http://")||i.startsWith("https://")){const l=await import(`${i}`);c.lib.l[`${r}`]={lib:l,src:i}}}}console.log(await c.lib.get_all({}))},get:async t=>{let n=null;const e=`${t.name}:${t.run_from}`;return c.lib.l.hasOwnProperty(`${e}`)==!1&&await c.lib.set({lib:[{renderer_src:t.name,hydrator_src:t.name,editor_src:t.name,name:t.name}],run_from:t.run_from,lazy_lib:t.lazy_lib}),n=c.lib.l[`${e}`],n},get_all:async t=>c.lib.l},path:{set:t=>{let n="",e="";const s=t.src.split("/");if(t.src.indexOf("://localhost")!==-1||t.src.indexOf("://127.0.0.1")!==-1||(e="/dist"),s.indexOf(t.type)!==-1)for(const[a,r]of s.entries()){let d=a==0?"":"/";if(n+=`${d}${r}`,r==t.type)return`${n}${e}${t.name}`}else for(const[a,r]of s.entries()){let d=a==0?"":"/";if(n+=`${d}${r}`,r=="src")return`${n}${e}${t.name}`}return`${n}${e}${t.name}`}}};const p=y(),k=y(),E=p.on,O=p.emit,B=k.emit,R=k.on,I=async t=>{const n=await g();return await c.lib.set({lib:t.lib,run_from:"renderer",lazy_lib:t.lazy_lib}),{set:async e=>{console.log("--renderer [set]"),e.return=e?.return||{},e.return.r=e?.return?.r||"full";const s=new $;s.start();let a=e.data?.value?.l||e.data.l,r={r:null,style:"",head:"",benchmark:null};return e.return.r=="full"?r.r="":r.r=[],await(async()=>{for(const i of a){const m=await await c.lib.get({name:i.type,run_from:"renderer",lazy_lib:t.lazy_lib}),l=await(await m.lib.index({f:{name:f=>n.f.name({id:i.id,name:f}),get_lib:async f=>await await c.lib.get({name:f.name,run_from:f.run_from,lazy_lib:t.lazy_lib}),set_theme:async f=>await(await x()).set(f),path:f=>c.path.set({src:m.src,type:i.type,name:f}),uuid:()=>h().set(),wait_until:w}})).set({data:{curr:i}});e?.return?.r=="full"?r.r+=l?.r||"":r.r.push(l?.r||""),r.style+=l?.style||"",r.head+=l?.head||""}})(),s.stop(),r.benchmark=s.result(),r}}},P=async t=>{const n=await g();return await c.lib.set({lib:t.lib,run_from:"hydrator",lazy_lib:t.lazy_lib}),{set:async e=>{console.log("--hydrator [set]");const s=new $;s.start();let a={r:"",style:""},r={style_id:`${h().set()}_stl`},d=e.data?.value?.l||e.data.l;const i=async()=>{for(const m of d){const u=await await c.lib.get({name:m.type,run_from:"hydrator",lazy_lib:t.lazy_lib}),l=u.lib,f=y(),z=f.on,b=await(await l.index({my:{},f:{name:o=>n.f.name({id:m.id,name:o}),get_lib:async o=>await await c.lib.get({name:o.name,run_from:o.run_from,lazy_lib:t.lazy_lib}),set_theme:async o=>await(await x()).set(o),path:o=>c.path.set({src:u.src,type:m.type,name:o}),uuid:()=>h().set(),wait_until:w,call:B,listen:z,new_emitter:()=>y()}})).set({data:{curr:m}});E("msg",async o=>{try{if(Object.keys(o.where||{}).length==0){await f.emit("msg",o);return}}catch{}try{if(m?.[o.where?.key||""]==o.where?.value){await f.emit("msg",o);return}}catch{}}),a.style+=b.style}};await w(()=>document.readyState==="complete"||typeof window<"u",50),await i();try{(m=>{const u=document.getElementById(`${r.style_id}`);u&&u.remove();const l=document.createElement("style");l.id=`${r.style_id}`,l.innerHTML=`${a.style}`,m.appendChild(l)})(document.head)}catch(m){console.log(`${m}, Failed to set style..`)}return s.stop(),{benchmark:s.result()}}}};_.ce_call=O,_.ce_hydrator=P,_.ce_listen=R,_.ce_renderer=I,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/u/types/index.d.ts
CHANGED
package/package.json
CHANGED