content-engine-lib 1.0.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.
- package/LICENSE +27 -0
- package/README.md +12 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.es.js +261 -0
- package/dist/index.umd.js +3 -0
- package/dist/l/editor/hydrator/index.d.ts +8 -0
- package/dist/l/editor/hydrator/index__OLD.d.ts +19 -0
- package/dist/l/editor/renderer/index.d.ts +8 -0
- package/dist/l/editor/renderer/index__OLD.d.ts +19 -0
- package/dist/l/editor/shared/api/component/index/index.d.ts +13 -0
- package/dist/l/editor/shared/types/index.d.ts +35 -0
- package/dist/l/table/editor/index.d.ts +7 -0
- package/dist/l/table/hydrator/index.d.ts +11 -0
- package/dist/l/table/renderer/index.d.ts +8 -0
- package/dist/l/table/shared/types/index.d.ts +45 -0
- package/dist/l/text/editor/index.d.ts +7 -0
- package/dist/l/text/hydrator/index.d.ts +11 -0
- package/dist/l/text/renderer/index.d.ts +8 -0
- package/dist/l/text/shared/types/index.d.ts +35 -0
- package/dist/logo.svg +106 -0
- package/dist/u/helper/index.d.ts +9 -0
- package/dist/u/observe/index.d.ts +9 -0
- package/dist/u/theme/index.d.ts +8 -0
- package/dist/u/types/index.d.ts +23 -0
- package/dist/u/uuid/index.d.ts +4 -0
- package/dist/u/wait_until/index.d.ts +2 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
### **2. LICENSE (MIT)**
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Coreutility
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { editor_p_TYP, hydrator_p_TYP, renderer_p_TYP } from './u/types';
|
|
2
|
+
declare const renderer: (_p: renderer_p_TYP) => Promise<{
|
|
3
|
+
set: (_$p: {
|
|
4
|
+
data: {
|
|
5
|
+
l: any[];
|
|
6
|
+
} | any;
|
|
7
|
+
}, _$cb?: {}) => Promise<{
|
|
8
|
+
r: string;
|
|
9
|
+
style: string;
|
|
10
|
+
head: string;
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
declare const hydrator: (_p: hydrator_p_TYP) => Promise<{
|
|
14
|
+
set: (_$p: {
|
|
15
|
+
data: {
|
|
16
|
+
l: any[];
|
|
17
|
+
} | any;
|
|
18
|
+
}, _$cb?: {}) => Promise<{
|
|
19
|
+
r: string;
|
|
20
|
+
style: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
declare const editor: (_p: editor_p_TYP) => Promise<{
|
|
24
|
+
set: (_$p: {
|
|
25
|
+
data: {
|
|
26
|
+
l: any[];
|
|
27
|
+
};
|
|
28
|
+
}, _$cb?: {
|
|
29
|
+
change: (_v: any) => any;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
r: string;
|
|
32
|
+
style: string;
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
export { renderer as ce_renderer, hydrator as ce_hydrator, editor as ce_editor };
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
const h = () => ({
|
|
2
|
+
set: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
3
|
+
const a = Math.random() * 16 | 0;
|
|
4
|
+
return (t == "x" ? a : a & 3 | 8).toString(16);
|
|
5
|
+
})
|
|
6
|
+
}), f = async () => ({
|
|
7
|
+
f: {
|
|
8
|
+
name: (t) => `${t.name}${t.id}`
|
|
9
|
+
}
|
|
10
|
+
}), w = async () => ({
|
|
11
|
+
set: async (t) => {
|
|
12
|
+
console.log("--theme");
|
|
13
|
+
try {
|
|
14
|
+
if (!t.el_id)
|
|
15
|
+
throw new Error("[el_id] is required");
|
|
16
|
+
const a = t.name, n = document.getElementById(t.el_id);
|
|
17
|
+
if (!n)
|
|
18
|
+
throw new Error("[el_id] is invalid");
|
|
19
|
+
((_) => {
|
|
20
|
+
const r = (s) => {
|
|
21
|
+
((i) => {
|
|
22
|
+
const l = i.getAttribute("data-ce");
|
|
23
|
+
if (!l)
|
|
24
|
+
return;
|
|
25
|
+
const o = JSON.parse(l).filter((e) => e?.k.startsWith("t-"));
|
|
26
|
+
if (o.length != 0)
|
|
27
|
+
for (const e of o) {
|
|
28
|
+
const y = e.k, m = e.v.split(" ");
|
|
29
|
+
if (y == `t-${a}-class`)
|
|
30
|
+
for (const u of m)
|
|
31
|
+
i.classList.add(u);
|
|
32
|
+
else
|
|
33
|
+
for (const u of m)
|
|
34
|
+
i.classList.remove(u);
|
|
35
|
+
}
|
|
36
|
+
})(s);
|
|
37
|
+
};
|
|
38
|
+
for (const s of _.getElementsByTagName("*"))
|
|
39
|
+
r(s);
|
|
40
|
+
r(_);
|
|
41
|
+
})(n);
|
|
42
|
+
} catch (a) {
|
|
43
|
+
const n = `err: [theme] ${a}`;
|
|
44
|
+
throw console.log(n), n;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function x(t, a = 1e3) {
|
|
49
|
+
let n = {
|
|
50
|
+
cnt: 0
|
|
51
|
+
};
|
|
52
|
+
return new Promise((_) => {
|
|
53
|
+
const r = () => {
|
|
54
|
+
console.log(`[setInterval] is running.. [count=${n.cnt}]`);
|
|
55
|
+
try {
|
|
56
|
+
t() && (clearInterval(s), _());
|
|
57
|
+
} catch {
|
|
58
|
+
console.log(`warn: [wait_until] ignoring the exception in setInterval and will check again after [interval=${a}]`);
|
|
59
|
+
}
|
|
60
|
+
n.cnt += 1;
|
|
61
|
+
}, s = setInterval(() => {
|
|
62
|
+
r();
|
|
63
|
+
}, a);
|
|
64
|
+
r();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
console.log("content_engine_lib");
|
|
68
|
+
let c = {
|
|
69
|
+
lib: {
|
|
70
|
+
inbuilt_lib: [],
|
|
71
|
+
// <any>[], // [`text`,`table`,`editor`]
|
|
72
|
+
l: {},
|
|
73
|
+
set: async (t) => {
|
|
74
|
+
const a = t?.lib || [];
|
|
75
|
+
for (const [n, _] of a.entries()) {
|
|
76
|
+
const r = _, s = `${r.name}:${t.run_from}`, i = `${t.run_from}_src`;
|
|
77
|
+
let l = r[i];
|
|
78
|
+
const d = `${t.run_from}_src`;
|
|
79
|
+
let o = t?.lazy_lib?.[d] || null;
|
|
80
|
+
if (o && (o = o.replace("{*}", `${r.name}`)), console.log(`_lazy_src: ${o}`), console.log(`_src: ${l}`), c.lib.l.hasOwnProperty(`${s}`) == !1) {
|
|
81
|
+
if (/^[a-zA-Z0-9]/.test(l) && l.includes("/") == !1 && c.lib.inbuilt_lib.indexOf(`${r.name}`) === -1)
|
|
82
|
+
if (o)
|
|
83
|
+
l = o;
|
|
84
|
+
else
|
|
85
|
+
throw `[lib-name=${r.name},lib-src=${l}] not allowed or available in in-build mode. Need to use lazy-lib config.`;
|
|
86
|
+
if (l.startsWith("./") || l.startsWith("../")) {
|
|
87
|
+
const e = await import(
|
|
88
|
+
/* @vite-ignore */
|
|
89
|
+
/* webpackIgnore: true */
|
|
90
|
+
`${l}`
|
|
91
|
+
);
|
|
92
|
+
c.lib.l[`${s}`] = {
|
|
93
|
+
lib: e,
|
|
94
|
+
src: l
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (l.startsWith("http://") || l.startsWith("https://")) {
|
|
98
|
+
const e = await import(
|
|
99
|
+
/* @vite-ignore */
|
|
100
|
+
/* webpackIgnore: true */
|
|
101
|
+
`${l}`
|
|
102
|
+
);
|
|
103
|
+
c.lib.l[`${s}`] = {
|
|
104
|
+
lib: e,
|
|
105
|
+
src: l
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
console.log(await c.lib.get_all({}));
|
|
111
|
+
},
|
|
112
|
+
get: async (t) => {
|
|
113
|
+
let a = null;
|
|
114
|
+
const n = `${t.name}:${t.run_from}`;
|
|
115
|
+
return c.lib.l.hasOwnProperty(`${n}`) == !1 && await c.lib.set({
|
|
116
|
+
lib: [
|
|
117
|
+
{
|
|
118
|
+
renderer_src: t.name,
|
|
119
|
+
hydrator_src: t.name,
|
|
120
|
+
editor_src: t.name,
|
|
121
|
+
name: t.name
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
run_from: t.run_from,
|
|
125
|
+
lazy_lib: t.lazy_lib
|
|
126
|
+
}), a = c.lib.l[`${n}`], a;
|
|
127
|
+
},
|
|
128
|
+
get_all: async (t) => c.lib.l
|
|
129
|
+
},
|
|
130
|
+
path: {
|
|
131
|
+
set: (t) => {
|
|
132
|
+
let a = "", n = "";
|
|
133
|
+
const _ = t.src.split("/");
|
|
134
|
+
if (t.src.indexOf("://localhost") !== -1 || t.src.indexOf("://127.0.0.1") !== -1 || (n = "/dist"), _.indexOf(t.type) !== -1)
|
|
135
|
+
for (const [r, s] of _.entries()) {
|
|
136
|
+
let i = r == 0 ? "" : "/";
|
|
137
|
+
if (a += `${i}${s}`, s == t.type)
|
|
138
|
+
return `${a}${n}${t.name}`;
|
|
139
|
+
}
|
|
140
|
+
else
|
|
141
|
+
for (const [r, s] of _.entries()) {
|
|
142
|
+
let i = r == 0 ? "" : "/";
|
|
143
|
+
if (a += `${i}${s}`, s == "src")
|
|
144
|
+
return `${a}${n}${t.name}`;
|
|
145
|
+
}
|
|
146
|
+
return `${a}${n}${t.name}`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const $ = async (t) => {
|
|
151
|
+
const a = await f();
|
|
152
|
+
return await c.lib.set({ lib: t.lib, run_from: "renderer", lazy_lib: t.lazy_lib }), {
|
|
153
|
+
set: async (n, _) => {
|
|
154
|
+
console.log("--renderer [set]");
|
|
155
|
+
let r = {
|
|
156
|
+
r: "",
|
|
157
|
+
style: "",
|
|
158
|
+
head: ""
|
|
159
|
+
// `<test>head-1</test>`
|
|
160
|
+
};
|
|
161
|
+
return await (async () => {
|
|
162
|
+
for (const i of n.data?.value?.l || n.data.l) {
|
|
163
|
+
const l = await await c.lib.get({ name: i.type, run_from: "renderer", lazy_lib: t.lazy_lib }), o = await (await l.lib.index({
|
|
164
|
+
f: {
|
|
165
|
+
name: (e) => a.f.name({ id: i.id, name: e }),
|
|
166
|
+
get_lib: async (e) => await await c.lib.get({ name: e.name, run_from: e.run_from, lazy_lib: t.lazy_lib }),
|
|
167
|
+
set_theme: async (e) => await (await w()).set(e),
|
|
168
|
+
path: (e) => c.path.set({ src: l.src, type: i.type, name: e })
|
|
169
|
+
}
|
|
170
|
+
})).set({
|
|
171
|
+
data: {
|
|
172
|
+
curr: i
|
|
173
|
+
}
|
|
174
|
+
}, _);
|
|
175
|
+
r.r += o?.r || "", r.style += o?.style || "", r.head += o?.head || "";
|
|
176
|
+
}
|
|
177
|
+
})(), r;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}, g = async (t) => {
|
|
181
|
+
const a = await f();
|
|
182
|
+
return await c.lib.set({ lib: t.lib, run_from: "hydrator", lazy_lib: t.lazy_lib }), {
|
|
183
|
+
set: async (n, _) => {
|
|
184
|
+
console.log("--hydrator [set]");
|
|
185
|
+
let r = {
|
|
186
|
+
r: "",
|
|
187
|
+
style: ""
|
|
188
|
+
};
|
|
189
|
+
const s = async () => {
|
|
190
|
+
for (const i of n.data?.value?.l || n.data.l) {
|
|
191
|
+
const l = await await c.lib.get({ name: i.type, run_from: "hydrator", lazy_lib: t.lazy_lib }), o = await (await l.lib.index({
|
|
192
|
+
f: {
|
|
193
|
+
name: (e) => a.f.name({ id: i.id, name: e }),
|
|
194
|
+
get_lib: async (e) => await await c.lib.get({ name: e.name, run_from: e.run_from, lazy_lib: t.lazy_lib }),
|
|
195
|
+
set_theme: async (e) => await (await w()).set(e),
|
|
196
|
+
path: (e) => c.path.set({ src: l.src, type: i.type, name: e })
|
|
197
|
+
}
|
|
198
|
+
})).set({
|
|
199
|
+
data: {
|
|
200
|
+
curr: i
|
|
201
|
+
}
|
|
202
|
+
}, _);
|
|
203
|
+
r.style += o.style;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
return await x(
|
|
207
|
+
() => document.readyState === "complete" || typeof window < "u",
|
|
208
|
+
50
|
|
209
|
+
), await s(), r;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}, z = async (t) => (await f(), await c.lib.set({ lib: t.lib, run_from: "editor", lazy_lib: t.lazy_lib }), {
|
|
213
|
+
set: async (a, n) => {
|
|
214
|
+
console.log("--editor [set]");
|
|
215
|
+
let _ = {
|
|
216
|
+
data: {
|
|
217
|
+
l: [
|
|
218
|
+
{
|
|
219
|
+
id: h().set(),
|
|
220
|
+
type: "editor",
|
|
221
|
+
data: {
|
|
222
|
+
l: []
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
}, r = {
|
|
228
|
+
r: "",
|
|
229
|
+
style: ""
|
|
230
|
+
};
|
|
231
|
+
const s = $, i = g, l = await s({
|
|
232
|
+
lib: t.lib,
|
|
233
|
+
lazy_lib: t.lazy_lib
|
|
234
|
+
}), d = await i({
|
|
235
|
+
lib: t.lib,
|
|
236
|
+
lazy_lib: t.lazy_lib
|
|
237
|
+
}), o = await l.set({
|
|
238
|
+
data: _.data
|
|
239
|
+
});
|
|
240
|
+
return (async () => {
|
|
241
|
+
const e = await d.set({
|
|
242
|
+
data: _.data
|
|
243
|
+
}, {
|
|
244
|
+
change: (y) => {
|
|
245
|
+
n?.change(y);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
((y) => {
|
|
249
|
+
const b = document.createElement("style");
|
|
250
|
+
b.innerHTML = `${e.style}`, y.appendChild(b);
|
|
251
|
+
})(document.head);
|
|
252
|
+
})(), r.r = o.r, r.style = `
|
|
253
|
+
${o.style}
|
|
254
|
+
`, r;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
export {
|
|
258
|
+
z as ce_editor,
|
|
259
|
+
g as ce_hydrator,
|
|
260
|
+
$ as ce_renderer
|
|
261
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(d,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(d=typeof globalThis<"u"?globalThis:d||self,u(d["content-engine-lib"]={}))})(this,(function(d){"use strict";const u=()=>({set:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const a=Math.random()*16|0;return(e=="x"?a:a&3|8).toString(16)})}),b=async()=>({f:{name:e=>`${e.name}${e.id}`}}),w=async()=>({set:async e=>{console.log("--theme");try{if(!e.el_id)throw new Error("[el_id] is required");const a=e.name,r=document.getElementById(e.el_id);if(!r)throw new Error("[el_id] is invalid");(_=>{const n=s=>{(i=>{const l=i.getAttribute("data-ce");if(!l)return;const c=JSON.parse(l).filter(t=>t?.k.startsWith("t-"));if(c.length!=0)for(const t of c){const f=t.k,g=t.v.split(" ");if(f==`t-${a}-class`)for(const h of g)i.classList.add(h);else for(const h of g)i.classList.remove(h)}})(s)};for(const s of _.getElementsByTagName("*"))n(s);n(_)})(r)}catch(a){const r=`err: [theme] ${a}`;throw console.log(r),r}}});function p(e,a=1e3){let r={cnt:0};return new Promise(_=>{const n=()=>{console.log(`[setInterval] is running.. [count=${r.cnt}]`);try{e()&&(clearInterval(s),_())}catch{console.log(`warn: [wait_until] ignoring the exception in setInterval and will check again after [interval=${a}]`)}r.cnt+=1},s=setInterval(()=>{n()},a);n()})}console.log("content_engine_lib");let o={lib:{inbuilt_lib:[],l:{},set:async e=>{const a=e?.lib||[];for(const[r,_]of a.entries()){const n=_,s=`${n.name}:${e.run_from}`,i=`${e.run_from}_src`;let l=n[i];const y=`${e.run_from}_src`;let c=e?.lazy_lib?.[y]||null;if(c&&(c=c.replace("{*}",`${n.name}`)),console.log(`_lazy_src: ${c}`),console.log(`_src: ${l}`),o.lib.l.hasOwnProperty(`${s}`)==!1){if(/^[a-zA-Z0-9]/.test(l)&&l.includes("/")==!1&&o.lib.inbuilt_lib.indexOf(`${n.name}`)===-1)if(c)l=c;else throw`[lib-name=${n.name},lib-src=${l}] not allowed or available in in-build mode. Need to use lazy-lib config.`;if(l.startsWith("./")||l.startsWith("../")){const t=await import(`${l}`);o.lib.l[`${s}`]={lib:t,src:l}}if(l.startsWith("http://")||l.startsWith("https://")){const t=await import(`${l}`);o.lib.l[`${s}`]={lib:t,src:l}}}}console.log(await o.lib.get_all({}))},get:async e=>{let a=null;const r=`${e.name}:${e.run_from}`;return o.lib.l.hasOwnProperty(`${r}`)==!1&&await o.lib.set({lib:[{renderer_src:e.name,hydrator_src:e.name,editor_src:e.name,name:e.name}],run_from:e.run_from,lazy_lib:e.lazy_lib}),a=o.lib.l[`${r}`],a},get_all:async e=>o.lib.l},path:{set:e=>{let a="",r="";const _=e.src.split("/");if(e.src.indexOf("://localhost")!==-1||e.src.indexOf("://127.0.0.1")!==-1||(r="/dist"),_.indexOf(e.type)!==-1)for(const[n,s]of _.entries()){let i=n==0?"":"/";if(a+=`${i}${s}`,s==e.type)return`${a}${r}${e.name}`}else for(const[n,s]of _.entries()){let i=n==0?"":"/";if(a+=`${i}${s}`,s=="src")return`${a}${r}${e.name}`}return`${a}${r}${e.name}`}}};const $=async e=>{const a=await b();return await o.lib.set({lib:e.lib,run_from:"renderer",lazy_lib:e.lazy_lib}),{set:async(r,_)=>{console.log("--renderer [set]");let n={r:"",style:"",head:""};return await(async()=>{for(const i of r.data?.value?.l||r.data.l){const l=await await o.lib.get({name:i.type,run_from:"renderer",lazy_lib:e.lazy_lib}),c=await(await l.lib.index({f:{name:t=>a.f.name({id:i.id,name:t}),get_lib:async t=>await await o.lib.get({name:t.name,run_from:t.run_from,lazy_lib:e.lazy_lib}),set_theme:async t=>await(await w()).set(t),path:t=>o.path.set({src:l.src,type:i.type,name:t})}})).set({data:{curr:i}},_);n.r+=c?.r||"",n.style+=c?.style||"",n.head+=c?.head||""}})(),n}}},x=async e=>{const a=await b();return await o.lib.set({lib:e.lib,run_from:"hydrator",lazy_lib:e.lazy_lib}),{set:async(r,_)=>{console.log("--hydrator [set]");let n={r:"",style:""};const s=async()=>{for(const i of r.data?.value?.l||r.data.l){const l=await await o.lib.get({name:i.type,run_from:"hydrator",lazy_lib:e.lazy_lib}),c=await(await l.lib.index({f:{name:t=>a.f.name({id:i.id,name:t}),get_lib:async t=>await await o.lib.get({name:t.name,run_from:t.run_from,lazy_lib:e.lazy_lib}),set_theme:async t=>await(await w()).set(t),path:t=>o.path.set({src:l.src,type:i.type,name:t})}})).set({data:{curr:i}},_);n.style+=c.style}};return await p(()=>document.readyState==="complete"||typeof window<"u",50),await s(),n}}},z=async e=>(await b(),await o.lib.set({lib:e.lib,run_from:"editor",lazy_lib:e.lazy_lib}),{set:async(a,r)=>{console.log("--editor [set]");let _={data:{l:[{id:u().set(),type:"editor",data:{l:[]}}]}},n={r:"",style:""};const s=$,i=x,l=await s({lib:e.lib,lazy_lib:e.lazy_lib}),y=await i({lib:e.lib,lazy_lib:e.lazy_lib}),c=await l.set({data:_.data});return(async()=>{const t=await y.set({data:_.data},{change:f=>{r?.change(f)}});(f=>{const m=document.createElement("style");m.innerHTML=`${t.style}`,f.appendChild(m)})(document.head)})(),n.r=c.r,n.style=`
|
|
2
|
+
${c.style}
|
|
3
|
+
`,n}});d.ce_editor=z,d.ce_hydrator=x,d.ce_renderer=$,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const index: (_p: {
|
|
2
|
+
f: {
|
|
3
|
+
name: (v: string) => string;
|
|
4
|
+
};
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
set: (_$p: {
|
|
7
|
+
data: {
|
|
8
|
+
curr: {
|
|
9
|
+
"id": "";
|
|
10
|
+
"type": "editor";
|
|
11
|
+
"data": string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
r: string;
|
|
16
|
+
style: string;
|
|
17
|
+
}>;
|
|
18
|
+
}>;
|
|
19
|
+
export { index };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const index: (_p: {
|
|
2
|
+
f: {
|
|
3
|
+
name: (v: string) => string;
|
|
4
|
+
};
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
set: (_$p: {
|
|
7
|
+
data: {
|
|
8
|
+
curr: {
|
|
9
|
+
"id": "";
|
|
10
|
+
"type": "editor";
|
|
11
|
+
"data": string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
r: string;
|
|
16
|
+
style: string;
|
|
17
|
+
}>;
|
|
18
|
+
}>;
|
|
19
|
+
export { index };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type _p_TYP = {
|
|
2
|
+
f: {
|
|
3
|
+
name: (v: string) => string;
|
|
4
|
+
get_lib: (v: {
|
|
5
|
+
name: string;
|
|
6
|
+
run_from: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
set_theme: (v: {
|
|
9
|
+
name: string;
|
|
10
|
+
el_id: string;
|
|
11
|
+
}) => any;
|
|
12
|
+
path: (v: string) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type _$p_TYP = {
|
|
16
|
+
data: {
|
|
17
|
+
curr: {
|
|
18
|
+
"id": "";
|
|
19
|
+
"type": "editor";
|
|
20
|
+
"data": {
|
|
21
|
+
"l": any[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type _$cb_TYP = {
|
|
27
|
+
change: (_v: {
|
|
28
|
+
_$p: _$p_TYP;
|
|
29
|
+
}) => any;
|
|
30
|
+
add: (_v: {
|
|
31
|
+
$d: _$p_TYP[`data`][`curr`][`data`];
|
|
32
|
+
el: HTMLElement;
|
|
33
|
+
}) => any;
|
|
34
|
+
};
|
|
35
|
+
export type { _p_TYP, _$p_TYP, _$cb_TYP };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { _$cb_TYP, _$p_TYP, _p_TYP } from '../shared/types';
|
|
2
|
+
declare const index: (_p: _p_TYP) => Promise<{
|
|
3
|
+
set: (_$p: _$p_TYP, _$cb: _$cb_TYP) => Promise<{
|
|
4
|
+
r: string;
|
|
5
|
+
style: string;
|
|
6
|
+
evt: {
|
|
7
|
+
change: () => void;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
export { index, index as hydrator };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type _p_TYP = {
|
|
2
|
+
f: {
|
|
3
|
+
name: (v: string) => string;
|
|
4
|
+
get_lib: (v: {
|
|
5
|
+
name: string;
|
|
6
|
+
run_from: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
set_theme: (v: {
|
|
9
|
+
name: string;
|
|
10
|
+
el_id: string;
|
|
11
|
+
}) => any;
|
|
12
|
+
path: (v: string) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type _$p_TYP = {
|
|
16
|
+
data: {
|
|
17
|
+
curr: {
|
|
18
|
+
"id": "";
|
|
19
|
+
"type": "table";
|
|
20
|
+
"data": {
|
|
21
|
+
sortBy: string;
|
|
22
|
+
sortDirection: string;
|
|
23
|
+
columns: {
|
|
24
|
+
key: string;
|
|
25
|
+
title: string;
|
|
26
|
+
type: 'number' | 'string';
|
|
27
|
+
sortable: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
rows: {
|
|
30
|
+
id: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type _$cb_TYP = {
|
|
37
|
+
change: (_v: {
|
|
38
|
+
_$p: _$p_TYP;
|
|
39
|
+
}) => any;
|
|
40
|
+
add: (_v: {
|
|
41
|
+
$d: _$p_TYP[`data`][`curr`][`data`][`columns`][`0`] | _$p_TYP[`data`][`curr`][`data`][`rows`][`0`] | any;
|
|
42
|
+
el: HTMLElement;
|
|
43
|
+
}) => any;
|
|
44
|
+
};
|
|
45
|
+
export type { _p_TYP, _$p_TYP, _$cb_TYP };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { _p_TYP, _$cb_TYP, _$p_TYP } from '../shared/types';
|
|
2
|
+
declare const index: (_p: _p_TYP) => Promise<{
|
|
3
|
+
set: (_$p: _$p_TYP, _$cb?: _$cb_TYP) => Promise<{
|
|
4
|
+
r: string;
|
|
5
|
+
style: string;
|
|
6
|
+
evt: {
|
|
7
|
+
change: () => void;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
export { index, index as hydrator };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type _p_TYP = {
|
|
2
|
+
f: {
|
|
3
|
+
name: (v: string) => string;
|
|
4
|
+
get_lib: (v: {
|
|
5
|
+
name: string;
|
|
6
|
+
run_from: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
set_theme: (v: {
|
|
9
|
+
name: string;
|
|
10
|
+
el_id: string;
|
|
11
|
+
}) => any;
|
|
12
|
+
path: (v: string) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type _$p_TYP = {
|
|
16
|
+
data: {
|
|
17
|
+
curr: {
|
|
18
|
+
"id": "";
|
|
19
|
+
"type": "text";
|
|
20
|
+
"data": {
|
|
21
|
+
"data": string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type _$cb_TYP = {
|
|
27
|
+
change: (_v: {
|
|
28
|
+
_$p: _$p_TYP;
|
|
29
|
+
}) => any;
|
|
30
|
+
add: (_v: {
|
|
31
|
+
$d: _$p_TYP[`data`][`curr`][`data`];
|
|
32
|
+
el: HTMLElement;
|
|
33
|
+
}) => any;
|
|
34
|
+
};
|
|
35
|
+
export type { _p_TYP, _$p_TYP, _$cb_TYP };
|
package/dist/logo.svg
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<svg width="260" height="260" viewBox="0 0 260 260" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
|
|
3
|
+
<!-- ======= GRADIENTS ======= -->
|
|
4
|
+
<defs>
|
|
5
|
+
<!-- Gear metallic gradient -->
|
|
6
|
+
<linearGradient id="gearGrad" x1="0" y1="0" x2="1" y2="1">
|
|
7
|
+
<stop offset="0%" stop-color="#dfe7ff"/>
|
|
8
|
+
<stop offset="100%" stop-color="#9db4ff"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
|
|
11
|
+
<!-- Inner 3D shadow -->
|
|
12
|
+
<radialGradient id="innerShadow" cx="50%" cy="50%" r="60%">
|
|
13
|
+
<stop offset="60%" stop-color="rgba(0,0,0,0)" />
|
|
14
|
+
<stop offset="100%" stop-color="rgba(0,0,0,0.25)" />
|
|
15
|
+
</radialGradient>
|
|
16
|
+
|
|
17
|
+
<!-- Outer rim highlight -->
|
|
18
|
+
<radialGradient id="rimLight" cx="50%" cy="50%" r="70%">
|
|
19
|
+
<stop offset="70%" stop-color="rgba(255,255,255,0)" />
|
|
20
|
+
<stop offset="100%" stop-color="rgba(255,255,255,0.6)" />
|
|
21
|
+
</radialGradient>
|
|
22
|
+
</defs>
|
|
23
|
+
|
|
24
|
+
<!-- ======= CIRCLE BADGE ======= -->
|
|
25
|
+
|
|
26
|
+
<!-- Outer circle (outline only) -->
|
|
27
|
+
<circle cx="130" cy="130" r="118"
|
|
28
|
+
fill="#ffffff"
|
|
29
|
+
stroke="#111"
|
|
30
|
+
stroke-width="6"/>
|
|
31
|
+
|
|
32
|
+
<!-- Rim highlight -->
|
|
33
|
+
<circle cx="130" cy="130" r="118"
|
|
34
|
+
fill="url(#rimLight)"/>
|
|
35
|
+
|
|
36
|
+
<!-- Inner 3D shadow ring -->
|
|
37
|
+
<circle cx="130" cy="130" r="95"
|
|
38
|
+
fill="none"
|
|
39
|
+
stroke="url(#innerShadow)"
|
|
40
|
+
stroke-width="18"/>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<!-- ======= CONTENT GRID (subtle, outline only) ======= -->
|
|
44
|
+
<g stroke="#bfc7d8" stroke-width="4" stroke-linecap="round">
|
|
45
|
+
<line x1="60" y1="70" x2="200" y2="70"/>
|
|
46
|
+
<line x1="60" y1="100" x2="200" y2="100"/>
|
|
47
|
+
<line x1="60" y1="200" x2="200" y2="200"/>
|
|
48
|
+
<line x1="60" y1="170" x2="200" y2="170"/>
|
|
49
|
+
<line x1="60" y1="135" x2="150" y2="135"/>
|
|
50
|
+
</g>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<!-- ======= GRADIENT GEAR (outline, 3D) ======= -->
|
|
54
|
+
<path
|
|
55
|
+
d="M130 62
|
|
56
|
+
l14 -8 10 10 16 -4 6 14 16 2 2 16 14 6 -4 16 10 10 -8 14 8 14 -10 10
|
|
57
|
+
4 16 -14 6 -2 16 -16 2 -6 14 -16 -4 -10 10 -14 -8 -14 8 -10 -10 -16 4
|
|
58
|
+
-6 -14 -16 -2 -2 -16 -14 -6 4 -16 -10 -10 8 -14 -8 -14 10 -10 -4 -16
|
|
59
|
+
14 -6 2 -16 16 -2 6 -14 16 4 10 -10 14 8z"
|
|
60
|
+
fill="url(#gearGrad)"
|
|
61
|
+
stroke="#111"
|
|
62
|
+
stroke-width="8"
|
|
63
|
+
stroke-linejoin="round"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<!-- ======= SCI-FI ANGULAR CE ======= -->
|
|
68
|
+
<g fill="#111" transform="translate(130 135)">
|
|
69
|
+
|
|
70
|
+
<!-- C (angular, tech-cut) -->
|
|
71
|
+
<path d="
|
|
72
|
+
M -48 -26
|
|
73
|
+
L -10 -26
|
|
74
|
+
L -10 -12
|
|
75
|
+
L -32 -12
|
|
76
|
+
L -32 12
|
|
77
|
+
L -10 12
|
|
78
|
+
L -10 26
|
|
79
|
+
L -48 26
|
|
80
|
+
Q -60 26 -60 12
|
|
81
|
+
L -60 -12
|
|
82
|
+
Q -60 -26 -48 -26
|
|
83
|
+
Z
|
|
84
|
+
"/>
|
|
85
|
+
|
|
86
|
+
<!-- E (sharp sci-fi) -->
|
|
87
|
+
<path d="
|
|
88
|
+
M 10 -26
|
|
89
|
+
L 52 -26
|
|
90
|
+
L 52 -12
|
|
91
|
+
L 26 -12
|
|
92
|
+
L 26 -4
|
|
93
|
+
L 46 -4
|
|
94
|
+
L 46 10
|
|
95
|
+
L 26 10
|
|
96
|
+
L 26 18
|
|
97
|
+
L 52 18
|
|
98
|
+
L 52 32
|
|
99
|
+
L 10 32
|
|
100
|
+
Z
|
|
101
|
+
"/>
|
|
102
|
+
|
|
103
|
+
</g>
|
|
104
|
+
|
|
105
|
+
</svg>
|
|
106
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ChangeCallback = (path: string, key: PropertyKey, oldValue: any, newValue: any) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Recursively creates a Proxy for an object to observe deep changes.
|
|
4
|
+
* @param target The object or array to observe.
|
|
5
|
+
* @param onChange The callback function to execute on change or deletion.
|
|
6
|
+
* @param path The current path (used for internal recursion).
|
|
7
|
+
*/
|
|
8
|
+
declare function index<T extends object>(target: T, onChange: ChangeCallback, path?: string): T;
|
|
9
|
+
export { index as createObserver };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type renderer_p_TYP = {
|
|
2
|
+
lib?: {
|
|
3
|
+
/**`text_library` || `../my_libs_path/text_library/renderer/index.ts` || `https://example.com/text_library/renderer/index.es` */
|
|
4
|
+
renderer_src: string;
|
|
5
|
+
/**`text_library` || `../my_libs_path/text_library/hydrator/index.ts` || `https://example.com/text_library/hydrator/index.es` */
|
|
6
|
+
hydrator_src: string;
|
|
7
|
+
/**`text_library` || `../my_libs_path/text_library/editor/index.ts` || `https://example.com/text_library/editor/index.es` */
|
|
8
|
+
editor_src: string;
|
|
9
|
+
/**`text_library` */
|
|
10
|
+
name: string;
|
|
11
|
+
}[];
|
|
12
|
+
lazy_lib?: {
|
|
13
|
+
/**http://localhost:5173/src/l/{*}/renderer/index.ts*/
|
|
14
|
+
renderer_src: string;
|
|
15
|
+
/**http://localhost:5173/src/l/{*}/hydrator/index.ts */
|
|
16
|
+
hydrator_src: string;
|
|
17
|
+
/**http://localhost:5173/src/l/{*}/editor/index.ts */
|
|
18
|
+
editor_src: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type hydrator_p_TYP = renderer_p_TYP;
|
|
22
|
+
type editor_p_TYP = renderer_p_TYP;
|
|
23
|
+
export type { renderer_p_TYP, hydrator_p_TYP, editor_p_TYP };
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "content-engine-lib",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A lightweight library for content engine functionality",
|
|
5
|
+
"keywords": ["content", "engine", "library"],
|
|
6
|
+
"author": "Coreutility",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "vite",
|
|
11
|
+
"build": "tsc && vite build",
|
|
12
|
+
"preview": "vite preview"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^24.9.1",
|
|
16
|
+
"typescript": "~5.9.3",
|
|
17
|
+
"vite": "^7.1.7",
|
|
18
|
+
"vite-plugin-dts": "^4.5.4"
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
"main": "./dist/index.umd.js",
|
|
23
|
+
"module": "./dist/index.es.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./dist/index.es.js",
|
|
28
|
+
"require": "./dist/index.umd.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
}
|