@gxp-dev/tools 2.0.63 → 2.0.65

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 (182) hide show
  1. package/README.md +32 -31
  2. package/bin/gx-devtools.js +74 -54
  3. package/bin/lib/cli.js +23 -21
  4. package/bin/lib/commands/add-dependency.js +366 -325
  5. package/bin/lib/commands/assets.js +137 -139
  6. package/bin/lib/commands/build.js +169 -174
  7. package/bin/lib/commands/datastore.js +181 -183
  8. package/bin/lib/commands/dev.js +127 -131
  9. package/bin/lib/commands/extensions.js +147 -149
  10. package/bin/lib/commands/extract-config.js +73 -67
  11. package/bin/lib/commands/index.js +12 -12
  12. package/bin/lib/commands/init.js +342 -240
  13. package/bin/lib/commands/publish.js +69 -75
  14. package/bin/lib/commands/socket.js +69 -69
  15. package/bin/lib/commands/ssl.js +14 -14
  16. package/bin/lib/constants.js +10 -24
  17. package/bin/lib/tui/App.tsx +761 -705
  18. package/bin/lib/tui/components/AIPanel.tsx +191 -171
  19. package/bin/lib/tui/components/CommandInput.tsx +394 -343
  20. package/bin/lib/tui/components/GeminiPanel.tsx +175 -151
  21. package/bin/lib/tui/components/Header.tsx +23 -21
  22. package/bin/lib/tui/components/LogPanel.tsx +244 -220
  23. package/bin/lib/tui/components/TabBar.tsx +50 -48
  24. package/bin/lib/tui/components/WelcomeScreen.tsx +126 -71
  25. package/bin/lib/tui/index.tsx +37 -39
  26. package/bin/lib/tui/services/AIService.ts +518 -462
  27. package/bin/lib/tui/services/ExtensionService.ts +140 -129
  28. package/bin/lib/tui/services/GeminiService.ts +367 -337
  29. package/bin/lib/tui/services/ServiceManager.ts +344 -322
  30. package/bin/lib/tui/services/SocketService.ts +168 -168
  31. package/bin/lib/tui/services/ViteService.ts +88 -88
  32. package/bin/lib/tui/services/index.ts +47 -22
  33. package/bin/lib/utils/ai-scaffold.js +291 -280
  34. package/bin/lib/utils/extract-config.js +157 -140
  35. package/bin/lib/utils/files.js +82 -86
  36. package/bin/lib/utils/index.js +7 -7
  37. package/bin/lib/utils/paths.js +34 -34
  38. package/bin/lib/utils/prompts.js +194 -169
  39. package/bin/lib/utils/ssl.js +79 -81
  40. package/browser-extensions/README.md +0 -1
  41. package/browser-extensions/chrome/background.js +244 -237
  42. package/browser-extensions/chrome/content.js +32 -29
  43. package/browser-extensions/chrome/devtools.html +7 -7
  44. package/browser-extensions/chrome/devtools.js +19 -19
  45. package/browser-extensions/chrome/inspector.js +802 -767
  46. package/browser-extensions/chrome/manifest.json +71 -63
  47. package/browser-extensions/chrome/panel.html +674 -636
  48. package/browser-extensions/chrome/panel.js +722 -712
  49. package/browser-extensions/chrome/popup.html +586 -543
  50. package/browser-extensions/chrome/popup.js +282 -244
  51. package/browser-extensions/chrome/rules.json +1 -1
  52. package/browser-extensions/chrome/test-chrome.html +216 -136
  53. package/browser-extensions/chrome/test-mixed-content.html +284 -189
  54. package/browser-extensions/chrome/test-uri-pattern.html +221 -198
  55. package/browser-extensions/firefox/README.md +9 -6
  56. package/browser-extensions/firefox/background.js +221 -218
  57. package/browser-extensions/firefox/content.js +55 -52
  58. package/browser-extensions/firefox/debug-errors.html +386 -228
  59. package/browser-extensions/firefox/debug-https.html +153 -105
  60. package/browser-extensions/firefox/devtools.html +7 -7
  61. package/browser-extensions/firefox/devtools.js +23 -20
  62. package/browser-extensions/firefox/inspector.js +802 -767
  63. package/browser-extensions/firefox/manifest.json +68 -68
  64. package/browser-extensions/firefox/panel.html +674 -636
  65. package/browser-extensions/firefox/panel.js +722 -712
  66. package/browser-extensions/firefox/popup.html +572 -535
  67. package/browser-extensions/firefox/popup.js +281 -236
  68. package/browser-extensions/firefox/test-gramercy.html +170 -125
  69. package/browser-extensions/firefox/test-imports.html +59 -55
  70. package/browser-extensions/firefox/test-masking.html +231 -140
  71. package/browser-extensions/firefox/test-uri-pattern.html +221 -198
  72. package/dist/tui/App.d.ts +1 -1
  73. package/dist/tui/App.d.ts.map +1 -1
  74. package/dist/tui/App.js +154 -150
  75. package/dist/tui/App.js.map +1 -1
  76. package/dist/tui/components/AIPanel.d.ts.map +1 -1
  77. package/dist/tui/components/AIPanel.js +42 -35
  78. package/dist/tui/components/AIPanel.js.map +1 -1
  79. package/dist/tui/components/CommandInput.d.ts +1 -1
  80. package/dist/tui/components/CommandInput.d.ts.map +1 -1
  81. package/dist/tui/components/CommandInput.js +92 -62
  82. package/dist/tui/components/CommandInput.js.map +1 -1
  83. package/dist/tui/components/GeminiPanel.d.ts.map +1 -1
  84. package/dist/tui/components/GeminiPanel.js +37 -30
  85. package/dist/tui/components/GeminiPanel.js.map +1 -1
  86. package/dist/tui/components/Header.d.ts.map +1 -1
  87. package/dist/tui/components/Header.js +1 -1
  88. package/dist/tui/components/Header.js.map +1 -1
  89. package/dist/tui/components/LogPanel.d.ts +1 -1
  90. package/dist/tui/components/LogPanel.d.ts.map +1 -1
  91. package/dist/tui/components/LogPanel.js +26 -24
  92. package/dist/tui/components/LogPanel.js.map +1 -1
  93. package/dist/tui/components/TabBar.d.ts +2 -2
  94. package/dist/tui/components/TabBar.d.ts.map +1 -1
  95. package/dist/tui/components/TabBar.js +11 -11
  96. package/dist/tui/components/TabBar.js.map +1 -1
  97. package/dist/tui/components/WelcomeScreen.d.ts.map +1 -1
  98. package/dist/tui/components/WelcomeScreen.js +6 -6
  99. package/dist/tui/components/WelcomeScreen.js.map +1 -1
  100. package/dist/tui/index.d.ts.map +1 -1
  101. package/dist/tui/index.js +8 -8
  102. package/dist/tui/index.js.map +1 -1
  103. package/dist/tui/services/AIService.d.ts +2 -2
  104. package/dist/tui/services/AIService.d.ts.map +1 -1
  105. package/dist/tui/services/AIService.js +165 -125
  106. package/dist/tui/services/AIService.js.map +1 -1
  107. package/dist/tui/services/ExtensionService.d.ts +1 -1
  108. package/dist/tui/services/ExtensionService.d.ts.map +1 -1
  109. package/dist/tui/services/ExtensionService.js +33 -26
  110. package/dist/tui/services/ExtensionService.js.map +1 -1
  111. package/dist/tui/services/GeminiService.d.ts +1 -1
  112. package/dist/tui/services/GeminiService.d.ts.map +1 -1
  113. package/dist/tui/services/GeminiService.js +87 -76
  114. package/dist/tui/services/GeminiService.js.map +1 -1
  115. package/dist/tui/services/ServiceManager.d.ts +3 -3
  116. package/dist/tui/services/ServiceManager.d.ts.map +1 -1
  117. package/dist/tui/services/ServiceManager.js +72 -58
  118. package/dist/tui/services/ServiceManager.js.map +1 -1
  119. package/dist/tui/services/SocketService.d.ts.map +1 -1
  120. package/dist/tui/services/SocketService.js +32 -32
  121. package/dist/tui/services/SocketService.js.map +1 -1
  122. package/dist/tui/services/ViteService.d.ts.map +1 -1
  123. package/dist/tui/services/ViteService.js +26 -28
  124. package/dist/tui/services/ViteService.js.map +1 -1
  125. package/dist/tui/services/index.d.ts +6 -6
  126. package/dist/tui/services/index.d.ts.map +1 -1
  127. package/dist/tui/services/index.js +6 -6
  128. package/dist/tui/services/index.js.map +1 -1
  129. package/mcp/gxp-api-server.js +83 -81
  130. package/package.json +109 -93
  131. package/runtime/PortalContainer.vue +258 -234
  132. package/runtime/dev-tools/DevToolsModal.vue +153 -155
  133. package/runtime/dev-tools/LayoutSwitcher.vue +144 -140
  134. package/runtime/dev-tools/MockDataEditor.vue +456 -433
  135. package/runtime/dev-tools/SocketSimulator.vue +379 -371
  136. package/runtime/dev-tools/StoreInspector.vue +517 -455
  137. package/runtime/dev-tools/index.js +5 -5
  138. package/runtime/fallback-layouts/PrivateLayout.vue +2 -2
  139. package/runtime/fallback-layouts/PublicLayout.vue +2 -2
  140. package/runtime/fallback-layouts/SystemLayout.vue +2 -2
  141. package/runtime/gxpStringsPlugin.js +159 -134
  142. package/runtime/index.html +17 -19
  143. package/runtime/main.js +24 -22
  144. package/runtime/mock-api/auth-middleware.js +15 -15
  145. package/runtime/mock-api/image-generator.js +46 -46
  146. package/runtime/mock-api/index.js +55 -55
  147. package/runtime/mock-api/response-generator.js +116 -105
  148. package/runtime/mock-api/route-generator.js +107 -84
  149. package/runtime/mock-api/socket-triggers.js +94 -93
  150. package/runtime/mock-api/spec-loader.js +79 -80
  151. package/runtime/package.json +3 -0
  152. package/runtime/server.js +68 -68
  153. package/runtime/stores/gxpPortalConfigStore.js +204 -186
  154. package/runtime/stores/index.js +2 -2
  155. package/runtime/vite-inspector-plugin.js +858 -707
  156. package/runtime/vite-source-tracker-plugin.js +132 -113
  157. package/runtime/vite.config.js +191 -139
  158. package/scripts/launch-chrome.js +41 -41
  159. package/scripts/pack-chrome.js +38 -39
  160. package/socket-events/AiSessionMessageCreated.json +17 -17
  161. package/socket-events/SocialStreamPostCreated.json +23 -23
  162. package/socket-events/SocialStreamPostVariantCompleted.json +22 -22
  163. package/template/.claude/agents/gxp-developer.md +100 -99
  164. package/template/.claude/settings.json +7 -7
  165. package/template/AGENTS.md +30 -23
  166. package/template/GEMINI.md +20 -20
  167. package/template/README.md +70 -53
  168. package/template/app-manifest.json +2 -4
  169. package/template/configuration.json +10 -10
  170. package/template/default-styling.css +1 -1
  171. package/template/index.html +18 -20
  172. package/template/main.js +24 -22
  173. package/template/src/DemoPage.vue +415 -362
  174. package/template/src/Plugin.vue +76 -85
  175. package/template/src/stores/index.js +3 -3
  176. package/template/src/stores/test-data.json +164 -172
  177. package/template/theme-layouts/AdditionalStyling.css +50 -50
  178. package/template/theme-layouts/PrivateLayout.vue +8 -12
  179. package/template/theme-layouts/PublicLayout.vue +8 -12
  180. package/template/theme-layouts/SystemLayout.vue +8 -12
  181. package/template/vite.extend.js +45 -0
  182. package/template/vite.config.js +0 -409
