@interware/content-generator 0.4.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +21 -1
  2. package/dist/_chunks/{App-CfwvfmvL.js → App-CJxSC8yt.js} +32 -720
  3. package/dist/_chunks/{App-BQr5_g5u.mjs → App-qbgUXlOZ.mjs} +38 -726
  4. package/dist/_chunks/ImageStudioTabs-BLAH3KYv.mjs +5270 -0
  5. package/dist/_chunks/ImageStudioTabs-DtusqpQO.js +5271 -0
  6. package/dist/_chunks/PluginProviders-D79TeGSE.js +34 -0
  7. package/dist/_chunks/PluginProviders-DWMpcAIh.mjs +35 -0
  8. package/dist/_chunks/Settings-BQXxV3LO.js +242 -0
  9. package/dist/_chunks/Settings-o2GngLaW.mjs +242 -0
  10. package/dist/_chunks/StudioApp-BaySMwrk.js +18 -0
  11. package/dist/_chunks/StudioApp-C_znlQRo.mjs +18 -0
  12. package/dist/_chunks/{getTranslation-B9ND5RaH.mjs → getTranslation-B6Bsu-uq.mjs} +1 -1
  13. package/dist/_chunks/{getTranslation-DNhP1INv.js → getTranslation-BRVMWSf8.js} +1 -1
  14. package/dist/_chunks/{index-DGPqyrzz.js → index-BKhe-Jyx.js} +24 -6
  15. package/dist/_chunks/{index-Dyq8dxMX.mjs → index-BKigRXm3.mjs} +25 -7
  16. package/dist/admin/index.js +1 -1
  17. package/dist/admin/index.mjs +1 -1
  18. package/dist/admin/src/components/PluginIcon.d.ts +4 -2
  19. package/dist/admin/src/components/PluginProviders.d.ts +12 -0
  20. package/dist/admin/src/components/generate-video/Form.d.ts +1 -1
  21. package/dist/admin/src/components/settings/Form.d.ts +4 -5
  22. package/dist/admin/src/components/settings/VertexSettings.d.ts +18 -0
  23. package/dist/admin/src/containers/settings/index.d.ts +7 -7
  24. package/dist/admin/src/features/background-removal/RemoveBackgroundButton.d.ts +7 -0
  25. package/dist/admin/src/features/background-removal/RemoveBackgroundDialog.d.ts +15 -0
  26. package/dist/admin/src/features/background-removal/colorKey.d.ts +29 -0
  27. package/dist/admin/src/features/background-removal/imageCanvas.d.ts +20 -0
  28. package/dist/admin/src/features/background-removal/mask.d.ts +10 -0
  29. package/dist/admin/src/features/background-removal/runtime.d.ts +31 -0
  30. package/dist/admin/src/features/generator/EditEmpty.d.ts +13 -0
  31. package/dist/admin/src/features/generator/GeneratorTab.d.ts +7 -0
  32. package/dist/admin/src/features/generator/GroundingSources.d.ts +9 -0
  33. package/dist/admin/src/features/generator/ModeSwitch.d.ts +6 -0
  34. package/dist/admin/src/features/generator/PromptComposer.d.ts +25 -0
  35. package/dist/admin/src/features/generator/ReferencePicker.d.ts +26 -0
  36. package/dist/admin/src/features/generator/VersionHistory.d.ts +13 -0
  37. package/dist/admin/src/features/generator/generatorApi.d.ts +71 -0
  38. package/dist/admin/src/features/generator/model.d.ts +60 -0
  39. package/dist/admin/src/features/generator/useGeneratorApi.d.ts +21 -0
  40. package/dist/admin/src/features/image-studio/ImageStudioTabs.d.ts +26 -0
  41. package/dist/admin/src/features/image-studio/SegmentedSwitch.d.ts +18 -0
  42. package/dist/admin/src/features/image-studio/checkerboard.d.ts +5 -0
  43. package/dist/admin/src/features/library/FileCard.d.ts +17 -0
  44. package/dist/admin/src/features/library/FolderTree.d.ts +14 -0
  45. package/dist/admin/src/features/library/LibraryDialogs.d.ts +46 -0
  46. package/dist/admin/src/features/library/LibraryImagePicker.d.ts +15 -0
  47. package/dist/admin/src/features/library/LibraryTab.d.ts +2 -0
  48. package/dist/admin/src/features/library/SaveToLibraryDialog.d.ts +15 -0
  49. package/dist/admin/src/features/library/model.d.ts +40 -0
  50. package/dist/admin/src/features/library/studioRoot.d.ts +11 -0
  51. package/dist/admin/src/features/library/uploadApi.d.ts +77 -0
  52. package/dist/admin/src/features/library/useLibraryApi.d.ts +34 -0
  53. package/dist/admin/src/features/templates/editor/ColorField.d.ts +11 -0
  54. package/dist/admin/src/features/templates/editor/Editor.d.ts +19 -0
  55. package/dist/admin/src/features/templates/editor/EditorBar.d.ts +9 -0
  56. package/dist/admin/src/features/templates/editor/EditorMenuBar.d.ts +58 -0
  57. package/dist/admin/src/features/templates/editor/EditorToolbar.d.ts +20 -0
  58. package/dist/admin/src/features/templates/editor/ElementPalette.d.ts +10 -0
  59. package/dist/admin/src/features/templates/editor/FloatingPanel.d.ts +17 -0
  60. package/dist/admin/src/features/templates/editor/FullscreenView.d.ts +11 -0
  61. package/dist/admin/src/features/templates/editor/IconPicker.d.ts +9 -0
  62. package/dist/admin/src/features/templates/editor/Inspector.d.ts +17 -0
  63. package/dist/admin/src/features/templates/editor/LayersPanel.d.ts +12 -0
  64. package/dist/admin/src/features/templates/editor/Precision.d.ts +23 -0
  65. package/dist/admin/src/features/templates/editor/RangeField.d.ts +12 -0
  66. package/dist/admin/src/features/templates/editor/SaveTemplateDialog.d.ts +14 -0
  67. package/dist/admin/src/features/templates/editor/Stage.d.ts +29 -0
  68. package/dist/admin/src/features/templates/editor/TemplateFolderSelect.d.ts +9 -0
  69. package/dist/admin/src/features/templates/editor/TemplatePicker.d.ts +23 -0
  70. package/dist/admin/src/features/templates/editor/TemplatesTab.d.ts +5 -0
  71. package/dist/admin/src/features/templates/editor/TypographyControls.d.ts +24 -0
  72. package/dist/admin/src/features/templates/editor/icons.d.ts +7 -0
  73. package/dist/admin/src/features/templates/editor/overlays.d.ts +20 -0
  74. package/dist/admin/src/features/templates/editor/useCanvasNav.d.ts +25 -0
  75. package/dist/admin/src/features/templates/editor/useFitScale.d.ts +3 -0
  76. package/dist/admin/src/features/templates/export/fontEmbed.d.ts +22 -0
  77. package/dist/admin/src/features/templates/export/imageSource.d.ts +21 -0
  78. package/dist/admin/src/features/templates/export/pdf.d.ts +6 -0
  79. package/dist/admin/src/features/templates/export/render.d.ts +22 -0
  80. package/dist/admin/src/features/templates/export/useEditorIO.d.ts +18 -0
  81. package/dist/admin/src/features/templates/fonts/catalog.d.ts +47 -0
  82. package/dist/admin/src/features/templates/fonts/customFonts.d.ts +19 -0
  83. package/dist/admin/src/features/templates/fonts/useCustomFonts.d.ts +9 -0
  84. package/dist/admin/src/features/templates/fonts/useFonts.d.ts +2 -0
  85. package/dist/admin/src/features/templates/model/drag.d.ts +10 -0
  86. package/dist/admin/src/features/templates/model/editorReducer.d.ts +58 -0
  87. package/dist/admin/src/features/templates/model/layers.d.ts +42 -0
  88. package/dist/admin/src/features/templates/model/palette.d.ts +38 -0
  89. package/dist/admin/src/features/templates/model/presets.d.ts +17 -0
  90. package/dist/admin/src/features/templates/model/shortcuts.d.ts +19 -0
  91. package/dist/admin/src/features/templates/model/snap.d.ts +24 -0
  92. package/dist/admin/src/features/templates/model/templates.d.ts +8 -0
  93. package/dist/admin/src/features/templates/model/types.d.ts +154 -0
  94. package/dist/admin/src/features/templates/model/viewport.d.ts +36 -0
  95. package/dist/admin/src/features/templates/render/IWLogo.d.ts +7 -0
  96. package/dist/admin/src/features/templates/render/LayerCanvas.d.ts +13 -0
  97. package/dist/admin/src/features/templates/render/fonts.d.ts +5 -0
  98. package/dist/admin/src/features/templates/render/icons.d.ts +10 -0
  99. package/dist/admin/src/features/templates/render/renderLayer.d.ts +9 -0
  100. package/dist/admin/src/features/templates/store/persist.d.ts +41 -0
  101. package/dist/admin/src/features/templates/store/templatesApi.d.ts +49 -0
  102. package/dist/admin/src/features/templates/store/useMyTemplates.d.ts +19 -0
  103. package/dist/admin/src/features/templates/store/useTemplateSaving.d.ts +14 -0
  104. package/dist/admin/src/features/templates/store/useTemplatesApi.d.ts +23 -0
  105. package/dist/admin/src/hooks/useAdminTheme.d.ts +8 -0
  106. package/dist/admin/src/hooks/useThemeColors.d.ts +9 -0
  107. package/dist/admin/src/lib/dataUrl.d.ts +6 -0
  108. package/dist/admin/src/lib/promptRules.d.ts +23 -0
  109. package/dist/admin/src/lib/use-cases/articles/index.d.ts +12 -1
  110. package/dist/admin/src/lib/use-cases/categories/index.d.ts +12 -1
  111. package/dist/admin/src/lib/use-cases/facebook/index.d.ts +1 -1
  112. package/dist/admin/src/lib/use-cases/generate-content/index.d.ts +2 -2
  113. package/dist/admin/src/lib/use-cases/images/index.d.ts +1 -4
  114. package/dist/admin/src/lib/use-cases/linkedin/index.d.ts +1 -1
  115. package/dist/admin/src/lib/use-cases/settings/index.d.ts +14 -2
  116. package/dist/admin/src/lib/use-cases/users/index.d.ts +12 -1
  117. package/dist/admin/src/pages/ImageStudio.d.ts +3 -0
  118. package/dist/admin/src/pages/StudioApp.d.ts +3 -0
  119. package/dist/admin/src/pluginId.d.ts +6 -0
  120. package/dist/admin/src/test-setup.d.ts +1 -0
  121. package/dist/admin/src/test-utils.d.ts +5 -0
  122. package/dist/server/index.js +2494 -1279
  123. package/dist/server/index.mjs +2501 -1285
  124. package/dist/server/src/bootstrap.d.ts +1 -1
  125. package/dist/server/src/content-types/index.d.ts +66 -1
  126. package/dist/server/src/content-types/template/index.d.ts +65 -0
  127. package/dist/server/src/content-types/template/schema.d.ts +69 -0
  128. package/dist/server/src/controllers/config.d.ts +10 -0
  129. package/dist/server/src/controllers/controller.d.ts +0 -5
  130. package/dist/server/src/controllers/image-studio.d.ts +23 -0
  131. package/dist/server/src/controllers/index.d.ts +129 -5
  132. package/dist/server/src/controllers/templates.d.ts +26 -0
  133. package/dist/server/src/image-studio/geminiConfig.d.ts +40 -0
  134. package/dist/server/src/image-studio/models.d.ts +39 -0
  135. package/dist/server/src/image-studio/prompt.d.ts +7 -0
  136. package/dist/server/src/image-studio/validate.d.ts +41 -0
  137. package/dist/server/src/index.d.ts +233 -75
  138. package/dist/server/src/routes/admin.d.ts +6 -2
  139. package/dist/server/src/routes/content-api.d.ts +4 -9
  140. package/dist/server/src/routes/index.d.ts +7 -11
  141. package/dist/server/src/routes/policies.d.ts +14 -0
  142. package/dist/server/src/services/image-studio.d.ts +66 -0
  143. package/dist/server/src/services/index.d.ts +30 -57
  144. package/dist/server/src/services/service.d.ts +10 -57
  145. package/dist/server/src/services/templates.d.ts +81 -0
  146. package/dist/server/src/templates/folders.d.ts +14 -0
  147. package/dist/server/src/templates/validate.d.ts +23 -0
  148. package/dist/server/src/utils/folders.d.ts +15 -0
  149. package/dist/server/src/utils/geminiClient.d.ts +24 -0
  150. package/dist/server/src/utils/secrets.d.ts +9 -0
  151. package/dist/server/src/utils/serviceAccount.d.ts +29 -0
  152. package/package.json +23 -10
  153. package/static/background-worker.d.mts +15 -0
  154. package/static/background-worker.mjs +87 -0
  155. package/dist/_chunks/Settings-BrqTzJp-.js +0 -262
  156. package/dist/_chunks/Settings-CdZnYLLK.mjs +0 -244
  157. package/dist/admin/src/components/Navigation.d.ts +0 -2
  158. package/dist/admin/src/components/generate-image/Form.d.ts +0 -15
  159. package/dist/admin/src/components/generate-images/Image.d.ts +0 -5
  160. package/dist/admin/src/components/generate-images/Images.d.ts +0 -2
  161. package/dist/admin/src/components/generate-images/Modal.d.ts +0 -9
  162. package/dist/admin/src/containers/generate-image/index.d.ts +0 -2
  163. package/dist/admin/src/containers/generate-images/index.d.ts +0 -2
  164. package/dist/admin/src/hooks/generate-images/useImages.d.ts +0 -12
  165. package/dist/admin/src/pages/GenerateImage.d.ts +0 -2
  166. package/dist/admin/src/pages/GenerateImages.d.ts +0 -2
