dcp-client 5.0.4 → 5.1.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.
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ dist/dcp-client-bundle.js* binary
2
+ libexec/sandbox/pyodide-core.js binary
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file dcp-client.css Styles for dcp-client. These impact the appearance of DOM elements
3
+ * generated by DCP-Client; eg. the modal dialogs which pop up when the
4
+ * wallet API is used.
5
+ *
6
+ * This stylesheet is loaded automatically by dcp-client when the load-css attribute is
7
+ * undefined or has the value true. Any other value will be interpreted as a URL from
8
+ * which to load the css.
9
+ *
10
+ * @author Wes Garland, wes@distributive.network
11
+ * @date Nov 2024
12
+ */
13
+
14
+ @layer dcp-style dcp-client;
15
+ @import https://cdn.distributed.computerl
16
+
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-alert"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-hard-drive-upload"><path d="m16 6-4-4-4 4"/><path d="M12 2v8"/><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6 18h.01"/><path d="M10 18h.01"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-triangle-alert"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
package/assets/x.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
package/build/bundle CHANGED
@@ -174,7 +174,7 @@ fi
174
174
  NO_LOG=1 \
175
175
  SKIP_SUDO_CHECK=1 \
176
176
  DCP_LOCAL_CONFIG_EXTRAS="${BUNDLE_TMP}/local-config.incl" \
177
- "${DCP_SRC}/install.sh" -NI ${DCP_INSTALL_FLAGS} build-dcp-client
177
+ "${DCP_SRC}/install.sh" -N ${DCP_INSTALL_FLAGS} build-dcp-client
178
178
 
179
179
  EXIT_CODE="$?"
180
180
  if [ "$EXIT_CODE" != "0" ]; then
package/dcp-client.js CHANGED
@@ -258,22 +258,35 @@ https://distributive.network/`, "font-weight: bold; font-size: 1.2em; color: #00
258
258
  };
259
259
  }
260
260
 
261
- /* Load the modal stylesheet
262
- * Add our favicon (unless they've already got one)
261
+ /* Load the default appearance CSS. This lets us style trivial DCP programs so that the modals use
262
+ * e.g. so that popups in wallet API look right.
263
263
  */
264
- function loadLinks () {
264
+ function loadCSS () {
265
+ // Best-effort to find cdn location
266
+ // 1. use dcpConfig.cdn.location
267
+ // 2. use dcpConfigHref to infer where cdn is (when dcpConfigHref is loading through some service)
268
+ // 3. use thisScriptURL to infer where cdn is
269
+ var cdnOrigin;
270
+ if (typeof dcpConfig === 'object' && dcpConfig.cdn?.location?.href)
271
+ cdnOrigin = dcpConfig.cdn.location.origin
272
+ else if (typeof dcpConfigHref === 'string' && dcpConfigHref.match(/(portal|auth|cdn|scheduler)\.?/))
273
+ {
274
+ cdnOrigin = new URL(dcpConfigHref).origin;
275
+ cdnOrigin = cdnOrigin.replace(/(portal|auth|cdn|scheduler)\.?/, 'cdn.');
276
+ }
277
+ else
278
+ {
279
+ cdnOrigin = thisScriptURL.origin.replace(/(portal|auth|cdn|scheduler)\.?/, 'cdn.');
280
+ if (!cdnOrigin.match(/^(http|https):\/\/cdn/)) // Loaded directly
281
+ cdnOrigin = cdnOrigin.replace(/^(http:\/\/|https:\/\/)/, '$1cdn.');
282
+ }
283
+
265
284
  const head = document.getElementsByTagName('head')[0];
266
285
  let styleLink = document.createElement('link');
267
286
  styleLink.rel = 'stylesheet';
268
- styleLink.href = thisScript.src.replace('/dcp-client.js', '/templates/dcp-modal.css');
269
- head.prepend(styleLink);
270
-
271
- if (document.querySelector("link[rel*='icon']")) return
272
- let faviconLink = document.createElement('link');
273
- faviconLink.type = 'image/x-icon';
274
- faviconLink.rel = 'shortcut icon';
275
- faviconLink.href = thisScript.src.replace('/dcp-client.js', '/favicon.ico');
276
- head.appendChild(faviconLink);
287
+ styleLink.href = cdnOrigin + '/css/dcp-modals.css';
288
+ styleLink.id = 'dcp-modal-styles'
289
+ head.appendChild(styleLink);
277
290
  }
278
291
 
279
292
  let shimCallback;
@@ -281,8 +294,8 @@ https://distributive.network/`, "font-weight: bold; font-size: 1.2em; color: #00
281
294
  shimCallback = loadCJS2Shim(); /* BravoJS, NobleJS, etc - set up for requireNative */
282
295
 
283
296
  loadConfig();
297
+ loadCSS();
284
298
  loadBundle(shimCallback);
285
- loadLinks();
286
299
  }
287
300
  })();
288
301