@@ -1,6 +1,6 @@
1
1
  // GxP Dev Tools Components
2
- export { default as DevToolsModal } from './DevToolsModal.vue';
3
- export { default as StoreInspector } from './StoreInspector.vue';
4
- export { default as LayoutSwitcher } from './LayoutSwitcher.vue';
5
- export { default as SocketSimulator } from './SocketSimulator.vue';
6
- export { default as MockDataEditor } from './MockDataEditor.vue';
2
+ export { default as DevToolsModal } from "./DevToolsModal.vue"
3
+ export { default as StoreInspector } from "./StoreInspector.vue"
4
+ export { default as LayoutSwitcher } from "./LayoutSwitcher.vue"
5
+ export { default as SocketSimulator } from "./SocketSimulator.vue"
6
+ export { default as MockDataEditor } from "./MockDataEditor.vue"
@@ -3,12 +3,12 @@
3
3
  </template>
4
4
 
5
5
  <script setup>
6
- defineOptions({ inheritAttrs: false });
6
+ defineOptions({ inheritAttrs: false })
7
7
  defineProps({
8
8
  usrLang: { type: String, default: "" },
9
9
  portalSettings: { type: Object, default: () => ({}) },
10
10
  portalLanguage: { type: Object, default: () => ({}) },
11
11
  portalNavigation: { type: Array, default: () => [] },
12
12
  portalAssets: { type: Object, default: () => ({}) },
13
- });
13
+ })
14
14
  </script>
