@templatical/editor 0.0.1 → 0.0.3

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 (130) hide show
  1. package/dist/AiChatSidebar-busJk9hm.js +214 -0
  2. package/dist/AiFeatureMenu-DLGv_-pj.js +63 -0
  3. package/dist/CloudEditor-BDnHd6Um.js +919 -0
  4. package/dist/CollaboratorBar-Dv3l52vC.js +91 -0
  5. package/dist/CommentsSidebar-4tjp0VU5.js +439 -0
  6. package/dist/DesignReferenceSidebar-CmwXvltV.js +273 -0
  7. package/dist/LoadingTrack-vK8W2PJf.js +10 -0
  8. package/dist/ModuleBrowserModal-lrk3Fr0H.js +205 -0
  9. package/dist/ModulePreviewCanvas-BcBJLnwL.js +106 -0
  10. package/dist/ParagraphEditor-DH8cSC6m.js +625 -0
  11. package/dist/RichTextEditorContent-CQqodi7p.js +133 -0
  12. package/dist/SaveModuleDialog-Bmzi72td.js +122 -0
  13. package/dist/SnapshotHistory-AEgi9Xsn.js +126 -0
  14. package/dist/TemplateScoringPanel-CTgMtc0-.js +249 -0
  15. package/dist/TestEmailModal-Dpq1is9S.js +94 -0
  16. package/dist/TitleEditor-CLcDdcWI.js +167 -0
  17. package/dist/TplModal-CGzRjR96.js +44 -0
  18. package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
  19. package/dist/blockTypeIcons-BpPTqcok.js +126 -0
  20. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js +3 -0
  21. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js.map +1 -0
  22. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js +2 -0
  23. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js.map +1 -0
  24. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js +3 -0
  25. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js.map +1 -0
  26. package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
  27. package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
  28. package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
  29. package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
  30. package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
  31. package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
  32. package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
  33. package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
  34. package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
  35. package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
  36. package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
  37. package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
  38. package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
  39. package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
  40. package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
  41. package/dist/cdn/chunks/extensions-ea_ewKUl.js +2 -0
  42. package/dist/cdn/chunks/extensions-ea_ewKUl.js.map +1 -0
  43. package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
  44. package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
  45. package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
  46. package/dist/cdn/chunks/styleConstants-CNejCb-L.js +2 -0
  47. package/dist/cdn/chunks/styleConstants-CNejCb-L.js.map +1 -0
  48. package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
  49. package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
  50. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js +2 -0
  51. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js.map +1 -0
  52. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js +2 -0
  53. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js.map +1 -0
  54. package/dist/cdn/editor.css +1 -0
  55. package/dist/cdn/editor.js +2 -0
  56. package/dist/cdn/editor.js.map +1 -0
  57. package/dist/check-B7kDuZmP.js +7 -0
  58. package/dist/chevron-down-DJLW2Q9Z.js +7 -0
  59. package/dist/circle-alert-E2vYPs5r.js +25 -0
  60. package/dist/clock-lWIIQA3C.js +12 -0
  61. package/dist/de-B4Ob4vCo.js +682 -0
  62. package/dist/dist-4LiM9FDd.js +35 -0
  63. package/dist/dist-Bu7veieH.js +776 -0
  64. package/dist/dist-C1BIRHCQ.js +61 -0
  65. package/dist/dist-CG-vEqSU.js +314 -0
  66. package/dist/dist-C_ymrGFi.js +10625 -0
  67. package/dist/dist-ChAGLpWo.js +35 -0
  68. package/dist/dist-D_HQYSY-.js +189 -0
  69. package/dist/dist-DkypH7qG.js +5 -0
  70. package/dist/dist-DmOE-Ubp.js +74 -0
  71. package/dist/dist-DmpMJbmZ.js +513 -0
  72. package/dist/dist-DrvKRSU6.js +47 -0
  73. package/dist/dist-Dxnd0GRf.js +5 -0
  74. package/dist/dist-DysAFIPy.js +2054 -0
  75. package/dist/emojiData-BfWQS72m.js +17 -0
  76. package/dist/en-YXsspZJG.js +682 -0
  77. package/dist/extensions-CKM99njP.js +420 -0
  78. package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
  79. package/dist/i18n-CJsFtdbZ.js +23 -0
  80. package/dist/image-up-X4xIq4ea.js +23 -0
  81. package/dist/keys-Dwa2PmdD.js +10 -0
  82. package/dist/liquid.browser-BemTg3sZ.js +3272 -0
  83. package/dist/loader-circle-BTQQxC3l.js +7 -0
  84. package/dist/message-circle-Blgm6V_h.js +7 -0
  85. package/dist/refresh-cw-Bb4PEeW1.js +44 -0
  86. package/dist/scan-line-7lZPfOdm.js +25 -0
  87. package/dist/send-C0ltAQrv.js +10 -0
  88. package/dist/shield-check-f-qv4RKs.js +10 -0
  89. package/dist/sparkles-KhBCGlqB.js +23 -0
  90. package/dist/styleConstants-D4SOZGBV.js +94 -0
  91. package/dist/styles-DSw1VNU3.js +3406 -0
  92. package/dist/templatical-editor.css +2 -1
  93. package/dist/templatical-editor.js +242 -9
  94. package/dist/templatical-editor.umd.cjs +112 -524
  95. package/dist/timeouts-CmBrLeZA.js +4 -0
  96. package/dist/trash-2-OwjZ-guZ.js +25 -0
  97. package/dist/triangle-alert-DOSRIUYZ.js +17 -0
  98. package/dist/useEditorCore-Cc4RCwWq.js +5556 -0
  99. package/dist/useI18n-DUirdXEX.js +17 -0
  100. package/dist/useMergeTag-DVnlvPYJ.js +33 -0
  101. package/dist/x-CGlq2XQe.js +10 -0
  102. package/package.json +30 -20
  103. package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
  104. package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
  105. package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
  106. package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
  107. package/dist/CommentsSidebar-PVUlloyB.js +0 -655
  108. package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
  109. package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
  110. package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
  111. package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
  112. package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
  113. package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
  114. package/dist/TestEmailModal-Cwre5elw.js +0 -128
  115. package/dist/TextEditor-BuUOIByX.js +0 -780
  116. package/dist/de-BWIAblxs.js +0 -685
  117. package/dist/en-cYyUzNV1.js +0 -685
  118. package/dist/index-0tWUczNu.js +0 -47
  119. package/dist/index-4okvXjqk.js +0 -41
  120. package/dist/index-BSc6h5zo.js +0 -967
  121. package/dist/index-CrvwWlhN.js +0 -41
  122. package/dist/index-D-iD-7lO.js +0 -10961
  123. package/dist/index-D-ygXbc8.js +0 -2452
  124. package/dist/index-DbrWKz-e.js +0 -1415
  125. package/dist/index-DeUeHy6g.js +0 -422
  126. package/dist/index-Ude6e9RU.js +0 -41
  127. package/dist/index-ZQzHBwkr.js +0 -12767
  128. package/dist/liquid.browser-CeNxS2GL.js +0 -3493
  129. package/dist/loader-circle-tM9j2mRh.js +0 -13
  130. package/dist/shield-check-Ngi9jAQc.js +0 -20
