@pine-ds/icons 9.6.0 → 9.6.2
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/components/pds-icon.js +151 -18
- package/components/pds-icon.js.map +1 -1
- package/dist/cheatsheet.html +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pds-icon.cjs.entry.js +148 -15
- package/dist/cjs/pds-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-icon.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-icons.cjs.js +1 -1
- package/dist/collection/components/pds-icon/pds-icon.js +122 -10
- package/dist/collection/components/pds-icon/pds-icon.js.map +1 -1
- package/dist/collection/components/pds-icon/request.js +26 -5
- package/dist/collection/components/pds-icon/request.js.map +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pds-icon.entry.js +148 -15
- package/dist/esm/pds-icon.entry.js.map +1 -1
- package/dist/esm/pds-icons.js +1 -1
- package/dist/pds-icons/p-5ea9f963.entry.js +2 -0
- package/dist/pds-icons/p-5ea9f963.entry.js.map +1 -0
- package/dist/pds-icons/pds-icon.entry.esm.js.map +1 -1
- package/dist/pds-icons/pds-icons.esm.js +1 -1
- package/dist/pds-icons.json +1 -1
- package/dist/pds-icons.symbols.svg +1 -1
- package/dist/types/components/pds-icon/pds-icon.d.ts +8 -0
- package/icons/index.d.ts +1 -1
- package/icons/index.js +1 -1
- package/icons/index.mjs +1 -1
- package/icons/package.json +1 -1
- package/package.json +1 -1
- package/dist/pds-icons/p-5a3a5e3c.entry.js +0 -2
- package/dist/pds-icons/p-5a3a5e3c.entry.js.map +0 -1
package/components/pds-icon.js
CHANGED
|
@@ -270,10 +270,18 @@ const getSvgContent = (url, sanitize = false) => {
|
|
|
270
270
|
if (!parser) {
|
|
271
271
|
parser = new DOMParser();
|
|
272
272
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
try {
|
|
274
|
+
const doc = parser.parseFromString(url, 'text/html');
|
|
275
|
+
const svg = doc.querySelector('svg');
|
|
276
|
+
if (svg) {
|
|
277
|
+
pdsIconContent.set(url, svg.outerHTML);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
pdsIconContent.set(url, '');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
pdsIconContent.set(url, '');
|
|
277
285
|
}
|
|
278
286
|
return Promise.resolve();
|
|
279
287
|
}
|
|
@@ -283,12 +291,25 @@ const getSvgContent = (url, sanitize = false) => {
|
|
|
283
291
|
if (rsp.ok) {
|
|
284
292
|
return rsp.text().then((svgContent) => {
|
|
285
293
|
if (svgContent && sanitize !== false) {
|
|
286
|
-
|
|
294
|
+
try {
|
|
295
|
+
svgContent = validateContent(svgContent);
|
|
296
|
+
}
|
|
297
|
+
catch (validationError) {
|
|
298
|
+
svgContent = '';
|
|
299
|
+
}
|
|
287
300
|
}
|
|
288
301
|
pdsIconContent.set(url, svgContent || '');
|
|
289
302
|
});
|
|
290
303
|
}
|
|
304
|
+
else {
|
|
305
|
+
// Handle HTTP errors
|
|
306
|
+
throw new Error(`Failed to load SVG: ${rsp.status} ${rsp.statusText}`);
|
|
307
|
+
}
|
|
308
|
+
}).catch((error) => {
|
|
309
|
+
// Handle all fetch errors gracefully
|
|
310
|
+
console.warn('Failed to load SVG:', url, error);
|
|
291
311
|
pdsIconContent.set(url, '');
|
|
312
|
+
// Don't re-throw to prevent unhandled promise rejections
|
|
292
313
|
});
|
|
293
314
|
requests.set(url, req);
|
|
294
315
|
}
|
|
@@ -344,10 +365,26 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
344
365
|
if (!this.didLoadIcon) {
|
|
345
366
|
this.loadIcon();
|
|
346
367
|
}
|
|
368
|
+
// Fallback: Ensure icon loads even if IntersectionObserver doesn't fire
|
|
369
|
+
setTimeout(() => {
|
|
370
|
+
if (!this.svgContent && !this.isVisible) {
|
|
371
|
+
this.isVisible = true;
|
|
372
|
+
this.loadIcon();
|
|
373
|
+
}
|
|
374
|
+
}, 100);
|
|
375
|
+
// Additional fallback for client-side navigation (React Router, etc.)
|
|
376
|
+
// React's useLayoutEffect and rendering cycles can delay visibility detection
|
|
377
|
+
setTimeout(() => {
|
|
378
|
+
if (!this.svgContent && !this.isVisible) {
|
|
379
|
+
this.isVisible = true;
|
|
380
|
+
this.loadIcon();
|
|
381
|
+
}
|
|
382
|
+
}, 500);
|
|
347
383
|
}
|
|
348
384
|
componentWillLoad() {
|
|
349
385
|
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
350
386
|
this.setCSSVariables();
|
|
387
|
+
this.setupInitialAriaLabel();
|
|
351
388
|
}
|
|
352
389
|
setCSSVariables() {
|
|
353
390
|
this.el.style.setProperty(`--dimension-icon-height`, this.iconSize());
|
|
@@ -355,10 +392,18 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
355
392
|
this.el.style.setProperty(`--color-icon-fill`, typeof this.color !== 'undefined' ? this.color : 'currentColor');
|
|
356
393
|
}
|
|
357
394
|
connectedCallback() {
|
|
358
|
-
|
|
395
|
+
// Handle re-connection during client-side navigation
|
|
396
|
+
if (!this.isVisible && !this.svgContent) {
|
|
397
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
398
|
+
this.isVisible = true;
|
|
399
|
+
this.loadIcon();
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
// Immediate load attempt if already visible (e.g., during React navigation)
|
|
403
|
+
if (this.isElementInViewport(this.el)) {
|
|
359
404
|
this.isVisible = true;
|
|
360
405
|
this.loadIcon();
|
|
361
|
-
}
|
|
406
|
+
}
|
|
362
407
|
}
|
|
363
408
|
disconnectedCallback() {
|
|
364
409
|
if (this.io) {
|
|
@@ -369,7 +414,16 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
369
414
|
updateStyles() {
|
|
370
415
|
this.setCSSVariables();
|
|
371
416
|
}
|
|
417
|
+
onIconPropertyChange() {
|
|
418
|
+
this.loadIcon();
|
|
419
|
+
// Update aria-label when icon properties change
|
|
420
|
+
this.setupInitialAriaLabel();
|
|
421
|
+
}
|
|
372
422
|
loadIcon() {
|
|
423
|
+
// Reset load state when URL changes
|
|
424
|
+
this.didLoadIcon = false;
|
|
425
|
+
// Clear existing content to prevent stale content when switching icons
|
|
426
|
+
this.svgContent = undefined;
|
|
373
427
|
if (Build.isBrowser && this.isVisible) {
|
|
374
428
|
const url = getUrl(this);
|
|
375
429
|
if (url) {
|
|
@@ -377,15 +431,23 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
377
431
|
this.svgContent = pdsIconContent.get(url);
|
|
378
432
|
}
|
|
379
433
|
else {
|
|
380
|
-
|
|
434
|
+
// Fix: Ensure promise callback triggers re-render and handle errors
|
|
435
|
+
getSvgContent(url)
|
|
436
|
+
.then(() => {
|
|
437
|
+
// Force re-render by setting state in next tick
|
|
438
|
+
setTimeout(() => {
|
|
439
|
+
this.svgContent = pdsIconContent.get(url);
|
|
440
|
+
}, 0);
|
|
441
|
+
})
|
|
442
|
+
.catch(() => {
|
|
443
|
+
// Handle fetch errors gracefully
|
|
444
|
+
this.svgContent = '';
|
|
445
|
+
});
|
|
381
446
|
}
|
|
382
447
|
this.didLoadIcon = true;
|
|
383
448
|
}
|
|
384
449
|
}
|
|
385
450
|
this.iconName = getName(this.name, this.icon);
|
|
386
|
-
if (this.iconName) {
|
|
387
|
-
this.ariaLabel = this.iconName.replace(/\-/g, ' ');
|
|
388
|
-
}
|
|
389
451
|
}
|
|
390
452
|
render() {
|
|
391
453
|
const { ariaLabel, flipRtl, iconName, inheritedAttributes } = this;
|
|
@@ -393,11 +455,22 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
393
455
|
? shouldRtlFlipIcon(iconName, this.el) && flipRtl !== false
|
|
394
456
|
: false;
|
|
395
457
|
const shouldFlip = flipRtl || shouldIconAutoFlip;
|
|
396
|
-
|
|
458
|
+
// Use inherited aria-label if provided, otherwise fall back to auto-generated one
|
|
459
|
+
const finalAriaLabel = inheritedAttributes['aria-label'] || ariaLabel;
|
|
460
|
+
return (h(Host, Object.assign({ key: '43aa73531314e6529a887468e69362430d006229', "aria-label": finalAriaLabel !== undefined && !this.hasAriaHidden() ? finalAriaLabel : null, alt: "", role: "img", class: Object.assign(Object.assign({}, createColorClasses(this.color)), { 'flip-rtl': shouldFlip, 'icon-rtl': shouldFlip && isRTL(this.el) }) }, inheritedAttributes), Build.isBrowser && this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
|
|
397
461
|
}
|
|
398
462
|
/*****
|
|
399
463
|
* Private Methods
|
|
400
464
|
****/
|
|
465
|
+
setupInitialAriaLabel() {
|
|
466
|
+
// Only set aria-label during initial load if one isn't already provided
|
|
467
|
+
if (!this.inheritedAttributes['aria-label']) {
|
|
468
|
+
const iconName = getName(this.name, this.icon);
|
|
469
|
+
if (iconName) {
|
|
470
|
+
this.ariaLabel = iconName.replace(/\-/g, ' ');
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
401
474
|
waitUntilVisible(el, rootMargin, cb) {
|
|
402
475
|
if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {
|
|
403
476
|
const io = (this.io = new (window).IntersectionObserver((data) => {
|
|
@@ -408,6 +481,18 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
408
481
|
}
|
|
409
482
|
}, { rootMargin }));
|
|
410
483
|
io.observe(el);
|
|
484
|
+
// Safety timeout for client-side navigation scenarios
|
|
485
|
+
// Sometimes IntersectionObserver doesn't fire during React navigation
|
|
486
|
+
setTimeout(() => {
|
|
487
|
+
if (this.io && !this.isVisible) {
|
|
488
|
+
// Check if element is actually visible in viewport
|
|
489
|
+
if (this.isElementInViewport(el)) {
|
|
490
|
+
this.io.disconnect();
|
|
491
|
+
this.io = undefined;
|
|
492
|
+
cb();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}, 1000);
|
|
411
496
|
}
|
|
412
497
|
else {
|
|
413
498
|
// browser doesn't support IntersectionObserver
|
|
@@ -415,14 +500,62 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
415
500
|
cb();
|
|
416
501
|
}
|
|
417
502
|
}
|
|
503
|
+
isElementInViewport(el) {
|
|
504
|
+
if (!el || !el.isConnected)
|
|
505
|
+
return false;
|
|
506
|
+
const rect = el.getBoundingClientRect();
|
|
507
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
508
|
+
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
509
|
+
return (rect.top >= 0 &&
|
|
510
|
+
rect.left >= 0 &&
|
|
511
|
+
rect.bottom <= windowHeight &&
|
|
512
|
+
rect.right <= windowWidth) || (
|
|
513
|
+
// Also consider partially visible elements
|
|
514
|
+
rect.top < windowHeight &&
|
|
515
|
+
rect.bottom > 0 &&
|
|
516
|
+
rect.left < windowWidth &&
|
|
517
|
+
rect.right > 0);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Debug method to help diagnose loading issues
|
|
521
|
+
* Call from browser console: document.querySelector('pds-icon').debugIconState()
|
|
522
|
+
*/
|
|
523
|
+
debugIconState() {
|
|
524
|
+
var _a;
|
|
525
|
+
const url = getUrl(this);
|
|
526
|
+
const rect = this.el.getBoundingClientRect();
|
|
527
|
+
console.log('PdsIcon Debug State:', {
|
|
528
|
+
name: this.name,
|
|
529
|
+
src: this.src,
|
|
530
|
+
icon: this.icon,
|
|
531
|
+
iconName: this.iconName,
|
|
532
|
+
url,
|
|
533
|
+
isVisible: this.isVisible,
|
|
534
|
+
didLoadIcon: this.didLoadIcon,
|
|
535
|
+
hasSvgContent: !!this.svgContent,
|
|
536
|
+
svgContentLength: ((_a = this.svgContent) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
537
|
+
isInCache: url ? pdsIconContent.has(url) : false,
|
|
538
|
+
cachedContent: url ? pdsIconContent.get(url) : null,
|
|
539
|
+
element: this.el,
|
|
540
|
+
// Client-side navigation specific debug info
|
|
541
|
+
isConnected: this.el.isConnected,
|
|
542
|
+
isInViewport: this.isElementInViewport(this.el),
|
|
543
|
+
hasIntersectionObserver: !!this.io,
|
|
544
|
+
boundingClientRect: rect,
|
|
545
|
+
windowDimensions: {
|
|
546
|
+
width: window.innerWidth || document.documentElement.clientWidth,
|
|
547
|
+
height: window.innerHeight || document.documentElement.clientHeight
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
418
551
|
static get assetsDirs() { return ["svg"]; }
|
|
419
552
|
get el() { return this; }
|
|
420
553
|
static get watchers() { return {
|
|
421
554
|
"size": ["updateStyles"],
|
|
422
555
|
"color": ["updateStyles"],
|
|
423
|
-
"name": ["
|
|
424
|
-
"src": ["
|
|
425
|
-
"icon": ["
|
|
556
|
+
"name": ["onIconPropertyChange"],
|
|
557
|
+
"src": ["onIconPropertyChange"],
|
|
558
|
+
"icon": ["onIconPropertyChange"]
|
|
426
559
|
}; }
|
|
427
560
|
static get style() { return pdsIconCss; }
|
|
428
561
|
}, [1, "pds-icon", {
|
|
@@ -438,9 +571,9 @@ const PdsIcon$1 = /*@__PURE__*/ proxyCustomElement(class PdsIcon extends HTMLEle
|
|
|
438
571
|
}, undefined, {
|
|
439
572
|
"size": ["updateStyles"],
|
|
440
573
|
"color": ["updateStyles"],
|
|
441
|
-
"name": ["
|
|
442
|
-
"src": ["
|
|
443
|
-
"icon": ["
|
|
574
|
+
"name": ["onIconPropertyChange"],
|
|
575
|
+
"src": ["onIconPropertyChange"],
|
|
576
|
+
"icon": ["onIcon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AAgB,CAAC,EAAe,EAAE,UAAkB,EAAE,EAAc,EAAA;AAC1E,QAAA,IAAI,KAAK,CAAC,SAAS,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE;AACrF,YAAA,MAAM,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,oBAAoB,CACrD,CAAC,IAAiC,KAAI;AACpC,gBAAA,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE;oBAC1B,EAAE,CAAC,UAAU,EAAE;AACf,oBAAA,IAAI,CAAC,EAAE,GAAG,SAAS;AACnB,oBAAA,EAAE,EAAE;;AAER,aAAC,EACD,EAAE,UAAU,EAAE,CACf,CAAC;AAEF,YAAA,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;aACT;;;AAGL,YAAA,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWV,MAAM,kBAAkB,GAAG,CAAC,KAAyB,KAAI;AACvD,IAAA,OAAO;AACN,UAAE;AACE,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,CAAC,CAAa,UAAA,EAAA,KAAK,CAAE,CAAA,GAAG,IAAI;AAC7B;UACD,IAAI;AACR,CAAC;;;;;;;;;;;;;;;;;;;;","names":["PdsIcon","__stencil_proxyCustomElement"],"sources":["src/components/pds-icon/assetPath.ts","src/components/pds-icon/utils.ts","src/components/pds-icon/validate.ts","src/components/pds-icon/request.ts","src/components/pds-icon/pds-icon.scss?tag=pds-icon&encapsulation=shadow","src/components/pds-icon/pds-icon.tsx"],"sourcesContent":["import { Build } from '@stencil/core';\n\nlet missingAssetPathWarning = false;\n\ndeclare global {\n interface Window {\n __PINE_ASSET_PATH__?: string\n }\n}\n\n/**\n *\n * Reads the component asset path config from meta tag or a global variable.\n * This is a temporary workaround until these issues have been addressed:\n *\n * https://github.com/ionic-team/stencil/issues/2826/\n * https://github.com/ionic-team/stencil/issues/3470\n * https://github.com/ionic-team/stencil-ds-output-targets/issues/186\n */\nexport const getAssetPath = (path: string) => {\n const metaPineAssetPath = document.head.querySelector<HTMLMetaElement>('meta[data-pine-asset-path]')?.dataset.pineAssetPath;\n\n // Get the asset path from the window object if available\n const windowAssetPath = window.__PINE_ASSET_PATH__;\n\n // Set the CDN Asset path using the latest version\n const cdnAssetPath = 'https://cdn.jsdelivr.net/npm/@pine-ds/icons/dist/';\n\n const assetBasePath = Build.isTesting ? '/dist/pds-icons' : metaPineAssetPath || windowAssetPath || cdnAssetPath || '/'\n\n // Display a warning if the assets are fetched from the CDN.\n if ( assetBasePath.startsWith('https://cdn.jsdelivr.net/npm/') && !missingAssetPathWarning ) {\n missingAssetPathWarning = true;\n console.warn(`\n Fetching Pine assets from jsDelivr CDN.\\n\\n It's recommended that you bundle Pine Assets with your application and set the path accordingly.\\n\\nFor more information, read the documentation: \\nhttps://pine-design-system.netlify.app/?path=/docs/resources-assets--docs\n `)\n }\n\n let assetPath = path;\n\n if ( path.startsWith ('./') ) {\n assetPath = path.substring(2);\n }\n\n if ( !assetBasePath.endsWith('/') ) {\n assetPath = '/' + assetPath;\n }\n\n return assetBasePath + assetPath;\n}\n\n\nexport {};\n","import { getAssetPath } from './assetPath';\n\nimport { PdsIcon } from './pds-icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const addIcons = (icons: { [name: string]: string; }) => {\n const map = getIconMap();\n Object.keys(icons).forEach(name => map.set(name, icons[name]));\n}\n\nexport const getIconMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window as any; // eslint-disable-line @typescript-eslint/no-explicit-any\n win.PdsIcons = win.PdsIcons || {};\n CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();\n }\n\n return CACHED_MAP;\n }\n}\n\nexport const getName = (\n iconName: string | undefined,\n icon: string | undefined\n ) => {\n\n if(!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi,'');\n if (invalidChars != '') { return null; }\n\n return iconName;\n}\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n\n return getAssetPath(`svg/${iconName}.svg`);\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n\n if (isSrc(src)) {\n return src;\n }\n }\n\n return null;\n}\n\nexport const getUrl = (pdsIcon: PdsIcon) => {\n let url = getSrc(pdsIcon.src);\n if (url) {\n return url;\n }\n\n url = getName(pdsIcon.name, pdsIcon.icon);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (pdsIcon.icon) {\n url = getSrc(pdsIcon.icon);\n\n if(url) {\n return url;\n }\n }\n\n return null;\n};\n\n\n/**\n * Returns `true` if the document or host element\n * has a `dir` set to `rtl`. The host value will always\n * take priority over the root document value.\n */\nexport const isRTL = (hostEl?: Pick<HTMLElement, 'dir'>) => {\n if (hostEl) {\n if (hostEl.dir !== '') {\n return hostEl.dir.toLowerCase() === 'rtl';\n }\n }\n return document?.dir.toLowerCase() === 'rtl';\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport const toLower = (val: string) => val.toLowerCase();\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `pds-input` should inherit\n * the `title` attribute that developers set directly on `pds-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\n export const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n}\n\n/**\n * Determines if an icon should be flipped when RTL is enabled\n * @param iconName - The name of the icon to check\n * @param hostEl - Optional host element to check for RTL direction\n * @returns {boolean} - True if the icon should be flipped in RTL mode, false otherwise\n */\nexport const shouldRtlFlipIcon = (iconName: string, hostEl?: Pick<HTMLElement, 'dir'>): boolean => {\n // First check if we're in RTL mode\n const rtlEnabled = isRTL(hostEl);\n\n // Only flip if we're in RTL mode and the icon is in the flip list\n return rtlEnabled && ICONS_TO_FLIP.includes(iconName);\n}\n\n/**\n * Array of available icon names\n */\nexport const ICONS_TO_FLIP = [\n 'align-horizontal-bottom',\n 'align-horizontal-center',\n 'align-horizontal-top',\n 'align-left',\n 'align-right',\n 'align-vertical-left',\n 'align-vertical-right',\n 'arrow-corner',\n 'arrow-left',\n 'arrow-right',\n 'calendar-schedule',\n 'caret-left',\n 'caret-right',\n 'cart',\n 'cart-add',\n 'comment',\n 'comment-no',\n 'conversation',\n 'copy',\n 'copy-07',\n 'delete-key',\n 'delete-x',\n 'downsell',\n 'drawer-collapse',\n 'drawer-expand',\n 'duplicate',\n 'feedback',\n 'file-lock',\n 'file-search',\n 'form-field',\n 'form-filled',\n 'left-small',\n 'launch',\n 'list-bullet',\n 'list-numbers',\n 'margin-left',\n 'margin-right',\n 'move-left',\n 'move-right',\n 'newsletter-2',\n 'one-off-session',\n 'quote',\n 'redo',\n 'reset-password',\n 'right-small',\n 'send-message',\n 'share',\n 'super-admin',\n 'tablet-landscape',\n 'undo',\n 'user-star',\n 'user-star-filled',\n 'users',\n 'users-filled',\n 'users-tone'\n];\n\n","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string) => {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', (svgClass + ' s-pds-icon').trim());\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) {\n return div.innerHTML;\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const name = elm.attributes[i].name;\n if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as HTMLElement)) {\n return false;\n }\n }\n }\n return true;\n};\n\nexport const isSvgDataUrl = (url: string) => url.startsWith('data:image/svg+xml');\nexport const isEncodedDataUrl = (url: string) => url.indexOf(';utf8,') !== -1;\n","import { isEncodedDataUrl, isSvgDataUrl, validateContent } from './validate';\n\nexport const pdsIconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>(); // eslint-disable-line @typescript-eslint/no-explicit-any\n\nlet parser: DOMParser;\n\nexport const getSvgContent = (url: string, sanitize = false) => {\n let req = requests.get(url);\n\n if(!req) {\n if (typeof fetch != 'undefined' && typeof document !== 'undefined') {\n if (isSvgDataUrl(url) && isEncodedDataUrl(url)) {\n if (!parser) {\n parser = new DOMParser();\n }\n\n const doc = parser.parseFromString(url, 'text/html');\n const svg = doc.querySelector('svg');\n\n if (svg) {\n pdsIconContent.set(url, svg.outerHTML);\n }\n\n return Promise.resolve();\n } else {\n // we don't have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n svgContent = validateContent(svgContent);\n }\n pdsIconContent.set(url, svgContent || '');\n });\n }\n pdsIconContent.set(url, '');\n });\n\n requests.set(url, req);\n }\n } else {\n pdsIconContent.set(url, '');\n return Promise.resolve();\n }\n }\n\n return req;\n}\n",":host {\n --dimension-icon-height: 16px;\n --dimension-icon-width: 16px;\n --color-icon-fill: currentColor;\n\n contain: strict;\n display: inline-block;\n fill: var(--color-icon-fill);\n flex-shrink: 0;\n height: var(--dimension-icon-height);\n width: var(--dimension-icon-width);\n\n .pdsicon {\n fill: var(--color-icon-fill);\n }\n}\n\n.pds-icon-fill-none {\n fill: none;\n}\n\n.icon-inner,\n.pds-icon,\nsvg {\n display: block;\n height: 100%;\n width: 100%;\n}\n\n/* :host-context is supported in chromium; :dir is supported in safari & firefox */\n:host(.flip-rtl):host-context([dir='rtl']) .icon-inner {\n transform: scaleX(-1);\n}\n\n:host(.flip-rtl:dir(rtl)) .icon-inner {\n transform: scaleX(-1);\n}\n\n/**\n * This is needed for WebKit otherwise the fallback\n * will always cause the icon to be flipped if the document\n * loads in RTL.\n */\n:host(.flip-rtl:dir(ltr)) .icon-inner {\n transform: scaleX(1);\n}\n\n","import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getSvgContent, pdsIconContent } from './request';\nimport { getName, getUrl, inheritAttributes, isRTL, shouldRtlFlipIcon } from './utils';\n\n@Component({\n tag: 'pds-icon',\n assetsDirs: ['svg'],\n styleUrl: 'pds-icon.scss',\n shadow: true,\n})\nexport class PdsIcon {\n private didLoadIcon = false;\n private iconName: string | null = null;\n private io?: IntersectionObserver;\n private inheritedAttributes: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n @Element() el!: HTMLPdsIconElement;\n\n @State() private ariaLabel?: string;\n @State() private isVisible = false;\n @State() private svgContent?: string;\n\n /**\n *\n * The color of the icon\n *\n */\n @Prop() color?: string;\n\n /**\n * Determines if the icon should be flipped when the `dir` is right-to-left (`\"rtl\"`).\n * This is automatically enabled for icons that are in the `ICONS_TO_FLIP` list and\n * when the `dir` is `\"rtl\"`. If `flipRtl` is set to `false`, the icon will not be flipped\n * even if the `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * This is a combination of both `name` and `src`. If a `src` URL is detected,\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and sets the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The name of the icon to use from\n * the built-in set.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * The size of the icon. This can be\n * 'small', 'regular', 'medium', 'large', or a\n * custom value (40px, 1rem, etc)\n *\n */\n @Prop({ reflect: true }) size?:\n | 'small' // 12px\n | 'regular' // 16px\n | 'medium' // 20px\n | 'large' // 24px\n | 'auto'\n | string = 'regular'\n\n /**\n *\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n private iconSize() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sizes: { [key: string]: any } = {\n small: '12px',\n regular: '16px',\n medium: '20px',\n large: '24px',\n }\n\n if (sizes[this.size]) {\n return sizes[this.size];\n } else {\n return this.size;\n }\n }\n\n componentDidLoad() {\n this.setCSSVariables();\n\n if (!this.didLoadIcon) {\n this.loadIcon();\n }\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);\n this.setCSSVariables();\n }\n\n setCSSVariables() {\n this.el.style.setProperty(`--dimension-icon-height`, this.iconSize());\n this.el.style.setProperty(`--dimension-icon-width`, this.iconSize());\n this.el.style.setProperty(`--color-icon-fill`, typeof this.color !== 'undefined' ? this.color : 'currentColor');\n }\n\n connectedCallback() {\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n })\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n @Watch('size')\n @Watch('color')\n updateStyles() {\n this.setCSSVariables();\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (pdsIconContent.has(url)) {\n this.svgContent = pdsIconContent.get(url);\n } else {\n getSvgContent(url).then(() => (this.svgContent = pdsIconContent.get(url)));\n }\n this.didLoadIcon = true;\n }\n }\n\n this.iconName = getName(this.name, this.icon);\n\n if (this.iconName) {\n this.ariaLabel = this.iconName.replace(/\\-/g, ' ');\n }\n }\n\n render() {\n const { ariaLabel, flipRtl, iconName,inheritedAttributes } = this;\n const shouldIconAutoFlip = iconName\n ? shouldRtlFlipIcon(iconName, this.el) && flipRtl !== false\n : false;\n const shouldFlip = flipRtl || shouldIconAutoFlip;\n\n return (\n\n <Host\n aria-label={ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null }\n alt=\"\"\n role=\"img\"\n class={{\n ...createColorClasses(this.color),\n 'flip-rtl': shouldFlip,\n 'icon-rtl': shouldFlip && isRTL(this.el)\n }}\n {...inheritedAttributes}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n )\n }\n\n /*****\n * Private Methods\n ****/\n\n private waitUntilVisible(el: HTMLElement, rootMargin: string, cb: () => void) {\n if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {\n const io = (this.io = new (window).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin },\n ));\n\n io.observe(el);\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n private hasAriaHidden = () => {\n const { el } = this;\n\n return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';\n }\n}\n\nconst createColorClasses = (color: string | undefined) => {\n return color\n ? {\n 'pds-color': true,\n [`pds-color-${color}`]: true,\n }\n : null;\n };\n"],"version":3}
|
|
1
|
+
{"file":"p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AA,MAAA,GAAA,EAAA,CAAE,MAAM,KAAI,CAAC;AAC9C,YAAA,SAAS,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAChD,YAAA,aAAa,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI;YACnD,OAAO,EAAE,IAAI,CAAC,EAAE;;AAEhB,YAAA,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,WAAW;YAChC,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/C,YAAA,uBAAuB,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;AAClC,YAAA,kBAAkB,EAAE,IAAI;AACxB,YAAA,gBAAgB,EAAE;gBAChB,KAAK,EAAE,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW;gBAChE,MAAM,EAAE,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC;AACxD;AACF,SAAA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIN,MAAM,kBAAkB,GAAG,CAAC,KAAyB,KAAI;AACvD,IAAA,OAAO;AACN,UAAE;AACE,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,CAAC,CAAa,UAAA,EAAA,KAAK,CAAE,CAAA,GAAG,IAAI;AAC7B;UACD,IAAI;AACR,CAAC;;;;;;;;;;;;;;;;;;;;","names":["PdsIcon","__stencil_proxyCustomElement"],"sources":["src/components/pds-icon/assetPath.ts","src/components/pds-icon/utils.ts","src/components/pds-icon/validate.ts","src/components/pds-icon/request.ts","src/components/pds-icon/pds-icon.scss?tag=pds-icon&encapsulation=shadow","src/components/pds-icon/pds-icon.tsx"],"sourcesContent":["import { Build } from '@stencil/core';\n\nlet missingAssetPathWarning = false;\n\ndeclare global {\n interface Window {\n __PINE_ASSET_PATH__?: string\n }\n}\n\n/**\n *\n * Reads the component asset path config from meta tag or a global variable.\n * This is a temporary workaround until these issues have been addressed:\n *\n * https://github.com/ionic-team/stencil/issues/2826/\n * https://github.com/ionic-team/stencil/issues/3470\n * https://github.com/ionic-team/stencil-ds-output-targets/issues/186\n */\nexport const getAssetPath = (path: string) => {\n const metaPineAssetPath = document.head.querySelector<HTMLMetaElement>('meta[data-pine-asset-path]')?.dataset.pineAssetPath;\n\n // Get the asset path from the window object if available\n const windowAssetPath = window.__PINE_ASSET_PATH__;\n\n // Set the CDN Asset path using the latest version\n const cdnAssetPath = 'https://cdn.jsdelivr.net/npm/@pine-ds/icons/dist/';\n\n const assetBasePath = Build.isTesting ? '/dist/pds-icons' : metaPineAssetPath || windowAssetPath || cdnAssetPath || '/'\n\n // Display a warning if the assets are fetched from the CDN.\n if ( assetBasePath.startsWith('https://cdn.jsdelivr.net/npm/') && !missingAssetPathWarning ) {\n missingAssetPathWarning = true;\n console.warn(`\n Fetching Pine assets from jsDelivr CDN.\\n\\n It's recommended that you bundle Pine Assets with your application and set the path accordingly.\\n\\nFor more information, read the documentation: \\nhttps://pine-design-system.netlify.app/?path=/docs/resources-assets--docs\n `)\n }\n\n let assetPath = path;\n\n if ( path.startsWith ('./') ) {\n assetPath = path.substring(2);\n }\n\n if ( !assetBasePath.endsWith('/') ) {\n assetPath = '/' + assetPath;\n }\n\n return assetBasePath + assetPath;\n}\n\n\nexport {};\n","import { getAssetPath } from './assetPath';\n\nimport { PdsIcon } from './pds-icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const addIcons = (icons: { [name: string]: string; }) => {\n const map = getIconMap();\n Object.keys(icons).forEach(name => map.set(name, icons[name]));\n}\n\nexport const getIconMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window as any; // eslint-disable-line @typescript-eslint/no-explicit-any\n win.PdsIcons = win.PdsIcons || {};\n CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();\n }\n\n return CACHED_MAP;\n }\n}\n\nexport const getName = (\n iconName: string | undefined,\n icon: string | undefined\n ) => {\n\n if(!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi,'');\n if (invalidChars != '') { return null; }\n\n return iconName;\n}\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n\n return getAssetPath(`svg/${iconName}.svg`);\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n\n if (isSrc(src)) {\n return src;\n }\n }\n\n return null;\n}\n\nexport const getUrl = (pdsIcon: PdsIcon) => {\n let url = getSrc(pdsIcon.src);\n if (url) {\n return url;\n }\n\n url = getName(pdsIcon.name, pdsIcon.icon);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (pdsIcon.icon) {\n url = getSrc(pdsIcon.icon);\n\n if(url) {\n return url;\n }\n }\n\n return null;\n};\n\n\n/**\n * Returns `true` if the document or host element\n * has a `dir` set to `rtl`. The host value will always\n * take priority over the root document value.\n */\nexport const isRTL = (hostEl?: Pick<HTMLElement, 'dir'>) => {\n if (hostEl) {\n if (hostEl.dir !== '') {\n return hostEl.dir.toLowerCase() === 'rtl';\n }\n }\n return document?.dir.toLowerCase() === 'rtl';\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport const toLower = (val: string) => val.toLowerCase();\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `pds-input` should inherit\n * the `title` attribute that developers set directly on `pds-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\n export const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n}\n\n/**\n * Determines if an icon should be flipped when RTL is enabled\n * @param iconName - The name of the icon to check\n * @param hostEl - Optional host element to check for RTL direction\n * @returns {boolean} - True if the icon should be flipped in RTL mode, false otherwise\n */\nexport const shouldRtlFlipIcon = (iconName: string, hostEl?: Pick<HTMLElement, 'dir'>): boolean => {\n // First check if we're in RTL mode\n const rtlEnabled = isRTL(hostEl);\n\n // Only flip if we're in RTL mode and the icon is in the flip list\n return rtlEnabled && ICONS_TO_FLIP.includes(iconName);\n}\n\n/**\n * Array of available icon names\n */\nexport const ICONS_TO_FLIP = [\n 'align-horizontal-bottom',\n 'align-horizontal-center',\n 'align-horizontal-top',\n 'align-left',\n 'align-right',\n 'align-vertical-left',\n 'align-vertical-right',\n 'arrow-corner',\n 'arrow-left',\n 'arrow-right',\n 'calendar-schedule',\n 'caret-left',\n 'caret-right',\n 'cart',\n 'cart-add',\n 'comment',\n 'comment-no',\n 'conversation',\n 'copy',\n 'copy-07',\n 'delete-key',\n 'delete-x',\n 'downsell',\n 'drawer-collapse',\n 'drawer-expand',\n 'duplicate',\n 'feedback',\n 'file-lock',\n 'file-search',\n 'form-field',\n 'form-filled',\n 'left-small',\n 'launch',\n 'list-bullet',\n 'list-numbers',\n 'margin-left',\n 'margin-right',\n 'move-left',\n 'move-right',\n 'newsletter-2',\n 'one-off-session',\n 'quote',\n 'redo',\n 'reset-password',\n 'right-small',\n 'send-message',\n 'share',\n 'super-admin',\n 'tablet-landscape',\n 'undo',\n 'user-star',\n 'user-star-filled',\n 'users',\n 'users-filled',\n 'users-tone'\n];\n\n","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string) => {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', (svgClass + ' s-pds-icon').trim());\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) {\n return div.innerHTML;\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const name = elm.attributes[i].name;\n if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as HTMLElement)) {\n return false;\n }\n }\n }\n return true;\n};\n\nexport const isSvgDataUrl = (url: string) => url.startsWith('data:image/svg+xml');\nexport const isEncodedDataUrl = (url: string) => url.indexOf(';utf8,') !== -1;\n","import { isEncodedDataUrl, isSvgDataUrl, validateContent } from './validate';\n\nexport const pdsIconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>(); // eslint-disable-line @typescript-eslint/no-explicit-any\n\nlet parser: DOMParser;\n\nexport const getSvgContent = (url: string, sanitize = false) => {\n let req = requests.get(url);\n\n if(!req) {\n if (typeof fetch != 'undefined' && typeof document !== 'undefined') {\n if (isSvgDataUrl(url) && isEncodedDataUrl(url)) {\n if (!parser) {\n parser = new DOMParser();\n }\n\n try {\n const doc = parser.parseFromString(url, 'text/html');\n const svg = doc.querySelector('svg');\n\n if (svg) {\n pdsIconContent.set(url, svg.outerHTML);\n } else {\n pdsIconContent.set(url, '');\n }\n } catch (error) {\n pdsIconContent.set(url, '');\n }\n\n return Promise.resolve();\n } else {\n // we don't have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n try {\n svgContent = validateContent(svgContent);\n } catch (validationError) {\n svgContent = '';\n }\n }\n pdsIconContent.set(url, svgContent || '');\n });\n } else {\n // Handle HTTP errors\n throw new Error(`Failed to load SVG: ${rsp.status} ${rsp.statusText}`);\n }\n }).catch((error) => {\n // Handle all fetch errors gracefully\n console.warn('Failed to load SVG:', url, error);\n pdsIconContent.set(url, '');\n // Don't re-throw to prevent unhandled promise rejections\n });\n\n requests.set(url, req);\n }\n } else {\n pdsIconContent.set(url, '');\n return Promise.resolve();\n }\n }\n\n return req;\n}\n",":host {\n --dimension-icon-height: 16px;\n --dimension-icon-width: 16px;\n --color-icon-fill: currentColor;\n\n contain: strict;\n display: inline-block;\n fill: var(--color-icon-fill);\n flex-shrink: 0;\n height: var(--dimension-icon-height);\n width: var(--dimension-icon-width);\n\n .pdsicon {\n fill: var(--color-icon-fill);\n }\n}\n\n.pds-icon-fill-none {\n fill: none;\n}\n\n.icon-inner,\n.pds-icon,\nsvg {\n display: block;\n height: 100%;\n width: 100%;\n}\n\n/* :host-context is supported in chromium; :dir is supported in safari & firefox */\n:host(.flip-rtl):host-context([dir='rtl']) .icon-inner {\n transform: scaleX(-1);\n}\n\n:host(.flip-rtl:dir(rtl)) .icon-inner {\n transform: scaleX(-1);\n}\n\n/**\n * This is needed for WebKit otherwise the fallback\n * will always cause the icon to be flipped if the document\n * loads in RTL.\n */\n:host(.flip-rtl:dir(ltr)) .icon-inner {\n transform: scaleX(1);\n}\n\n","import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getSvgContent, pdsIconContent } from './request';\nimport { getName, getUrl, inheritAttributes, isRTL, shouldRtlFlipIcon } from './utils';\n\n@Component({\n tag: 'pds-icon',\n assetsDirs: ['svg'],\n styleUrl: 'pds-icon.scss',\n shadow: true,\n})\nexport class PdsIcon {\n private didLoadIcon = false;\n private iconName: string | null = null;\n private io?: IntersectionObserver;\n private inheritedAttributes: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n @Element() el!: HTMLPdsIconElement;\n\n @State() private ariaLabel?: string;\n @State() private isVisible = false;\n @State() private svgContent?: string;\n\n /**\n *\n * The color of the icon\n *\n */\n @Prop() color?: string;\n\n /**\n * Determines if the icon should be flipped when the `dir` is right-to-left (`\"rtl\"`).\n * This is automatically enabled for icons that are in the `ICONS_TO_FLIP` list and\n * when the `dir` is `\"rtl\"`. If `flipRtl` is set to `false`, the icon will not be flipped\n * even if the `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * This is a combination of both `name` and `src`. If a `src` URL is detected,\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and sets the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The name of the icon to use from\n * the built-in set.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * The size of the icon. This can be\n * 'small', 'regular', 'medium', 'large', or a\n * custom value (40px, 1rem, etc)\n *\n */\n @Prop({ reflect: true }) size?:\n | 'small' // 12px\n | 'regular' // 16px\n | 'medium' // 20px\n | 'large' // 24px\n | 'auto'\n | string = 'regular'\n\n /**\n *\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n private iconSize() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sizes: { [key: string]: any } = {\n small: '12px',\n regular: '16px',\n medium: '20px',\n large: '24px',\n }\n\n if (sizes[this.size]) {\n return sizes[this.size];\n } else {\n return this.size;\n }\n }\n\n componentDidLoad() {\n this.setCSSVariables();\n\n if (!this.didLoadIcon) {\n this.loadIcon();\n }\n\n // Fallback: Ensure icon loads even if IntersectionObserver doesn't fire\n setTimeout(() => {\n if (!this.svgContent && !this.isVisible) {\n this.isVisible = true;\n this.loadIcon();\n }\n }, 100);\n\n // Additional fallback for client-side navigation (React Router, etc.)\n // React's useLayoutEffect and rendering cycles can delay visibility detection\n setTimeout(() => {\n if (!this.svgContent && !this.isVisible) {\n this.isVisible = true;\n this.loadIcon();\n }\n }, 500);\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);\n this.setCSSVariables();\n this.setupInitialAriaLabel();\n }\n\n setCSSVariables() {\n this.el.style.setProperty(`--dimension-icon-height`, this.iconSize());\n this.el.style.setProperty(`--dimension-icon-width`, this.iconSize());\n this.el.style.setProperty(`--color-icon-fill`, typeof this.color !== 'undefined' ? this.color : 'currentColor');\n }\n\n connectedCallback() {\n // Handle re-connection during client-side navigation\n if (!this.isVisible && !this.svgContent) {\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n // Immediate load attempt if already visible (e.g., during React navigation)\n if (this.isElementInViewport(this.el)) {\n this.isVisible = true;\n this.loadIcon();\n }\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n @Watch('size')\n @Watch('color')\n updateStyles() {\n this.setCSSVariables();\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n onIconPropertyChange() {\n this.loadIcon();\n // Update aria-label when icon properties change\n this.setupInitialAriaLabel();\n }\n\n loadIcon() {\n // Reset load state when URL changes\n this.didLoadIcon = false;\n\n // Clear existing content to prevent stale content when switching icons\n this.svgContent = undefined;\n\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (pdsIconContent.has(url)) {\n this.svgContent = pdsIconContent.get(url);\n } else {\n // Fix: Ensure promise callback triggers re-render and handle errors\n getSvgContent(url)\n .then(() => {\n // Force re-render by setting state in next tick\n setTimeout(() => {\n this.svgContent = pdsIconContent.get(url);\n }, 0);\n })\n .catch(() => {\n // Handle fetch errors gracefully\n this.svgContent = '';\n });\n }\n this.didLoadIcon = true;\n }\n }\n\n this.iconName = getName(this.name, this.icon);\n }\n\n render() {\n const { ariaLabel, flipRtl, iconName,inheritedAttributes } = this;\n const shouldIconAutoFlip = iconName\n ? shouldRtlFlipIcon(iconName, this.el) && flipRtl !== false\n : false;\n const shouldFlip = flipRtl || shouldIconAutoFlip;\n\n // Use inherited aria-label if provided, otherwise fall back to auto-generated one\n const finalAriaLabel = inheritedAttributes['aria-label'] || ariaLabel;\n\n return (\n\n <Host\n aria-label={finalAriaLabel !== undefined && !this.hasAriaHidden() ? finalAriaLabel : null }\n alt=\"\"\n role=\"img\"\n class={{\n ...createColorClasses(this.color),\n 'flip-rtl': shouldFlip,\n 'icon-rtl': shouldFlip && isRTL(this.el)\n }}\n {...inheritedAttributes}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n )\n }\n\n /*****\n * Private Methods\n ****/\n\n private setupInitialAriaLabel() {\n // Only set aria-label during initial load if one isn't already provided\n if (!this.inheritedAttributes['aria-label']) {\n const iconName = getName(this.name, this.icon);\n if (iconName) {\n this.ariaLabel = iconName.replace(/\\-/g, ' ');\n }\n }\n }\n\n private waitUntilVisible(el: HTMLElement, rootMargin: string, cb: () => void) {\n if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {\n const io = (this.io = new (window).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin },\n ));\n\n io.observe(el);\n\n // Safety timeout for client-side navigation scenarios\n // Sometimes IntersectionObserver doesn't fire during React navigation\n setTimeout(() => {\n if (this.io && !this.isVisible) {\n // Check if element is actually visible in viewport\n if (this.isElementInViewport(el)) {\n this.io.disconnect();\n this.io = undefined;\n cb();\n }\n }\n }, 1000);\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n private isElementInViewport(el: HTMLElement): boolean {\n if (!el || !el.isConnected) return false;\n\n const rect = el.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <= windowHeight &&\n rect.right <= windowWidth\n ) || (\n // Also consider partially visible elements\n rect.top < windowHeight &&\n rect.bottom > 0 &&\n rect.left < windowWidth &&\n rect.right > 0\n );\n }\n\n private hasAriaHidden = () => {\n const { el } = this;\n\n return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';\n }\n\n /**\n * Debug method to help diagnose loading issues\n * Call from browser console: document.querySelector('pds-icon').debugIconState()\n */\n debugIconState() {\n const url = getUrl(this);\n const rect = this.el.getBoundingClientRect();\n\n console.log('PdsIcon Debug State:', {\n name: this.name,\n src: this.src,\n icon: this.icon,\n iconName: this.iconName,\n url,\n isVisible: this.isVisible,\n didLoadIcon: this.didLoadIcon,\n hasSvgContent: !!this.svgContent,\n svgContentLength: this.svgContent?.length || 0,\n isInCache: url ? pdsIconContent.has(url) : false,\n cachedContent: url ? pdsIconContent.get(url) : null,\n element: this.el,\n // Client-side navigation specific debug info\n isConnected: this.el.isConnected,\n isInViewport: this.isElementInViewport(this.el),\n hasIntersectionObserver: !!this.io,\n boundingClientRect: rect,\n windowDimensions: {\n width: window.innerWidth || document.documentElement.clientWidth,\n height: window.innerHeight || document.documentElement.clientHeight\n }\n });\n }\n}\n\nconst createColorClasses = (color: string | undefined) => {\n return color\n ? {\n 'pds-color': true,\n [`pds-color-${color}`]: true,\n }\n : null;\n };\n"],"version":3}
|
package/dist/cheatsheet.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<title>Pine icons Library - 9.
|
|
5
|
+
<title>Pine icons Library - 9.6.1</title>
|
|
6
6
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🌲</text></svg>"/>
|
|
7
7
|
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
<div class="icon-count-container">
|
|
202
202
|
<p class="icon-count">369 icons</p>
|
|
203
203
|
</div>
|
|
204
|
-
<h1>Pine Icons - 9.
|
|
204
|
+
<h1>Pine Icons - 9.6.1</h1>
|
|
205
205
|
<div class="search-container">
|
|
206
206
|
<label for="search" class="visually-hidden">Search all 369 icons</label>
|
|
207
207
|
<input type="text" id="search" class="search-input" placeholder="Search icons by name or tag..." oninput="filterIcons(this.value)">
|
|
@@ -580,7 +580,7 @@
|
|
|
580
580
|
<button class="icon-button" title="Copy wrench code snippet" data-tags="preferences,settings,spanner,tool,tools" data-icon-name="wrench"><pds-icon name="wrench"></pds-icon><span class="visually-hidden">Copy wrench icon code</span></button>
|
|
581
581
|
<button class="icon-button" title="Copy zoom-in code snippet" data-tags="plus,zoom,zoom in" data-icon-name="zoom-in"><pds-icon name="zoom-in"></pds-icon><span class="visually-hidden">Copy zoom-in icon code</span></button>
|
|
582
582
|
<button class="icon-button" title="Copy zoom-out code snippet" data-tags="minus,zoom,zoom out" data-icon-name="zoom-out"><pds-icon name="zoom-out"></pds-icon><span class="visually-hidden">Copy zoom-out icon code</span></button>
|
|
583
|
-
<svg data-pdsicons="9.
|
|
583
|
+
<svg data-pdsicons="9.6.1" style="display:none">
|
|
584
584
|
<style>
|
|
585
585
|
.pdsicon {
|
|
586
586
|
fill: currentColor;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["pds-icon.cjs",[[1,"pds-icon",{"color":[1],"flipRtl":[4,"flip-rtl"],"icon":[8],"name":[513],"size":[513],"src":[1],"ariaLabel":[32],"isVisible":[32],"svgContent":[32]},null,{"size":["updateStyles"],"color":["updateStyles"],"name":["
|
|
9
|
+
return index.bootstrapLazy([["pds-icon.cjs",[[1,"pds-icon",{"color":[1],"flipRtl":[4,"flip-rtl"],"icon":[8],"name":[513],"size":[513],"src":[1],"ariaLabel":[32],"isVisible":[32],"svgContent":[32]},null,{"size":["updateStyles"],"color":["updateStyles"],"name":["onIconPropertyChange"],"src":["onIconPropertyChange"],"icon":["onIconPropertyChange"]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|