@@ -3,12 +3,12 @@
3
3
  </template>
4
4
 
5
5
  <script setup>
6
- defineOptions({ inheritAttrs: false });
6
+ defineOptions({ inheritAttrs: false })
7
7
  defineProps({
8
8
  usrLang: { type: String, default: "" },
9
9
  portalSettings: { type: Object, default: () => ({}) },
10
10
  portalLanguage: { type: Object, default: () => ({}) },
11
11
  portalNavigation: { type: Array, default: () => [] },
12
12
  portalAssets: { type: Object, default: () => ({}) },
13
- });
13
+ })
14
14
  </script>
@@ -3,12 +3,12 @@
3
3
  </template>
4
4
 
5
5
  <script setup>
6
- defineOptions({ inheritAttrs: false });
6
+ defineOptions({ inheritAttrs: false })
7
7
  defineProps({
8
8
  usrLang: { type: String, default: "" },
9
9
  portalSettings: { type: Object, default: () => ({}) },
10
10
  portalLanguage: { type: Object, default: () => ({}) },
11
11
  portalNavigation: { type: Array, default: () => [] },
12
12
  portalAssets: { type: Object, default: () => ({}) },
13
- });
13
+ })
14
14
  </script>
@@ -28,7 +28,7 @@
28
28
  * 4. Fall back to the original if no value found