@@ -0,0 +1,17 @@
1
+ import { S as e } from "./keys-Dwa2PmdD.js";
2
+ import { inject as t, isRef as n } from "vue";
3
+ //#region src/composables/useI18n.ts
4
+ function r(r) {
5
+ let i = r ?? t(e, null);
6
+ if (!i) throw Error("useI18n() requires a translations provider. Ensure the component is a descendant of Editor or CloudEditor.");
7
+ let a = n(i) ? i.value : i;
8
+ function o(e, t) {
9
+ return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
10
+ }
11
+ return {
12
+ t: a,
13
+ format: o
14
+ };
15
+ }
16
+ //#endregion
17
+ export { r as t };
@@ -0,0 +1,33 @@
1
+ import { g as e, h as t, v as n } from "./keys-Dwa2PmdD.js";
2
+ import { inject as r, ref as i } from "vue";
3
+ import { SYNTAX_PRESETS as a, getMergeTagLabel as o, isMergeTagValue as s } from "@templatical/types";
4
+ //#region src/composables/useMergeTag.ts
5
+ function c() {
6
+ let c = r(t, []), l = r(e, a.liquid), u = r(n, null), d = i(!1);
7
+ function f(e) {
8
+ return s(e, l);
9
+ }
10
+ function p(e) {
11
+ return o(e, c);
12
+ }
13
+ async function m() {
14
+ if (!u) return null;
15
+ d.value = !0;
16
+ try {
17
+ return await u();
18
+ } finally {
19
+ d.value = !1;
20
+ }
21
+ }
22
+ return {
23
+ mergeTags: c,
24
+ isRequesting: d,
25
+ isEnabled: c.length > 0 || !!u,
26
+ syntax: l,
27
+ isMergeTagValue: f,
28
+ getMergeTagLabel: p,
29
+ requestMergeTag: m
30
+ };
31
+ }
32
+ //#endregion
33
+ export { c as t };
@@ -0,0 +1,10 @@
1
+ import { n as e } from "./_plugin-vue_export-helper-B1-bu7yR.js";
2
+ var t = e("x", [["path", {
3
+ d: "M18 6 6 18",
4
+ key: "1bl5f8"
5
+ }], ["path", {
6
+ d: "m6 6 12 12",
7
+ key: "d8bk6v"
8
+ }]]);
9
+ //#endregion
10
+ export { t };
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@templatical/editor",
3
- "version": "0.0.1",
4
- "publishConfig": { "access": "public" },
3
+ "version": "0.0.3",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
5
7
  "description": "Vue 3 visual drag-and-drop email editor powered by Templatical",
