@forgedevstack/ink 1.1.7 → 1.1.8
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 +31 -0
- package/README.md +9 -1
- package/bin/ink.const.mjs +26 -0
- package/bin/ink.mjs +58 -0
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +1178 -834
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +58 -52
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts +4 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +209 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts +10 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts +4 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +91 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts +11 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/index.d.ts +3 -0
- package/dist/components/InkEditor/components/GraphEditModal/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts +4 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +98 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts +10 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/GraphPicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts +4 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +27 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts +7 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts.map +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +17 -12
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts.map +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts +10 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +18 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts +4 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +95 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts +11 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/TableSizePicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts +4 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +81 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts +12 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ThemePicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts +4 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +79 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts +10 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/index.d.ts +3 -0
- package/dist/components/InkEditor/components/TitleGallery/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +41 -18
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +25 -23
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +7 -7
- package/dist/components/InkEditor/components/index.d.ts +14 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +2 -2
- package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -1
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +72 -72
- package/dist/constants/colorMode.const.cjs +1 -1
- package/dist/constants/colorMode.const.d.ts +1 -1
- package/dist/constants/colorMode.const.d.ts.map +1 -1
- package/dist/constants/colorMode.const.js +4 -4
- package/dist/constants/contextMenu.const.cjs +1 -1
- package/dist/constants/contextMenu.const.d.ts +2 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -1
- package/dist/constants/contextMenu.const.js +17 -15
- package/dist/constants/defaultIcons.cjs +1 -1
- package/dist/constants/defaultIcons.d.ts.map +1 -1
- package/dist/constants/defaultIcons.js +20 -13
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts +48 -0
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +201 -102
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +48 -0
- package/dist/constants/generals.const.d.ts.map +1 -1
- package/dist/constants/generals.const.js +71 -28
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.d.ts +14 -0
- package/dist/constants/numbers.d.ts.map +1 -1
- package/dist/constants/numbers.js +44 -30
- package/dist/constants/plugins.const.cjs +1 -0
- package/dist/constants/plugins.const.d.ts +13 -0
- package/dist/constants/plugins.const.d.ts.map +1 -0
- package/dist/constants/plugins.const.js +45 -0
- package/dist/constants/table.const.cjs +1 -1
- package/dist/constants/table.const.d.ts +4 -0
- package/dist/constants/table.const.d.ts.map +1 -1
- package/dist/constants/table.const.js +10 -6
- package/dist/constants/toolbar.const.cjs +1 -1
- package/dist/constants/toolbar.const.d.ts +7 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -1
- package/dist/constants/toolbar.const.js +16 -9
- package/dist/constants/toolbarMenu.const.cjs +1 -1
- package/dist/constants/toolbarMenu.const.d.ts +2 -0
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
- package/dist/constants/toolbarMenu.const.js +80 -19
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useToolbarOverflow.cjs +1 -0
- package/dist/hooks/useToolbarOverflow.d.ts +8 -0
- package/dist/hooks/useToolbarOverflow.d.ts.map +1 -0
- package/dist/hooks/useToolbarOverflow.js +29 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -86
- package/dist/plugins/excel/excel.utils.cjs +1 -0
- package/dist/plugins/excel/excel.utils.d.ts +13 -0
- package/dist/plugins/excel/excel.utils.d.ts.map +1 -0
- package/dist/plugins/excel/excel.utils.js +40 -0
- package/dist/plugins/excel/index.d.ts +3 -0
- package/dist/plugins/excel/index.d.ts.map +1 -0
- package/dist/plugins/graph/graph.const.cjs +1 -0
- package/dist/plugins/graph/graph.const.d.ts +14 -0
- package/dist/plugins/graph/graph.const.d.ts.map +1 -0
- package/dist/plugins/graph/graph.const.js +24 -0
- package/dist/plugins/graph/graph.types.d.ts +7 -0
- package/dist/plugins/graph/graph.types.d.ts.map +1 -0
- package/dist/plugins/graph/graph.utils.cjs +1 -0
- package/dist/plugins/graph/graph.utils.d.ts +11 -0
- package/dist/plugins/graph/graph.utils.d.ts.map +1 -0
- package/dist/plugins/graph/graph.utils.js +76 -0
- package/dist/plugins/graph/index.d.ts +4 -0
- package/dist/plugins/graph/index.d.ts.map +1 -0
- package/dist/plugins/host/index.d.ts +2 -0
- package/dist/plugins/host/index.d.ts.map +1 -0
- package/dist/plugins/host/inkPlugins.cjs +1 -0
- package/dist/plugins/host/inkPlugins.d.ts +16 -0
- package/dist/plugins/host/inkPlugins.d.ts.map +1 -0
- package/dist/plugins/host/inkPlugins.js +20 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/theme/index.d.ts +4 -0
- package/dist/plugins/theme/index.d.ts.map +1 -0
- package/dist/plugins/theme/inkTheme.cjs +1 -0
- package/dist/plugins/theme/inkTheme.d.ts +5 -0
- package/dist/plugins/theme/inkTheme.d.ts.map +1 -0
- package/dist/plugins/theme/inkTheme.js +30 -0
- package/dist/plugins/theme/theme.const.cjs +1 -0
- package/dist/plugins/theme/theme.const.d.ts +9 -0
- package/dist/plugins/theme/theme.const.d.ts.map +1 -0
- package/dist/plugins/theme/theme.const.js +15 -0
- package/dist/plugins/theme/theme.types.d.ts +12 -0
- package/dist/plugins/theme/theme.types.d.ts.map +1 -0
- package/dist/plugins/titles/index.d.ts +4 -0
- package/dist/plugins/titles/index.d.ts.map +1 -0
- package/dist/plugins/titles/titles.const.cjs +1 -0
- package/dist/plugins/titles/titles.const.d.ts +4 -0
- package/dist/plugins/titles/titles.const.d.ts.map +1 -0
- package/dist/plugins/titles/titles.const.js +15 -0
- package/dist/plugins/titles/titles.types.d.ts +2 -0
- package/dist/plugins/titles/titles.types.d.ts.map +1 -0
- package/dist/plugins/titles/titles.utils.cjs +1 -0
- package/dist/plugins/titles/titles.utils.d.ts +3 -0
- package/dist/plugins/titles/titles.utils.d.ts.map +1 -0
- package/dist/plugins/titles/titles.utils.js +14 -0
- package/dist/styles.css +1 -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 +6 -2
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/plugin.types.d.ts +8 -0
- package/dist/types/plugin.types.d.ts.map +1 -0
- package/dist/types/premium.types.d.ts +1 -1
- package/dist/types/premium.types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/outline.utils.cjs +1 -1
- package/dist/utils/outline.utils.d.ts.map +1 -1
- package/dist/utils/outline.utils.js +32 -32
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +4 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +84 -45
- package/package.json +7 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphColors, GraphPoint } from '../../../../plugins/graph';
|
|
2
|
+
export type GraphEditMode = 'values' | 'colors';
|
|
3
|
+
export type GraphEditModalProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
mode: GraphEditMode;
|
|
6
|
+
points: GraphPoint[];
|
|
7
|
+
colors: GraphColors;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onApply: (points: GraphPoint[], colors: GraphColors) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=GraphEditModal.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphEditModal.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphEditModal/GraphEditModal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphEditModal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("react"),K=require("react-dom"),A=require("../../../../constants/numbers.cjs"),a=require("../../../../constants/generals.const.cjs"),D=require("../../../../constants/colorMode.const.cjs"),M=require("../../../../constants/keyboard.const.cjs"),o=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const s=require("../../../../plugins/graph/graph.const.cjs"),p=require("../../../../plugins/graph/graph.utils.cjs"),h=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),q=require("../ToolbarButton/ToolbarButton.cjs"),g=N=>{const{icon:v,disabled:d=!1,hint:I,onHint:T,pluginColor:b,onInsert:w}=N,[c,i]=n.useState(!1),[l,G]=n.useState(s.GRAPH_KIND_DEFAULT),[_,H]=n.useState({top:A.NUMBER_ZERO,left:A.NUMBER_ZERO}),E=n.useRef(null),L=n.useRef(null),S=n.useRef(null);return n.useEffect(()=>{if(!c)return;const e=()=>{const r=h.getToolbarDropdownMenuPosition(L.current);H({top:r.top,left:r.left})};e();const u=r=>{var m,P;const R=r.target;(m=E.current)!=null&&m.contains(R)||(P=S.current)!=null&&P.contains(R)||i(!1)},f=r=>{r.key===M.KEY_ESCAPE&&i(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[c]),t.jsxs("div",{className:o.INK_CLASS_STYLE_DD,ref:E,children:[t.jsx("div",{ref:L,children:t.jsx(q.ToolbarButton,{icon:v,title:a.INK_GRAPH_TITLE,hint:I,onHint:T,pluginColor:b,disabled:d,onClick:()=>{d||i(e=>!e)}})}),c?K.createPortal(t.jsxs("div",{ref:S,className:`${o.INK_CLASS_STYLE_MENU} ${o.INK_CLASS_STYLE_MENU_PORTAL} ${o.INK_CLASS_STYLE_MENU_FORCED} ${o.INK_CLASS_GRAPH_PANEL}`,"data-color-mode":D.COLOR_MODE_LIGHT,role:"dialog","aria-label":a.INK_GRAPH_TITLE,style:{top:_.top,left:_.left},children:[t.jsx("div",{className:o.INK_CLASS_GRAPH_TYPES,children:s.GRAPH_KINDS.map(e=>t.jsx("button",{type:"button","aria-pressed":e===l,onMouseDown:u=>{u.preventDefault(),G(e)},children:s.GRAPH_KIND_LABELS[e]},e))}),t.jsx("div",{className:o.INK_CLASS_GRAPH_PREVIEW,dangerouslySetInnerHTML:{__html:p.buildGraphHtml(l,s.GRAPH_SAMPLE)}}),t.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),w(p.buildGraphHtml(l,s.GRAPH_SAMPLE)),i(!1)},children:a.INK_GRAPH_INSERT})]}),document.body):null]})};exports.GraphPicker=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphPicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphPicker/GraphPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AA0B7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAiG5C,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs as S, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useRef as m, useEffect as G } from "react";
|
|
3
|
+
import { createPortal as M } from "react-dom";
|
|
4
|
+
import { NUMBER_ZERO as A } from "../../../../constants/numbers.js";
|
|
5
|
+
import { INK_GRAPH_TITLE as N, INK_GRAPH_INSERT as b } from "../../../../constants/generals.const.js";
|
|
6
|
+
import { COLOR_MODE_LIGHT as h } from "../../../../constants/colorMode.const.js";
|
|
7
|
+
import { KEY_ESCAPE as y } from "../../../../constants/keyboard.const.js";
|
|
8
|
+
import { INK_CLASS_STYLE_DD as g, INK_CLASS_STYLE_MENU as O, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as Y, INK_CLASS_GRAPH_PANEL as U, INK_CLASS_GRAPH_TYPES as $, INK_CLASS_GRAPH_PREVIEW as B } from "../../../../constants/defaults.const.js";
|
|
9
|
+
import "../../../../constants/openai.const.js";
|
|
10
|
+
import "../../../../utils/paste.utils.js";
|
|
11
|
+
import { GRAPH_KIND_DEFAULT as j, GRAPH_KINDS as z, GRAPH_KIND_LABELS as F, GRAPH_SAMPLE as P } from "../../../../plugins/graph/graph.const.js";
|
|
12
|
+
import { buildGraphHtml as v } from "../../../../plugins/graph/graph.utils.js";
|
|
13
|
+
import { getToolbarDropdownMenuPosition as x } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
14
|
+
import { ToolbarButton as V } from "../ToolbarButton/ToolbarButton.js";
|
|
15
|
+
const me = (R) => {
|
|
16
|
+
const { icon: I, disabled: d = !1, hint: w, onHint: K, pluginColor: T, onInsert: D } = R, [i, n] = l(!1), [s, H] = l(j), [a, C] = l({ top: A, left: A }), c = m(null), u = m(null), _ = m(null);
|
|
17
|
+
return G(() => {
|
|
18
|
+
if (!i) return;
|
|
19
|
+
const e = () => {
|
|
20
|
+
const t = x(u.current);
|
|
21
|
+
C({ top: t.top, left: t.left });
|
|
22
|
+
};
|
|
23
|
+
e();
|
|
24
|
+
const r = (t) => {
|
|
25
|
+
var E, L;
|
|
26
|
+
const p = t.target;
|
|
27
|
+
(E = c.current) != null && E.contains(p) || (L = _.current) != null && L.contains(p) || n(!1);
|
|
28
|
+
}, f = (t) => {
|
|
29
|
+
t.key === y && n(!1);
|
|
30
|
+
};
|
|
31
|
+
return document.addEventListener("mousedown", r), document.addEventListener("keydown", f), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
32
|
+
document.removeEventListener("mousedown", r), document.removeEventListener("keydown", f), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
33
|
+
};
|
|
34
|
+
}, [i]), /* @__PURE__ */ S("div", { className: g, ref: c, children: [
|
|
35
|
+
/* @__PURE__ */ o("div", { ref: u, children: /* @__PURE__ */ o(
|
|
36
|
+
V,
|
|
37
|
+
{
|
|
38
|
+
icon: I,
|
|
39
|
+
title: N,
|
|
40
|
+
hint: w,
|
|
41
|
+
onHint: K,
|
|
42
|
+
pluginColor: T,
|
|
43
|
+
disabled: d,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
d || n((e) => !e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
i ? M(
|
|
50
|
+
/* @__PURE__ */ S(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
ref: _,
|
|
54
|
+
className: `${O} ${k} ${Y} ${U}`,
|
|
55
|
+
"data-color-mode": h,
|
|
56
|
+
role: "dialog",
|
|
57
|
+
"aria-label": N,
|
|
58
|
+
style: { top: a.top, left: a.left },
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ o("div", { className: $, children: z.map((e) => /* @__PURE__ */ o(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
"aria-pressed": e === s,
|
|
65
|
+
onMouseDown: (r) => {
|
|
66
|
+
r.preventDefault(), H(e);
|
|
67
|
+
},
|
|
68
|
+
children: F[e]
|
|
69
|
+
},
|
|
70
|
+
e
|
|
71
|
+
)) }),
|
|
72
|
+
/* @__PURE__ */ o(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: B,
|
|
76
|
+
dangerouslySetInnerHTML: { __html: v(s, P) }
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ o(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
onMouseDown: (e) => {
|
|
84
|
+
e.preventDefault(), D(v(s, P)), n(!1);
|
|
85
|
+
},
|
|
86
|
+
children: b
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
document.body
|
|
93
|
+
) : null
|
|
94
|
+
] });
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
me as GraphPicker
|
|
98
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type GraphPickerProps = {
|
|
3
|
+
icon: ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
hint?: string;
|
|
6
|
+
onHint?: (hint: string) => void;
|
|
7
|
+
pluginColor?: string;
|
|
8
|
+
onInsert: (html: string) => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=GraphPicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphPicker.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphPicker/GraphPicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphPicker/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 u=require("react/jsx-runtime"),o=require("../../../../constants/generals.const.cjs"),i=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const c=e=>{const{value:r,onChange:t,disabled:a=!1,minHeight:n}=e,l=s=>{t(s.target.value)};return u.jsx("textarea",{className:i.INK_CLASS_SOURCE,"aria-label":o.INK_HTML_SOURCE_TITLE,value:r,disabled:a,spellCheck:!1,style:{minHeight:n},onChange:l})};exports.HtmlSourcePanel=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlSourcePanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAkBpD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { INK_HTML_SOURCE_TITLE as m } from "../../../../constants/generals.const.js";
|
|
3
|
+
import { INK_CLASS_SOURCE as i } from "../../../../constants/defaults.const.js";
|
|
4
|
+
import "../../../../constants/openai.const.js";
|
|
5
|
+
import "../../../../utils/paste.utils.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
const _ = (e) => {
|
|
9
|
+
const { value: a, onChange: t, disabled: o = !1, minHeight: r } = e;
|
|
10
|
+
return /* @__PURE__ */ n(
|
|
11
|
+
"textarea",
|
|
12
|
+
{
|
|
13
|
+
className: i,
|
|
14
|
+
"aria-label": m,
|
|
15
|
+
value: a,
|
|
16
|
+
disabled: o,
|
|
17
|
+
spellCheck: !1,
|
|
18
|
+
style: { minHeight: r },
|
|
19
|
+
onChange: (l) => {
|
|
20
|
+
t(l.target.value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
_ as HtmlSourcePanel
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlSourcePanel.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/HtmlSourcePanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,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 s=require("react/jsx-runtime"),i=require("../../../../constants/numbers.cjs"),e=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const L=t=>{const{items:_,activeIndex:I,onSelect:r,onHide:l}=t;return s.jsxs("aside",{className:e.INK_CLASS_OUTLINE,"aria-label":e.INK_OUTLINE_LABEL,children:[s.jsxs("div",{className:e.INK_CLASS_OUTLINE_LABEL,children:[e.INK_OUTLINE_LABEL,l?s.jsx("button",{type:"button",className:e.INK_CLASS_OUTLINE_TOGGLE,onClick:l,children:e.INK_OUTLINE_HIDE}):null]}),_.length===i.NUMBER_ZERO?s.jsx("p",{className:e.INK_CLASS_OUTLINE_ITEM,children:e.INK_OUTLINE_EMPTY}):null,_.map(n=>{const N=n.index===I;return s.jsxs("button",{type:"button",className:`${e.INK_CLASS_OUTLINE_ITEM} ${e.INK_CLASS_OUTLINE_ITEM}--h${n.level}${N?` ${e.INK_CLASS_OUTLINE_ITEM_ACTIVE}`:""}`,onClick:()=>r(n.index),children:[s.jsx("span",{className:`${e.INK_CLASS_OUTLINE_ITEM}-dot`,"aria-hidden":"true"}),n.text]},`${n.level}-${n.index}`)})]})};exports.OutlineRail=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutlineRail.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/OutlineRail/OutlineRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OutlineRail.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/OutlineRail/OutlineRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAiC5C,CAAC"}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as t, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { NUMBER_ZERO as I } from "../../../../constants/numbers.js";
|
|
3
|
+
import { INK_OUTLINE_LABEL as r, INK_CLASS_OUTLINE as c, INK_CLASS_OUTLINE_LABEL as E, INK_OUTLINE_HIDE as L, INK_CLASS_OUTLINE_TOGGLE as d, INK_OUTLINE_EMPTY as m, INK_CLASS_OUTLINE_ITEM as n, INK_CLASS_OUTLINE_ITEM_ACTIVE as p } from "../../../../constants/defaults.const.js";
|
|
3
4
|
import "../../../../constants/openai.const.js";
|
|
4
5
|
import "../../../../utils/paste.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
const x = (
|
|
8
|
-
const { items:
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const x = (N) => {
|
|
9
|
+
const { items: i, activeIndex: a, onSelect: s, onHide: o } = N;
|
|
10
|
+
return /* @__PURE__ */ t("aside", { className: c, "aria-label": r, children: [
|
|
11
|
+
/* @__PURE__ */ t("div", { className: E, children: [
|
|
12
|
+
r,
|
|
13
|
+
o ? /* @__PURE__ */ l("button", { type: "button", className: d, onClick: o, children: L }) : null
|
|
14
|
+
] }),
|
|
15
|
+
i.length === I ? /* @__PURE__ */ l("p", { className: n, children: m }) : null,
|
|
16
|
+
i.map((e) => {
|
|
17
|
+
const _ = e.index === a;
|
|
18
|
+
return /* @__PURE__ */ t(
|
|
14
19
|
"button",
|
|
15
20
|
{
|
|
16
21
|
type: "button",
|
|
17
|
-
className: `${
|
|
18
|
-
onClick: () =>
|
|
22
|
+
className: `${n} ${n}--h${e.level}${_ ? ` ${p}` : ""}`,
|
|
23
|
+
onClick: () => s(e.index),
|
|
19
24
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ l("span", { className: `${n}-dot`, "aria-hidden": "true" }),
|
|
21
26
|
e.text
|
|
22
27
|
]
|
|
23
28
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutlineRail.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/OutlineRail/OutlineRail.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"OutlineRail.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/OutlineRail/OutlineRail.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),v=require("react-dom"),_=require("../../../../constants/numbers.cjs"),L=require("../../../../constants/generals.const.cjs"),w=require("../../../../constants/colorMode.const.cjs"),B=require("../../../../constants/keyboard.const.cjs"),t=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const b=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),O=require("../ToolbarButton/ToolbarButton.cjs"),c=require("./TableSizePicker.const.cjs"),p=C=>{const{icon:f,disabled:I=!1,onSelect:P}=C,[a,E]=s.useState(!1),[u,d]=s.useState(c.TABLE_PICKER_INITIAL_HOVER),[T,m]=s.useState(c.TABLE_PICKER_EMPTY_POSITION),A=s.useRef(null),S=s.useRef(null),R=s.useRef(null);s.useEffect(()=>{if(!a)return;const e=()=>{const o=b.getToolbarDropdownMenuPosition(S.current);m({top:o.top,left:o.left})};e();const r=o=>{var K,N;const l=o.target;(K=A.current)!=null&&K.contains(l)||(N=R.current)!=null&&N.contains(l)||E(!1)},i=o=>{o.key===B.KEY_ESCAPE&&E(!1)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",i),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",i),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[a]);const M=Array.from({length:_.INK_TABLE_PICKER_MAX*_.INK_TABLE_PICKER_MAX},(e,r)=>{const i=Math.floor(r/_.INK_TABLE_PICKER_MAX)+_.NUMBER_ONE,o=r%_.INK_TABLE_PICKER_MAX+_.NUMBER_ONE,l=i<=u.rows&&o<=u.cols;return{rows:i,cols:o,isOn:l,key:`${i}-${o}`}});return n.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER,ref:A,children:[n.jsx("div",{ref:S,children:n.jsx(O.ToolbarButton,{icon:f,title:L.INK_TABLE_INSERT_TITLE,disabled:I,onClick:()=>{I||(d(c.TABLE_PICKER_INITIAL_HOVER),E(e=>!e))}})}),a?v.createPortal(n.jsxs("div",{ref:R,className:`${t.INK_CLASS_STYLE_MENU} ${t.INK_CLASS_STYLE_MENU_PORTAL} ${t.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":w.COLOR_MODE_LIGHT,role:"grid","aria-label":L.INK_TABLE_INSERT_TITLE,style:{top:T.top,left:T.left},children:[n.jsx("div",{className:t.INK_CLASS_TABLE_PICKER_GRID,style:{gridTemplateColumns:`repeat(${_.INK_TABLE_PICKER_MAX}, 1fr)`},children:M.map(e=>n.jsx("button",{type:"button",className:`${t.INK_CLASS_TABLE_PICKER_CELL}${e.isOn?`${L.SPACE_STRING}${t.INK_CLASS_TABLE_PICKER_CELL_ON}`:""}`,"aria-label":`${e.rows}${c.TABLE_PICKER_TIMES_MARK}${e.cols}`,onMouseEnter:()=>d({rows:e.rows,cols:e.cols}),onMouseDown:r=>{r.preventDefault(),P(e.rows,e.cols),E(!1)}},e.key))}),n.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER_LABEL,children:[u.rows,c.TABLE_PICKER_TIMES_MARK,u.cols]})]}),document.body):null]})};exports.TableSizePicker=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../../../constants/numbers.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const _={rows:E.NUMBER_ONE,cols:E.NUMBER_ONE},e={top:E.NUMBER_ZERO,left:E.NUMBER_ZERO},r=" × ";exports.TABLE_PICKER_EMPTY_POSITION=e;exports.TABLE_PICKER_INITIAL_HOVER=_;exports.TABLE_PICKER_TIMES_MARK=r;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const TABLE_PICKER_INITIAL_HOVER: {
|
|
2
|
+
rows: number;
|
|
3
|
+
cols: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const TABLE_PICKER_EMPTY_POSITION: {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const TABLE_PICKER_TIMES_MARK = " \u00D7 ";
|
|
10
|
+
//# sourceMappingURL=TableSizePicker.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSizePicker.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/TableSizePicker/TableSizePicker.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC;AAEF,eAAO,MAAM,uBAAuB,aAAQ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NUMBER_ONE as o, NUMBER_ZERO as E } from "../../../../constants/numbers.js";
|
|
2
|
+
import "../../../../constants/openai.const.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "../../../../utils/paste.utils.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "react-dom";
|
|
7
|
+
const m = {
|
|
8
|
+
rows: o,
|
|
9
|
+
cols: o
|
|
10
|
+
}, T = {
|
|
11
|
+
top: E,
|
|
12
|
+
left: E
|
|
13
|
+
}, i = " × ";
|
|
14
|
+
export {
|
|
15
|
+
T as TABLE_PICKER_EMPTY_POSITION,
|
|
16
|
+
m as TABLE_PICKER_INITIAL_HOVER,
|
|
17
|
+
i as TABLE_PICKER_TIMES_MARK
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSizePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/TableSizePicker/TableSizePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAyB7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAiGpD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsxs as l, jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as a, useEffect as B } from "react";
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { INK_TABLE_PICKER_MAX as n, NUMBER_ONE as A } from "../../../../constants/numbers.js";
|
|
5
|
+
import { INK_TABLE_INSERT_TITLE as C, SPACE_STRING as $ } from "../../../../constants/generals.const.js";
|
|
6
|
+
import { COLOR_MODE_LIGHT as y } from "../../../../constants/colorMode.const.js";
|
|
7
|
+
import { KEY_ESCAPE as b } from "../../../../constants/keyboard.const.js";
|
|
8
|
+
import { INK_CLASS_TABLE_PICKER as g, INK_CLASS_STYLE_MENU as h, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as D, INK_CLASS_TABLE_PICKER_GRID as Y, INK_CLASS_TABLE_PICKER_CELL as U, INK_CLASS_TABLE_PICKER_CELL_ON as x, INK_CLASS_TABLE_PICKER_LABEL as z } from "../../../../constants/defaults.const.js";
|
|
9
|
+
import "../../../../constants/openai.const.js";
|
|
10
|
+
import "../../../../utils/paste.utils.js";
|
|
11
|
+
import { getToolbarDropdownMenuPosition as G } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
12
|
+
import { ToolbarButton as H } from "../ToolbarButton/ToolbarButton.js";
|
|
13
|
+
import { TABLE_PICKER_INITIAL_HOVER as N, TABLE_PICKER_EMPTY_POSITION as j, TABLE_PICKER_TIMES_MARK as K } from "./TableSizePicker.const.js";
|
|
14
|
+
const se = (R) => {
|
|
15
|
+
const { icon: v, disabled: L = !1, onSelect: w } = R, [c, s] = m(!1), [i, d] = m(N), [f, P] = m(j), u = a(null), I = a(null), S = a(null);
|
|
16
|
+
B(() => {
|
|
17
|
+
if (!c) return;
|
|
18
|
+
const e = () => {
|
|
19
|
+
const o = G(I.current);
|
|
20
|
+
P({ top: o.top, left: o.left });
|
|
21
|
+
};
|
|
22
|
+
e();
|
|
23
|
+
const t = (o) => {
|
|
24
|
+
var p, T;
|
|
25
|
+
const _ = o.target;
|
|
26
|
+
(p = u.current) != null && p.contains(_) || (T = S.current) != null && T.contains(_) || s(!1);
|
|
27
|
+
}, r = (o) => {
|
|
28
|
+
o.key === b && s(!1);
|
|
29
|
+
};
|
|
30
|
+
return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
31
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
32
|
+
};
|
|
33
|
+
}, [c]);
|
|
34
|
+
const M = Array.from({ length: n * n }, (e, t) => {
|
|
35
|
+
const r = Math.floor(t / n) + A, o = t % n + A, _ = r <= i.rows && o <= i.cols;
|
|
36
|
+
return { rows: r, cols: o, isOn: _, key: `${r}-${o}` };
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ l("div", { className: g, ref: u, children: [
|
|
39
|
+
/* @__PURE__ */ E("div", { ref: I, children: /* @__PURE__ */ E(
|
|
40
|
+
H,
|
|
41
|
+
{
|
|
42
|
+
icon: v,
|
|
43
|
+
title: C,
|
|
44
|
+
disabled: L,
|
|
45
|
+
onClick: () => {
|
|
46
|
+
L || (d(N), s((e) => !e));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
) }),
|
|
50
|
+
c ? O(
|
|
51
|
+
/* @__PURE__ */ l(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: S,
|
|
55
|
+
className: `${h} ${k} ${D}`,
|
|
56
|
+
"data-color-mode": y,
|
|
57
|
+
role: "grid",
|
|
58
|
+
"aria-label": C,
|
|
59
|
+
style: { top: f.top, left: f.left },
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ E(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: Y,
|
|
65
|
+
style: { gridTemplateColumns: `repeat(${n}, 1fr)` },
|
|
66
|
+
children: M.map((e) => /* @__PURE__ */ E(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
className: `${U}${e.isOn ? `${$}${x}` : ""}`,
|
|
71
|
+
"aria-label": `${e.rows}${K}${e.cols}`,
|
|
72
|
+
onMouseEnter: () => d({ rows: e.rows, cols: e.cols }),
|
|
73
|
+
onMouseDown: (t) => {
|
|
74
|
+
t.preventDefault(), w(e.rows, e.cols), s(!1);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
e.key
|
|
78
|
+
))
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ l("div", { className: z, children: [
|
|
82
|
+
i.rows,
|
|
83
|
+
K,
|
|
84
|
+
i.cols
|
|
85
|
+
] })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
document.body
|
|
90
|
+
) : null
|
|
91
|
+
] });
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
se as TableSizePicker
|
|
95
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type TableSizePickerProps = {
|
|
3
|
+
icon: ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onSelect: (rows: number, cols: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export type TableSizePickerPosition = {
|
|
8
|
+
top: number;
|
|
9
|
+
left: number;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=TableSizePicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSizePicker.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/TableSizePicker/TableSizePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/TableSizePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),y=require("react-dom"),L=require("../../../../constants/numbers.cjs"),T=require("../../../../constants/generals.const.cjs"),g=require("../../../../constants/colorMode.const.cjs"),I=require("../../../../constants/keyboard.const.cjs"),c=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const P=require("../../../../plugins/theme/theme.const.cjs");require("../../../../plugins/host/inkPlugins.cjs");const C=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),O=require("../ToolbarButton/ToolbarButton.cjs"),k=p=>{const{icon:b,disabled:u=!1,hint:w,onHint:S,pluginColor:q,value:M,onChange:R}=p,[i,r]=o.useState(!1),[l,N]=o.useState({top:L.NUMBER_ZERO,left:L.NUMBER_ZERO}),a=o.useRef(null),d=o.useRef(null),E=o.useRef(null);return o.useEffect(()=>{if(!i)return;const e=()=>{const t=C.getToolbarDropdownMenuPosition(d.current);N({top:t.top,left:t.left})};e();const s=t=>{var m,v;const f=t.target;(m=a.current)!=null&&m.contains(f)||(v=E.current)!=null&&v.contains(f)||r(!1)},_=t=>{t.key===I.KEY_ESCAPE&&r(!1)};return document.addEventListener("mousedown",s),document.addEventListener("keydown",_),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",_),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]),n.jsxs("div",{ref:a,children:[n.jsx("div",{ref:d,children:n.jsx(O.ToolbarButton,{icon:b,title:T.INK_THEME_TITLE,hint:w,onHint:S,pluginColor:q,disabled:u,onClick:()=>{u||r(e=>!e)}})}),i?y.createPortal(n.jsx("div",{ref:E,className:`${c.INK_CLASS_STYLE_MENU} ${c.INK_CLASS_STYLE_MENU_PORTAL} ${c.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":g.COLOR_MODE_LIGHT,role:"listbox","aria-label":T.INK_THEME_TITLE,style:{top:l.top,left:l.left},children:P.INK_THEMES.map(e=>n.jsx("button",{type:"button",role:"option","aria-selected":e.id===M,className:"Ink-Editor__style-option",onMouseDown:s=>{s.preventDefault(),R(e.id),r(!1)},children:e.label},e.id))}),document.body):null]})};exports.ThemePicker=k;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAc7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmF5C,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as s, useEffect as I } from "react";
|
|
3
|
+
import { createPortal as P } from "react-dom";
|
|
4
|
+
import { NUMBER_ZERO as v } from "../../../../constants/numbers.js";
|
|
5
|
+
import { INK_THEME_TITLE as L } from "../../../../constants/generals.const.js";
|
|
6
|
+
import { COLOR_MODE_LIGHT as g } from "../../../../constants/colorMode.const.js";
|
|
7
|
+
import { KEY_ESCAPE as K } from "../../../../constants/keyboard.const.js";
|
|
8
|
+
import { INK_CLASS_STYLE_MENU as O, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as x } from "../../../../constants/defaults.const.js";
|
|
9
|
+
import "../../../../constants/openai.const.js";
|
|
10
|
+
import "../../../../utils/paste.utils.js";
|
|
11
|
+
import { INK_THEMES as A } from "../../../../plugins/theme/theme.const.js";
|
|
12
|
+
import "../../../../plugins/host/inkPlugins.js";
|
|
13
|
+
import { getToolbarDropdownMenuPosition as D } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
14
|
+
import { ToolbarButton as h } from "../ToolbarButton/ToolbarButton.js";
|
|
15
|
+
const W = (w) => {
|
|
16
|
+
const { icon: S, disabled: l = !1, hint: T, onHint: N, pluginColor: M, value: b, onChange: C } = w, [i, t] = _(!1), [d, R] = _({ top: v, left: v }), m = s(null), c = s(null), a = s(null);
|
|
17
|
+
return I(() => {
|
|
18
|
+
if (!i) return;
|
|
19
|
+
const e = () => {
|
|
20
|
+
const o = D(c.current);
|
|
21
|
+
R({ top: o.top, left: o.left });
|
|
22
|
+
};
|
|
23
|
+
e();
|
|
24
|
+
const n = (o) => {
|
|
25
|
+
var p, E;
|
|
26
|
+
const u = o.target;
|
|
27
|
+
(p = m.current) != null && p.contains(u) || (E = a.current) != null && E.contains(u) || t(!1);
|
|
28
|
+
}, f = (o) => {
|
|
29
|
+
o.key === K && t(!1);
|
|
30
|
+
};
|
|
31
|
+
return document.addEventListener("mousedown", n), document.addEventListener("keydown", f), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
32
|
+
document.removeEventListener("mousedown", n), document.removeEventListener("keydown", f), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
33
|
+
};
|
|
34
|
+
}, [i]), /* @__PURE__ */ y("div", { ref: m, children: [
|
|
35
|
+
/* @__PURE__ */ r("div", { ref: c, children: /* @__PURE__ */ r(
|
|
36
|
+
h,
|
|
37
|
+
{
|
|
38
|
+
icon: S,
|
|
39
|
+
title: L,
|
|
40
|
+
hint: T,
|
|
41
|
+
onHint: N,
|
|
42
|
+
pluginColor: M,
|
|
43
|
+
disabled: l,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
l || t((e) => !e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
i ? P(
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
ref: a,
|
|
54
|
+
className: `${O} ${k} ${x}`,
|
|
55
|
+
"data-color-mode": g,
|
|
56
|
+
role: "listbox",
|
|
57
|
+
"aria-label": L,
|
|
58
|
+
style: { top: d.top, left: d.left },
|
|
59
|
+
children: A.map((e) => /* @__PURE__ */ r(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
type: "button",
|
|
63
|
+
role: "option",
|
|
64
|
+
"aria-selected": e.id === b,
|
|
65
|
+
className: "Ink-Editor__style-option",
|
|
66
|
+
onMouseDown: (n) => {
|
|
67
|
+
n.preventDefault(), C(e.id), t(!1);
|
|
68
|
+
},
|
|
69
|
+
children: e.label
|
|
70
|
+
},
|
|
71
|
+
e.id
|
|
72
|
+
))
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
document.body
|
|
76
|
+
) : null
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
W as ThemePicker
|
|
81
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { InkThemeId } from '../../../../plugins/theme';
|
|
3
|
+
export type ThemePickerProps = {
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
hint?: string;
|
|
7
|
+
onHint?: (hint: string) => void;
|
|
8
|
+
pluginColor?: string;
|
|
9
|
+
value: InkThemeId;
|
|
10
|
+
onChange: (id: InkThemeId) => void;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=ThemePicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemePicker.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|