29
29
  */
30
30
 
31
- import { watch } from "vue";
31
+ import { watch } from "vue"
32
32
 
33
33
  /**
34
34
  * Create the GxP Strings Plugin
@@ -36,7 +36,7 @@ import { watch } from "vue";
36
36
  * @returns {Object} Vue plugin
37
37
  */
38
38
  export function createGxpStringsPlugin(store, options = {}) {
39
- const devServerBaseUrl = (options.devServerBaseUrl || "").replace(/\/+$/, "");
39
+ const devServerBaseUrl = (options.devServerBaseUrl || "").replace(/\/+$/, "")
40
40
 
41
41
  return {
42
42
  install(app) {
@@ -44,95 +44,103 @@ export function createGxpStringsPlugin(store, options = {}) {
44
44
  app.directive("gxp-string", {
45
45
  // Called when the element is mounted
46
46
  mounted(el, binding) {
47
- const key = binding.value || el.getAttribute("gxp-string");
48
- if (!key) return;
47
+ const key = binding.value || el.getAttribute("gxp-string")
48
+ if (!key) return
49
49
 
50
50
  // Store the original text content as default
51
- const defaultValue = el.textContent || "";
52
- el._gxpStringDefault = defaultValue;
53
- el._gxpStringKey = key;
51
+ const defaultValue = el.textContent || ""
52
+ el._gxpStringDefault = defaultValue
53
+ el._gxpStringKey = key
54
54
 
55
55
  // Initial update
56
- updateElementText(el, key, defaultValue, store);
56
+ updateElementText(el, key, defaultValue, store)
57
57
 
58
58
  // Watch for changes in the appropriate store based on attributes
59
59
  // Using deep: true to catch when entire object is replaced (async manifest load)
60
60
  if (store) {
61
- const watchSource = getWatchSource(el, key, store);
61
+ const watchSource = getWatchSource(el, key, store)
62
62
  if (watchSource) {
63
- el._gxpUnwatch = watch(watchSource, () => {
64
- updateElementText(el, key, defaultValue, store);
65
- }, { deep: true });
63
+ el._gxpUnwatch = watch(
64
+ watchSource,
65
+ () => {
66
+ updateElementText(el, key, defaultValue, store)
67
+ },
68
+ { deep: true },
69
+ )
66
70
  }
67
71
  }
68
72
  },
69
73
 
70
74
  // Called when binding value changes
71
75
  updated(el, binding) {
72
- const key = binding.value || el.getAttribute("gxp-string");
73
- if (!key) return;
76
+ const key = binding.value || el.getAttribute("gxp-string")
77
+ if (!key) return
74
78
 
75
- const defaultValue = el._gxpStringDefault || el.textContent || "";
76
- updateElementText(el, key, defaultValue, store);
79
+ const defaultValue = el._gxpStringDefault || el.textContent || ""
80
+ updateElementText(el, key, defaultValue, store)
77
81
  },
78
82
 
79
83
  // Cleanup when element is unmounted
80
84
  unmounted(el) {
81
85
  if (el._gxpUnwatch) {
82
- el._gxpUnwatch();
86
+ el._gxpUnwatch()
83
87
  }
84
- delete el._gxpStringDefault;
85
- delete el._gxpStringKey;
86
- delete el._gxpUnwatch;
88
+ delete el._gxpStringDefault
89
+ delete el._gxpStringKey
90
+ delete el._gxpUnwatch
87
91
  },
88
- });
92
+ })
89
93
 
90
94
  // Register the v-gxp-src directive for replacing src attributes
91
95
  app.directive("gxp-src", {
92
96
  // Called when the element is mounted
93
97
  mounted(el, binding) {
94
- const key = binding.value || el.getAttribute("gxp-src");
95
- if (!key) return;
98
+ const key = binding.value || el.getAttribute("gxp-src")
99
+ if (!key) return
96
100
 
97
101
  // Store the original src as default
98
- const defaultSrc = el.getAttribute("src") || "";
99
- el._gxpSrcDefault = defaultSrc;
100
- el._gxpSrcKey = key;
102
+ const defaultSrc = el.getAttribute("src") || ""
103
+ el._gxpSrcDefault = defaultSrc
104
+ el._gxpSrcKey = key
101
105
 
102
106
  // Initial update
103
- updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl);
107
+ updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl)
104
108
 
105
109
  // Watch for changes in the appropriate store based on attributes
106
110
  // Using deep: true to catch when entire object is replaced (async manifest load)
107
111
  if (store) {
108
- const watchSource = getSrcWatchSource(el, key, store);
112
+ const watchSource = getSrcWatchSource(el, key, store)
109
113
  if (watchSource) {
110
- el._gxpSrcUnwatch = watch(watchSource, () => {
111
- updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl);
112
- }, { deep: true });
114
+ el._gxpSrcUnwatch = watch(
115
+ watchSource,
116
+ () => {
117
+ updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl)
118
+ },
119
+ { deep: true },
120
+ )
113
121
  }
114
122
  }
115
123
  },
