@surnie/plugin-kit 0.2.4 → 0.2.6

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 (2) hide show
  1. package/dist/cli.js +21 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -879,6 +879,7 @@ var num = { type: "number" };
879
879
  var bool = { type: "boolean" };
880
880
  var json = (max, ts) => ({ type: "json", max, ts });
881
881
  var field2 = { name: s(80), label: s(120), required: bool, error: s(300), disabled: bool, hint: s(300) };
882
+ var UI_MAX_FILE_BYTES = 5 * 1024 * 1024;
882
883
  var UI_COMPONENTS = [
883
884
  // Colocar
884
885
  { tag: "surnie-stack", properties: { gap: oneOf("s", "m", "l") }, events: [], children: true },
@@ -946,6 +947,15 @@ var UI_COMPONENTS = [
946
947
  details: { change: "{ checked: boolean }" },
947
948
  children: false
948
949
  },
950
+ // Un fichero de texto (CSV, TSV, JSON o TXT, hasta 5 MB) que elige quien mira: `change` lleva su
951
+ // nombre, su tamaño y su texto (UTF-8). accept: ".csv", ".csv,.tsv"… (solo esos tipos)
952
+ {
953
+ tag: "surnie-filefield",
954
+ properties: { ...field2, accept: s(60) },
955
+ events: ["change"],
956
+ details: { change: "{ name: string; size: number; text: string }" },
957
+ children: false
958
+ },
949
959
  // value: "AAAA-MM-DD"
950
960
  { tag: "surnie-datefield", properties: { ...field2, value: s(10) }, events: ["change"], details: { change: "{ value: string }" }, children: false },
951
961
  {
@@ -1064,8 +1074,12 @@ type SurnieViewer = { id: string; name: string };
1064
1074
  */
1065
1075
  type SurniePanelContext = { user: SurnieViewer; permissions: readonly string[]; locale: string; t: SurnieTranslate };
1066
1076
 
1067
- /** Lo que devuelve una acci\xF3n: un aviso (opcional) y si el panel vuelve a leer la p\xE1gina (s\xED, por defecto). */
1068
- type SurnieActionAnswer = void | null | { toast?: string; tone?: "success" | "danger"; refresh?: boolean };
1077
+ /**
1078
+ * Lo que devuelve una acci\xF3n: un aviso (opcional), si el panel vuelve a leer la p\xE1gina (s\xED, por
1079
+ * defecto) y, con \`navigate\`, ad\xF3nde lleva: una pantalla tuya (\`"screen:<id>?param=valor"\`) o el
1080
+ * contenido del panel (\`"content:<apiId>[/<id>]"\`).
1081
+ */
1082
+ type SurnieActionAnswer = void | null | { toast?: string; tone?: "success" | "danger"; refresh?: boolean; navigate?: string };
1069
1083
 
1070
1084
  `;
1071
1085
  function settingType(s2) {
@@ -1103,6 +1117,11 @@ type SurnieUiContext = {
1103
1117
  navigate(to: SurnieLink): void;
1104
1118
  /** Deja el estado de la pantalla en la direcci\xF3n (p\xE1gina, pesta\xF1a\u2026), para enlazarla y recargarla; null lo quita. */
1105
1119
  setParams(params: Record<string, string | number | null>): void;
1120
+ /**
1121
+ * Da a quien mira un fichero para guardar: texto (CSV, TSV, JSON o TXT por la extensi\xF3n de
1122
+ * \`filename\`), hasta 5 MB. Se descarga, nunca se abre.
1123
+ */
1124
+ download(filename: string, content: string): Promise<void>;
1106
1125
  };
1107
1126
 
1108
1127
  /** Una pantalla o un widget: dibuja en \`root\` con los componentes de Surnie (surnie-*). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surnie/plugin-kit",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Kit para escribir plugins de Surnie: manifiesto, compilación reproducible, firma e inspección.",
5
5
  "type": "module",
6
6
  "bin": {