@pure-ds/core 0.5.18 → 0.5.20
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/package.json
CHANGED
|
@@ -303,32 +303,39 @@ customElements.define(
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
function buildAppJs() {
|
|
306
|
-
return `import { PDS } from
|
|
307
|
-
import { config } from
|
|
306
|
+
return `import { PDS } from "@pure-ds/core";
|
|
307
|
+
import { config } from "../../pds.config.js";
|
|
308
308
|
|
|
309
309
|
await PDS.start(config);
|
|
310
|
-
PDS.theme = 'light';
|
|
311
310
|
|
|
312
|
-
const main = document.querySelector(
|
|
313
|
-
if (main && !main.querySelector(
|
|
314
|
-
main.innerHTML =
|
|
311
|
+
const main = document.querySelector("main");
|
|
312
|
+
if (main && !main.querySelector("my-home")) {
|
|
313
|
+
main.innerHTML = "<my-home></my-home>";
|
|
315
314
|
}
|
|
316
315
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Generates an HTML NodeList by parsing the given HTML string
|
|
318
|
+
* @param {String} html
|
|
319
|
+
* @returns {NodeListOf<ChildNode>} DOM element
|
|
320
|
+
*/
|
|
321
|
+
const parseHTML = (html) => {
|
|
322
|
+
return new DOMParser().parseFromString(html, "text/html").body.childNodes;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const settingsBtn = parseHTML(
|
|
326
|
+
/*html*/
|
|
327
|
+
\`\n <button id="settings-btn" class="icon-only btn-xs btn-outline" aria-label="Settings">\n <pds-icon icon="gear"></pds-icon>\n </button>\`,
|
|
328
|
+
)[0];
|
|
329
|
+
|
|
322
330
|
document.body.appendChild(settingsBtn);
|
|
323
331
|
|
|
324
|
-
const drawer = document.createElement(
|
|
325
|
-
drawer.setAttribute(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
'<div slot="drawer-content"><my-theme></my-theme></div>';
|
|
332
|
+
const drawer = document.createElement("pds-drawer");
|
|
333
|
+
drawer.setAttribute("position", "right");
|
|
334
|
+
|
|
335
|
+
drawer.innerHTML = /*html*/ \`<div slot="drawer-header">Settings</div>\n <div slot="drawer-content"><my-theme></my-theme></div>\`;
|
|
329
336
|
document.body.appendChild(drawer);
|
|
330
337
|
|
|
331
|
-
settingsBtn.addEventListener(
|
|
338
|
+
settingsBtn.addEventListener("click", () => {
|
|
332
339
|
drawer.open = true;
|
|
333
340
|
});
|
|
334
341
|
`;
|
|
@@ -348,7 +355,7 @@ export const config = {
|
|
|
348
355
|
|
|
349
356
|
// Custom component paths
|
|
350
357
|
mapper: (tag) => {
|
|
351
|
-
if (tag.startsWith("my-")) return
|
|
358
|
+
if (tag.startsWith("my-")) return \`/assets/my/\${tag}.js\`;
|
|
352
359
|
|
|
353
360
|
// Return nothing to use PDS default mapping
|
|
354
361
|
},
|
|
@@ -169,7 +169,7 @@ export const config = {
|
|
|
169
169
|
|
|
170
170
|
// Custom component paths
|
|
171
171
|
mapper: (tag) => {
|
|
172
|
-
if (tag.startsWith("my-")) return
|
|
172
|
+
if (tag.startsWith("my-")) return \`/assets/my/\${tag}.js\`;
|
|
173
173
|
|
|
174
174
|
// Return nothing to use PDS default mapping
|
|
175
175
|
},
|