116
124
 
117
125
  // Called when binding value changes
118
126
  updated(el, binding) {
119
- const key = binding.value || el.getAttribute("gxp-src");
120
- if (!key) return;
127
+ const key = binding.value || el.getAttribute("gxp-src")
128
+ if (!key) return
121
129
 
122
- const defaultSrc = el._gxpSrcDefault || el.getAttribute("src") || "";
123
- updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl);
130
+ const defaultSrc = el._gxpSrcDefault || el.getAttribute("src") || ""
131
+ updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl)
124
132
  },
125
133
 
126
134
  // Cleanup when element is unmounted
127
135
  unmounted(el) {
128
136
  if (el._gxpSrcUnwatch) {
129
- el._gxpSrcUnwatch();
137
+ el._gxpSrcUnwatch()
130
138
  }
131
- delete el._gxpSrcDefault;
132
- delete el._gxpSrcKey;
133
- delete el._gxpSrcUnwatch;
139
+ delete el._gxpSrcDefault
140
+ delete el._gxpSrcKey
141
+ delete el._gxpSrcUnwatch
134
142
  },
135
- });
143
+ })
136
144
 
137
145
  // Also handle raw gxp-string and gxp-src attributes (without v- prefix)
138
146
  // This runs after mount to catch all elements with the attribute
@@ -140,40 +148,40 @@ export function createGxpStringsPlugin(store, options = {}) {
140
148
  app.mixin({
141
149
  mounted() {
142
150
  this.$nextTick(() => {
143
- processGxpStringAttributes(this.$el, store);
144
- processGxpSrcAttributes(this.$el, store, devServerBaseUrl);
145
- });
151
+ processGxpStringAttributes(this.$el, store)
152
+ processGxpSrcAttributes(this.$el, store, devServerBaseUrl)
153
+ })
146
154
 
147
155
  // Watch for manifest loading to re-process attributes
148
156
  if (store && store.manifestLoaded !== undefined) {
149
- const rootEl = this.$el;
157
+ const rootEl = this.$el
150
158
  this._gxpManifestUnwatch = watch(
151
159
  () => store.manifestLoaded,
152
160
  (loaded) => {
153
161
  if (loaded) {
154
162
  this.$nextTick(() => {
155
- reprocessGxpStringAttributes(rootEl, store);
156
- reprocessGxpSrcAttributes(rootEl, store, devServerBaseUrl);
157
- });
163
+ reprocessGxpStringAttributes(rootEl, store)
164
+ reprocessGxpSrcAttributes(rootEl, store, devServerBaseUrl)
165
+ })
158
166
  }
159
- }
160
- );
167
+ },
168
+ )
161
169
  }
162
170
  },
163
171
  updated() {
164
172
  this.$nextTick(() => {
165
- processGxpStringAttributes(this.$el, store);
166
- processGxpSrcAttributes(this.$el, store, devServerBaseUrl);
167
- });
173
+ processGxpStringAttributes(this.$el, store)
174
+ processGxpSrcAttributes(this.$el, store, devServerBaseUrl)
175
+ })
168
176
  },
169
177
  unmounted() {
170
178
  if (this._gxpManifestUnwatch) {
171
- this._gxpManifestUnwatch();
179
+ this._gxpManifestUnwatch()
172
180
  }
173
181
  },
174
- });
182
+ })
175
183
  },
176
- };
184
+ }
177
185
  }
178
186
 
