@lv-x-software-house/x_view 1.2.2-dev.20 → 1.2.2-dev.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4021,6 +4021,70 @@ function DescriptionEditModal({
4021
4021
  setIsMentionModalOpen(true);
4022
4022
  }
4023
4023
  };
4024
+ const handleKeyDownTextarea = (e) => {
4025
+ const el = textareaRef.current;
4026
+ if (!el) return;
4027
+ if (e.key === "Enter") {
4028
+ const cursorPosition = el.selectionStart;
4029
+ const textBeforeCursor = text.substring(0, cursorPosition);
4030
+ const linesBeforeCursor = textBeforeCursor.split("\n");
4031
+ const currentLine = linesBeforeCursor[linesBeforeCursor.length - 1];
4032
+ const numberMatch = currentLine.match(/^(\s*)(\d+)\.\s(.*)/);
4033
+ if (numberMatch) {
4034
+ e.preventDefault();
4035
+ const space = numberMatch[1];
4036
+ const number = parseInt(numberMatch[2], 10);
4037
+ const content = numberMatch[3];
4038
+ if (content.trim() === "") {
4039
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
4040
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
4041
+ el.value = newText;
4042
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
4043
+ setText(newText);
4044
+ return;
4045
+ }
4046
+ const nextNumber = number + 1;
4047
+ insertAtCursor(`
4048
+ ${space}${nextNumber}. `);
4049
+ return;
4050
+ }
4051
+ const checklistMatch = currentLine.match(/^(\s*)- \[[ xX]\]\s(.*)/);
4052
+ if (checklistMatch) {
4053
+ e.preventDefault();
4054
+ const space = checklistMatch[1];
4055
+ const content = checklistMatch[2];
4056
+ if (content.trim() === "") {
4057
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
4058
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
4059
+ el.value = newText;
4060
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
4061
+ setText(newText);
4062
+ return;
4063
+ }
4064
+ insertAtCursor(`
4065
+ ${space}- [ ] `);
4066
+ return;
4067
+ }
4068
+ const bulletMatch = currentLine.match(/^(\s*)([-*])\s(.*)/);
4069
+ if (bulletMatch) {
4070
+ e.preventDefault();
4071
+ const space = bulletMatch[1];
4072
+ const bullet = bulletMatch[2];
4073
+ const content = bulletMatch[3];
4074
+ if (content.trim() === "") {
4075
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
4076
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
4077
+ el.value = newText;
4078
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
4079
+ setText(newText);
4080
+ return;
4081
+ }
4082
+ insertAtCursor(`
4083
+ ${space}${bullet} `);
4084
+ return;
4085
+ }
4086
+ }
4087
+ };
4024
4088
  const openMentionModalViaButton = () => {
4025
4089
  setMentionTriggerIndex(null);
4026
4090
  setIsMentionModalOpen(true);
@@ -4053,7 +4117,7 @@ function DescriptionEditModal({
4053
4117
  ),
4054
4118
  /* @__PURE__ */ import_react6.default.createElement("div", { className: "h-[2px] bg-gradient-to-r from-indigo-400/0 via-indigo-400/70 to-indigo-400/0 shrink-0" }),
4055
4119
  /* @__PURE__ */ import_react6.default.createElement("div", { className: "px-6 pt-5 pb-3 flex items-center justify-between gap-4 shrink-0" }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react6.default.createElement("span", { className: "inline-flex h-2.5 w-2.5 rounded-full bg-indigo-400/80" }), /* @__PURE__ */ import_react6.default.createElement("p", { className: "text-sm font-medium text-slate-200" }, title || "Editar Descri\xE7\xE3o")), /* @__PURE__ */ import_react6.default.createElement("button", { onClick: handleClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl", title: "Fechar" }, "\xD7")),
4056
- /* @__PURE__ */ import_react6.default.createElement("div", { className: "px-6 py-3 flex flex-col gap-3 border-b border-white/5 bg-white/5 shrink-0" }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex items-center gap-2 overflow-x-auto custom-scrollbar" }, /* @__PURE__ */ import_react6.default.createElement(
4120
+ /* @__PURE__ */ import_react6.default.createElement("div", { className: "px-6 py-3 flex flex-col gap-3 border-b border-white/5 bg-white/5 shrink-0" }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex items-center gap-2 flex-wrap" }, /* @__PURE__ */ import_react6.default.createElement(
4057
4121
  "button",
4058
4122
  {
4059
4123
  onClick: () => insertAtCursor("# "),
@@ -4125,7 +4189,7 @@ function DescriptionEditModal({
4125
4189
  },
4126
4190
  /* @__PURE__ */ import_react6.default.createElement(import_fi4.FiImage, { size: 12 }),
4127
4191
  " Imagem"
4128
- )), /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex items-center gap-2 overflow-x-auto custom-scrollbar" }, /* @__PURE__ */ import_react6.default.createElement(
4192
+ )), /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex items-center gap-2 flex-wrap" }, /* @__PURE__ */ import_react6.default.createElement(
4129
4193
  "button",
4130
4194
  {
4131
4195
  onClick: openMentionModalViaButton,
@@ -4158,6 +4222,7 @@ function DescriptionEditModal({
4158
4222
  ref: textareaRef,
4159
4223
  value: text,
4160
4224
  onChange: handleTextChange,
4225
+ onKeyDown: handleKeyDownTextarea,
4161
4226
  placeholder: "Escreva aqui... Use *// para dividir o texto em 'Sess\xF5es'... Digite @ para mencionar...",
4162
4227
  autoFocus: true,
4163
4228
  className: "w-full flex-1 h-full bg-slate-800/70 p-4 text-sm leading-relaxed rounded-lg border border-white/10 focus:outline-none focus:ring-2 focus:ring-indigo-400/60 custom-scrollbar font-mono resize-none"
package/dist/index.mjs CHANGED
@@ -3977,6 +3977,70 @@ function DescriptionEditModal({
3977
3977
  setIsMentionModalOpen(true);
3978
3978
  }
3979
3979
  };
3980
+ const handleKeyDownTextarea = (e) => {
3981
+ const el = textareaRef.current;
3982
+ if (!el) return;
3983
+ if (e.key === "Enter") {
3984
+ const cursorPosition = el.selectionStart;
3985
+ const textBeforeCursor = text.substring(0, cursorPosition);
3986
+ const linesBeforeCursor = textBeforeCursor.split("\n");
3987
+ const currentLine = linesBeforeCursor[linesBeforeCursor.length - 1];
3988
+ const numberMatch = currentLine.match(/^(\s*)(\d+)\.\s(.*)/);
3989
+ if (numberMatch) {
3990
+ e.preventDefault();
3991
+ const space = numberMatch[1];
3992
+ const number = parseInt(numberMatch[2], 10);
3993
+ const content = numberMatch[3];
3994
+ if (content.trim() === "") {
3995
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
3996
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
3997
+ el.value = newText;
3998
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
3999
+ setText(newText);
4000
+ return;
4001
+ }
4002
+ const nextNumber = number + 1;
4003
+ insertAtCursor(`
4004
+ ${space}${nextNumber}. `);
4005
+ return;
4006
+ }
4007
+ const checklistMatch = currentLine.match(/^(\s*)- \[[ xX]\]\s(.*)/);
4008
+ if (checklistMatch) {
4009
+ e.preventDefault();
4010
+ const space = checklistMatch[1];
4011
+ const content = checklistMatch[2];
4012
+ if (content.trim() === "") {
4013
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
4014
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
4015
+ el.value = newText;
4016
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
4017
+ setText(newText);
4018
+ return;
4019
+ }
4020
+ insertAtCursor(`
4021
+ ${space}- [ ] `);
4022
+ return;
4023
+ }
4024
+ const bulletMatch = currentLine.match(/^(\s*)([-*])\s(.*)/);
4025
+ if (bulletMatch) {
4026
+ e.preventDefault();
4027
+ const space = bulletMatch[1];
4028
+ const bullet = bulletMatch[2];
4029
+ const content = bulletMatch[3];
4030
+ if (content.trim() === "") {
4031
+ const newTextBeforeCursor = textBeforeCursor.substring(0, textBeforeCursor.length - currentLine.length);
4032
+ const newText = newTextBeforeCursor + "\n" + text.substring(el.selectionEnd);
4033
+ el.value = newText;
4034
+ el.setSelectionRange(newTextBeforeCursor.length + 1, newTextBeforeCursor.length + 1);
4035
+ setText(newText);
4036
+ return;
4037
+ }
4038
+ insertAtCursor(`
4039
+ ${space}${bullet} `);
4040
+ return;
4041
+ }
4042
+ }
4043
+ };
3980
4044
  const openMentionModalViaButton = () => {
3981
4045
  setMentionTriggerIndex(null);
3982
4046
  setIsMentionModalOpen(true);
@@ -4009,7 +4073,7 @@ function DescriptionEditModal({
4009
4073
  ),
4010
4074
  /* @__PURE__ */ React5.createElement("div", { className: "h-[2px] bg-gradient-to-r from-indigo-400/0 via-indigo-400/70 to-indigo-400/0 shrink-0" }),
4011
4075
  /* @__PURE__ */ React5.createElement("div", { className: "px-6 pt-5 pb-3 flex items-center justify-between gap-4 shrink-0" }, /* @__PURE__ */ React5.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React5.createElement("span", { className: "inline-flex h-2.5 w-2.5 rounded-full bg-indigo-400/80" }), /* @__PURE__ */ React5.createElement("p", { className: "text-sm font-medium text-slate-200" }, title || "Editar Descri\xE7\xE3o")), /* @__PURE__ */ React5.createElement("button", { onClick: handleClose, className: "w-9 h-9 grid place-content-center rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-xl", title: "Fechar" }, "\xD7")),
4012
- /* @__PURE__ */ React5.createElement("div", { className: "px-6 py-3 flex flex-col gap-3 border-b border-white/5 bg-white/5 shrink-0" }, /* @__PURE__ */ React5.createElement("div", { className: "flex items-center gap-2 overflow-x-auto custom-scrollbar" }, /* @__PURE__ */ React5.createElement(
4076
+ /* @__PURE__ */ React5.createElement("div", { className: "px-6 py-3 flex flex-col gap-3 border-b border-white/5 bg-white/5 shrink-0" }, /* @__PURE__ */ React5.createElement("div", { className: "flex items-center gap-2 flex-wrap" }, /* @__PURE__ */ React5.createElement(
4013
4077
  "button",
4014
4078
  {
4015
4079
  onClick: () => insertAtCursor("# "),
@@ -4081,7 +4145,7 @@ function DescriptionEditModal({
4081
4145
  },
4082
4146
  /* @__PURE__ */ React5.createElement(FiImage, { size: 12 }),
4083
4147
  " Imagem"
4084
- )), /* @__PURE__ */ React5.createElement("div", { className: "flex items-center gap-2 overflow-x-auto custom-scrollbar" }, /* @__PURE__ */ React5.createElement(
4148
+ )), /* @__PURE__ */ React5.createElement("div", { className: "flex items-center gap-2 flex-wrap" }, /* @__PURE__ */ React5.createElement(
4085
4149
  "button",
4086
4150
  {
4087
4151
  onClick: openMentionModalViaButton,
@@ -4114,6 +4178,7 @@ function DescriptionEditModal({
4114
4178
  ref: textareaRef,
4115
4179
  value: text,
4116
4180
  onChange: handleTextChange,
4181
+ onKeyDown: handleKeyDownTextarea,
4117
4182
  placeholder: "Escreva aqui... Use *// para dividir o texto em 'Sess\xF5es'... Digite @ para mencionar...",
4118
4183
  autoFocus: true,
4119
4184
  className: "w-full flex-1 h-full bg-slate-800/70 p-4 text-sm leading-relaxed rounded-lg border border-white/10 focus:outline-none focus:ring-2 focus:ring-indigo-400/60 custom-scrollbar font-mono resize-none"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.2-dev.20",
3
+ "version": "1.2.2-dev.21",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",