@digital-ai/dot-illustrations 2.0.23 → 2.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/demo/script.js +23 -8
  2. package/package.json +1 -1
package/demo/script.js CHANGED
@@ -109,6 +109,7 @@ document.addEventListener('DOMContentLoaded', () => {
109
109
  localStorage.setItem('theme', 'light');
110
110
  themeToggle.addEventListener('click', () => {
111
111
  setTheme(!root.classList.contains('dark'));
112
+ renderIllustrations();
112
113
  });
113
114
 
114
115
  // --- TABS ---
@@ -208,11 +209,18 @@ document.addEventListener('DOMContentLoaded', () => {
208
209
  if (!descriptionsLoaded) return;
209
210
  const themeClass = root.classList.contains('dark') ? 'dark' : 'light';
210
211
  let categoryClass = "";
211
- if (globalList.includes(illustration)) categoryClass = "global-illustration";
212
- else if (dashboardsList.includes(illustration)) categoryClass = "dashboards-illustration";
213
- modalImage.innerHTML = `<span class=\"dot-illustration\"><img src=\"svgs/${illustration}.svg\" class=\"${illustration} ${themeClass} ${categoryClass}\" style=\"width:286px;height:286px;object-fit:contain;\"/></span>`;
212
+ let categoryFolder = "";
213
+ if (globalList.includes(illustration)) {
214
+ categoryClass = "global-illustration";
215
+ categoryFolder = "global";
216
+ } else if (dashboardsList.includes(illustration)) {
217
+ categoryClass = "dashboards-illustration";
218
+ categoryFolder = "dashboards";
219
+ }
220
+ const svgPath = `illustrations/${themeClass}/${categoryFolder}/${illustration}.svg`;
221
+ modalImage.innerHTML = `<span class=\"dot-illustration\"><img src=\"${svgPath}\" class=\"${illustration} ${themeClass} ${categoryClass}\" style=\"width:286px;height:286px;object-fit:contain;\"/></span>`;
214
222
  modalIdInput.value = illustration;
215
- const codeString = `<span class=\"dot-illustration\"><img src=\"svgs/${illustration}.svg\" class=\"${illustration} ${themeClass} ${categoryClass}\"/></span>`;
223
+ const codeString = `<span class=\"dot-illustration\"><img src=\"${svgPath}\" class=\"${illustration} ${themeClass} ${categoryClass}\"/></span>`;
216
224
  modalCode.value = codeString;
217
225
  modal.classList.add('active');
218
226
  modal.classList.remove('hidden');
@@ -259,8 +267,15 @@ document.addEventListener('DOMContentLoaded', () => {
259
267
  const themeClass = root.classList.contains('dark') ? 'dark' : 'light';
260
268
  toShow.forEach(illustration => {
261
269
  let categoryClass = "";
262
- if (globalList.includes(illustration)) categoryClass = "global-illustration";
263
- else if (dashboardsList.includes(illustration)) categoryClass = "dashboards-illustration";
270
+ let categoryFolder = "";
271
+ if (globalList.includes(illustration)) {
272
+ categoryClass = "global-illustration";
273
+ categoryFolder = "global";
274
+ } else if (dashboardsList.includes(illustration)) {
275
+ categoryClass = "dashboards-illustration";
276
+ categoryFolder = "dashboards";
277
+ }
278
+ const svgPath = `illustrations/${themeClass}/${categoryFolder}/${illustration}.svg`;
264
279
  const isFav = favs.includes(illustration);
265
280
  const div = document.createElement("div");
266
281
  div.setAttribute("class", "copy-container relative group flex flex-col items-center justify-between bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-lg p-2 md:p-3 transition-transform duration-200 hover:scale-105 hover:shadow-2xl h-[302px] w-full justify-center");
@@ -272,7 +287,7 @@ document.addEventListener('DOMContentLoaded', () => {
272
287
  </button>
273
288
  <div class="flex-1 flex flex-col justify-center items-center">
274
289
  <span class="dot-illustration">
275
- <img src="svgs/${illustration}.svg" class="${illustration} ${themeClass} ${categoryClass}"/>
290
+ <img src="${svgPath}" class="${illustration} ${themeClass} ${categoryClass}"/>
276
291
  </span>
277
292
  <span class="iconID block text-center text-base font-medium text-gray-800 dark:text-gray-200 my-2">${illustration}</span>
278
293
  </div>
@@ -286,7 +301,7 @@ document.addEventListener('DOMContentLoaded', () => {
286
301
  <span class="tooltiptext left-1/2 -translate-x-1/2 bottom-10 shadow-md">Copy Code</span>
287
302
  </button>
288
303
  </div>
289
- <pre class="codeBlock"><code class="codeBlock"><span class="dot-illustration"><img src="svgs/${illustration}.svg" class="${illustration} ${themeClass} ${categoryClass}"/></span></code></pre>
304
+ <pre class="codeBlock"><code class="codeBlock"><span class="dot-illustration"><img src="${svgPath}" class="${illustration} ${themeClass} ${categoryClass}"/></span></code></pre>
290
305
  `;
291
306
  list.appendChild(div);
292
307
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-illustrations",
3
- "version": "2.0.23",
3
+ "version": "2.0.24",
4
4
  "description": "A central place for the design team to keep illustrations and for dev teams to find them.",
5
5
  "main": "./index.css",
6
6
  "scripts": {