179
187
  /**
@@ -191,28 +199,31 @@ function getWatchSource(el, key, store) {
191
199
  return () => ({
192
200
  value: store.triggerState?.[key],
193
201
  obj: store.triggerState,
194
- loaded: store.manifestLoaded
195
- });
196
- } else if (el.hasAttribute("gxp-settings") && store.pluginVars !== undefined) {
202
+ loaded: store.manifestLoaded,
203
+ })
204
+ } else if (
205
+ el.hasAttribute("gxp-settings") &&
206
+ store.pluginVars !== undefined
207
+ ) {
197
208
  return () => ({
198
209
  value: store.pluginVars?.[key],
199
210
  obj: store.pluginVars,
200
- loaded: store.manifestLoaded
201
- });
211
+ loaded: store.manifestLoaded,
212
+ })
202
213
  } else if (el.hasAttribute("gxp-assets") && store.assetList !== undefined) {
203
214
  return () => ({
204
215
  value: store.assetList?.[key],
205
216
  obj: store.assetList,
206
- loaded: store.manifestLoaded
207
- });
217
+ loaded: store.manifestLoaded,
218
+ })
208
219
  } else if (store.stringsList !== undefined) {
209
220
  return () => ({
210
221
  value: store.stringsList?.[key],
211
222
  obj: store.stringsList,
212
- loaded: store.manifestLoaded
213
- });
223
+ loaded: store.manifestLoaded,
224
+ })
214
225
  }
215
- return null;
226
+ return null
216
227
  }
217
228
 
218
229
  /**
@@ -224,16 +235,16 @@ function getSrcWatchSource(el, key, store) {
224
235
  return () => ({
225
236
  value: store.triggerState?.[key],
226
237
  obj: store.triggerState,
227
- loaded: store.manifestLoaded
228
- });
238
+ loaded: store.manifestLoaded,
239
+ })
229
240
  } else if (store.assetList !== undefined) {
230
241
  return () => ({
231
242
  value: store.assetList?.[key],
232
243
  obj: store.assetList,
233
- loaded: store.manifestLoaded
234
- });
244
+ loaded: store.manifestLoaded,
245
+ })
235
246
  }
236
- return null;
247
+ return null
237
248
  }
238
249
 
239
250
  /**
@@ -241,24 +252,24 @@ function getSrcWatchSource(el, key, store) {
241
252
  */
242
253
  function updateElementText(el, key, defaultValue, store) {
243
254
  if (!store) {
244
- return;
255
+ return
245
256
  }
246
257
 
247
- let translatedValue;
258
+ let translatedValue
248
259
  if (el.hasAttribute("gxp-state")) {
249
- translatedValue = store.getState?.(key);
260
+ translatedValue = store.getState?.(key)
250
261
  } else if (el.hasAttribute("gxp-settings")) {
251
- translatedValue = store.getSetting?.(key);
262
+ translatedValue = store.getSetting?.(key)
252
263
  } else if (el.hasAttribute("gxp-assets")) {
253
- translatedValue = store.getAsset?.(key);
264
+ translatedValue = store.getAsset?.(key)
254
265
  } else {
255
- translatedValue = store.getString?.(key);
266
+ translatedValue = store.getString?.(key)
256
267
  }
257
268
 
258
269
  if (translatedValue && translatedValue !== defaultValue) {
259
- el.textContent = translatedValue;
270
+ el.textContent = translatedValue
260
271
  } else {
261
- el.textContent = defaultValue;
272
+ el.textContent = defaultValue
262
273
  }
263
274
  }
264
275
 
@@ -268,12 +279,12 @@ function updateElementText(el, key, defaultValue, store) {
268
279
  * Store-returned values are never prefixed — they are already absolute.
269
280
  */
270
281
  function resolveDefaultSrc(defaultSrc, devServerBaseUrl) {
271
- if (!devServerBaseUrl || !defaultSrc) return defaultSrc;
282
+ if (!devServerBaseUrl || !defaultSrc) return defaultSrc
272
283
  // Only prefix relative paths, not already-absolute URLs
273
284
  if (defaultSrc.startsWith("/") && !defaultSrc.startsWith("//")) {
274
- return devServerBaseUrl + defaultSrc;
285
+ return devServerBaseUrl + defaultSrc
275
286
  }
276
- return defaultSrc;
287
+ return defaultSrc
277
288
  }
278
289
 
279
290
  /**
@@ -282,20 +293,20 @@ function resolveDefaultSrc(defaultSrc, devServerBaseUrl) {
282
293
  */
283
294
  function updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl) {
284
295
  if (!store) {
285
- return;
296
+ return
286
297
  }
287
298
 
288
- let srcUrl;
299
+ let srcUrl
289
300
  if (el.hasAttribute("gxp-state")) {
290
- srcUrl = store.getState?.(key);
301
+ srcUrl = store.getState?.(key)
291
302
  } else {
292
- srcUrl = store.getAsset?.(key);
303
+ srcUrl = store.getAsset?.(key)
293
304
  }
294
305
 
295
306
  if (srcUrl && srcUrl !== defaultSrc) {
296
- el.setAttribute("src", srcUrl);
307
+ el.setAttribute("src", srcUrl)
297
308
  } else if (defaultSrc) {
298
- el.setAttribute("src", resolveDefaultSrc(defaultSrc, devServerBaseUrl));
309
+ el.setAttribute("src", resolveDefaultSrc(defaultSrc, devServerBaseUrl))
299
310
  }
300
311
  }
301
312
 