6
8
  "license": "SEE LICENSE IN LICENSE",
7
9
  "type": "module",
@@ -21,44 +23,52 @@
21
23
  ],
22
24
  "scripts": {
23
25
  "build": "vite build",
26
+ "build:cdn": "vite build --config vite.cdn.config.ts",
27
+ "build:all": "vite build && vite build --config vite.cdn.config.ts",
24
28
  "test": "vitest run",
25
29
  "typecheck": "vue-tsc --noEmit"
26
30
  },
27
31
  "dependencies": {
28
32
  "@templatical/core": "workspace:*",
29
- "@templatical/media-library": "workspace:*",
30
33
  "@templatical/types": "workspace:*",
31
- "@tiptap/core": "^2.0.0",
32
- "@tiptap/extension-link": "^2.0.0",
33
- "@tiptap/extension-subscript": "^2.0.0",
34
- "@tiptap/extension-superscript": "^2.0.0",
35
- "@tiptap/extension-text-align": "^2.0.0",
36
- "@tiptap/extension-underline": "^2.0.0",
37
- "@tiptap/starter-kit": "^2.0.0",
38
- "@tiptap/vue-3": "^2.0.0",
34
+ "@tiptap/core": "^3.22.0",
35
+ "@tiptap/extension-color": "^3.22.0",
36
+ "@tiptap/extension-font-family": "^3.22.0",
37
+ "@tiptap/extension-highlight": "^3.22.0",
38
+ "@tiptap/extension-link": "^3.22.0",
39
+ "@tiptap/extension-subscript": "^3.22.0",
40
+ "@tiptap/extension-superscript": "^3.22.0",
41
+ "@tiptap/extension-text-align": "^3.22.0",
42
+ "@tiptap/extension-text-style": "^3.22.0",
43
+ "@tiptap/extension-underline": "^3.22.0",
44
+ "@tiptap/starter-kit": "^3.22.0",
45
+ "@tiptap/vue-3": "^3.22.0",
39
46
  "@vueuse/core": "^14.0.0",
40
47
  "liquidjs": "^10.0.0",
41
- "lucide-vue-next": "^0.475.0",
48
+ "@lucide/vue": "^1.0.0",
42
49
  "vanilla-colorful": "^0.7.2",
43
- "vue-advanced-cropper": "^2.0.0",
44
50
  "vuedraggable": "^4.1.0"
45
51
  },