@@ -20,6 +20,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
20
20
  });
21
21
  };
22
22
  const PLUGIN_ID = "strapi-content-generator-gemini";
23
+ const STUDIO_PATH = `plugins/${PLUGIN_ID}-studio`;
23
24
  const loadFontAwesome = () => {
24
25
  if (document.getElementById("font-awesome-kit")) return;
25
26
  const script = document.createElement("script");
@@ -37,7 +38,8 @@ const Initializer = ({ setPlugin }) => {
37
38
  }, []);
38
39
  return null;
39
40
  };
40
- const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Sparkle, {});
41
+ const ContentIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Quotes, {});
42
+ const StudioIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Lightning, {});
41
43
  const pluginPermissions = {
42
44
  access: [
43
45
  {
@@ -71,19 +73,34 @@ const index = {
71
73
  register(app) {
72
74
  app.addMenuLink({
73
75
  to: `plugins/${PLUGIN_ID}`,
74
- icon: PluginIcon,
76
+ icon: ContentIcon,
75
77
  intlLabel: {
76
- id: `${PLUGIN_ID}.plugin.name`,
77
- defaultMessage: PLUGIN_ID
78
+ id: `${PLUGIN_ID}.menu.content`,
79
+ defaultMessage: "Generador de contenido"
78
80
  },
79
81
  Component: async () => {
80
- const { App } = await Promise.resolve().then(() => require("./App-CfwvfmvL.js"));
82
+ const { App } = await Promise.resolve().then(() => require("./App-CJxSC8yt.js"));
81
83
  return App;
82
84
  },
83
85
  permissions: [
84
86
  pluginPermissions.access[0]
85
87
  ]
86
88
  });
89
+ app.addMenuLink({
90
+ to: STUDIO_PATH,
91
+ icon: StudioIcon,
92
+ intlLabel: {
93
+ id: `${PLUGIN_ID}.menu.studio`,
94
+ defaultMessage: "Estudio de imágenes"
95
+ },
96
+ Component: async () => {
97
+ const { StudioApp } = await Promise.resolve().then(() => require("./StudioApp-BaySMwrk.js"));
98
+ return StudioApp;
99
+ },
100
+ permissions: [
101
+ pluginPermissions.access[0]
102
+ ]
103
+ });
87
104
  app.registerPlugin({
88
105
  id: PLUGIN_ID,
89
106
  initializer: Initializer,
@@ -98,7 +115,7 @@ const index = {
98
115
  defaultMessage: PLUGIN_ID
99
116
  },
100
117
  Component: async () => {
101
- const component = await Promise.resolve().then(() => require("./Settings-BrqTzJp-.js"));
118
+ const component = await Promise.resolve().then(() => require("./Settings-BQXxV3LO.js"));
102
119
  return component.default;
103
120
  },
104
121
  to: `plugins/${PLUGIN_ID}/settings`,
@@ -119,6 +136,7 @@ const index = {
119
136
  }
120
137
  };
121
138
  exports.PLUGIN_ID = PLUGIN_ID;
139
+ exports.STUDIO_PATH = STUDIO_PATH;
122
140
  exports.closeDialog = closeDialog;
123
141
  exports.index = index;
124
142
  exports.openDialog = openDialog;
@@ -1,6 +1,6 @@
1
1
  import { useRef, useEffect } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { Sparkle } from "@strapi/icons";
3
+ import { Quotes, Lightning } from "@strapi/icons";
4
4
  import { createSlice } from "@reduxjs/toolkit";
5
5
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
6
6
  const v = glob[path];
@@ -19,6 +19,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
19
19
  });
20
20
  };
21
21
  const PLUGIN_ID = "strapi-content-generator-gemini";
22
+ const STUDIO_PATH = `plugins/${PLUGIN_ID}-studio`;
22
23
  const loadFontAwesome = () => {
23
24
  if (document.getElementById("font-awesome-kit")) return;
24
25
  const script = document.createElement("script");
@@ -36,7 +37,8 @@ const Initializer = ({ setPlugin }) => {
36
37
  }, []);
37
38
  return null;
38
39
  };
39
- const PluginIcon = () => /* @__PURE__ */ jsx(Sparkle, {});
40
+ const ContentIcon = () => /* @__PURE__ */ jsx(Quotes, {});
41
+ const StudioIcon = () => /* @__PURE__ */ jsx(Lightning, {});
40
42
  const pluginPermissions = {
41
43
  access: [
42
44
  {
@@ -70,19 +72,34 @@ const index = {
70
72
  register(app) {
71
73
  app.addMenuLink({
72
74
  to: `plugins/${PLUGIN_ID}`,
73
- icon: PluginIcon,
75
+ icon: ContentIcon,
74
76
  intlLabel: {
75
- id: `${PLUGIN_ID}.plugin.name`,
76
- defaultMessage: PLUGIN_ID
77
+ id: `${PLUGIN_ID}.menu.content`,
78
+ defaultMessage: "Generador de contenido"
77
79
  },
78
80
  Component: async () => {
79
- const { App } = await import("./App-BQr5_g5u.mjs");
81
+ const { App } = await import("./App-qbgUXlOZ.mjs");
80
82
  return App;
81
83
  },
82
84
  permissions: [
83
85
  pluginPermissions.access[0]
84
86
  ]
85
87
  });
88
+ app.addMenuLink({
89
+ to: STUDIO_PATH,
90
+ icon: StudioIcon,
91
+ intlLabel: {
92
+ id: `${PLUGIN_ID}.menu.studio`,
93
+ defaultMessage: "Estudio de imágenes"
94
+ },
95
+ Component: async () => {
96
+ const { StudioApp } = await import("./StudioApp-C_znlQRo.mjs");
97
+ return StudioApp;
98
+ },
99
+ permissions: [
100
+ pluginPermissions.access[0]
101
+ ]
102
+ });
86
103
  app.registerPlugin({
87
104
  id: PLUGIN_ID,
88
105
  initializer: Initializer,
@@ -97,7 +114,7 @@ const index = {
97
114
  defaultMessage: PLUGIN_ID
98
115
  },
99
116
  Component: async () => {
100
- const component = await import("./Settings-CdZnYLLK.mjs");
117
+ const component = await import("./Settings-o2GngLaW.mjs");
101
118
  return component.default;
102
119
  },
103
120
  to: `plugins/${PLUGIN_ID}/settings`,
@@ -119,6 +136,7 @@ const index = {
119
136
  };
120
137
  export {
121
138
  PLUGIN_ID as P,
139
+ STUDIO_PATH as S,
122
140
  closeDialog as c,
123
141
  index as i,
124
142
  openDialog as o,
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-DGPqyrzz.js");
2
+ const index = require("../_chunks/index-BKhe-Jyx.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-Dyq8dxMX.mjs";
1
+ import { i } from "../_chunks/index-BKigRXm3.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -1,2 +1,4 @@
1
- declare const PluginIcon: () => import("react/jsx-runtime").JSX.Element;
2
- export { PluginIcon };
1
+ /** Íconos de las entradas del menú principal (S4.10; Quotes y Lightning a pedido de Israel). */
2
+ declare const ContentIcon: () => import("react/jsx-runtime").JSX.Element;
3
+ declare const StudioIcon: () => import("react/jsx-runtime").JSX.Element;
4
+ export { ContentIcon, StudioIcon };
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Proveedores del plugin. El plugin trae su propia copia del Design System (2.2), así que sus componentes
4
+ * necesitan su tema (claro u oscuro según el panel, S4.10) y el proveedor de tooltips.
5
+ *
6
+ * NO se usa `DesignSystemProvider`: monta un `GlobalStyle` con el mismo id que el del panel y, al desmontarse
7
+ * (al salir del plugin), styled-components borraba también los estilos globales del panel: todo Strapi quedaba
8
+ * en Times hasta recargar. Los estilos globales y las regiones `aria-live` ya los pone el panel.
9
+ */
10
+ export declare const PluginProviders: ({ children }: {
11
+ children: ReactNode;
12
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -16,7 +16,7 @@ export type ReferenceImage = {
16
16
  previewUrl?: string;
17
17
  };
18
18
  export declare const validationSchema: Yup.ObjectSchema<{
19
- aspectRatio: NonNullable<"1:1" | "9:16" | "16:9" | undefined>;
19
+ aspectRatio: NonNullable<"1:1" | "16:9" | "9:16" | undefined>;
20
20
  scenes: {
21
21
  referenceImages?: {
22
22
  file?: {} | undefined;
@@ -1,8 +1,7 @@
1
- import { type FormikHelpers } from 'formik';
2
- import type { FormValues } from "../../containers/settings";
1
+ import type { FormValues, SettingsStatus } from '../../containers/settings';
3
2
  interface FormProps {
4
- settings: FormValues;
5
- handleSubmit: (values: FormValues, formikHelpers: FormikHelpers<FormValues>) => void;
3
+ status: SettingsStatus;
4
+ handleSubmit: (values: Partial<FormValues>) => void | Promise<void>;
6
5
  }
7
- declare const Form: ({ settings, handleSubmit }: FormProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const Form: ({ status, handleSubmit }: FormProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export { Form };
@@ -0,0 +1,18 @@
1
+ /** Estado público de la cuenta de servicio que devuelve `GET /config`: nunca la llave (S5.1). */
2
+ export interface VertexStatus {
3
+ configured: boolean;
4
+ projectId: string | null;
5
+ clientEmail: string | null;
6
+ }
7
+ interface VertexSettingsProps {
8
+ status: VertexStatus;
9
+ /** Guarda el JSON pegado. Rechaza con el mensaje del servidor si no es válido. */
10
+ onSave: (json: string) => Promise<void>;
11
+ onRemove: () => Promise<void>;
12
+ }
13
+ /**
14
+ * Cuenta de servicio de Vertex AI en Ajustes (S5.1, decisión de Israel). Se pega el JSON completo; al guardarse,
15
+ * el campo se limpia y la llave no vuelve a mostrarse: solo el proyecto y el correo de la cuenta.
16
+ */
17
+ export declare const VertexSettings: ({ status, onSave, onRemove }: VertexSettingsProps) => import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -1,9 +1,9 @@
1
- export type FormValues = {
2
- googleGenAI: string;
3
- linkedInAccessToken: string;
4
- linkedInOrganizationId: string;
5
- facebookClientToken: string;
6
- facebookPageId: string;
7
- };
1
+ export type CredentialField = 'googleGenAI' | 'linkedInAccessToken' | 'linkedInOrganizationId' | 'facebookClientToken' | 'facebookPageId';
2
+ export type FormValues = Record<CredentialField, string>;
3
+ /** Estado enmascarado que devuelve `GET /config`: nunca incluye el valor completo. */
4
+ export type SettingsStatus = Record<CredentialField, {
5
+ configured: boolean;
6
+ last4: string | null;
7
+ }>;
8
8
  declare const SettingsContainer: () => import("react/jsx-runtime").JSX.Element;
9
9
  export { SettingsContainer };
@@ -0,0 +1,7 @@
1
+ interface RemoveBackgroundButtonProps {
2
+ src: string;
3
+ onDone: (dataUrl: string) => void;
4
+ }
5
+ /** «Quitar fondo»: abre el diálogo con los modos Automático y Por color (S4.18); los errores se ven ahí. */
6
+ export declare const RemoveBackgroundButton: ({ src, onDone }: RemoveBackgroundButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,15 @@
1
+ /** Tolerancia inicial (%): quita el fondo liso y sus variaciones leves (compresión, sombras suaves). */
2
+ export declare const DEFAULT_TOLERANCE = 15;
3
+ interface RemoveBackgroundDialogProps {
4
+ open: boolean;
5
+ src: string;
6
+ onClose: () => void;
7
+ /** PNG sin fondo en data URL. Puede ser asíncrono (la biblioteca guarda la copia). */
8
+ onApply: (dataUrl: string) => void | Promise<void>;
9
+ }
10
+ /**
11
+ * «Quitar fondo» con dos modos (S4.18): *Automático* corre ISNet (S4.17) al abrir; *Por color* quita
12
+ * el fondo conectado a cada punto marcado, con tolerancia y vista previa en vivo.
13
+ */
14
+ export declare const RemoveBackgroundDialog: ({ open, src, onClose, onApply }: RemoveBackgroundDialogProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * «Quitar fondo» por color (S4.18). Desde cada punto marcado se rellenan los píxeles conectados
3
+ * (vecinos arriba, abajo, izquierda y derecha) cuyo color se parece al del punto. Solo se quita lo
4
+ * conectado: otro fondo, aunque sea del mismo color, se queda si un objeto lo separa. Funciones puras
5
+ * sobre arreglos RGBA; el canvas queda en el diálogo.
6
+ */
7
+ export interface Point {
8
+ x: number;
9
+ y: number;
10
+ }
11
+ type Rgb = readonly [number, number, number];
12
+ /** Franja después de la tolerancia con alfa parcial, para que el contorno no quede dentado. */
13
+ export declare const SOFTNESS = 0.06;
14
+ /** Distancia euclidiana RGB normalizada: 0 es el mismo color, 1 es blanco contra negro. */
15
+ export declare const colorDistance: (a: Rgb, b: Rgb) => number;
16
+ /**
17
+ * Alfa por píxel (0 quitado, 255 intacto). Cada píxel se compara con el color de su punto, no con su
18
+ * vecino, así un degradado no se va en cadena. Hasta `tolerance` (0–1) el píxel se quita y el relleno
19
+ * sigue; en la franja siguiente (`SOFTNESS`) queda con alfa parcial y el relleno se detiene ahí.
20
+ *
21
+ * Con `contiguous: false` se quita ese color en toda la imagen, conectado o no: los huecos de letras y
22
+ * figuras (la «o», la «a») que el relleno no alcanza porque el trazo los encierra.
23
+ */
24
+ export declare const colorKeyAlpha: (rgba: Uint8ClampedArray, width: number, height: number, points: Point[], tolerance: number, { contiguous }?: {
25
+ contiguous?: boolean;
26
+ }) => Uint8ClampedArray;
27
+ /** Copia de la imagen con el alfa aplicado; conserva la transparencia que ya tenía. */
28
+ export declare const applyKeyAlpha: (rgba: Uint8ClampedArray, alpha: Uint8ClampedArray) => Uint8ClampedArray;
29
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Canvas de «Quitar fondo» (S4.18): leer los píxeles de una imagen, pintarlos y exportarlos a PNG.
3
+ * Aislado aquí porque jsdom no dibuja; las pruebas lo simulan.
4
+ */
5
+ export interface Pixels {
6
+ width: number;
7
+ height: number;
8
+ data: Uint8ClampedArray;
9
+ }
10
+ export declare const canvas: (width: number, height: number) => {
11
+ c: HTMLCanvasElement;
12
+ ctx: CanvasRenderingContext2D;
13
+ };
14
+ export declare const loadImage: (src: string) => Promise<HTMLImageElement>;
15
+ /** Píxeles RGBA de una imagen (data URL o URL del mismo origen) a su tamaño original. */
16
+ export declare const loadPixels: (src: string) => Promise<Pixels>;
17
+ /** Pinta los píxeles en un canvas de la página (la vista previa). */
18
+ export declare const drawPixels: (target: HTMLCanvasElement, width: number, height: number, data: Uint8ClampedArray) => void;
19
+ /** Píxeles → PNG en data URL (conserva la transparencia). */
20
+ export declare const pixelsToDataUrl: (width: number, height: number, data: Uint8ClampedArray) => string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Posprocesamiento de «Quitar fondo» en el panel (S4.17). La normalización y el modelo (ISNet) los hace el
3
+ * worker (`static/background-worker.mjs`); aquí se aplica su máscara 0–1 al tamaño de la imagen.
4
+ * Funciones puras sobre arreglos RGBA: el canvas queda en `runtime.ts`.
5
+ */
6
+ export declare const INPUT_SIZE = 1024;
7
+ /** Máscara 0–1 → RGBA en gris opaco, para escalarla con un canvas sin alfa premultiplicado. */
8
+ export declare const maskToRgba: (mask: Float32Array, width: number, height: number) => Uint8ClampedArray;
9
+ /** Usa el canal rojo de la máscara (ya al tamaño de la imagen) como alfa de la imagen. */
10
+ export declare const applyAlpha: (rgba: Uint8ClampedArray, maskRgba: Uint8ClampedArray) => void;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Worker que sirve el CMS desde `/ort/` (lo copia `npm run assets:image-studio` de web-cms desde
3
+ * `static/background-worker.mjs`): la inferencia corre fuera del hilo del panel (S4.17, ADR-007).
4
+ */
5
+ export declare const WORKER_URL = "/ort/background-worker.mjs";
6
+ /** Límite por imagen: con WASM en una máquina lenta tarda decenas de segundos, nunca minutos. */
7
+ export declare const RUN_TIMEOUT_MS = 120000;
8
+ export declare const TIMEOUT_MESSAGE = "Quitar fondo tard\u00F3 demasiado. Intenta de nuevo.";
9
+ export declare class RemoveBackgroundTimeout extends Error {
10
+ constructor();
11
+ }
12
+ /** Mensaje para el panel: el aviso de tiempo agotado o el genérico. */
13
+ export declare const removeBackgroundError: (err: unknown) => "Quitar fondo tardó demasiado. Intenta de nuevo." | "No se pudo quitar el fondo.";
14
+ export interface Model {
15
+ /** Píxeles RGBA de 1024 × 1024 → máscara 0–1. El búfer se transfiere al worker. */
16
+ run: (rgba: Uint8ClampedArray) => Promise<Float32Array>;
17
+ }
18
+ /**
19
+ * Crea el worker y carga el modelo una sola vez por sesión del panel. El worker elige WebGPU o WASM.
20
+ * Si la carga o una imagen fallan, o una imagen pasa del límite, termina el worker y descarta la
21
+ * promesa: una sesión que falló puede no volver a responder, y el siguiente intento empieza de cero.
22
+ */
23
+ export declare const loadModel: (onStatus?: (status: string) => void) => Promise<Model>;
24
+ /** Solo para pruebas. */
25
+ export declare const resetModel: () => void;
26
+ /**
27
+ * Quita el fondo de una imagen (data URL o URL del mismo origen) y devuelve un PNG en data URL con
28
+ * el fondo transparente, al tamaño original. La máscara vuelve a ese tamaño escalándola con el
29
+ * canvas (diseño S4.7, D8).
30
+ */
31
+ export declare const removeBackground: (src: string, onStatus?: (status: string) => void) => Promise<string>;
@@ -0,0 +1,13 @@
1
+ import type { LibraryFile } from '../library/uploadApi';
2
+ interface EditEmptyProps {
3
+ disabled: boolean;
4
+ onUpload: (file: File | undefined) => void;
5
+ onOpenLibrary: () => void;
6
+ onOpenRecent: (file: LibraryFile) => void;
7
+ }
8
+ /**
9
+ * Modo Editar sin imagen (S4.13): arrastrar, subir o elegir de la biblioteca, con las imágenes más
10
+ * recientes de toda la biblioteca (raíz y subcarpetas, S4.14) a un clic.
11
+ */
12
+ export declare const EditEmpty: ({ disabled, onUpload, onOpenLibrary, onOpenRecent }: EditEmptyProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pestaña «Generador» del Estudio de imágenes (diseño S4.2, modos de S4.13). «Crear imagen»: parámetros,
3
+ * referencias de estilo y prompt con «Expandir idea». «Editar imagen»: una imagen (generada, subida o
4
+ * de la biblioteca) con cambios por instrucción, elementos para integrar e historial de versiones en
5
+ * memoria. Nada se sube a la biblioteca hasta que se guarda (D4).
6
+ */
7
+ export declare const GeneratorTab: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { Grounding } from './generatorApi';
2
+ /**
3
+ * Fuentes y sugerencia de búsqueda de una imagen generada con búsqueda de Google (S4.14, D6). Los
4
+ * términos de Google piden mostrar la sugerencia tal cual: es HTML de Google, así que va en un
5
+ * iframe `srcdoc` sin scripts (solo puede abrir sus enlaces en otra pestaña).
6
+ */
7
+ export declare const GroundingSources: ({ grounding }: {
8
+ grounding: Grounding;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ export type GeneratorMode = 'create' | 'edit';
2
+ /** Crear o editar (S4.13): dos modos separados para que quede claro qué aplica en cada uno. */
3
+ export declare const ModeSwitch: ({ value, onChange }: {
4
+ value: GeneratorMode;
5
+ onChange: (mode: GeneratorMode) => void;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { PromptLabels } from '../../lib/promptRules';
3
+ interface PromptComposerProps {
4
+ label: string;
5
+ value: string;
6
+ onChange: (value: string) => void;
7
+ /** Recibe el texto ya saneado (S4.14, D1). */
8
+ onSubmit: (text: string) => void;
9
+ labels: PromptLabels;
10
+ placeholder: string;
11
+ actionLabel: string;
12
+ actionIcon: ReactNode;
13
+ loading: boolean;
14
+ disabled: boolean;
15
+ hint?: string;
16
+ /** Acciones secundarias dentro del campo, a la izquierda del contador (p. ej. «Expandir idea»). */
17
+ tools?: ReactNode;
18
+ }
19
+ /**
20
+ * Campo de prompt con la acción principal dentro (S4.14, D3): contador, validación con las reglas
21
+ * compartidas y ⌘/Ctrl + Enter. Snowflake: el `Textarea` del DS no admite contenido dentro del
22
+ * borde; se pinta con los tokens del tema.
23
+ */
24
+ export declare const PromptComposer: (p: PromptComposerProps) => import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -0,0 +1,26 @@
1
+ interface ReferencePickerProps {
2
+ files: File[];
3
+ max: number;
4
+ modelLabel: string;
5
+ onChange: (files: File[]) => void;
6
+ /** Abre el selector de la biblioteca (S4.13). */
7
+ onPickFromLibrary: () => void;
8
+ /**
9
+ * Textos del uso: referencias de estilo al crear o elementos para el cambio al editar (S4.13).
10
+ * `noun` arma «Agregar …», «… desde la biblioteca» y las etiquetas accesibles.
11
+ */
12
+ label?: string;
13
+ hint?: string;
14
+ noun?: {
15
+ plural: string;
16
+ capital: string;
17
+ file: string;
18
+ none: string;
19
+ };
20
+ }
21
+ /**
22
+ * Imágenes de referencia con miniaturas. Snowflake: el DS no tiene un cargador de imágenes con
23
+ * vista previa. El tope lo da el modelo (diseño S4.2, D7); con 0 se deshabilita y lo explica.
24
+ */
25
+ export declare const ReferencePicker: ({ files, max, modelLabel, onChange, onPickFromLibrary, label, hint, noun, }: ReferencePickerProps) => import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Version } from './model';
2
+ interface VersionHistoryProps {
3
+ versions: Version[];
4
+ currentId: string | null;
5
+ disabled: boolean;
6
+ onSelect: (id: string) => void;
7
+ }
8
+ /**
9
+ * Historial de versiones con miniatura. Snowflake: el DS no tiene una lista seleccionable con
10
+ * imagen; cada fila es un botón con `aria-current` en la versión actual.
11
+ */
12
+ export declare const VersionHistory: ({ versions, currentId, disabled, onSelect }: VersionHistoryProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,71 @@
1
+ export interface ImageModelInfo {
2
+ id: string;
3
+ label: string;
4
+ maxReferences: number;
5
+ sizes: string[];
6
+ aspectRatios: string[];
7
+ canEdit: boolean;
8
+ /** Admite la búsqueda de Google al generar (S4.14). */
9
+ grounding: boolean;
10
+ }
11
+ /** Fuentes y sugerencia de búsqueda que devuelve una imagen generada con búsqueda de Google. */
12
+ export interface Grounding {
13
+ suggestions?: string;
14
+ /** Consultas web y de imágenes que hizo el modelo. */
15
+ queries: string[];
16
+ sources: {
17
+ title: string;
18
+ uri: string;
19
+ }[];
20
+ }
21
+ export interface GenerateParams {
22
+ prompt: string;
23
+ model: string;
24
+ aspectRatio: string;
25
+ imageSize?: string;
26
+ safety: boolean;
27
+ allowPeople: boolean;
28
+ grounding: boolean;
29
+ references: File[];
30
+ }
31
+ /** Editar la versión actual; `references` son los elementos para el cambio (S4.13). */
32
+ export interface EditParams {
33
+ src: string;
34
+ instruction: string;
35
+ model: string;
36
+ references: File[];
37
+ safety: boolean;
38
+ allowPeople: boolean;
39
+ /** Proporción que debe conservar el resultado (la de la imagen base). */
40
+ aspectRatio?: string;
41
+ }
42
+ type Client = {
43
+ get: (url: string) => Promise<{
44
+ data: unknown;
45
+ }>;
46
+ post: (url: string, body: unknown) => Promise<{
47
+ data: unknown;
48
+ }>;
49
+ };
50
+ /** Mensaje del servidor (400 y 422 traen uno legible, diseño S4.2 D12) o el genérico dado. */
51
+ export declare const errorMessage: (err: unknown, fallback: string) => string;
52
+ /** Cliente de las rutas del Generador. Las imágenes viajan en multipart (el JSON admite 1 MB). */
53
+ export declare const createGeneratorApi: (client: Client) => {
54
+ models(): Promise<{
55
+ models: ImageModelInfo[];
56
+ verified: boolean;
57
+ }>;
58
+ generate(p: GenerateParams): Promise<{
59
+ grounding?: Grounding | undefined;
60
+ src: string;
61
+ model: string;
62
+ }>;
63
+ edit(p: EditParams): Promise<{
64
+ grounding?: Grounding | undefined;
65
+ src: string;
66
+ model: string;
67
+ }>;
68
+ expand(prompt: string): Promise<string>;
69
+ };
70
+ export type GeneratorApi = ReturnType<typeof createGeneratorApi>;
71
+ export {};
@@ -0,0 +1,60 @@
1
+ import type { Grounding } from './generatorApi';
2
+ /**
3
+ * Historial de versiones del Generador (diseño S4.2, D10). Vive en memoria como en el prototipo:
4
+ * la persistencia quedó en el parking lot del epic.
5
+ */
6
+ export interface Version {
7
+ id: string;
8
+ /** Data URL de la imagen. */
9
+ src: string;
10
+ prompt: string;
11
+ /** Instrucción con la que se iteró; vacía en la versión original. */
12
+ instruction?: string;
13
+ /** Fuentes y sugerencia si se generó con búsqueda de Google (S4.14). */
14
+ grounding?: Grounding;
15
+ }
16
+ export interface GeneratorState {
17
+ versions: Version[];
18
+ currentId: string | null;
19
+ }
20
+ export type GeneratorAction = {
21
+ type: 'generated';
22
+ id: string;
23
+ src: string;
24
+ prompt: string;
25
+ grounding?: Grounding;
26
+ } | {
27
+ type: 'iterated';
28
+ id: string;
29
+ src: string;
30
+ instruction: string;
31
+ }
32
+ /** Una imagen existente (subida o de la biblioteca) como Original, para editarla (S4.13). */
33
+ | {
34
+ type: 'loaded';
35
+ id: string;
36
+ src: string;
37
+ name: string;
38
+ } | {
39
+ type: 'select';
40
+ id: string;
41
+ }
42
+ /** «Cambiar imagen» en el modo Editar (S4.13). */
43
+ | {
44
+ type: 'reset';
45
+ };
46
+ export declare const initialGenerator: GeneratorState;
47
+ export declare const currentVersion: (s: GeneratorState) => Version | null;
48
+ export declare const generatorReducer: (state: GeneratorState, action: GeneratorAction) => GeneratorState;
49
+ export declare const versionLabel: (index: number) => string;
50
+ /**
51
+ * «Imagen 28 sep» y, desde la segunda versión, « v3». La fecha se arma a mano: `toLocaleDateString`
52
+ * da «28-sep» o «28 sept» según la versión de ICU del navegador.
53
+ */
54
+ export declare const defaultSaveName: (date: Date, index: number) => string;
55
+ export declare const ITERATE_EXAMPLES: string[];
56
+ /**
57
+ * La proporción del modelo más cercana a unas medidas (S4.13). Al editar con elementos, Gemini no
58
+ * conserva la proporción de la imagen base, así que se le pide la más parecida.
59
+ */
60
+ export declare const closestRatio: (width: number, height: number, ratios: string[]) => string | undefined;
@@ -0,0 +1,21 @@
1
+ /** Cliente del Generador conectado al panel (sesión y notificaciones de Strapi). */
2
+ export declare const useGeneratorApi: () => {
3
+ api: {
4
+ models(): Promise<{
5
+ models: import("./generatorApi").ImageModelInfo[];
6
+ verified: boolean;
7
+ }>;
8
+ generate(p: import("./generatorApi").GenerateParams): Promise<{
9
+ grounding?: import("./generatorApi").Grounding | undefined;
10
+ src: string;
11
+ model: string;
12
+ }>;
13
+ edit(p: import("./generatorApi").EditParams): Promise<{
14
+ grounding?: import("./generatorApi").Grounding | undefined;
15
+ src: string;
16
+ model: string;
17
+ }>;
18
+ expand(prompt: string): Promise<string>;
19
+ };
20
+ notify: (type: 'success' | 'danger' | 'warning', message: string) => void;
21
+ };