@@ -304,36 +315,40 @@ function updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl) {
304
315
  * This handles elements that use the raw attribute without the v- directive
305
316
  */
306
317
  function processGxpStringAttributes(rootEl, store) {
307
- if (!rootEl || !store) return;
318
+ if (!rootEl || !store) return
308
319
 
309
320
  // Handle case where rootEl is a text node or comment
310
- if (!rootEl.querySelectorAll) return;
321
+ if (!rootEl.querySelectorAll) return
311
322
 
312
- const elements = rootEl.querySelectorAll("[gxp-string]");
323
+ const elements = rootEl.querySelectorAll("[gxp-string]")
313
324
 
314
325
  elements.forEach((el) => {
315
- const key = el.getAttribute("gxp-string");
316
- if (!key) return;
326
+ const key = el.getAttribute("gxp-string")
327
+ if (!key) return
317
328
 
318
329
  // Store default value only on first processing
319
330
  if (!el._gxpStringDefault) {
320
- el._gxpStringDefault = el.textContent || "";
331
+ el._gxpStringDefault = el.textContent || ""
321
332
  }
322
- el._gxpStringKey = key;
333
+ el._gxpStringKey = key
323
334
 
324
335
  // Update text
325
- updateElementText(el, key, el._gxpStringDefault, store);
336
+ updateElementText(el, key, el._gxpStringDefault, store)
326
337
 
327
338
  // Set up watcher for this element (if not already watching)
328
339
  if (!el._gxpUnwatch) {
329
- const watchSource = getWatchSource(el, key, store);
340
+ const watchSource = getWatchSource(el, key, store)
330
341
  if (watchSource) {
331
- el._gxpUnwatch = watch(watchSource, () => {
332
- updateElementText(el, key, el._gxpStringDefault, store);
333
- }, { deep: true });
342
+ el._gxpUnwatch = watch(
343
+ watchSource,
344
+ () => {
345
+ updateElementText(el, key, el._gxpStringDefault, store)
346
+ },
347
+ { deep: true },
348
+ )
334
349
  }
335
350
  }
336
- });
351
+ })
337
352
  }
338
353
 
339
354
  /**
@@ -341,18 +356,18 @@ function processGxpStringAttributes(rootEl, store) {
341
356
  * This is called when manifest loads to update elements that were already processed
342
357
  */
343
358
  function reprocessGxpStringAttributes(rootEl, store) {
344
- if (!rootEl || !store) return;
345
- if (!rootEl.querySelectorAll) return;
359
+ if (!rootEl || !store) return
360
+ if (!rootEl.querySelectorAll) return
346
361
 
347
- const elements = rootEl.querySelectorAll("[gxp-string]");
362
+ const elements = rootEl.querySelectorAll("[gxp-string]")
348
363
 
349
364
  elements.forEach((el) => {
350
- const key = el.getAttribute("gxp-string");
351
- if (!key) return;
365
+ const key = el.getAttribute("gxp-string")
366
+ if (!key) return
352
367
 
353
- const defaultValue = el._gxpStringDefault || el.textContent || "";
354
- updateElementText(el, key, defaultValue, store);
355
- });
368
+ const defaultValue = el._gxpStringDefault || el.textContent || ""
369
+ updateElementText(el, key, defaultValue, store)
370
+ })
356
371
  }
357
372
 
358
373
  /**
@@ -360,36 +375,46 @@ function reprocessGxpStringAttributes(rootEl, store) {
360
375
  * This handles elements that use the raw attribute without the v- directive
361
376
  */
362
377
  function processGxpSrcAttributes(rootEl, store, devServerBaseUrl) {
363
- if (!rootEl || !store) return;
378
+ if (!rootEl || !store) return
364
379
 
365
380
  // Handle case where rootEl is a text node or comment
366
- if (!rootEl.querySelectorAll) return;
381
+ if (!rootEl.querySelectorAll) return
367
382
 
368
- const elements = rootEl.querySelectorAll("[gxp-src]");
383
+ const elements = rootEl.querySelectorAll("[gxp-src]")
369
384
 
370
385
  elements.forEach((el) => {
371
- const key = el.getAttribute("gxp-src");
372
- if (!key) return;
386
+ const key = el.getAttribute("gxp-src")
387
+ if (!key) return
373
388
 
374
389
  // Store default value only on first processing
375
390
  if (!el._gxpSrcDefault) {
376
- el._gxpSrcDefault = el.getAttribute("src") || "";
391
+ el._gxpSrcDefault = el.getAttribute("src") || ""
377
392
  }
378
- el._gxpSrcKey = key;
393
+ el._gxpSrcKey = key
379
394
 
380
395
  // Update src
381
- updateElementSrc(el, key, el._gxpSrcDefault, store, devServerBaseUrl);
396
+ updateElementSrc(el, key, el._gxpSrcDefault, store, devServerBaseUrl)
382
397
 
383
398
  // Set up watcher for this element (if not already watching)
384
399
  if (!el._gxpSrcUnwatch) {
385
- const watchSource = getSrcWatchSource(el, key, store);
400
+ const watchSource = getSrcWatchSource(el, key, store)
386
401
  if (watchSource) {
387
- el._gxpSrcUnwatch = watch(watchSource, () => {
388
- updateElementSrc(el, key, el._gxpSrcDefault, store, devServerBaseUrl);
389
- }, { deep: true });
402
+ el._gxpSrcUnwatch = watch(
403
+ watchSource,
404
+ () => {
405
+ updateElementSrc(
406
+ el,
407
+ key,
408
+ el._gxpSrcDefault,
409
+ store,
410
+ devServerBaseUrl,
411
+ )
412
+ },
413
+ { deep: true },
414
+ )
390
415
  }
391
416
  }
392
- });
417
+ })
393
418
  }
