directus-extension-texttoanything 0.1.2 → 0.2.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 (4) hide show
  1. package/dist/api.js +21339 -11
  2. package/dist/app.js +983 -1
  3. package/package.json +31 -1
  4. package/readme.md +1 -0
package/dist/app.js CHANGED
@@ -1 +1,983 @@
1
- import{defineOperationApp as e}from"@directus/extensions-sdk";const t=[],a=[],o=[],i=[],n=[],d=[e({id:"ttabarcode",name:"TTA generate barcode",icon:"box",description:"Generate a barcode trough Text to anything!",overview:({barcodeContent:e})=>[{label:"barcode content",text:e}],options:[{field:"RapidAPI token",name:"RapidAPI token",type:"string",meta:{width:"full",interface:"input"}},{field:"barcodeContent",name:"content",type:"string",meta:{width:"full",interface:"input"}},{field:"barcodeType",name:"type",type:"dropdown",meta:{interface:"select-dropdown",options:{choices:["auspost","azteccode","azteccodecompact","aztecrune","bc412","channelcode","codablockf","code11","code128","code16k","code2of5","code32","code39","code39ext","code49","code93","code93ext","codeone","coop2of5","daft","databarexpanded","databarexpandedcomposite","databarexpandedstacked","databarexpandedstackedcomposite","databarlimited","databarlimitedcomposite","databaromni","databaromnicomposite","databarstacked","databarstackedcomposite","databarstackedomni","databarstackedomnicomposite","databartruncated","databartruncatedcomposite","datalogic2of5","datamatrix","datamatrixrectangular","datamatrixrectangularextension","dotcode","ean13","ean13composite","ean14","ean2","ean5","ean8","ean8composite","flattermarken","gs1-128","gs1-128composite","gs1-cc","gs1datamatrix","gs1datamatrixrectangular","gs1dldatamatrix","gs1dlqrcode","gs1dotcode","gs1northamericancoupon","gs1qrcode","hanxin","hibcazteccode","hibccodablockf","hibccode128","hibccode39","hibcdatamatrix","hibcdatamatrixrectangular","hibcmicropdf417","hibcpdf417","hibcqrcode","iata2of5","identcode","industrial2of5","interleaved2of5","isbn","ismn","issn","itf14","japanpost","kix","leitcode","mailmark","mands","matrix2of5","maxicode","micropdf417","microqrcode","msi","onecode","pdf417","pdf417compact","pharmacode","pharmacode2","planet","plessey","posicode","postnet","pzn","qrcode","rationalizedCodabar","raw","rectangularmicroqrcode","royalmail","sscc18","swissqrcode","symbol","telepen","telepennumeric","ultracode","upca","upcacomposite","upce","upcecomposite"].map((e=>({text:e,value:e})))}}},{field:"scale",name:"scale",type:"number",meta:{width:"full",interface:"input"}},{field:"height",name:"height",type:"number",meta:{width:"full",interface:"input"}},{field:"includetext",name:"include text",type:"boolean",meta:{width:"full",interface:"boolean"}}]}),e({id:"ttapdf",name:"TTA generate PDF",icon:"box",description:"Generate a PDF trough Text to anything!",overview:({filename:e})=>[{label:"File name",text:e}],options:[{field:"RapidAPI token",name:"RapidAPI token",type:"string",meta:{width:"full",interface:"input"}},{field:"filename",name:"File name",type:"string",meta:{width:"full",interface:"input"}},{field:"pdfoptions",name:"Options",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json",placeholder:JSON.stringify({html:"<h1>Hello world!</h1>"},null,2),template:JSON.stringify({html:"<h1>Hello world!</h1>"},null,2)}}}]}),e({id:"ttaqrcode",name:"TTA generate QRcode",icon:"box",description:"Generate a QRcode trough Text to anything!",overview:({qrcodeContent:e})=>[{label:"QRCode content",text:e}],options:[{field:"RapidAPI token",name:"RapidAPI token",type:"string",meta:{width:"full",interface:"input"}},{field:"qrcodeContent",name:"QRCode content",type:"string",meta:{width:"full",interface:"input"}}]})];export{a as displays,t as interfaces,o as layouts,i as modules,d as operations,n as panels};
1
+ import { defineOperationApp, useApi, useStores, defineModule, defineInterface } from '@directus/extensions-sdk';
2
+ import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createCommentVNode, defineComponent, ref, computed, onMounted, watch, createTextVNode, unref, createElementBlock, createElementVNode, toDisplayString, resolveDynamicComponent, normalizeStyle, Fragment, pushScopeId, popScopeId, inject } from 'vue';
3
+
4
+ const types = [
5
+ "auspost",
6
+ "azteccode",
7
+ "azteccodecompact",
8
+ "aztecrune",
9
+ "bc412",
10
+ "channelcode",
11
+ "codablockf",
12
+ "code11",
13
+ "code128",
14
+ "code16k",
15
+ "code2of5",
16
+ "code32",
17
+ "code39",
18
+ "code39ext",
19
+ "code49",
20
+ "code93",
21
+ "code93ext",
22
+ "codeone",
23
+ "coop2of5",
24
+ "daft",
25
+ "databarexpanded",
26
+ "databarexpandedcomposite",
27
+ "databarexpandedstacked",
28
+ "databarexpandedstackedcomposite",
29
+ "databarlimited",
30
+ "databarlimitedcomposite",
31
+ "databaromni",
32
+ "databaromnicomposite",
33
+ "databarstacked",
34
+ "databarstackedcomposite",
35
+ "databarstackedomni",
36
+ "databarstackedomnicomposite",
37
+ "databartruncated",
38
+ "databartruncatedcomposite",
39
+ "datalogic2of5",
40
+ "datamatrix",
41
+ "datamatrixrectangular",
42
+ "datamatrixrectangularextension",
43
+ "dotcode",
44
+ "ean13",
45
+ "ean13composite",
46
+ "ean14",
47
+ "ean2",
48
+ "ean5",
49
+ "ean8",
50
+ "ean8composite",
51
+ "flattermarken",
52
+ "gs1-128",
53
+ "gs1-128composite",
54
+ "gs1-cc",
55
+ "gs1datamatrix",
56
+ "gs1datamatrixrectangular",
57
+ "gs1dldatamatrix",
58
+ "gs1dlqrcode",
59
+ "gs1dotcode",
60
+ "gs1northamericancoupon",
61
+ "gs1qrcode",
62
+ "hanxin",
63
+ "hibcazteccode",
64
+ "hibccodablockf",
65
+ "hibccode128",
66
+ "hibccode39",
67
+ "hibcdatamatrix",
68
+ "hibcdatamatrixrectangular",
69
+ "hibcmicropdf417",
70
+ "hibcpdf417",
71
+ "hibcqrcode",
72
+ "iata2of5",
73
+ "identcode",
74
+ "industrial2of5",
75
+ "interleaved2of5",
76
+ "isbn",
77
+ "ismn",
78
+ "issn",
79
+ "itf14",
80
+ "japanpost",
81
+ "kix",
82
+ "leitcode",
83
+ "mailmark",
84
+ "mands",
85
+ "matrix2of5",
86
+ "maxicode",
87
+ "micropdf417",
88
+ "microqrcode",
89
+ "msi",
90
+ "onecode",
91
+ "pdf417",
92
+ "pdf417compact",
93
+ "pharmacode",
94
+ "pharmacode2",
95
+ "planet",
96
+ "plessey",
97
+ "posicode",
98
+ "postnet",
99
+ "pzn",
100
+ "qrcode",
101
+ "rationalizedCodabar",
102
+ "raw",
103
+ "rectangularmicroqrcode",
104
+ "royalmail",
105
+ "sscc18",
106
+ "swissqrcode",
107
+ "symbol",
108
+ "telepen",
109
+ "telepennumeric",
110
+ "ultracode",
111
+ "upca",
112
+ "upcacomposite",
113
+ "upce",
114
+ "upcecomposite"
115
+ ];
116
+ var e0 = defineOperationApp({
117
+ id: "ttabarcode",
118
+ name: "TTA generate barcode",
119
+ icon: "box",
120
+ description: "Generate a barcode trough Text to anything!",
121
+ overview: ({ barcodeContent }) => [
122
+ {
123
+ label: "barcode content",
124
+ text: barcodeContent
125
+ }
126
+ ],
127
+ options: [
128
+ {
129
+ field: "barcodeContent",
130
+ name: "content",
131
+ type: "string",
132
+ meta: {
133
+ width: "full",
134
+ interface: "input"
135
+ }
136
+ },
137
+ {
138
+ field: "barcodeType",
139
+ name: "type",
140
+ type: "dropdown",
141
+ meta: {
142
+ interface: "select-dropdown",
143
+ options: {
144
+ choices: types.map((e) => ({ text: e, value: e }))
145
+ }
146
+ }
147
+ },
148
+ {
149
+ field: "scale",
150
+ name: "scale",
151
+ type: "number",
152
+ meta: {
153
+ width: "full",
154
+ interface: "input"
155
+ }
156
+ },
157
+ {
158
+ field: "height",
159
+ name: "height",
160
+ type: "number",
161
+ meta: {
162
+ width: "full",
163
+ interface: "input"
164
+ }
165
+ },
166
+ {
167
+ field: "includetext",
168
+ name: "include text",
169
+ type: "boolean",
170
+ meta: {
171
+ width: "full",
172
+ interface: "boolean"
173
+ }
174
+ }
175
+ ]
176
+ });
177
+
178
+ var e1 = defineOperationApp({
179
+ id: "ttapdf",
180
+ name: "TTA generate PDF",
181
+ icon: "box",
182
+ description: "Generate a PDF trough Text to anything!",
183
+ overview: ({ filename }) => [
184
+ {
185
+ label: "File name",
186
+ text: filename
187
+ }
188
+ ],
189
+ options: [
190
+ {
191
+ field: "filename",
192
+ name: "File name",
193
+ type: "string",
194
+ meta: {
195
+ width: "full",
196
+ interface: "input"
197
+ }
198
+ },
199
+ {
200
+ field: "pdfoptions",
201
+ name: "Options",
202
+ type: "json",
203
+ meta: {
204
+ width: "full",
205
+ interface: "input-code",
206
+ options: {
207
+ language: "json",
208
+ placeholder: JSON.stringify(
209
+ {
210
+ html: "<h1>Hello world!</h1>",
211
+ format: "A4",
212
+ landscape: false,
213
+ margin: 10,
214
+ marginRight: 5,
215
+ marginLeft: 5
216
+ },
217
+ null,
218
+ 2
219
+ ),
220
+ template: JSON.stringify(
221
+ {
222
+ html: "<h1>Hello world!</h1>",
223
+ format: "A4",
224
+ landscape: false,
225
+ margin: 10,
226
+ marginRight: 5,
227
+ marginLeft: 5
228
+ },
229
+ null,
230
+ 2
231
+ )
232
+ }
233
+ }
234
+ }
235
+ ]
236
+ });
237
+
238
+ var e2 = defineOperationApp({
239
+ id: "ttapdftemplate",
240
+ name: "TTA generate PDF from template",
241
+ icon: "box",
242
+ description: "Generate a PDF based on a template trough Text to anything!",
243
+ overview: ({ filename }) => [
244
+ {
245
+ label: "File name",
246
+ text: filename
247
+ }
248
+ ],
249
+ options: [
250
+ {
251
+ field: "filename",
252
+ name: "File name",
253
+ type: "string",
254
+ meta: {
255
+ width: "full",
256
+ interface: "input"
257
+ }
258
+ },
259
+ {
260
+ field: "template",
261
+ name: "Template",
262
+ type: "string",
263
+ meta: {
264
+ interface: "TTA-pdf-template-selector",
265
+ options: {}
266
+ }
267
+ },
268
+ {
269
+ field: "templatevariables",
270
+ name: "Template variables",
271
+ type: "json",
272
+ meta: {
273
+ width: "full",
274
+ interface: "input-code",
275
+ options: {
276
+ language: "json"
277
+ }
278
+ }
279
+ }
280
+ ]
281
+ });
282
+
283
+ var e3 = defineOperationApp({
284
+ id: "ttaqrcode",
285
+ name: "TTA generate QRcode",
286
+ icon: "box",
287
+ description: "Generate a QRcode trough Text to anything!",
288
+ overview: ({ qrcodeContent }) => [
289
+ {
290
+ label: "QRCode content",
291
+ text: qrcodeContent
292
+ }
293
+ ],
294
+ options: [
295
+ {
296
+ field: "qrcodeContent",
297
+ name: "QRCode content",
298
+ type: "string",
299
+ meta: {
300
+ width: "full",
301
+ interface: "input"
302
+ }
303
+ },
304
+ {
305
+ field: "lightColor",
306
+ name: "Light color",
307
+ type: "string",
308
+ meta: {
309
+ width: "full",
310
+ interface: "input"
311
+ }
312
+ },
313
+ {
314
+ field: "darkColor",
315
+ name: "Dark color",
316
+ type: "string",
317
+ meta: {
318
+ width: "full",
319
+ interface: "input"
320
+ }
321
+ },
322
+ {
323
+ field: "margin",
324
+ name: "Margin",
325
+ type: "integer",
326
+ meta: {
327
+ width: "half",
328
+ interface: "input"
329
+ }
330
+ },
331
+ {
332
+ field: "width",
333
+ name: "Width",
334
+ type: "integer",
335
+ meta: {
336
+ width: "half",
337
+ interface: "input"
338
+ }
339
+ }
340
+ ]
341
+ });
342
+
343
+ function render(_ctx, _cache) {
344
+ const _component_v_icon = resolveComponent("v-icon");
345
+ const _component_v_list_item_icon = resolveComponent("v-list-item-icon");
346
+ const _component_v_text_overflow = resolveComponent("v-text-overflow");
347
+ const _component_v_list_item_content = resolveComponent("v-list-item-content");
348
+ const _component_v_list_item = resolveComponent("v-list-item");
349
+ const _component_v_list = resolveComponent("v-list");
350
+
351
+ return (openBlock(), createBlock(_component_v_list, { nav: "" }, {
352
+ default: withCtx(() => [
353
+ createVNode(_component_v_list_item, { to: "/tta_settings/templates" }, {
354
+ default: withCtx(() => [
355
+ createVNode(_component_v_list_item_icon, null, {
356
+ default: withCtx(() => [
357
+ createVNode(_component_v_icon, { name: "code" })
358
+ ]),
359
+ _: 1 /* STABLE */
360
+ }),
361
+ createVNode(_component_v_list_item_content, null, {
362
+ default: withCtx(() => [
363
+ createVNode(_component_v_text_overflow, { text: "Templates" })
364
+ ]),
365
+ _: 1 /* STABLE */
366
+ })
367
+ ]),
368
+ _: 1 /* STABLE */
369
+ }),
370
+ createVNode(_component_v_list_item, { to: "/tta_settings/settings" }, {
371
+ default: withCtx(() => [
372
+ createVNode(_component_v_list_item_icon, null, {
373
+ default: withCtx(() => [
374
+ createVNode(_component_v_icon, { name: "settings" })
375
+ ]),
376
+ _: 1 /* STABLE */
377
+ }),
378
+ createVNode(_component_v_list_item_content, null, {
379
+ default: withCtx(() => [
380
+ createVNode(_component_v_text_overflow, { text: "Settings" })
381
+ ]),
382
+ _: 1 /* STABLE */
383
+ })
384
+ ]),
385
+ _: 1 /* STABLE */
386
+ }),
387
+ createCommentVNode(" <v-list-item to=\"/tta_settings/usage\">\n <v-list-item-icon><v-icon name=\"bar_chart\" /></v-list-item-icon>\n <v-list-item-content>\n <v-text-overflow text=\"Usage\" />\n </v-list-item-content>\n </v-list-item> ")
388
+ ]),
389
+ _: 1 /* STABLE */
390
+ }))
391
+ }
392
+
393
+ const script$4 = {};
394
+
395
+
396
+ script$4.render = render;
397
+ script$4.__file = "settingsmodule/src/TTAnav.vue";
398
+
399
+ const _hoisted_1$1 = {
400
+ key: 0,
401
+ class: "TTA-popup"
402
+ };
403
+ const _hoisted_2$1 = { class: "TTA-toolbar" };
404
+ const _hoisted_3$1 = { class: "right-side" };
405
+ const _hoisted_4$1 = { class: "setwidth" };
406
+ const _hoisted_5 = { class: "TTA-action" };
407
+ const _hoisted_6 = { class: "TTA-wapper" };
408
+ const _hoisted_7 = ["srcdoc"];
409
+ var script$3 = /* @__PURE__ */ defineComponent({
410
+ __name: "templates",
411
+ setup(__props) {
412
+ const templates = ref([]), templateDetails = ref(false), editTemplate = ref(false), assetsKey = ref("");
413
+ const widthPartition = ref(50);
414
+ const previewWidth = computed(() => {
415
+ return 100 - widthPartition.value;
416
+ });
417
+ const editorWidth = computed(() => {
418
+ return 100 - previewWidth.value;
419
+ });
420
+ const api = useApi();
421
+ const currentTemplate = ref({
422
+ template: "",
423
+ id: -1,
424
+ name: "",
425
+ description: "",
426
+ collection: "",
427
+ format: "A4",
428
+ orientation: "portrait"
429
+ });
430
+ const { useCollectionsStore } = useStores();
431
+ const collectionsStore = useCollectionsStore();
432
+ const collections = computed(() => {
433
+ return collectionsStore.collections.filter((e) => e.collection != "TTA_htmltemplates").map((e) => ({
434
+ text: e.name,
435
+ value: e.collection
436
+ }));
437
+ });
438
+ const computedTemplate = computed(() => {
439
+ return `${currentTemplate.value.template}`;
440
+ });
441
+ onMounted(async () => {
442
+ const settings = await api.get("/settings");
443
+ assetsKey.value = settings.data.data.TTA_ASSETS_KEY;
444
+ widthPartition.value = parseInt(
445
+ localStorage.getItem("TTA-widthPartition") || "50"
446
+ );
447
+ fetchTemplates();
448
+ });
449
+ watch(
450
+ () => widthPartition.value,
451
+ (newval) => localStorage.setItem("TTA-widthPartition", newval + "")
452
+ );
453
+ async function fetchTemplates() {
454
+ const getTemplates = await api.get("/items/TTA_htmltemplates", {
455
+ params: {
456
+ limit: -1
457
+ }
458
+ });
459
+ templates.value = getTemplates.data.data;
460
+ }
461
+ async function saveTemplate() {
462
+ if (currentTemplate.value.id == -1) {
463
+ await api.post("/items/TTA_htmltemplates", {
464
+ ...currentTemplate.value
465
+ });
466
+ } else {
467
+ await api.patch("/items/TTA_htmltemplates/" + currentTemplate.value.id, {
468
+ ...currentTemplate.value,
469
+ id: void 0
470
+ });
471
+ }
472
+ templateDetails.value = false;
473
+ fetchTemplates();
474
+ }
475
+ function openTemplate({ item }) {
476
+ console.log(item);
477
+ currentTemplate.value = item;
478
+ editTemplate.value = true;
479
+ }
480
+ function closeEditor() {
481
+ currentTemplate.value = {
482
+ template: "",
483
+ id: -1,
484
+ name: "",
485
+ description: "",
486
+ collection: "",
487
+ format: "A4",
488
+ orientation: "portrait"
489
+ };
490
+ editTemplate.value = false;
491
+ }
492
+ return (_ctx, _cache) => {
493
+ const _component_v_icon = resolveComponent("v-icon");
494
+ const _component_v_button = resolveComponent("v-button");
495
+ const _component_v_card_title = resolveComponent("v-card-title");
496
+ const _component_v_input = resolveComponent("v-input");
497
+ const _component_v_list_item_content = resolveComponent("v-list-item-content");
498
+ const _component_v_list_item = resolveComponent("v-list-item");
499
+ const _component_v_select = resolveComponent("v-select");
500
+ const _component_v_list = resolveComponent("v-list");
501
+ const _component_v_card_text = resolveComponent("v-card-text");
502
+ const _component_v_card_actions = resolveComponent("v-card-actions");
503
+ const _component_v_card = resolveComponent("v-card");
504
+ const _component_v_dialog = resolveComponent("v-dialog");
505
+ const _component_v_slider = resolveComponent("v-slider");
506
+ const _component_v_table = resolveComponent("v-table");
507
+ const _component_private_view = resolveComponent("private-view");
508
+ return openBlock(), createBlock(_component_private_view, { title: "Templates" }, {
509
+ navigation: withCtx(() => [
510
+ createVNode(script$4)
511
+ ]),
512
+ actions: withCtx(() => [
513
+ createVNode(_component_v_button, {
514
+ rounded: "",
515
+ icon: "",
516
+ onClick: _cache[0] || (_cache[0] = ($event) => templateDetails.value = true)
517
+ }, {
518
+ default: withCtx(() => [
519
+ createVNode(_component_v_icon, { name: "add" })
520
+ ]),
521
+ _: 1
522
+ }),
523
+ createVNode(_component_v_dialog, {
524
+ modelValue: templateDetails.value,
525
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => templateDetails.value = $event),
526
+ persistent: true
527
+ }, {
528
+ default: withCtx(() => [
529
+ createVNode(_component_v_card, null, {
530
+ default: withCtx(() => [
531
+ createVNode(_component_v_card_title, null, {
532
+ default: withCtx(() => [
533
+ createTextVNode("Create a new HTML template")
534
+ ]),
535
+ _: 1
536
+ }),
537
+ createVNode(_component_v_card_text, null, {
538
+ default: withCtx(() => [
539
+ createVNode(_component_v_list, null, {
540
+ default: withCtx(() => [
541
+ createVNode(_component_v_list_item, null, {
542
+ default: withCtx(() => [
543
+ createVNode(_component_v_list_item_content, null, {
544
+ default: withCtx(() => [
545
+ createVNode(_component_v_input, {
546
+ modelValue: currentTemplate.value.name,
547
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentTemplate.value.name = $event),
548
+ placeholder: "Template name"
549
+ }, null, 8, ["modelValue"])
550
+ ]),
551
+ _: 1
552
+ })
553
+ ]),
554
+ _: 1
555
+ }),
556
+ createVNode(_component_v_list_item, null, {
557
+ default: withCtx(() => [
558
+ createVNode(_component_v_list_item_content, null, {
559
+ default: withCtx(() => [
560
+ createVNode(_component_v_input, {
561
+ modelValue: currentTemplate.value.description,
562
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => currentTemplate.value.description = $event),
563
+ placeholder: "Description"
564
+ }, null, 8, ["modelValue"])
565
+ ]),
566
+ _: 1
567
+ })
568
+ ]),
569
+ _: 1
570
+ }),
571
+ createVNode(_component_v_list_item, null, {
572
+ default: withCtx(() => [
573
+ createVNode(_component_v_list_item_content, null, {
574
+ default: withCtx(() => [
575
+ createVNode(_component_v_select, {
576
+ modelValue: currentTemplate.value.format,
577
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => currentTemplate.value.format = $event),
578
+ placeholder: "Size",
579
+ items: [
580
+ "A1",
581
+ "A2",
582
+ "A3",
583
+ "A4",
584
+ "A5",
585
+ "A6",
586
+ "Letter",
587
+ "Legal",
588
+ "Tabloid",
589
+ "Ledger"
590
+ ].map((e) => ({ text: e, value: e }))
591
+ }, null, 8, ["modelValue", "items"])
592
+ ]),
593
+ _: 1
594
+ })
595
+ ]),
596
+ _: 1
597
+ }),
598
+ createVNode(_component_v_list_item, null, {
599
+ default: withCtx(() => [
600
+ createVNode(_component_v_list_item_content, null, {
601
+ default: withCtx(() => [
602
+ createVNode(_component_v_select, {
603
+ modelValue: currentTemplate.value.orientation,
604
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => currentTemplate.value.orientation = $event),
605
+ placeholder: "Orientation",
606
+ items: ["portrait", "landscape"].map((e) => ({
607
+ text: e,
608
+ value: e
609
+ }))
610
+ }, null, 8, ["modelValue", "items"])
611
+ ]),
612
+ _: 1
613
+ })
614
+ ]),
615
+ _: 1
616
+ }),
617
+ createVNode(_component_v_list_item, null, {
618
+ default: withCtx(() => [
619
+ createVNode(_component_v_list_item_content, null, {
620
+ default: withCtx(() => [
621
+ createVNode(_component_v_select, {
622
+ modelValue: currentTemplate.value.collection,
623
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => currentTemplate.value.collection = $event),
624
+ items: unref(collections),
625
+ placeholder: "Collection"
626
+ }, null, 8, ["modelValue", "items"])
627
+ ]),
628
+ _: 1
629
+ })
630
+ ]),
631
+ _: 1
632
+ })
633
+ ]),
634
+ _: 1
635
+ })
636
+ ]),
637
+ _: 1
638
+ }),
639
+ createVNode(_component_v_card_actions, null, {
640
+ default: withCtx(() => [
641
+ createVNode(_component_v_button, {
642
+ secondary: "",
643
+ onClick: _cache[6] || (_cache[6] = ($event) => templateDetails.value = false)
644
+ }, {
645
+ default: withCtx(() => [
646
+ createTextVNode(" Cancel ")
647
+ ]),
648
+ _: 1
649
+ }),
650
+ createVNode(_component_v_button, {
651
+ disabled: !currentTemplate.value.collection || !currentTemplate.value.name || !currentTemplate.value.format,
652
+ onClick: saveTemplate
653
+ }, {
654
+ default: withCtx(() => [
655
+ createTextVNode(" Save ")
656
+ ]),
657
+ _: 1
658
+ }, 8, ["disabled"])
659
+ ]),
660
+ _: 1
661
+ })
662
+ ]),
663
+ _: 1
664
+ })
665
+ ]),
666
+ _: 1
667
+ }, 8, ["modelValue"])
668
+ ]),
669
+ default: withCtx(() => [
670
+ editTemplate.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
671
+ createElementVNode("div", _hoisted_2$1, [
672
+ createElementVNode("div", {
673
+ onClick: _cache[8] || (_cache[8] = ($event) => templateDetails.value = true),
674
+ class: "TTA-template-title"
675
+ }, [
676
+ createTextVNode(toDisplayString(currentTemplate.value.name) + " ", 1),
677
+ createVNode(_component_v_icon, { name: "edit" })
678
+ ]),
679
+ createElementVNode("div", _hoisted_3$1, [
680
+ createElementVNode("div", {
681
+ class: "TTA-action",
682
+ onClick: saveTemplate
683
+ }, [
684
+ createVNode(_component_v_icon, { name: "save" })
685
+ ]),
686
+ createElementVNode("div", _hoisted_4$1, [
687
+ createVNode(_component_v_slider, {
688
+ modelValue: widthPartition.value,
689
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => widthPartition.value = $event),
690
+ min: 10,
691
+ max: 90,
692
+ class: "TTA-slider"
693
+ }, null, 8, ["modelValue"])
694
+ ]),
695
+ createElementVNode("div", _hoisted_5, [
696
+ createVNode(_component_v_icon, {
697
+ name: "close",
698
+ onClick: closeEditor
699
+ })
700
+ ])
701
+ ])
702
+ ]),
703
+ createElementVNode("div", _hoisted_6, [
704
+ (openBlock(), createBlock(resolveDynamicComponent("interface-input-rich-text-html"), {
705
+ class: "TTA-editor",
706
+ value: currentTemplate.value.template,
707
+ imageToken: assetsKey.value,
708
+ onInput: _cache[10] || (_cache[10] = (html) => currentTemplate.value.template = html),
709
+ style: normalizeStyle("width: " + unref(editorWidth) + "%")
710
+ }, null, 40, ["value", "imageToken", "style"])),
711
+ createElementVNode("iframe", {
712
+ class: "TTA-preview",
713
+ srcdoc: unref(computedTemplate),
714
+ style: normalizeStyle("width: " + unref(previewWidth) + "%")
715
+ }, null, 12, _hoisted_7)
716
+ ])
717
+ ])) : createCommentVNode("v-if", true),
718
+ createVNode(_component_v_table, {
719
+ headers: [
720
+ {
721
+ text: "Name",
722
+ value: "name"
723
+ },
724
+ {
725
+ text: "Description",
726
+ value: "description"
727
+ },
728
+ {
729
+ text: "Collection",
730
+ value: "collection"
731
+ },
732
+ {
733
+ text: "Format",
734
+ value: "format"
735
+ }
736
+ ],
737
+ "onClick:row": openTemplate,
738
+ items: templates.value
739
+ }, null, 8, ["items"])
740
+ ]),
741
+ _: 1
742
+ });
743
+ };
744
+ }
745
+ });
746
+
747
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
748
+
749
+ var css$1 = "\n.TTA-popup {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n flex-direction: column;\n background-color: var(--background-subdued);\n}\n.TTA-toolbar {\n background-color: var(--background-subdued);\n display: flex;\n justify-content: space-between;\n}\n.TTA-toolbar .right-side {\n display: flex;\n gap: 5px;\n}\n.TTA-toolbar .TTA-slider {\n padding-top: 5px;\n}\n.TTA-toolbar .TTA-action {\n padding: 5px;\n cursor: pointer;\n}\n.TTA-toolbar .setwidth {\n display: flex;\n gap: 10px;\n padding-top: 6px;\n}\n.TTA-toolbar .TTA-template-title {\n margin: auto 0;\n font-size: 18px;\n cursor: pointer;\n padding-right: 5px;\n padding-left: 20px;\n border-bottom: 1px solid var(--v-list-item-border-color);\n}\n.TTA-toolbar .TTA-template-title i {\n padding-left: 5px;\n}\n.TTA-wapper {\n display: flex;\n flex-grow: 1;\n}\n.TTA-preview {\n flex-grow: 1;\n background-color: white;\n border: 0;\n}\n.TTA-editor {\n flex-grow: 1;\n height: 100%;\n}\n.TTA-editor .tox.tox-tinymce {\n height: 100% !important;\n border-radius: 0 !important;\n}\n";
750
+ n(css$1,{});
751
+
752
+ script$3.__file = "settingsmodule/src/templates.vue";
753
+
754
+ const _withScopeId = (n) => (pushScopeId("data-v-014dce90"), n = n(), popScopeId(), n);
755
+ const _hoisted_1 = { class: "px-5" };
756
+ const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "RapidAPI token", -1));
757
+ const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "Directus Assets token", -1));
758
+ const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "Directus Assets folder", -1));
759
+ var script$2 = /* @__PURE__ */ defineComponent({
760
+ __name: "settings",
761
+ setup(__props) {
762
+ const rapidKey = ref("");
763
+ const assetsKey = ref("");
764
+ const assetsFolder = ref("");
765
+ const saving = ref(false);
766
+ const api = useApi();
767
+ const folder = ref([]);
768
+ onMounted(async () => {
769
+ const settings = await api.get("/settings");
770
+ rapidKey.value = settings.data.data.TTA_KEY;
771
+ assetsKey.value = settings.data.data.TTA_ASSETS_KEY;
772
+ assetsFolder.value = settings.data.data.TTA_ASSETS_FOLDER;
773
+ const folders = await api.get("/folders");
774
+ folder.value = folders.data.data.map((e) => ({
775
+ text: e.name,
776
+ value: e.id
777
+ }));
778
+ });
779
+ async function saveSettings() {
780
+ saving.value = true;
781
+ await api.patch("/settings", {
782
+ TTA_KEY: rapidKey.value,
783
+ TTA_ASSETS_KEY: assetsKey.value,
784
+ TTA_ASSETS_FOLDER: assetsFolder.value
785
+ });
786
+ setTimeout(() => {
787
+ saving.value = false;
788
+ }, 500);
789
+ }
790
+ return (_ctx, _cache) => {
791
+ const _component_v_card_title = resolveComponent("v-card-title");
792
+ const _component_v_input = resolveComponent("v-input");
793
+ const _component_v_select = resolveComponent("v-select");
794
+ const _component_v_card_text = resolveComponent("v-card-text");
795
+ const _component_v_icon = resolveComponent("v-icon");
796
+ const _component_v_button = resolveComponent("v-button");
797
+ const _component_v_progress_circular = resolveComponent("v-progress-circular");
798
+ const _component_v_card_actions = resolveComponent("v-card-actions");
799
+ const _component_v_card = resolveComponent("v-card");
800
+ const _component_private_view = resolveComponent("private-view");
801
+ return openBlock(), createBlock(_component_private_view, { title: "Settings" }, {
802
+ navigation: withCtx(() => [
803
+ createVNode(script$4)
804
+ ]),
805
+ default: withCtx(() => [
806
+ createElementVNode("div", _hoisted_1, [
807
+ createVNode(_component_v_card, { class: "w-full" }, {
808
+ default: withCtx(() => [
809
+ createVNode(_component_v_card_title, null, {
810
+ default: withCtx(() => [
811
+ createTextVNode("API settings")
812
+ ]),
813
+ _: 1
814
+ }),
815
+ createVNode(_component_v_card_text, { class: "fields-spacing" }, {
816
+ default: withCtx(() => [
817
+ createElementVNode("div", null, [
818
+ _hoisted_2,
819
+ createVNode(_component_v_input, {
820
+ modelValue: rapidKey.value,
821
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => rapidKey.value = $event)
822
+ }, null, 8, ["modelValue"])
823
+ ]),
824
+ createElementVNode("div", null, [
825
+ _hoisted_3,
826
+ createVNode(_component_v_input, {
827
+ modelValue: assetsKey.value,
828
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => assetsKey.value = $event)
829
+ }, null, 8, ["modelValue"])
830
+ ]),
831
+ createElementVNode("div", null, [
832
+ _hoisted_4,
833
+ createVNode(_component_v_select, {
834
+ modelValue: assetsFolder.value,
835
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => assetsFolder.value = $event),
836
+ items: folder.value,
837
+ placeholder: "Assets folder"
838
+ }, null, 8, ["modelValue", "items"])
839
+ ])
840
+ ]),
841
+ _: 1
842
+ }),
843
+ createVNode(_component_v_card_actions, null, {
844
+ default: withCtx(() => [
845
+ createVNode(_component_v_button, {
846
+ href: "https://rapidapi.com/Attacler/api/text-to-anything",
847
+ target: "_blank"
848
+ }, {
849
+ default: withCtx(() => [
850
+ createVNode(_component_v_icon, { name: "open_in_new" }),
851
+ createTextVNode(" Get RapidAPI token ")
852
+ ]),
853
+ _: 1
854
+ }),
855
+ createVNode(_component_v_button, {
856
+ onClick: saveSettings,
857
+ disabled: saving.value
858
+ }, {
859
+ default: withCtx(() => [
860
+ !saving.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
861
+ createTextVNode(" Save ")
862
+ ], 64)) : (openBlock(), createBlock(_component_v_progress_circular, {
863
+ key: 1,
864
+ small: true,
865
+ indeterminate: ""
866
+ }))
867
+ ]),
868
+ _: 1
869
+ }, 8, ["disabled"])
870
+ ]),
871
+ _: 1
872
+ })
873
+ ]),
874
+ _: 1
875
+ })
876
+ ])
877
+ ]),
878
+ _: 1
879
+ });
880
+ };
881
+ }
882
+ });
883
+
884
+ var css = "\n.w-full[data-v-014dce90] {\n width: 100%;\n}\n.px-5[data-v-014dce90] {\n padding: 0 2.5rem;\n}\n.fields-spacing[data-v-014dce90] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n";
885
+ n(css,{});
886
+
887
+ script$2.__scopeId = "data-v-014dce90";
888
+ script$2.__file = "settingsmodule/src/settings.vue";
889
+
890
+ var script$1 = /* @__PURE__ */ defineComponent({
891
+ __name: "usage",
892
+ setup(__props) {
893
+ return (_ctx, _cache) => {
894
+ const _component_private_view = resolveComponent("private-view");
895
+ return openBlock(), createBlock(_component_private_view, { title: "Usage" }, {
896
+ navigation: withCtx(() => [
897
+ createVNode(script$4)
898
+ ]),
899
+ default: withCtx(() => [
900
+ createTextVNode(" Comming soon! ")
901
+ ]),
902
+ _: 1
903
+ });
904
+ };
905
+ }
906
+ });
907
+
908
+ script$1.__file = "settingsmodule/src/usage.vue";
909
+
910
+ var e4 = defineModule({
911
+ id: "tta_settings",
912
+ name: "Text to anything settings",
913
+ icon: "text_fields",
914
+ routes: [
915
+ {
916
+ path: "",
917
+ redirect: "/tta_settings/templates"
918
+ },
919
+ {
920
+ path: "templates",
921
+ component: script$3
922
+ },
923
+ {
924
+ path: "settings",
925
+ component: script$2
926
+ },
927
+ {
928
+ path: "usage",
929
+ component: script$1
930
+ }
931
+ ]
932
+ });
933
+
934
+ var script = /* @__PURE__ */ defineComponent({
935
+ __name: "interface",
936
+ props: ["value"],
937
+ emits: ["input"],
938
+ setup(__props, { emit }) {
939
+ const props = __props;
940
+ const api = inject("api");
941
+ const value = ref(""), templates = ref([]);
942
+ onMounted(async () => {
943
+ value.value = props.value;
944
+ watch(
945
+ () => value.value,
946
+ (newval, oldval) => {
947
+ if (newval != oldval) {
948
+ emit("input", newval);
949
+ }
950
+ }
951
+ );
952
+ const getTemplates = await api.get("/items/TTA_htmltemplates");
953
+ templates.value = getTemplates.data.data.map((e) => ({
954
+ text: e.name,
955
+ value: e.id
956
+ }));
957
+ });
958
+ return (_ctx, _cache) => {
959
+ const _component_v_select = resolveComponent("v-select");
960
+ return openBlock(), createBlock(_component_v_select, {
961
+ modelValue: value.value,
962
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
963
+ items: templates.value
964
+ }, null, 8, ["modelValue", "items"]);
965
+ };
966
+ }
967
+ });
968
+
969
+ script.__file = "PDFTemplateSelector/src/interface.vue";
970
+
971
+ var e5 = defineInterface({
972
+ id: "TTA-pdf-template-selector",
973
+ name: "TTA PDF template selector",
974
+ icon: "box",
975
+ description: "Selector for a PDF template",
976
+ component: script,
977
+ options: null,
978
+ types: ["string"]
979
+ });
980
+
981
+ const interfaces = [e5];const displays = [];const layouts = [];const modules = [e4];const panels = [];const operations = [e0,e1,e2,e3];
982
+
983
+ export { displays, interfaces, layouts, modules, operations, panels };