@surnie/plugin-kit 0.2.5 → 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 +15 -0
  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
  {
@@ -1107,6 +1117,11 @@ type SurnieUiContext = {
1107
1117
  navigate(to: SurnieLink): void;
1108
1118
  /** Deja el estado de la pantalla en la direcci\xF3n (p\xE1gina, pesta\xF1a\u2026), para enlazarla y recargarla; null lo quita. */
1109
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>;
1110
1125
  };
1111
1126
 
1112
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.5",
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": {