394
419
 
395
420
  /**
@@ -397,18 +422,18 @@ function processGxpSrcAttributes(rootEl, store, devServerBaseUrl) {
397
422
  * This is called when manifest loads to update elements that were already processed
398
423
  */
399
424
  function reprocessGxpSrcAttributes(rootEl, store, devServerBaseUrl) {
400
- if (!rootEl || !store) return;
401
- if (!rootEl.querySelectorAll) return;
425
+ if (!rootEl || !store) return
426
+ if (!rootEl.querySelectorAll) return
402
427
 
403
- const elements = rootEl.querySelectorAll("[gxp-src]");
428
+ const elements = rootEl.querySelectorAll("[gxp-src]")
404
429
 
405
430
  elements.forEach((el) => {
406
- const key = el.getAttribute("gxp-src");
407
- if (!key) return;
431
+ const key = el.getAttribute("gxp-src")
432
+ if (!key) return
408
433
 
409
- const defaultSrc = el._gxpSrcDefault || el.getAttribute("src") || "";
410
- updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl);
411
- });
434
+ const defaultSrc = el._gxpSrcDefault || el.getAttribute("src") || ""
435
+ updateElementSrc(el, key, defaultSrc, store, devServerBaseUrl)
436
+ })
412
437
  }
413
438
 
414
439
  /**
@@ -416,7 +441,7 @@ function reprocessGxpSrcAttributes(rootEl, store, devServerBaseUrl) {
416
441
  * Can be called manually if needed
417
442
  */
418
443
  export function processGxpStrings(rootElement, store) {
419
- processGxpStringAttributes(rootElement, store);
444
+ processGxpStringAttributes(rootElement, store)
420
445
  }
421
446
 
422
447
  /**
@@ -424,21 +449,21 @@ export function processGxpStrings(rootElement, store) {
424
449
  * Can be called manually if needed
425
450
  */
426
451
  export function processGxpSrcs(rootElement, store, devServerBaseUrl) {
427
- processGxpSrcAttributes(rootElement, store, devServerBaseUrl);
452
+ processGxpSrcAttributes(rootElement, store, devServerBaseUrl)
428
453
  }
429
454
 
430
455
  /**
431
456
  * Get the string key from an element if it has gxp-string attribute
432
457
  */
433
458
  export function getGxpStringKey(element) {
434
- return element?.getAttribute?.("gxp-string") || null;
459
+ return element?.getAttribute?.("gxp-string") || null
435
460
  }
436
461
 
437
462
  /**
438
463
  * Check if an element has a gxp-string attribute
439
464
  */
440
465
  export function hasGxpString(element) {
441
- return element?.hasAttribute?.("gxp-string") || false;
466
+ return element?.hasAttribute?.("gxp-string") || false
442
467
  }
443
468
 
444
- export default createGxpStringsPlugin;
469
+ export default createGxpStringsPlugin
@@ -1,22 +1,20 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>GxP Plugin Builder</title>
8
+ <script type="module">
9
+ import * as Vue from "/node_modules/vue/dist/vue.esm-bundler.js"
10
+ window.Vue = Vue
11
+ import * as Pinia from "/node_modules/pinia/dist/pinia.esm-browser.js"
12
+ window.Pinia = Pinia
13
+ </script>
14
+ </head>
3
15
 
4
- <head>
5
- <meta charset="UTF-8" />
6
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <title>GxP Plugin Builder</title>
9
- <script type="module">
10
- import * as Vue from '/node_modules/vue/dist/vue.esm-bundler.js';
11
- window.Vue = Vue;
12
- import * as Pinia from '/node_modules/pinia/dist/pinia.esm-browser.js';
13
- window.Pinia = Pinia;
14
- </script>
15
- </head>
16
-
17
- <body>
18
- <div id="app"></div>
19
- <script type="module" src="/@gx-runtime/main.js"></script>
20
- </body>
21
-
16
+ <body>
17
+ <div id="app"></div>
18
+ <script type="module" src="/@gx-runtime/main.js"></script>
19
+ </body>
22
20
  </html>