46
52
  "peerDependencies": {
47
- "vue": "^3.4.0",
53
+ "vue": "^3.5.0",
48
54
  "tailwindcss": "^4.0.0",
49
- "@templatical/renderer": "^0.0.1"
55
+ "@templatical/renderer": "^0.0.3",
56
+ "@templatical/media-library": "workspace:*"
50
57
  },
51
58
  "peerDependenciesMeta": {
52
59
  "@templatical/renderer": {
53
60
  "optional": true
61
+ },
62
+ "@templatical/media-library": {
63
+ "optional": true
54
64
  }
55
65
  },
56
66
  "devDependencies": {
57
- "@vitejs/plugin-vue": "^5.0.0",
58
- "typescript": "^5.7.0",
59
- "vite": "^6.0.0",
60
- "vitest": "^3.0.0",
67
+ "@vitejs/plugin-vue": "^6.0.0",
68
+ "typescript": "^6.0.0",
69
+ "vite": "^8.0.0",
70
+ "vitest": "^4.0.0",
61
71
  "vue": "^3.5.0",
62
- "vue-tsc": "^2.0.0"
72
+ "vue-tsc": "^3.0.0"
63
73
  }
64
74
  }
@@ -1,305 +0,0 @@
1
- import { defineComponent as U, inject as f, ref as y, watch as C, openBlock as s, createBlock as B, Transition as J, withCtx as X, createElementBlock as a, createElementVNode as o, createVNode as d, unref as t, toDisplayString as i, createCommentVNode as m, Fragment as b, renderList as H, createTextVNode as R, normalizeClass as q, withDirectives as O, vModelText as Q, nextTick as W } from "vue";
2
- import { c as F, B as Y, s as Z, S as E, E as tt, X as et, L as lt, C as st, t as at } from "./index-D-iD-7lO.js";
3
- import { useAiChat as ot } from "@templatical/core/cloud";
4
- import { L as rt } from "./loader-circle-tM9j2mRh.js";
5
- import { S as pt } from "./CloudEditor-Wdfv_9xn.js";
6
- /**
7
- * @license lucide-vue-next v0.475.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
12
- const nt = F("Redo2Icon", [
13
- ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
14
- ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
15
- ]);
16
- /**
17
- * @license lucide-vue-next v0.475.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */
22
- const it = F("Undo2Icon", [
23
- ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
24
- ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
25
- ]), dt = {
26
- key: 0,
27
- class: "tpl-ai-sidebar tpl:absolute tpl:top-14 tpl:right-0 tpl:bottom-0 tpl:z-[45] tpl:flex tpl:w-[360px] tpl:flex-col tpl:border-l tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)]"
28
- }, ct = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-3" }, ut = { class: "tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-primary)]" }, vt = { class: "tpl:flex tpl:items-center tpl:gap-1" }, mt = ["title"], ht = { class: "tpl:relative tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col" }, xt = {
29
- key: 0,
30
- class: "tpl:flex tpl:h-full tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:text-center"
31
- }, gt = {
32
- class: "tpl:text-sm",
33
- style: { color: "var(--tpl-text-muted)" }
34
- }, ft = {
35
- key: 1,
36
- class: "tpl:flex tpl:h-full tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:text-center"
37
- }, yt = {
38
- class: "tpl:max-w-[240px] tpl:text-sm",
39
- style: { color: "var(--tpl-text-muted)" }
40
- }, bt = {
41
- key: 2,
42
- class: "tpl:flex tpl:flex-col tpl:gap-4"
43
- }, kt = {
44
- key: 0,
45
- class: "tpl:self-end tpl:rounded-[var(--tpl-radius-sm)] tpl:px-3.5 tpl:py-2.5 tpl:text-sm",
46
- style: { "background-color": "var(--tpl-primary-light)", color: "var(--tpl-text)", "max-width": "85%", "box-shadow": "var(--tpl-shadow)" }
47
- }, _t = {
48
- key: 1,
49
- class: "tpl:flex tpl:flex-col tpl:gap-2"
50
- }, wt = {
51
- key: 1,
52
- class: "tpl:rounded-[var(--tpl-radius-sm)] tpl:px-3.5 tpl:py-2.5 tpl:text-sm tpl:whitespace-pre-wrap",
53
- style: { "max-width": "85%", "background-color": "white", color: "var(--tpl-text)", "box-shadow": "var(--tpl-shadow)" }
54
- }, Ct = {
55
- key: 0,
56
- class: "tpl:mx-3 tpl:mb-2 tpl:flex tpl:items-start tpl:gap-2 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:text-xs",
57
- style: { "background-color": "var(--tpl-danger-light)", color: "var(--tpl-danger)" }
58
- }, zt = {
59
- key: 1,
60
- class: "tpl:absolute tpl:right-0 tpl:bottom-0 tpl:left-0 tpl:z-10 tpl:px-3 tpl:pb-3",
61
- style: { "background-color": `color-mix(
62
- in srgb,
63
- var(--tpl-bg) 50%,
64
- transparent
65
- )`, "backdrop-filter": "blur(2px)" }
66
- }, St = { class: "tpl:flex tpl:flex-col tpl:gap-1.5" }, Tt = ["onClick"], At = {
67
- class: "tpl:border-t tpl:p-3",
68
- style: { "border-color": "var(--tpl-border)" }
69
- }, Lt = {
70
- class: "tpl-ai-input-wrapper tpl:flex tpl:items-end tpl:gap-2 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:px-3 tpl:py-2",
71
- style: { "border-color": "var(--tpl-border)", "background-color": "var(--tpl-bg)" }
72
- }, It = ["placeholder", "disabled"], Mt = ["disabled"], jt = {
73
- class: "tpl:m-0 tpl:px-1 tpl:pt-2 tpl:text-center tpl:text-[11px]",
74
- style: { color: "var(--tpl-text-dim)" }
75
- }, Bt = /* @__PURE__ */ U({
76
- __name: "AiChatSidebar",
77
- props: {
78
- visible: { type: Boolean },
79
- onApply: { type: Function }
80
- },
81
- emits: ["close"],
82
- setup(z, { emit: G }) {
83
- const S = z, P = G, n = f("translations"), h = f("editor"), V = f("authManager"), T = f("mergeTags", []), e = ot({
84
- authManager: V,
85
- getTemplateId: () => {
86
- var l;
87
- return ((l = h.state.template) == null ? void 0 : l.id) ?? null;
88
- },
89
- onApply: S.onApply,
90
- onError: void 0
91
- }), c = y(""), x = y(null), A = y(!1), u = y(0), { pause: k, resume: N } = Y(
92
- () => {
93
- var r;
94
- const l = ((r = e.suggestions.value) == null ? void 0 : r.length) ?? 0;
95
- u.value < l ? u.value++ : k();
96
- },
97
- 150,
98
- { immediate: !1 }
99
- );
100
- C(
101
- () => {
102
- var l;
103
- return ((l = e.suggestions.value) == null ? void 0 : l.length) ?? 0;
104
- },
105
- (l) => {
106
- if (k(), l === 0) {
107
- u.value = 0;
108
- return;
109
- }
110
- u.value = 0, Z(() => N(), 100);
111
- }
112
- );
113
- function _() {
114
- W(() => {
115
- x.value && (x.value.scrollTop = x.value.scrollHeight);
116
- });
117
- }
118
- C(
119
- () => {
120
- var l;
121
- return ((l = e.messages.value) == null ? void 0 : l.length) ?? 0;
122
- },
123
- () => _()
124
- ), C(
125
- () => S.visible,
126
- async (l) => {
127
- var r;
128
- l && !A.value && (A.value = !0, await e.loadConversation(), (((r = e.messages.value) == null ? void 0 : r.length) ?? 0) === 0 && h.content.value.blocks.length === 0 && e.loadSuggestions(h.content.value, T));
129
- }
130
- );
131
- async function w() {
132
- const l = c.value.trim();
133
- !l || e.isGenerating.value || (c.value = "", e.error.value = null, e.failedPrompt.value = null, _(), await e.sendPrompt(l, h.content.value, T), e.failedPrompt.value && (c.value = e.failedPrompt.value), _());
134
- }
135
- function L(l) {
136
- return l.replace(/```json[\s\S]*?```/g, "").replace(/```json[\s\S]*/g, "").trim();
137
- }
138
- function $(l) {
139
- k(), c.value = l, w();
140
- }
141
- function D(l) {
142
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), w());
143
- }
144
- return (l, r) => (s(), B(J, {
145
- "enter-active-class": "tpl-ai-slide-enter-active",
146
- "enter-from-class": "tpl:translate-x-full",
147
- "enter-to-class": "tpl:translate-x-0",
148
- "leave-active-class": "tpl-ai-slide-leave-active",
149
- "leave-from-class": "tpl:translate-x-0",
150
- "leave-to-class": "tpl:translate-x-full"
151
- }, {
152
- default: X(() => {
153
- var I, M, j;
154
- return [
155
- z.visible ? (s(), a("div", dt, [
156
- o("div", ct, [
157
- o("div", ut, [
158
- d(t(E), {
159
- size: 13,
160
- "stroke-width": 2
161
- }),
162
- o("span", null, i(t(n).aiChat.title), 1)
163
- ]),
164
- o("div", vt, [
165
- (((I = t(e).messages.value) == null ? void 0 : I.length) ?? 0) > 0 ? (s(), a("button", {
166
- key: 0,
167
- class: "tpl:rounded-md tpl:p-0.5 tpl:transition-colors tpl:duration-150",
168
- style: { color: "var(--tpl-text-muted)" },
169
- title: t(n).aiChat.clear,
170
- onClick: r[0] || (r[0] = (p) => t(e).clearChat())
171
- }, [
172
- d(t(tt), {
173
- size: 14,
174
- "stroke-width": 2
175
- })
176
- ], 8, mt)) : m("", !0),
177
- o("button", {
178
- class: "tpl:rounded-md tpl:p-0.5 tpl:transition-colors tpl:duration-150",
179
- style: { color: "var(--tpl-text-muted)" },
180
- onClick: r[1] || (r[1] = (p) => P("close"))
181
- }, [
182
- d(t(et), {
183
- size: 14,
184
- "stroke-width": 2
185
- })
186
- ])
187
- ])
188
- ]),
189
- o("div", ht, [
190
- o("div", {
191
- ref_key: "messagesContainer",
192
- ref: x,
193
- class: "tpl:flex-1 tpl:overflow-y-auto tpl:p-4"
194
- }, [
195
- t(e).isLoadingHistory.value ? (s(), a("div", xt, [
196
- d(t(rt), {
197
- class: "tpl-spinner",
198
- size: 24,
199
- "stroke-width": 2,
200
- style: { color: "var(--tpl-text-muted)" }
201
- }),
202
- o("p", gt, i(t(n).aiChat.loadingHistory), 1)
203
- ])) : (((M = t(e).messages.value) == null ? void 0 : M.length) ?? 0) === 0 ? (s(), a("div", ft, [
204
- d(t(E), {
205
- size: 32,
206
- "stroke-width": 1.5,
207
- style: { color: "var(--tpl-text-dim)" }
208
- }),
209
- o("p", yt, i(t(n).aiChat.placeholder), 1)
210
- ])) : (s(), a("div", bt, [
211
- (s(!0), a(b, null, H(t(e).messages.value, (p, g) => {
212
- var v;
213
- return s(), a("div", {
214
- key: p.id,
215
- class: "tpl:flex tpl:flex-col tpl:gap-2"
216
- }, [
217
- p.role === "user" ? (s(), a("div", kt, i(p.content), 1)) : (s(), a("div", _t, [
218
- !L(p.content) && t(e).isGenerating.value && g === (((v = t(e).messages.value) == null ? void 0 : v.length) ?? 0) - 1 ? (s(), B(lt, { key: 0 })) : (s(), a("div", wt, i(L(p.content) || t(n).aiChat.applied), 1)),
219
- p.id === t(e).lastApplyMessageId.value && !t(e).isGenerating.value ? (s(), a("button", {
220
- key: 2,
221
- class: "tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:self-start tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
222
- style: { "border-color": "var(--tpl-border)", color: "var(--tpl-text-muted)", "background-color": "transparent" },
223
- onClick: r[2] || (r[2] = (K) => t(e).toggleLastRevert())
224
- }, [
225
- t(e).isLastChangeReverted.value ? (s(), a(b, { key: 0 }, [
226
- d(t(nt), {
227
- size: 12,
228
- "stroke-width": 2
229
- }),
230
- R(" " + i(t(n).aiChat.reapply), 1)
231
- ], 64)) : (s(), a(b, { key: 1 }, [
232
- d(t(it), {
233
- size: 12,
234
- "stroke-width": 2
235
- }),
236
- R(" " + i(t(n).aiChat.revert), 1)
237
- ], 64))
238
- ])) : m("", !0)
239
- ]))
240
- ]);
241
- }), 128))
242
- ]))
243
- ], 512),
244
- t(e).error.value ? (s(), a("div", Ct, [
245
- d(t(st), {
246
- size: 14,
247
- "stroke-width": 2,
248
- class: "tpl:mt-0.5 tpl:shrink-0"
249
- }),
250
- o("span", null, i(t(e).error.value === "ai_apply_failed" ? t(n).aiChat.applyFailed : t(n).aiChat.error), 1)
251
- ])) : m("", !0),
252
- (((j = t(e).suggestions.value) == null ? void 0 : j.length) ?? 0) > 0 ? (s(), a("div", zt, [
253
- o("div", St, [
254
- (s(!0), a(b, null, H(t(e).suggestions.value ?? [], (p, g) => {
255
- var v;
256
- return s(), a("button", {
257
- key: g,
258
- class: q([
259
- "tpl-suggestion-btn tpl:cursor-pointer tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:leading-snug tpl:transition-all tpl:duration-300 tpl:ease-out",
260
- (((v = t(e).suggestions.value) == null ? void 0 : v.length) ?? 0) - 1 - g < u.value ? "tpl:translate-y-0 tpl:opacity-100" : "tpl:pointer-events-none tpl:-translate-y-2 tpl:opacity-0"
261
- ]),
262
- style: { "border-color": "var(--tpl-border)", color: "var(--tpl-primary)", "background-color": "white", "box-shadow": "var(--tpl-shadow)" },
263
- onClick: (K) => $(p)
264
- }, i(p), 11, Tt);
265
- }), 128))
266
- ])
267
- ])) : m("", !0)
268
- ]),
269
- o("div", At, [
270
- o("div", Lt, [
271
- O(o("textarea", {
272
- "onUpdate:modelValue": r[3] || (r[3] = (p) => c.value = p),
273
- class: "tpl:max-h-32 tpl:min-h-[64px] tpl:flex-1 tpl:resize-none tpl:border-none tpl:bg-transparent tpl:font-sans tpl:text-sm tpl:outline-none",
274
- style: { color: "var(--tpl-text)" },
275
- placeholder: t(n).aiChat.inputPlaceholder,
276
- disabled: t(e).isGenerating.value,
277
- rows: "3",
278
- onKeydown: D
279
- }, null, 40, It), [
280
- [Q, c.value]
281
- ]),
282
- o("button", {
283
- class: "tpl-ai-send-btn tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1.5 tpl:transition-all tpl:duration-150 tpl:disabled:opacity-40",
284
- style: { color: "var(--tpl-primary)" },
285
- disabled: !c.value.trim() || t(e).isGenerating.value,
286
- onClick: w
287
- }, [
288
- d(t(pt), {
289
- size: 16,
290
- "stroke-width": 2
291
- })
292
- ], 8, Mt)
293
- ]),
294
- o("p", jt, i(t(n).aiMenu.disclaimer), 1)
295
- ])
296
- ])) : m("", !0)
297
- ];
298
- }),
299
- _: 1
300
- }));
301
- }
302
- }), Pt = /* @__PURE__ */ at(Bt, [["__scopeId", "data-v-3d9d0cf5"]]);
303
- export {
304
- Pt as default
305
- };
@@ -1,69 +0,0 @@
1
- import { defineComponent as v, inject as y, computed as h, openBlock as l, createElementBlock as a, Fragment as x, renderList as b, normalizeStyle as o, createElementVNode as n, createBlock as _, resolveDynamicComponent as w, toDisplayString as s } from "vue";
2
- import { u as C, S as F, I as M, t as S } from "./index-D-iD-7lO.js";
3
- import "@templatical/types";
4
- import { S as T } from "./shield-check-Ngi9jAQc.js";
5
- const D = {
6
- class: "tpl-ai-feature-menu tpl:w-[280px] tpl:overflow-hidden tpl:rounded-[var(--tpl-radius)] tpl:py-1",
7
- style: { "background-color": "var(--tpl-bg-elevated)", border: "1px solid var(--tpl-border)", "box-shadow": "var(--tpl-shadow-lg)", "backdrop-filter": "blur(8px)", "-webkit-backdrop-filter": "blur(8px)" }
8
- }, A = ["onClick"], I = { class: "tpl:flex tpl:min-w-0 tpl:flex-col tpl:gap-0.5" }, z = {
9
- class: "tpl:text-sm tpl:font-medium",
10
- style: { color: "var(--tpl-text)" }
11
- }, B = {
12
- class: "tpl:text-xs tpl:leading-snug",
13
- style: { color: "var(--tpl-text-muted)" }
14
- }, E = /* @__PURE__ */ v({
15
- __name: "AiFeatureMenu",
16
- props: {
17
- activeFeature: {}
18
- },
19
- emits: ["select"],
20
- setup(i, { emit: c }) {
21
- const p = c, { t: r } = C(), u = y("aiConfig"), d = {
22
- "ai-chat": "chat",
23
- "design-reference": "designToTemplate",
24
- scoring: "scoring"
25
- }, m = [
26
- { key: "ai-chat", icon: F },
27
- { key: "design-reference", icon: M },
28
- { key: "scoring", icon: T }
29
- ], g = h(
30
- () => m.filter((e) => u.isFeatureEnabled(d[e.key]))
31
- );
32
- function f(e) {
33
- return e === "ai-chat" ? r.aiMenu.aiAssistant : e === "design-reference" ? r.aiMenu.designToTemplate : r.aiMenu.templateScore;
34
- }
35
- function k(e) {
36
- return e === "ai-chat" ? r.aiMenu.aiAssistantDesc : e === "design-reference" ? r.aiMenu.designToTemplateDesc : r.aiMenu.templateScoreDesc;
37
- }
38
- return (e, j) => (l(), a("div", D, [
39
- (l(!0), a(x, null, b(g.value, (t) => (l(), a("button", {
40
- key: t.key,
41
- class: "tpl-ai-feature-menu-item tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-start tpl:gap-3 tpl:border-none tpl:px-3 tpl:py-2.5 tpl:text-left tpl:transition-colors tpl:duration-100",
42
- style: o({
43
- backgroundColor: i.activeFeature === t.key ? "var(--tpl-primary-light)" : "transparent"
44
- }),
45
- onClick: (K) => p("select", t.key)
46
- }, [
47
- n("div", {
48
- class: "tpl:mt-0.5 tpl:flex tpl:size-7 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)]",
49
- style: o({
50
- backgroundColor: i.activeFeature === t.key ? "var(--tpl-primary)" : "var(--tpl-bg-active)",
51
- color: i.activeFeature === t.key ? "white" : "var(--tpl-text-muted)"
52
- })
53
- }, [
54
- (l(), _(w(t.icon), {
55
- size: 15,
56
- "stroke-width": 2
57
- }))
58
- ], 4),
59
- n("div", I, [
60
- n("span", z, s(f(t.key)), 1),
61
- n("span", B, s(k(t.key)), 1)
62
- ])
63
- ], 12, A))), 128))
64
- ]));
65
- }
66
- }), $ = /* @__PURE__ */ S(E, [["__scopeId", "data-v-5200b3b6"]]);
67
- export {
68
- $ as default
69
- };