@forgedevstack/ink 1.1.0 → 1.1.2
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 +27 -5
- package/README.md +77 -19
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +448 -365
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +7 -6
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.cjs +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.d.ts +11 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.const.js +13 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.d.ts +4 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +49 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts +12 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/FindReplace/index.d.ts +3 -0
- package/dist/components/InkEditor/components/FindReplace/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts +17 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.js +20 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts +4 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.js +76 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.types.d.ts +10 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.cjs +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts +6 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.js +19 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/index.d.ts +3 -0
- package/dist/components/InkEditor/components/SignPad/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/index.d.ts +2 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +46 -39
- package/dist/constants/generals.const.cjs +1 -0
- package/dist/constants/generals.const.d.ts +6 -0
- package/dist/constants/generals.const.d.ts.map +1 -0
- package/dist/constants/generals.const.js +5 -0
- package/dist/constants/index.d.ts +4 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -0
- package/dist/constants/numbers.d.ts +119 -0
- package/dist/constants/numbers.d.ts.map +1 -0
- package/dist/constants/numbers.js +20 -0
- 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 +100 -0
- package/dist/constants/toolbar.const.cjs +1 -0
- package/dist/constants/toolbar.const.d.ts +4 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -0
- package/dist/constants/toolbar.const.js +6 -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 +42 -29
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.js +1 -1
- package/dist/styles.css +74 -1
- package/dist/types/features.types.d.ts +1 -1
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +10 -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/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.js +1 -1
- package/dist/utils/findReplace.utils.cjs +1 -0
- package/dist/utils/findReplace.utils.d.ts +3 -0
- package/dist/utils/findReplace.utils.d.ts.map +1 -0
- package/dist/utils/findReplace.utils.js +26 -0
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/ink.features.test.d.ts +2 -0
- package/dist/utils/ink.features.test.d.ts.map +1 -0
- 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/memory.utils.cjs +1 -0
- package/dist/utils/memory.utils.d.ts +5 -0
- package/dist/utils/memory.utils.d.ts.map +1 -0
- package/dist/utils/memory.utils.js +10 -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 -1
- package/dist/utils/slash.utils.js +1 -1
- package/dist/utils/storage.utils.cjs +1 -0
- package/dist/utils/storage.utils.d.ts +2 -0
- package/dist/utils/storage.utils.d.ts.map +1 -0
- package/dist/utils/storage.utils.js +4 -0
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.js +1 -1
- package/package.json +3 -2
- package/dist/constants/numbers.const.cjs +0 -1
- package/dist/constants/numbers.const.d.ts +0 -18
- package/dist/constants/numbers.const.d.ts.map +0 -1
- package/dist/constants/numbers.const.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../../../constants/defaults.const.cjs"),O=require("../../../../constants/aiModels.const.cjs"),P=require("../../../../plugins/ai/aiPlugin.cjs"),C=require("../../../../utils/id.utils.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../../../constants/defaults.const.cjs"),O=require("../../../../constants/aiModels.const.cjs"),P=require("../../../../plugins/ai/aiPlugin.cjs"),C=require("../../../../utils/id.utils.cjs");require("../../../../utils/paste.utils.cjs");const G=w=>{var p,N,f,y;const{config:s,documentHtml:k,selectionHtml:v,onApplyHtml:T,onClose:b}=w,[a,L]=i.useState("chat"),[x,g]=i.useState(""),[r,_]=i.useState([]),[l,j]=i.useState(!1),[o,h]=i.useState(null),[H,D]=i.useState([]),[A,q]=i.useState(I.INK_TRANSLATE_LANGUAGES[1]),M=s.providerId||O.INK_AI_DEMO_PROVIDER_ID,R=((p=s.uiTheme)==null?void 0:p.className)||s.className||"",c=async(t,d,u)=>{var S;j(!0);try{const E=t==="chat"&&u?[...r,{id:C.createInkId("turn"),role:"user",content:u,timestamp:Date.now(),capability:t}]:r;t==="chat"&&u&&_(E);const n=await P.inkAi.runProvider(M,{capability:t,html:k,selectionHtml:v||void 0,prompt:u,history:E,options:d,modelId:s.modelId,documentSnapshot:{html:k,selectionHtml:v||void 0}});(S=n.turns)!=null&&S.length?_(m=>[...m,...n.turns]):n.text&&t!=="chat"&&_(m=>[...m,{id:C.createInkId("turn"),role:"assistant",content:n.text||"",timestamp:Date.now(),capability:t}]),n.diff&&h(n.diff),n.reviewSuggestions&&D(n.reviewSuggestions)}finally{j(!1)}},K=t=>{t.preventDefault();const d=x.trim();!d||l||(g(""),c("chat",void 0,d))};return e.jsxs("aside",{className:`Ink-Ai ${R}`.trim(),"data-placement":s.placement||"sidebar",style:{"--ink-ai-accent":(N=s.uiTheme)==null?void 0:N.accent,"--ink-ai-surface":(f=s.uiTheme)==null?void 0:f.surface,"--ink-ai-border":(y=s.uiTheme)==null?void 0:y.border},"aria-label":"Ink AI",children:[e.jsxs("div",{className:"Ink-Ai__header",children:[e.jsx("strong",{children:"Ink AI"}),b?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:b,title:"Close AI",children:"×"}):null]}),e.jsx("div",{className:"Ink-Ai__tabs",role:"tablist",children:["chat","actions","review","translate"].map(t=>e.jsx("button",{type:"button",role:"tab",className:`Ink-Editor__button${a===t?" Ink-Editor__button--active":""}`,"aria-selected":a===t,onClick:()=>L(t),children:t},t))}),e.jsxs("div",{className:"Ink-Ai__body",children:[a==="chat"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"Ink-Ai__history",children:r.length===0?e.jsxs("p",{className:"Ink-Ai__empty",children:["Multi-turn chat with local demo provider. Bring your own LLM via"," ",e.jsx("code",{children:"inkAi.registerProvider"}),"."]}):r.map(t=>e.jsxs("div",{className:`Ink-Ai__turn Ink-Ai__turn--${t.role}`,children:[e.jsx("span",{children:t.role}),e.jsx("p",{children:t.content})]},t.id))}),e.jsxs("form",{className:"Ink-Ai__form",onSubmit:K,children:[e.jsx("input",{value:x,onChange:t=>g(t.target.value),placeholder:"Ask Ink AI…",disabled:l}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,children:"Send"})]})]}):null,a==="actions"?e.jsxs("div",{className:"Ink-Ai__actions",children:[e.jsx("p",{className:"Ink-Ai__hint",children:"Quick actions use the current selection (or full document)."}),I.INK_QUICK_ACTIONS.map(t=>e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Ai__action",disabled:l,onClick:()=>void c(t.capability),children:t.label},t.id))]}):null,a==="review"?e.jsxs("div",{className:"Ink-Ai__review",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void c("review"),children:"Run grammar & style review"}),H.map(t=>e.jsxs("article",{className:`Ink-Ai__suggestion Ink-Ai__suggestion--${t.severity}`,children:[e.jsx("strong",{children:t.severity}),e.jsx("p",{children:t.message}),e.jsx("code",{children:t.suggestedText})]},t.id))]}):null,a==="translate"?e.jsxs("div",{className:"Ink-Ai__translate",children:[e.jsxs("label",{children:["Language",e.jsx("select",{value:A,onChange:t=>q(t.target.value),children:I.INK_TRANSLATE_LANGUAGES.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void c("translate",{language:A}),children:"Translate"})]}):null,o?e.jsxs("div",{className:"Ink-Ai__diff",children:[e.jsx("strong",{children:"Suggested change"}),e.jsx("p",{children:o.summary}),e.jsx("div",{className:"Ink-Ai__diff-preview",dangerouslySetInnerHTML:{__html:o.suggestedHtml}}),e.jsxs("div",{className:"Ink-Ai__diff-actions",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:()=>{T(o.suggestedHtml),h(null)},children:"Apply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>h(null),children:"Dismiss"})]})]}):null]}),e.jsx("footer",{className:"Ink-Ai__footer",children:"Demo provider · BYO LLM"})]})};exports.AiPanel=G;
|
|
@@ -4,9 +4,10 @@ import { INK_TRANSLATE_LANGUAGES as T, INK_QUICK_ACTIONS as G } from "../../../.
|
|
|
4
4
|
import { INK_AI_DEMO_PROVIDER_ID as P } from "../../../../constants/aiModels.const.js";
|
|
5
5
|
import { inkAi as Q } from "../../../../plugins/ai/aiPlugin.js";
|
|
6
6
|
import { createInkId as H } from "../../../../utils/id.utils.js";
|
|
7
|
-
|
|
7
|
+
import "../../../../utils/paste.utils.js";
|
|
8
|
+
const W = (D) => {
|
|
8
9
|
var N, y, E, C;
|
|
9
|
-
const { config: i, documentHtml: k, selectionHtml: v, onApplyHtml: L, onClose:
|
|
10
|
+
const { config: i, documentHtml: k, selectionHtml: v, onApplyHtml: L, onClose: p } = D, [a, x] = l("chat"), [b, g] = l(""), [r, _] = l([]), [o, f] = l(!1), [c, h] = l(null), [M, R] = l([]), [A, K] = l(T[1]), O = i.providerId || P, $ = ((N = i.uiTheme) == null ? void 0 : N.className) || i.className || "", d = async (e, u, m) => {
|
|
10
11
|
var w;
|
|
11
12
|
f(!0);
|
|
12
13
|
try {
|
|
@@ -46,7 +47,7 @@ const J = (D) => {
|
|
|
46
47
|
}
|
|
47
48
|
}, B = (e) => {
|
|
48
49
|
e.preventDefault();
|
|
49
|
-
const u =
|
|
50
|
+
const u = b.trim();
|
|
50
51
|
!u || o || (g(""), d("chat", void 0, u));
|
|
51
52
|
};
|
|
52
53
|
return /* @__PURE__ */ n(
|
|
@@ -63,7 +64,7 @@ const J = (D) => {
|
|
|
63
64
|
children: [
|
|
64
65
|
/* @__PURE__ */ n("div", { className: "Ink-Ai__header", children: [
|
|
65
66
|
/* @__PURE__ */ t("strong", { children: "Ink AI" }),
|
|
66
|
-
|
|
67
|
+
p ? /* @__PURE__ */ t("button", { type: "button", className: "Ink-Editor__button", onClick: p, title: "Close AI", children: "×" }) : null
|
|
67
68
|
] }),
|
|
68
69
|
/* @__PURE__ */ t("div", { className: "Ink-Ai__tabs", role: "tablist", children: ["chat", "actions", "review", "translate"].map((e) => /* @__PURE__ */ t(
|
|
69
70
|
"button",
|
|
@@ -92,7 +93,7 @@ const J = (D) => {
|
|
|
92
93
|
/* @__PURE__ */ t(
|
|
93
94
|
"input",
|
|
94
95
|
{
|
|
95
|
-
value:
|
|
96
|
+
value: b,
|
|
96
97
|
onChange: (e) => g(e.target.value),
|
|
97
98
|
placeholder: "Ask Ink AI…",
|
|
98
99
|
disabled: o
|
|
@@ -174,5 +175,5 @@ const J = (D) => {
|
|
|
174
175
|
);
|
|
175
176
|
};
|
|
176
177
|
export {
|
|
177
|
-
|
|
178
|
+
W as AiPanel
|
|
178
179
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),_=require("../../../../constants/generals.const.cjs"),t=require("./FindReplace.const.cjs"),D=i=>{const{open:E,onClose:o,onReplace:u,findLabel:L=t.FIND_REPLACE_DEFAULT_FIND,replaceLabel:d=t.FIND_REPLACE_DEFAULT_REPLACE,replaceOneLabel:A=t.FIND_REPLACE_DEFAULT_ONE,replaceAllLabel:F=t.FIND_REPLACE_DEFAULT_ALL,closeLabel:b=t.FIND_REPLACE_DEFAULT_CLOSE,title:l=t.FIND_REPLACE_DEFAULT_TITLE}=i,[s,C]=r.useState(_.EMPTY_STRING),[a,N]=r.useState(_.EMPTY_STRING);if(!E)return null;const c=(n,I)=>{n.preventDefault(),s&&u(s,a,I)};return e.jsxs("form",{className:t.FIND_REPLACE_CLASS,"aria-label":l,onSubmit:n=>c(n,!1),children:[e.jsx("p",{className:t.FIND_REPLACE_TITLE_CLASS,children:l}),e.jsxs("label",{className:t.FIND_REPLACE_FIELD_CLASS,children:[e.jsx("span",{children:L}),e.jsx("input",{value:s,onChange:n=>C(n.target.value),autoFocus:!0})]}),e.jsxs("label",{className:t.FIND_REPLACE_FIELD_CLASS,children:[e.jsx("span",{children:d}),e.jsx("input",{value:a,onChange:n=>N(n.target.value)})]}),e.jsxs("div",{className:t.FIND_REPLACE_ACTIONS_CLASS,children:[e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:o,children:b}),e.jsx("button",{type:"submit",className:"Ink-Editor__button",disabled:!s,children:A}),e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:!s,onClick:n=>c(n,!0),children:F})]})]})};exports.FindReplace=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E="Ink-FindReplace flex flex-col gap-2 p-3 border-b",_="Ink-FindReplace__field flex flex-col gap-1 text-sm",L="Ink-FindReplace__actions flex flex-wrap gap-1",A="Ink-FindReplace__title m-0 text-sm font-semibold",F="Find and replace",e="Find",D="Replace with",C="Replace",I="Replace all",R="Close";exports.FIND_REPLACE_ACTIONS_CLASS=L;exports.FIND_REPLACE_CLASS=E;exports.FIND_REPLACE_DEFAULT_ALL=I;exports.FIND_REPLACE_DEFAULT_CLOSE=R;exports.FIND_REPLACE_DEFAULT_FIND=e;exports.FIND_REPLACE_DEFAULT_ONE=C;exports.FIND_REPLACE_DEFAULT_REPLACE=D;exports.FIND_REPLACE_DEFAULT_TITLE=F;exports.FIND_REPLACE_FIELD_CLASS=_;exports.FIND_REPLACE_TITLE_CLASS=A;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const FIND_REPLACE_CLASS = "Ink-FindReplace flex flex-col gap-2 p-3 border-b";
|
|
2
|
+
export declare const FIND_REPLACE_FIELD_CLASS = "Ink-FindReplace__field flex flex-col gap-1 text-sm";
|
|
3
|
+
export declare const FIND_REPLACE_ACTIONS_CLASS = "Ink-FindReplace__actions flex flex-wrap gap-1";
|
|
4
|
+
export declare const FIND_REPLACE_TITLE_CLASS = "Ink-FindReplace__title m-0 text-sm font-semibold";
|
|
5
|
+
export declare const FIND_REPLACE_DEFAULT_TITLE = "Find and replace";
|
|
6
|
+
export declare const FIND_REPLACE_DEFAULT_FIND = "Find";
|
|
7
|
+
export declare const FIND_REPLACE_DEFAULT_REPLACE = "Replace with";
|
|
8
|
+
export declare const FIND_REPLACE_DEFAULT_ONE = "Replace";
|
|
9
|
+
export declare const FIND_REPLACE_DEFAULT_ALL = "Replace all";
|
|
10
|
+
export declare const FIND_REPLACE_DEFAULT_CLOSE = "Close";
|
|
11
|
+
//# sourceMappingURL=FindReplace.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindReplace.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/FindReplace/FindReplace.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,qDAAqD,CAAC;AACrF,eAAO,MAAM,wBAAwB,uDAAuD,CAAC;AAC7F,eAAO,MAAM,0BAA0B,kDAAkD,CAAC;AAC1F,eAAO,MAAM,wBAAwB,qDAAqD,CAAC;AAC3F,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAC7D,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,wBAAwB,gBAAgB,CAAC;AACtD,eAAO,MAAM,0BAA0B,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const _ = "Ink-FindReplace flex flex-col gap-2 p-3 border-b", E = "Ink-FindReplace__field flex flex-col gap-1 text-sm", e = "Ink-FindReplace__actions flex flex-wrap gap-1", L = "Ink-FindReplace__title m-0 text-sm font-semibold", F = "Find and replace", n = "Find", A = "Replace with", l = "Replace", c = "Replace all", t = "Close";
|
|
2
|
+
export {
|
|
3
|
+
e as FIND_REPLACE_ACTIONS_CLASS,
|
|
4
|
+
_ as FIND_REPLACE_CLASS,
|
|
5
|
+
c as FIND_REPLACE_DEFAULT_ALL,
|
|
6
|
+
t as FIND_REPLACE_DEFAULT_CLOSE,
|
|
7
|
+
n as FIND_REPLACE_DEFAULT_FIND,
|
|
8
|
+
l as FIND_REPLACE_DEFAULT_ONE,
|
|
9
|
+
A as FIND_REPLACE_DEFAULT_REPLACE,
|
|
10
|
+
F as FIND_REPLACE_DEFAULT_TITLE,
|
|
11
|
+
E as FIND_REPLACE_FIELD_CLASS,
|
|
12
|
+
L as FIND_REPLACE_TITLE_CLASS
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindReplace.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/FindReplace/FindReplace.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAc1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAoD5C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E } from "react";
|
|
3
|
+
import { EMPTY_STRING as _ } from "../../../../constants/generals.const.js";
|
|
4
|
+
import { FIND_REPLACE_DEFAULT_TITLE as I, FIND_REPLACE_DEFAULT_FIND as D, FIND_REPLACE_DEFAULT_REPLACE as R, FIND_REPLACE_DEFAULT_ONE as S, FIND_REPLACE_DEFAULT_ALL as T, FIND_REPLACE_DEFAULT_CLOSE as h, FIND_REPLACE_CLASS as P, FIND_REPLACE_TITLE_CLASS as f, FIND_REPLACE_FIELD_CLASS as i, FIND_REPLACE_ACTIONS_CLASS as v } from "./FindReplace.const.js";
|
|
5
|
+
const x = (s) => {
|
|
6
|
+
const {
|
|
7
|
+
open: c,
|
|
8
|
+
onClose: L,
|
|
9
|
+
onReplace: u,
|
|
10
|
+
findLabel: A = D,
|
|
11
|
+
replaceLabel: d = R,
|
|
12
|
+
replaceOneLabel: b = S,
|
|
13
|
+
replaceAllLabel: p = T,
|
|
14
|
+
closeLabel: C = h,
|
|
15
|
+
title: a = I
|
|
16
|
+
} = s, [l, N] = E(_), [o, F] = E(_);
|
|
17
|
+
if (!c) return null;
|
|
18
|
+
const r = (e, m) => {
|
|
19
|
+
e.preventDefault(), l && u(l, o, m);
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ n("form", { className: P, "aria-label": a, onSubmit: (e) => r(e, !1), children: [
|
|
22
|
+
/* @__PURE__ */ t("p", { className: f, children: a }),
|
|
23
|
+
/* @__PURE__ */ n("label", { className: i, children: [
|
|
24
|
+
/* @__PURE__ */ t("span", { children: A }),
|
|
25
|
+
/* @__PURE__ */ t("input", { value: l, onChange: (e) => N(e.target.value), autoFocus: !0 })
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ n("label", { className: i, children: [
|
|
28
|
+
/* @__PURE__ */ t("span", { children: d }),
|
|
29
|
+
/* @__PURE__ */ t("input", { value: o, onChange: (e) => F(e.target.value) })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ n("div", { className: v, children: [
|
|
32
|
+
/* @__PURE__ */ t("button", { type: "button", className: "Ink-Editor__button", onClick: L, children: C }),
|
|
33
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "Ink-Editor__button", disabled: !l, children: b }),
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
39
|
+
disabled: !l,
|
|
40
|
+
onClick: (e) => r(e, !0),
|
|
41
|
+
children: p
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
x as FindReplace
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FindReplaceProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onReplace: (find: string, replace: string, replaceAll: boolean) => void;
|
|
5
|
+
findLabel?: string;
|
|
6
|
+
replaceLabel?: string;
|
|
7
|
+
replaceOneLabel?: string;
|
|
8
|
+
replaceAllLabel?: string;
|
|
9
|
+
closeLabel?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FindReplace.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindReplace.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/FindReplace/FindReplace.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/FindReplace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("react"),a=require("../../../../constants/numbers.cjs"),n=require("./SignPad.const.cjs"),S=require("./SignPad.utils.cjs"),R=f=>{const{open:l,onClose:d,onConfirm:P,clearLabel:C=n.SIGN_PAD_DEFAULT_CLEAR,confirmLabel:E=n.SIGN_PAD_DEFAULT_CONFIRM,cancelLabel:D=n.SIGN_PAD_DEFAULT_CANCEL,title:I=n.SIGN_PAD_DEFAULT_TITLE}=f,r=c.useRef(null),_=c.useRef(!1),[N,u]=c.useState(!1);if(c.useEffect(()=>{if(!l)return;const e=r.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=n.SIGN_PAD_FILL_STYLE,t.fillRect(a.NUMBER_ZERO,a.NUMBER_ZERO,e.width,e.height),t.strokeStyle=n.SIGN_PAD_STROKE_STYLE,t.lineWidth=n.SIGN_PAD_LINE_WIDTH,t.lineCap="round",t.lineJoin="round",u(!1))},[l]),!l)return null;const L=e=>{const t=r.current,o=t==null?void 0:t.getContext("2d");if(!t||!o)return;_.current=!0,t.setPointerCapture(e.pointerId);const s=S.getCanvasPoint(t,e.clientX,e.clientY);o.beginPath(),o.moveTo(s.x,s.y)},b=e=>{if(!_.current)return;const t=r.current,o=t==null?void 0:t.getContext("2d");if(!t||!o)return;const s=S.getCanvasPoint(t,e.clientX,e.clientY);o.lineTo(s.x,s.y),o.stroke(),u(!0)},A=e=>{var t;_.current=!1,(t=r.current)==null||t.releasePointerCapture(e.pointerId)},h=()=>{const e=r.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=n.SIGN_PAD_FILL_STYLE,t.fillRect(a.NUMBER_ZERO,a.NUMBER_ZERO,e.width,e.height),u(!1))},g=()=>{const e=r.current;!e||!(N||S.canvasHasInk(e))||(P(e.toDataURL(n.SIGN_PAD_MIME)),d())};return i.jsxs("div",{className:n.SIGN_PAD_CLASS,role:"dialog","aria-modal":"true","aria-label":I,children:[i.jsx("p",{className:n.SIGN_PAD_TITLE_CLASS,children:I}),i.jsx("canvas",{ref:r,className:n.SIGN_PAD_CANVAS_CLASS,width:n.SIGN_PAD_CANVAS_WIDTH,height:n.SIGN_PAD_CANVAS_HEIGHT,onPointerDown:L,onPointerMove:b,onPointerUp:A,onPointerLeave:A}),i.jsxs("div",{className:n.SIGN_PAD_ACTIONS_CLASS,children:[i.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:h,children:C}),i.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:d,children:D}),i.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:!N,onClick:g,children:E})]})]})};exports.SignPad=R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),S="Ink-SignPad flex flex-col gap-2 p-3 border-b",A="Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair",I="Ink-SignPad__actions flex flex-wrap gap-1",N="Ink-SignPad__title m-0 text-sm font-semibold",D="Sign here",P="Clear",L="Insert",E="Cancel",T=480,n=180,G=_.NUMBER_TWO,o="#111827",t="#ffffff",e="image/png",s=_.NUMBER_FOUR,C=_.NUMBER_SIX;exports.SIGN_PAD_ACTIONS_CLASS=I;exports.SIGN_PAD_CANVAS_CLASS=A;exports.SIGN_PAD_CANVAS_HEIGHT=n;exports.SIGN_PAD_CANVAS_WIDTH=T;exports.SIGN_PAD_CLASS=S;exports.SIGN_PAD_DEFAULT_CANCEL=E;exports.SIGN_PAD_DEFAULT_CLEAR=P;exports.SIGN_PAD_DEFAULT_CONFIRM=L;exports.SIGN_PAD_DEFAULT_TITLE=D;exports.SIGN_PAD_EMPTY_ALPHA_THRESHOLD=s;exports.SIGN_PAD_FILL_STYLE=t;exports.SIGN_PAD_LINE_WIDTH=G;exports.SIGN_PAD_MIME=e;exports.SIGN_PAD_SAMPLE_STEP=C;exports.SIGN_PAD_STROKE_STYLE=o;exports.SIGN_PAD_TITLE_CLASS=N;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const SIGN_PAD_CLASS = "Ink-SignPad flex flex-col gap-2 p-3 border-b";
|
|
2
|
+
export declare const SIGN_PAD_CANVAS_CLASS = "Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair";
|
|
3
|
+
export declare const SIGN_PAD_ACTIONS_CLASS = "Ink-SignPad__actions flex flex-wrap gap-1";
|
|
4
|
+
export declare const SIGN_PAD_TITLE_CLASS = "Ink-SignPad__title m-0 text-sm font-semibold";
|
|
5
|
+
export declare const SIGN_PAD_DEFAULT_TITLE = "Sign here";
|
|
6
|
+
export declare const SIGN_PAD_DEFAULT_CLEAR = "Clear";
|
|
7
|
+
export declare const SIGN_PAD_DEFAULT_CONFIRM = "Insert";
|
|
8
|
+
export declare const SIGN_PAD_DEFAULT_CANCEL = "Cancel";
|
|
9
|
+
export declare const SIGN_PAD_CANVAS_WIDTH = 480;
|
|
10
|
+
export declare const SIGN_PAD_CANVAS_HEIGHT = 180;
|
|
11
|
+
export declare const SIGN_PAD_LINE_WIDTH = 2;
|
|
12
|
+
export declare const SIGN_PAD_STROKE_STYLE = "#111827";
|
|
13
|
+
export declare const SIGN_PAD_FILL_STYLE = "#ffffff";
|
|
14
|
+
export declare const SIGN_PAD_MIME = "image/png";
|
|
15
|
+
export declare const SIGN_PAD_EMPTY_ALPHA_THRESHOLD = 4;
|
|
16
|
+
export declare const SIGN_PAD_SAMPLE_STEP = 6;
|
|
17
|
+
//# sourceMappingURL=SignPad.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignPad.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAAiD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,uGAAuG,CAAC;AAC1I,eAAO,MAAM,sBAAsB,8CAA8C,CAAC;AAClF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AACnF,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAC9C,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAChD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,mBAAmB,IAAa,CAAC;AAC9C,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,8BAA8B,IAAc,CAAC;AAC1D,eAAO,MAAM,oBAAoB,IAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NUMBER_TWO as _, NUMBER_SIX as S, NUMBER_FOUR as A } from "../../../../constants/numbers.js";
|
|
2
|
+
const I = "Ink-SignPad flex flex-col gap-2 p-3 border-b", o = "Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair", t = "Ink-SignPad__actions flex flex-wrap gap-1", N = "Ink-SignPad__title m-0 text-sm font-semibold", s = "Sign here", P = "Clear", D = "Insert", c = "Cancel", E = 480, e = 180, L = _, T = "#111827", r = "#ffffff", G = "image/png", a = A, C = S;
|
|
3
|
+
export {
|
|
4
|
+
t as SIGN_PAD_ACTIONS_CLASS,
|
|
5
|
+
o as SIGN_PAD_CANVAS_CLASS,
|
|
6
|
+
e as SIGN_PAD_CANVAS_HEIGHT,
|
|
7
|
+
E as SIGN_PAD_CANVAS_WIDTH,
|
|
8
|
+
I as SIGN_PAD_CLASS,
|
|
9
|
+
c as SIGN_PAD_DEFAULT_CANCEL,
|
|
10
|
+
P as SIGN_PAD_DEFAULT_CLEAR,
|
|
11
|
+
D as SIGN_PAD_DEFAULT_CONFIRM,
|
|
12
|
+
s as SIGN_PAD_DEFAULT_TITLE,
|
|
13
|
+
a as SIGN_PAD_EMPTY_ALPHA_THRESHOLD,
|
|
14
|
+
r as SIGN_PAD_FILL_STYLE,
|
|
15
|
+
L as SIGN_PAD_LINE_WIDTH,
|
|
16
|
+
G as SIGN_PAD_MIME,
|
|
17
|
+
C as SIGN_PAD_SAMPLE_STEP,
|
|
18
|
+
T as SIGN_PAD_STROKE_STYLE,
|
|
19
|
+
N as SIGN_PAD_TITLE_CLASS
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignPad.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAkBhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA0GpC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A, useState as p, useEffect as b } from "react";
|
|
3
|
+
import { NUMBER_ZERO as l } from "../../../../constants/numbers.js";
|
|
4
|
+
import { SIGN_PAD_DEFAULT_TITLE as T, SIGN_PAD_DEFAULT_CLEAR as G, SIGN_PAD_DEFAULT_CONFIRM as g, SIGN_PAD_DEFAULT_CANCEL as x, SIGN_PAD_FILL_STYLE as I, SIGN_PAD_STROKE_STYLE as k, SIGN_PAD_LINE_WIDTH as R, SIGN_PAD_CLASS as y, SIGN_PAD_TITLE_CLASS as w, SIGN_PAD_CANVAS_HEIGHT as U, SIGN_PAD_CANVAS_WIDTH as F, SIGN_PAD_CANVAS_CLASS as H, SIGN_PAD_ACTIONS_CLASS as v, SIGN_PAD_MIME as M } from "./SignPad.const.js";
|
|
5
|
+
import { getCanvasPoint as C, canvasHasInk as O } from "./SignPad.utils.js";
|
|
6
|
+
const K = (N) => {
|
|
7
|
+
const {
|
|
8
|
+
open: c,
|
|
9
|
+
onClose: _,
|
|
10
|
+
onConfirm: D,
|
|
11
|
+
clearLabel: m = G,
|
|
12
|
+
confirmLabel: P = g,
|
|
13
|
+
cancelLabel: h = x,
|
|
14
|
+
title: u = T
|
|
15
|
+
} = N, n = A(null), a = A(!1), [d, s] = p(!1);
|
|
16
|
+
if (b(() => {
|
|
17
|
+
if (!c) return;
|
|
18
|
+
const e = n.current, t = e == null ? void 0 : e.getContext("2d");
|
|
19
|
+
!e || !t || (t.fillStyle = I, t.fillRect(l, l, e.width, e.height), t.strokeStyle = k, t.lineWidth = R, t.lineCap = "round", t.lineJoin = "round", s(!1));
|
|
20
|
+
}, [c]), !c) return null;
|
|
21
|
+
const L = (e) => {
|
|
22
|
+
const t = n.current, o = t == null ? void 0 : t.getContext("2d");
|
|
23
|
+
if (!t || !o) return;
|
|
24
|
+
a.current = !0, t.setPointerCapture(e.pointerId);
|
|
25
|
+
const r = C(t, e.clientX, e.clientY);
|
|
26
|
+
o.beginPath(), o.moveTo(r.x, r.y);
|
|
27
|
+
}, E = (e) => {
|
|
28
|
+
if (!a.current) return;
|
|
29
|
+
const t = n.current, o = t == null ? void 0 : t.getContext("2d");
|
|
30
|
+
if (!t || !o) return;
|
|
31
|
+
const r = C(t, e.clientX, e.clientY);
|
|
32
|
+
o.lineTo(r.x, r.y), o.stroke(), s(!0);
|
|
33
|
+
}, S = (e) => {
|
|
34
|
+
var t;
|
|
35
|
+
a.current = !1, (t = n.current) == null || t.releasePointerCapture(e.pointerId);
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ f("div", { className: y, role: "dialog", "aria-modal": "true", "aria-label": u, children: [
|
|
38
|
+
/* @__PURE__ */ i("p", { className: w, children: u }),
|
|
39
|
+
/* @__PURE__ */ i(
|
|
40
|
+
"canvas",
|
|
41
|
+
{
|
|
42
|
+
ref: n,
|
|
43
|
+
className: H,
|
|
44
|
+
width: F,
|
|
45
|
+
height: U,
|
|
46
|
+
onPointerDown: L,
|
|
47
|
+
onPointerMove: E,
|
|
48
|
+
onPointerUp: S,
|
|
49
|
+
onPointerLeave: S
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ f("div", { className: v, children: [
|
|
53
|
+
/* @__PURE__ */ i("button", { type: "button", className: "Ink-Editor__button", onClick: () => {
|
|
54
|
+
const e = n.current, t = e == null ? void 0 : e.getContext("2d");
|
|
55
|
+
!e || !t || (t.fillStyle = I, t.fillRect(l, l, e.width, e.height), s(!1));
|
|
56
|
+
}, children: m }),
|
|
57
|
+
/* @__PURE__ */ i("button", { type: "button", className: "Ink-Editor__button", onClick: _, children: h }),
|
|
58
|
+
/* @__PURE__ */ i(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
63
|
+
disabled: !d,
|
|
64
|
+
onClick: () => {
|
|
65
|
+
const e = n.current;
|
|
66
|
+
!e || !(d || O(e)) || (D(e.toDataURL(M)), _());
|
|
67
|
+
},
|
|
68
|
+
children: P
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
K as SignPad
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignPad.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./SignPad.const.cjs"),r=t=>{const n=t.getContext("2d");if(!n)return!1;const{width:s,height:e}=t,{data:o}=n.getImageData(0,0,s,e),a=3;for(let i=a;i<o.length;i+=c.SIGN_PAD_SAMPLE_STEP*4)if(o[i]>c.SIGN_PAD_EMPTY_ALPHA_THRESHOLD)return!0;return!1},g=(t,n,s)=>{const e=t.getBoundingClientRect(),o=t.width/e.width,a=t.height/e.height;return{x:(n-e.left)*o,y:(s-e.top)*a}};exports.canvasHasInk=r;exports.getCanvasPoint=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignPad.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,GAAI,QAAQ,iBAAiB,KAAG,OAUxD,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,iBAAiB,EACzB,SAAS,MAAM,EACf,SAAS,MAAM,KACd;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAQxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SIGN_PAD_SAMPLE_STEP as c, SIGN_PAD_EMPTY_ALPHA_THRESHOLD as h } from "./SignPad.const.js";
|
|
2
|
+
const g = (t) => {
|
|
3
|
+
const n = t.getContext("2d");
|
|
4
|
+
if (!n) return !1;
|
|
5
|
+
const { width: r, height: e } = t, { data: o } = n.getImageData(0, 0, r, e), s = 3;
|
|
6
|
+
for (let i = s; i < o.length; i += c * 4)
|
|
7
|
+
if (o[i] > h) return !0;
|
|
8
|
+
return !1;
|
|
9
|
+
}, f = (t, n, r) => {
|
|
10
|
+
const e = t.getBoundingClientRect(), o = t.width / e.width, s = t.height / e.height;
|
|
11
|
+
return {
|
|
12
|
+
x: (n - e.left) * o,
|
|
13
|
+
y: (r - e.top) * s
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
g as canvasHasInk,
|
|
18
|
+
f as getCanvasPoint
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignPad.utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("../../../../constants/defaults.const.cjs"),l=require("../../../../utils/cn.utils.cjs");require("../../../../utils/paste.utils.cjs");const c=r=>{const{icon:n,title:e,active:t=!1,onClick:s,disabled:i=!1}=r;return a.jsx("button",{type:"button",title:e,"aria-label":e,"aria-pressed":t,disabled:i,className:l.cn(o.INK_CLASS_BUTTON,t&&o.INK_CLASS_BUTTON_ACTIVE),onClick:s,children:n})};exports.ToolbarButton=c;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { INK_CLASS_BUTTON_ACTIVE as n, INK_CLASS_BUTTON as s } from "../../../../constants/defaults.const.js";
|
|
3
3
|
import { cn as c } from "../../../../utils/cn.utils.js";
|
|
4
|
-
|
|
4
|
+
import "../../../../utils/paste.utils.js";
|
|
5
|
+
const f = (r) => {
|
|
5
6
|
const { icon: e, title: t, active: o = !1, onClick: a, disabled: i = !1 } = r;
|
|
6
7
|
return /* @__PURE__ */ l(
|
|
7
8
|
"button",
|
|
@@ -18,5 +19,5 @@ const b = (r) => {
|
|
|
18
19
|
);
|
|
19
20
|
};
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
f as ToolbarButton
|
|
22
23
|
};
|
|
@@ -6,4 +6,6 @@ export { AiPanel } from './AiPanel';
|
|
|
6
6
|
export { BlockHandles } from './BlockHandles';
|
|
7
7
|
export { SlashMenu } from './SlashMenu';
|
|
8
8
|
export { TrackChangesBar } from './TrackChangesBar';
|
|
9
|
+
export { SignPad } from './SignPad';
|
|
10
|
+
export { FindReplace } from './FindReplace';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./numbers.cjs"),e=require("./toolbar.const.cjs"),i=["headingDropdown","divider","bold","italic","underline","strikethrough","divider","textColor","highlightColor","divider","bulletList","orderedList","divider","link","image","table",e.TOOLBAR_OPTION_SIGNATURE,e.TOOLBAR_OPTION_FIND_REPLACE,e.TOOLBAR_OPTION_HORIZONTAL_RULE,"divider","undo","redo","divider","trackChanges","comments","ai","divider","clearFormat"],a=["bold","italic","underline","divider","bulletList","orderedList"],l=["headingDropdown","divider","bold","italic","underline","divider","bulletList","orderedList","table","divider","trackChanges","comments","ai","divider","undo","redo"],n=[{value:"p",label:"Paragraph"},{value:"h1",label:"Heading 1"},{value:"h2",label:"Heading 2"},{value:"h3",label:"Heading 3"},{value:"h4",label:"Heading 4"},{value:"h5",label:"Heading 5"},{value:"h6",label:"Heading 6"}],o={bold:{title:"Bold (Ctrl+B)",command:"bold"},italic:{title:"Italic (Ctrl+I)",command:"italic"},underline:{title:"Underline (Ctrl+U)",command:"underline"},strikethrough:{title:"Strikethrough",command:"strikeThrough"},heading1:{title:"Heading 1",command:"formatBlock",value:"h1"},heading2:{title:"Heading 2",command:"formatBlock",value:"h2"},heading3:{title:"Heading 3",command:"formatBlock",value:"h3"},heading4:{title:"Heading 4",command:"formatBlock",value:"h4"},heading5:{title:"Heading 5",command:"formatBlock",value:"h5"},heading6:{title:"Heading 6",command:"formatBlock",value:"h6"},paragraph:{title:"Paragraph",command:"formatBlock",value:"p"},bulletList:{title:"Bullet list",command:"insertUnorderedList"},orderedList:{title:"Numbered list",command:"insertOrderedList"},blockquote:{title:"Quote",command:"formatBlock",value:"blockquote"},code:{title:"Code block",command:"formatBlock",value:"pre"},alignLeft:{title:"Align left",command:"justifyLeft"},alignCenter:{title:"Align center",command:"justifyCenter"},alignRight:{title:"Align right",command:"justifyRight"},alignJustify:{title:"Justify",command:"justifyFull"},indent:{title:"Indent",command:"indent"},outdent:{title:"Outdent",command:"outdent"},clearFormat:{title:"Clear formatting",command:"removeFormat"},undo:{title:"Undo",command:"undo"},redo:{title:"Redo",command:"redo"}},d=["#111827","#dc2626","#ea580c","#ca8a04","#16a34a","#2563eb","#0f766e","#db2777"],r="Start typing...",_="Ink-Editor",s="Ink-Editor__toolbar",c="Ink-Editor__content",A="Ink-Editor__divider",I="Ink-Editor__button",L="Ink-Editor__button--active",N="Ink-Editor__footer",T="Ink-Editor__shell",S="Ink-Editor__body",u="Ink-tc-insert",m="Ink-tc-delete",O="Ink-comment-mark",E="You",C="classic",K={table:!0,trackChanges:!0,comments:!0,ai:!0,blocks:!0,slash:!0,history:!0,typoAutoFix:!0,signature:!0,findReplace:!0,horizontalRule:!0},g=t.INK_DEFAULT_TABLE_ROWS,b=t.INK_DEFAULT_TABLE_COLS,h=[{id:"heading1",label:"Heading 1",keywords:["h1","title","heading"],insert:"heading1"},{id:"heading2",label:"Heading 2",keywords:["h2","subtitle","heading"],insert:"heading2"},{id:"bullet",label:"Bullet list",keywords:["ul","list","bullet"],insert:"bulletList"},{id:"ordered",label:"Numbered list",keywords:["ol","list","numbered"],insert:"orderedList"},{id:"table",label:"Table",keywords:["table","grid"],insert:"table"},{id:"ai",label:"Ask AI",keywords:["ai","assistant","chat"],insert:"ai"}],R=["English","Spanish","French","German","Chinese (Simplified)","Japanese","Russian","Portuguese","Korean","Italian"],k=[{id:"rewrite",label:"Rewrite",capability:"rewrite"},{id:"summarize",label:"Summarize",capability:"summarize"},{id:"expand",label:"Expand",capability:"expand"},{id:"tone",label:"Adjust tone",capability:"tone"}];exports.INK_BUTTON_CONFIG=o;exports.INK_CLASS_BODY=S;exports.INK_CLASS_BUTTON=I;exports.INK_CLASS_BUTTON_ACTIVE=L;exports.INK_CLASS_COMMENT_MARK=O;exports.INK_CLASS_CONTENT=c;exports.INK_CLASS_DIVIDER=A;exports.INK_CLASS_FOOTER=N;exports.INK_CLASS_ROOT=_;exports.INK_CLASS_SHELL=T;exports.INK_CLASS_TC_DELETE=m;exports.INK_CLASS_TC_INSERT=u;exports.INK_CLASS_TOOLBAR=s;exports.INK_COLLAB_TOOLBAR=l;exports.INK_COLOR_SWATCHES=d;exports.INK_DEFAULT_AUTHOR=E;exports.INK_DEFAULT_FEATURES=K;exports.INK_DEFAULT_TOOLBAR=i;exports.INK_DEFAULT_VARIANT=C;exports.INK_HEADING_OPTIONS=n;exports.INK_PLACEHOLDER_DEFAULT=r;exports.INK_QUICK_ACTIONS=k;exports.INK_SIMPLE_TOOLBAR=a;exports.INK_SLASH_COMMANDS=h;exports.INK_TABLE_DEFAULT_COLS=b;exports.INK_TABLE_DEFAULT_ROWS=g;exports.INK_TRANSLATE_LANGUAGES=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.const.d.ts","sourceRoot":"","sources":["../../src/constants/defaults.const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"defaults.const.d.ts","sourceRoot":"","sources":["../../src/constants/defaults.const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAWlD,eAAO,MAAM,mBAAmB,EAAE,aAAa,EA6B9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,EAO7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,EAiB7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAc,EAQ/C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,MAAM,EACN;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA0BnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAS9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AACzD,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AACvD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AACvD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AACvD,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,eAAe,sBAAsB,CAAC;AACnD,eAAO,MAAM,cAAc,qBAAqB,CAAC;AACjD,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,mBAAmB,EAAG,SAAkB,CAAC;AACtD,eAAO,MAAM,oBAAoB,EAAE,iBAYlC,CAAC;AACF,eAAO,MAAM,sBAAsB,IAAyB,CAAC;AAC7D,eAAO,MAAM,sBAAsB,IAAyB,CAAC;AAE7D,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAqChD,CAAC;AAEF,eAAO,MAAM,uBAAuB,uIAW1B,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;IAK7B,CAAC"}
|