@forgedevstack/ink 1.0.1 → 1.1.1
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 +34 -0
- package/README.md +78 -122
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +524 -172
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -0
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts +11 -0
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +179 -0
- package/dist/components/InkEditor/components/AiPanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/AiPanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.d.ts +9 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +12 -0
- package/dist/components/InkEditor/components/BlockHandles/index.d.ts +3 -0
- package/dist/components/InkEditor/components/BlockHandles/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.cjs +1 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts +11 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.js +61 -0
- package/dist/components/InkEditor/components/CommentsPanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/CommentsPanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -0
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.d.ts +10 -0
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +20 -0
- package/dist/components/InkEditor/components/SlashMenu/index.d.ts +3 -0
- package/dist/components/InkEditor/components/SlashMenu/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +3 -2
- package/dist/components/InkEditor/components/TrackChangesBar/TrackChangesBar.cjs +1 -0
- package/dist/components/InkEditor/components/TrackChangesBar/TrackChangesBar.d.ts +11 -0
- package/dist/components/InkEditor/components/TrackChangesBar/TrackChangesBar.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TrackChangesBar/TrackChangesBar.js +27 -0
- package/dist/components/InkEditor/components/TrackChangesBar/index.d.ts +3 -0
- package/dist/components/InkEditor/components/TrackChangesBar/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +5 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/constants/aiModels.const.cjs +1 -0
- package/dist/constants/aiModels.const.d.ts +5 -0
- package/dist/constants/aiModels.const.d.ts.map +1 -0
- package/dist/constants/aiModels.const.js +31 -0
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts +32 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +124 -20
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +13 -0
- package/dist/constants/numbers.const.d.ts.map +1 -1
- package/dist/constants/numbers.const.js +13 -3
- package/dist/constants/premium.const.cjs +1 -0
- package/dist/constants/premium.const.d.ts +8 -0
- package/dist/constants/premium.const.d.ts.map +1 -0
- package/dist/constants/premium.const.js +97 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -11
- package/dist/plugins/ai/aiPlugin.cjs +1 -1
- package/dist/plugins/ai/aiPlugin.d.ts.map +1 -1
- package/dist/plugins/ai/aiPlugin.js +40 -18
- package/dist/plugins/ai/demoProvider.cjs +1 -0
- package/dist/plugins/ai/demoProvider.d.ts +3 -0
- package/dist/plugins/ai/demoProvider.d.ts.map +1 -0
- package/dist/plugins/ai/demoProvider.js +130 -0
- package/dist/plugins/ai/index.cjs +1 -1
- package/dist/plugins/ai/index.d.ts +4 -1
- package/dist/plugins/ai/index.d.ts.map +1 -1
- package/dist/plugins/ai/index.js +15 -3
- package/dist/plugins/ai/stubs.cjs +1 -0
- package/dist/plugins/ai/stubs.d.ts +7 -0
- package/dist/plugins/ai/stubs.d.ts.map +1 -0
- package/dist/plugins/ai/stubs.js +23 -0
- package/dist/styles.css +486 -19
- package/dist/types/ai.types.d.ts +111 -2
- package/dist/types/ai.types.d.ts.map +1 -1
- package/dist/types/comments.types.d.ts +17 -0
- package/dist/types/comments.types.d.ts.map +1 -0
- package/dist/types/features.types.d.ts +5 -0
- package/dist/types/features.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +33 -1
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/premium.types.d.ts +30 -0
- package/dist/types/premium.types.d.ts.map +1 -0
- package/dist/types/trackChanges.types.d.ts +12 -0
- package/dist/types/trackChanges.types.d.ts.map +1 -0
- package/dist/utils/blocks.utils.cjs +1 -0
- package/dist/utils/blocks.utils.d.ts +4 -0
- package/dist/utils/blocks.utils.d.ts.map +1 -0
- package/dist/utils/blocks.utils.js +41 -0
- package/dist/utils/comments.utils.cjs +1 -0
- package/dist/utils/comments.utils.d.ts +5 -0
- package/dist/utils/comments.utils.d.ts.map +1 -0
- package/dist/utils/comments.utils.js +32 -0
- package/dist/utils/history.utils.cjs +1 -0
- package/dist/utils/history.utils.d.ts +13 -0
- package/dist/utils/history.utils.d.ts.map +1 -0
- package/dist/utils/history.utils.js +29 -0
- package/dist/utils/id.utils.cjs +1 -0
- package/dist/utils/id.utils.d.ts +2 -0
- package/dist/utils/id.utils.d.ts.map +1 -0
- package/dist/utils/id.utils.js +4 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/license.utils.cjs +1 -0
- package/dist/utils/license.utils.d.ts +2 -0
- package/dist/utils/license.utils.d.ts.map +1 -0
- package/dist/utils/license.utils.js +16 -0
- package/dist/utils/paste.utils.cjs +1 -0
- package/dist/utils/paste.utils.d.ts +4 -0
- package/dist/utils/paste.utils.d.ts.map +1 -0
- package/dist/utils/paste.utils.js +31 -0
- package/dist/utils/premium.utils.cjs +1 -0
- package/dist/utils/premium.utils.d.ts +6 -0
- package/dist/utils/premium.utils.d.ts.map +1 -0
- package/dist/utils/premium.utils.js +30 -0
- package/dist/utils/slash.utils.cjs +1 -0
- package/dist/utils/slash.utils.d.ts +4 -0
- package/dist/utils/slash.utils.d.ts.map +1 -0
- package/dist/utils/slash.utils.js +13 -0
- package/dist/utils/table.utils.cjs +1 -0
- package/dist/utils/table.utils.d.ts +2 -0
- package/dist/utils/table.utils.d.ts.map +1 -0
- package/dist/utils/table.utils.js +13 -0
- package/dist/utils/trackChanges.utils.cjs +1 -0
- package/dist/utils/trackChanges.utils.d.ts +7 -0
- package/dist/utils/trackChanges.utils.d.ts.map +1 -0
- package/dist/utils/trackChanges.utils.js +34 -0
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { INK_PREMIUM_LICENSE_PREFIX as u, INK_PREMIUM_FEATURES as a, INK_THEME_CSS_VARS as l } from "../constants/premium.const.js";
|
|
2
|
+
const n = () => Object.fromEntries(a.map((e) => [e, !1])), E = () => Object.fromEntries(a.map((e) => [e, !0])), m = /^[A-Z0-9]{4}(?:_[A-Z0-9]{4}){3}$/, o = (e) => {
|
|
3
|
+
if (!e) return !1;
|
|
4
|
+
const t = e.trim();
|
|
5
|
+
if (!t.startsWith(u)) return !1;
|
|
6
|
+
const s = t.slice(u.length);
|
|
7
|
+
return m.test(s);
|
|
8
|
+
}, I = (e) => {
|
|
9
|
+
const t = !!(e != null && e.enabled || o(e == null ? void 0 : e.licenseKey));
|
|
10
|
+
if (!t)
|
|
11
|
+
return { active: !1, features: n() };
|
|
12
|
+
const s = E();
|
|
13
|
+
if (e != null && e.features)
|
|
14
|
+
for (const r of a)
|
|
15
|
+
e.features[r] === !1 && (s[r] = !1);
|
|
16
|
+
return { active: t, features: s };
|
|
17
|
+
}, _ = (e, t) => e.active && e.features[t], c = (e) => {
|
|
18
|
+
if (!e) return {};
|
|
19
|
+
const t = {};
|
|
20
|
+
return Object.keys(l).forEach((s) => {
|
|
21
|
+
const r = e[s];
|
|
22
|
+
r && (t[l[s]] = r);
|
|
23
|
+
}), t;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
_ as hasInkPremiumFeature,
|
|
27
|
+
o as isInkPremiumLicenseKey,
|
|
28
|
+
I as resolveInkPremium,
|
|
29
|
+
c as themeTokensToStyle
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../constants/numbers.const.cjs"),n=require("../constants/defaults.const.cjs"),l=r=>{const e=r.trim().toLowerCase();return e?n.INK_SLASH_COMMANDS.filter(t=>t.label.toLowerCase().includes(e)?!0:t.keywords.some(o=>o.includes(e))).slice(0,s.INK_SLASH_MENU_MAX_ITEMS):n.INK_SLASH_COMMANDS.slice(0,s.INK_SLASH_MENU_MAX_ITEMS)},u=r=>{const e=r.match(/(?:^|\s)\/([^\s]*)$/);return e?e[1]??"":null};exports.extractSlashQuery=u;exports.filterSlashCommands=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.utils.d.ts","sourceRoot":"","sources":["../../src/utils/slash.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,gBAAgB,EAOnE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAIzD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { INK_SLASH_MENU_MAX_ITEMS as o } from "../constants/numbers.const.js";
|
|
2
|
+
import { INK_SLASH_COMMANDS as s } from "../constants/defaults.const.js";
|
|
3
|
+
const c = (e) => {
|
|
4
|
+
const r = e.trim().toLowerCase();
|
|
5
|
+
return r ? s.filter((t) => t.label.toLowerCase().includes(r) ? !0 : t.keywords.some((n) => n.includes(r))).slice(0, o) : s.slice(0, o);
|
|
6
|
+
}, u = (e) => {
|
|
7
|
+
const r = e.match(/(?:^|\s)\/([^\s]*)$/);
|
|
8
|
+
return r ? r[1] ?? "" : null;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
u as extractSlashQuery,
|
|
12
|
+
c as filterSlashCommands
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../constants/numbers.const.cjs"),n=(e,r,o)=>Math.min(o,Math.max(r,e)),c=(e=t.INK_DEFAULT_TABLE_ROWS,r=t.INK_DEFAULT_TABLE_COLS)=>{const o=n(e,t.INK_TABLE_MIN_ROWS,t.INK_TABLE_MAX_ROWS),l=n(r,t.INK_TABLE_MIN_COLS,t.INK_TABLE_MAX_COLS),a=Array.from({length:l},(_,b)=>`<th contenteditable="true">Header ${b+1}</th>`).join(""),s=Array.from({length:Math.max(0,o-1)},()=>`<tr>${Array.from({length:l},()=>'<td contenteditable="true"><br></td>').join("")}</tr>`).join("");return`<table class="Ink-table"><thead><tr>${a}</tr></thead><tbody>${s}</tbody></table><p><br></p>`};exports.buildTableHtml=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.utils.d.ts","sourceRoot":"","sources":["../../src/utils/table.utils.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,GACzB,aAA6B,EAC7B,aAA6B,KAC5B,MAaF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { INK_DEFAULT_TABLE_ROWS as c, INK_DEFAULT_TABLE_COLS as A, INK_TABLE_MAX_ROWS as b, INK_TABLE_MIN_ROWS as d, INK_TABLE_MAX_COLS as h, INK_TABLE_MIN_COLS as L } from "../constants/numbers.const.js";
|
|
2
|
+
const a = (t, e, r) => Math.min(r, Math.max(e, t)), I = (t = c, e = A) => {
|
|
3
|
+
const r = a(t, d, b), o = a(e, L, h), n = Array.from(
|
|
4
|
+
{ length: o },
|
|
5
|
+
(_, s) => `<th contenteditable="true">Header ${s + 1}</th>`
|
|
6
|
+
).join(""), l = Array.from({ length: Math.max(0, r - 1) }, () => `<tr>${Array.from({ length: o }, () => '<td contenteditable="true"><br></td>').join(
|
|
7
|
+
""
|
|
8
|
+
)}</tr>`).join("");
|
|
9
|
+
return `<table class="Ink-table"><thead><tr>${n}</tr></thead><tbody>${l}</tbody></table><p><br></p>`;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
I as buildTableHtml
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../constants/defaults.const.cjs"),i=require("./id.utils.cjs"),l=(t,r)=>`<ins class="${n.INK_CLASS_TC_INSERT}" data-ink-tc="${r}">${t}</ins>`,o=(t,r)=>`<del class="${n.INK_CLASS_TC_DELETE}" data-ink-tc="${r}">${t}</del>`,m=(t,r,c)=>({id:i.createInkId("tc"),type:t,html:r,author:c,timestamp:Date.now()}),d=(t,r)=>{const a=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild;return a?(a.querySelectorAll(`[data-ink-tc="${r}"]`).forEach(e=>{if(e.tagName==="INS"){e.replaceWith(...Array.from(e.childNodes));return}e.tagName==="DEL"&&e.remove()}),a.innerHTML):t},p=(t,r)=>{const a=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild;return a?(a.querySelectorAll(`[data-ink-tc="${r}"]`).forEach(e=>{if(e.tagName==="INS"){e.remove();return}e.tagName==="DEL"&&e.replaceWith(...Array.from(e.childNodes))}),a.innerHTML):t};exports.acceptTrackChangeInHtml=d;exports.createTrackChange=m;exports.rejectTrackChangeInHtml=p;exports.wrapDeleteHtml=o;exports.wrapInsertHtml=l;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InkTrackChange } from '../types';
|
|
2
|
+
export declare const wrapInsertHtml: (html: string, changeId: string) => string;
|
|
3
|
+
export declare const wrapDeleteHtml: (html: string, changeId: string) => string;
|
|
4
|
+
export declare const createTrackChange: (type: InkTrackChange["type"], html: string, author: string) => InkTrackChange;
|
|
5
|
+
export declare const acceptTrackChangeInHtml: (html: string, changeId: string) => string;
|
|
6
|
+
export declare const rejectTrackChangeInHtml: (html: string, changeId: string) => string;
|
|
7
|
+
//# sourceMappingURL=trackChanges.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackChanges.utils.d.ts","sourceRoot":"","sources":["../../src/utils/trackChanges.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MACe,CAAC;AAEhF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MACe,CAAC;AAEhF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,cAAc,CAAC,MAAM,CAAC,EAC5B,MAAM,MAAM,EACZ,QAAQ,MAAM,KACb,cAMD,CAAC;AAEH,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MAexE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MAexE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { INK_CLASS_TC_INSERT as i, INK_CLASS_TC_DELETE as o } from "../constants/defaults.const.js";
|
|
2
|
+
import { createInkId as s } from "./id.utils.js";
|
|
3
|
+
const d = (r, e) => `<ins class="${i}" data-ink-tc="${e}">${r}</ins>`, p = (r, e) => `<del class="${o}" data-ink-tc="${e}">${r}</del>`, f = (r, e, c) => ({
|
|
4
|
+
id: s("tc"),
|
|
5
|
+
type: r,
|
|
6
|
+
html: e,
|
|
7
|
+
author: c,
|
|
8
|
+
timestamp: Date.now()
|
|
9
|
+
}), h = (r, e) => {
|
|
10
|
+
const a = new DOMParser().parseFromString(`<div>${r}</div>`, "text/html").body.firstElementChild;
|
|
11
|
+
return a ? (a.querySelectorAll(`[data-ink-tc="${e}"]`).forEach((t) => {
|
|
12
|
+
if (t.tagName === "INS") {
|
|
13
|
+
t.replaceWith(...Array.from(t.childNodes));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
t.tagName === "DEL" && t.remove();
|
|
17
|
+
}), a.innerHTML) : r;
|
|
18
|
+
}, N = (r, e) => {
|
|
19
|
+
const a = new DOMParser().parseFromString(`<div>${r}</div>`, "text/html").body.firstElementChild;
|
|
20
|
+
return a ? (a.querySelectorAll(`[data-ink-tc="${e}"]`).forEach((t) => {
|
|
21
|
+
if (t.tagName === "INS") {
|
|
22
|
+
t.remove();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
t.tagName === "DEL" && t.replaceWith(...Array.from(t.childNodes));
|
|
26
|
+
}), a.innerHTML) : r;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
h as acceptTrackChangeInHtml,
|
|
30
|
+
f as createTrackChange,
|
|
31
|
+
N as rejectTrackChangeInHtml,
|
|
32
|
+
p as wrapDeleteHtml,
|
|
33
|
+
d as wrapInsertHtml
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgedevstack/ink",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "ForgeStack rich text editor for React — WYSIWYG
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "ForgeStack rich text editor for React — CKEditor-inspired WYSIWYG with tables, track changes, comments, block handles, and pluggable Ink AI (BYO LLM). The writing layer of ForgeStack.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|