@taprootio/espalier 4.3.0 → 4.5.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/CHANGELOG.md +17 -0
- package/css/fonts/font-fallback-profiles.json +1 -0
- package/custom-elements.json +2338 -1491
- package/dist/action-menu/esp-action-menu-item.js +7 -4
- package/dist/avatar/esp-avatar.js +14 -8
- package/dist/avatar/esp-profile-chip.js +4 -1
- package/dist/badge/esp-badge.js +7 -4
- package/dist/box/esp-box.d.ts +1 -1
- package/dist/checkbox/esp-checkbox.js +6 -3
- package/dist/color-picker/esp-color-picker.js +1 -1
- package/dist/data-cell/esp-data-cell.js +6 -3
- package/dist/date-picker/helpers/styles.js +10 -4
- package/dist/details/esp-details.d.ts +4 -4
- package/dist/details/esp-details.js +11 -5
- package/dist/empty-state/esp-empty-state.js +16 -7
- package/dist/flyout/esp-flyout.js +5 -2
- package/dist/font-picker/esp-font-picker.d.ts +1 -0
- package/dist/font-picker/esp-font-picker.js +4 -4
- package/dist/footer/esp-footer-link-group.js +12 -6
- package/dist/footer/esp-footer.js +21 -6
- package/dist/form-item/esp-form-item.js +4 -1
- package/dist/header/esp-header.d.ts +2 -1
- package/dist/header/esp-header.js +24 -6
- package/dist/help/esp-help-button.d.ts +1 -1
- package/dist/help/help-document.js +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/lightbox/esp-lightbox.d.ts +1 -1
- package/dist/page/esp-page.d.ts +1 -0
- package/dist/page/esp-page.js +40 -783
- package/dist/page/esp-page.styles.js +748 -0
- package/dist/page/workspace-geometry.js +1 -0
- package/dist/page/workspace-resize-session.js +1 -0
- package/dist/page/workspace-width.js +1 -1
- package/dist/pickers/esp-picker-menu.js +6 -6
- package/dist/progress/esp-progress.js +11 -5
- package/dist/radio-button/esp-radio-button.js +6 -3
- package/dist/root/esp-root.d.ts +8 -0
- package/dist/root/esp-root.js +13 -7
- package/dist/root/helpers/compute-theme-properties.js +1 -1
- package/dist/search/esp-search.js +10 -4
- package/dist/shared/esp-element-base.js +20 -4
- package/dist/shared/font-helpers.d.ts +26 -0
- package/dist/shared/font-helpers.js +1 -1
- package/dist/shared/font-plan.d.ts +90 -0
- package/dist/shared/font-plan.js +5 -0
- package/dist/shared/scale-engine.js +1 -1
- package/dist/shared/theme.d.ts +28 -4
- package/dist/shared/theme.js +1 -1
- package/dist/slider/esp-slider.js +8 -5
- package/dist/status-indicator/esp-status-indicator.d.ts +1 -1
- package/dist/switch/esp-switch.js +11 -5
- package/dist/tabs/esp-tab-group.js +6 -3
- package/dist/tabs/esp-tab.js +6 -3
- package/dist/tree/esp-tree.js +4 -1
- package/espalier.css-data.json +9 -5
- package/espalier.token-manifest.json +13 -5
- package/licenses/ASSET_PROVENANCE.md +2 -1
- package/licenses/THIRD_PARTY_NOTICES.md +35 -0
- package/licenses/asset-provenance.json +26 -2
- package/package.json +16 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,i,t,n);else for(var p=r.length-1;p>=0;p--)(c=r[p])&&(e=(a<3?c(e):a>3?c(i,t,e):c(i,t))||e);return a>3&&e&&Object.defineProperty(i,t,e),e};import{css as h,html as m,nothing as u}from"lit";import{customElement as f,property as l}from"lit/decorators.js";import{classMap as
|
|
2
|
-
<span part="item" class=${
|
|
1
|
+
var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,i,t,n);else for(var p=r.length-1;p>=0;p--)(c=r[p])&&(e=(a<3?c(e):a>3?c(i,t,e):c(i,t))||e);return a>3&&e&&Object.defineProperty(i,t,e),e};import{css as h,html as m,nothing as u}from"lit";import{customElement as f,property as l}from"lit/decorators.js";import{classMap as v}from"lit/directives/class-map.js";import{ref as g}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{getIconHrefForHost as b}from"../shared/intent-values.js";import{SlottedIconController as y}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as P}from"../shared/svgs/render-sprite-icon.js";let o=class extends d{constructor(){super(...arguments),this.iconSlot=new y(this),this.iconPositionExplicit=!1,this.inheritingIconPosition=!1,this._iconPosition="left",this.icon="",this.value="",this.disabled=!1,this.handleClick=i=>{if(this.disabled){i.preventDefault();return}this.activate()}}get iconPosition(){return this._iconPosition}set iconPosition(i){const t=this._iconPosition;this._iconPosition=i,this.inheritingIconPosition||(this.iconPositionExplicit=!0),this.requestUpdate("iconPosition",t)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick)}updated(i){super.updated(i),this.setAttribute("role","menuitem"),this.setAttribute("aria-disabled",String(this.disabled))}activate(){this.disabled||this.dispatchEvent(new CustomEvent("esp-internal-action-menu-item-activate",{detail:{item:this},bubbles:!0,composed:!0}))}inheritIconPosition(i){this.iconPositionExplicit||(this.inheritingIconPosition=!0,this.iconPosition=i,this.inheritingIconPosition=!1)}render(){const i=b(this.icon,this),t=this.iconSlot.hasSlottedIcon(),n={item:!0,"has-icon":t||i.length>0,"icon-right":this.iconPosition==="right"};return m`
|
|
2
|
+
<span part="item" class=${v(n)}>
|
|
3
3
|
<span part="icon" class="icon">
|
|
4
4
|
<slot
|
|
5
5
|
name="icon"
|
|
6
|
-
${
|
|
6
|
+
${g(this.iconSlot.slotRef)}
|
|
7
7
|
@slotchange=${this.iconSlot.handleSlotChange}
|
|
8
8
|
></slot>
|
|
9
9
|
${!t&&i?P(i):u}
|
|
@@ -28,7 +28,10 @@ var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnP
|
|
|
28
28
|
grid-template-columns: 1fr;
|
|
29
29
|
align-items: center;
|
|
30
30
|
min-width: max-content;
|
|
31
|
-
font-family: var(
|
|
31
|
+
font-family: var(
|
|
32
|
+
--_esp-font-body-effective,
|
|
33
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
34
|
+
);
|
|
32
35
|
font-size: var(--esp-size-font);
|
|
33
36
|
font-weight: bold;
|
|
34
37
|
line-height: 1.3;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var l=function(a,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(a,e,r,o);else for(var h=a.length-1;h>=0;h--)(i=a[h])&&(s=(n<3?i(s):n>3?i(e,r,s):i(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s};import{css as b,html as p,nothing as
|
|
1
|
+
var l=function(a,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(a,e,r,o);else for(var h=a.length-1;h>=0;h--)(i=a[h])&&(s=(n<3?i(s):n>3?i(e,r,s):i(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s};import{css as b,html as p,nothing as f}from"lit";import{customElement as y,property as c}from"lit/decorators.js";import{classMap as m}from"lit/directives/class-map.js";import{EspalierElementBase as g}from"../shared/esp-element-base.js";import{syncNormalizedAttribute as k}from"../shared/attribute-helpers.js";import{normalizeCrossOrigin as z,normalizeLoading as _,normalizePresence as B,normalizeReferrerPolicy as P,normalizeSize as O,nullableStringConverter as $}from"./avatar-values.js";const d=["primary","analogous-left","analogous-right","complementary","split-complementary-left","split-complementary-right","triadic-left","triadic-right"];function v(a){const e=Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(a),r=>r.segment):Array.from(a)}function u(a){return/[\p{Letter}\p{Number}]/u.test(a)}function w(a){const e=v(a).filter(r=>r.trim().length>0);return e.find(r=>u(r))??e[0]??""}function A(a){const e=a.trim().replace(/^@+/,"");if(!e)return"?";const r=e.split(/[\s._-]+/u).map(i=>i.trim()).filter(Boolean);if(r.length>1)return r.map(w).filter(Boolean).slice(0,2).join("").toLocaleUpperCase();const o=v(r[0]??e).filter(i=>i.trim().length>0),n=o.filter(u);return(n.length>0?n:o).slice(0,2).join("").toLocaleUpperCase()||"?"}function S(a){let e=0;for(const r of a)e=e*31+r.codePointAt(0)>>>0;return e}let t=class extends g{constructor(){super(...arguments),this.sizeBacker="medium",this.presenceBacker="",this.loadingBacker="lazy",this.crossOriginBacker="",this.referrerPolicyBacker="no-referrer",this.imageFailed=!1,this.src="",this.name=""}get size(){return this.sizeBacker}set size(e){const r=this.sizeBacker;this.sizeBacker=O(e),this.requestUpdate("size",r),k(this,"size",this.sizeBacker)}get presence(){return this.presenceBacker}set presence(e){const r=this.presenceBacker;this.presenceBacker=B(e),this.requestUpdate("presence",r),this.syncPresenceAttribute()}get loading(){return this.loadingBacker}set loading(e){const r=this.loadingBacker;this.loadingBacker=_(e),this.requestUpdate("loading",r)}get crossOrigin(){return this.crossOriginBacker}set crossOrigin(e){const r=this.crossOriginBacker;this.crossOriginBacker=z(e),this.requestUpdate("crossOrigin",r)}get referrerPolicy(){return this.referrerPolicyBacker}set referrerPolicy(e){const r=this.referrerPolicyBacker;this.referrerPolicyBacker=P(e),this.requestUpdate("referrerPolicy",r)}willUpdate(e){e.has("src")&&(this.imageFailed=!1)}syncPresenceAttribute(){const e=this.getAttribute("presence");if(this.presenceBacker){e!==null&&e!==this.presenceBacker&&this.setAttribute("presence",this.presenceBacker);return}e!==null&&this.removeAttribute("presence")}get accessibleName(){const e=this.name.trim()||"Avatar";return this.presence?`${e}, ${this.presence}`:e}get fallbackColorClass(){const e=S(this.name.trim().toLocaleLowerCase())%d.length;return`fallback-${d[e]}`}handleImageError(){this.imageFailed||(this.imageFailed=!0,this.requestUpdate())}retryImage(){this.imageFailed&&(this.imageFailed=!1,this.requestUpdate())}render(){const e=this.src.trim().length>0&&!this.imageFailed,r=this.presence;return p`
|
|
2
2
|
<span class="avatar" part="avatar">
|
|
3
3
|
<span class="visual" part=${e?"image":"fallback"}>
|
|
4
4
|
${e?p`
|
|
@@ -7,13 +7,13 @@ var l=function(a,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnP
|
|
|
7
7
|
alt=${this.accessibleName}
|
|
8
8
|
decoding="async"
|
|
9
9
|
loading=${this.loading}
|
|
10
|
-
referrerpolicy=${this.referrerPolicy||
|
|
11
|
-
crossorigin=${this.crossOrigin||
|
|
10
|
+
referrerpolicy=${this.referrerPolicy||f}
|
|
11
|
+
crossorigin=${this.crossOrigin||f}
|
|
12
12
|
@error=${this.handleImageError}
|
|
13
13
|
/>
|
|
14
14
|
`:p`
|
|
15
15
|
<span
|
|
16
|
-
class=${
|
|
16
|
+
class=${m({fallback:!0,[this.fallbackColorClass]:!0})}
|
|
17
17
|
role="img"
|
|
18
18
|
aria-label=${this.accessibleName}
|
|
19
19
|
>
|
|
@@ -22,12 +22,12 @@ var l=function(a,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnP
|
|
|
22
22
|
`}
|
|
23
23
|
</span>
|
|
24
24
|
${r?p`<span
|
|
25
|
-
class=${
|
|
25
|
+
class=${m({presence:!0,[r]:!0})}
|
|
26
26
|
part="presence"
|
|
27
27
|
aria-hidden="true"
|
|
28
|
-
></span>`:
|
|
28
|
+
></span>`:f}
|
|
29
29
|
</span>
|
|
30
|
-
`}};t.styles=[...
|
|
30
|
+
`}};t.styles=[...g.styles,b`
|
|
31
31
|
:host {
|
|
32
32
|
--_esp-avatar-resolved-size: var(--esp-avatar-size, var(--esp-size-big));
|
|
33
33
|
--_esp-avatar-fallback-base: var(--esp-color-primary);
|
|
@@ -80,7 +80,13 @@ var l=function(a,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnP
|
|
|
80
80
|
background: oklch(from var(--_esp-avatar-fallback-base) var(--esp-l-raised-3) c h);
|
|
81
81
|
color: var(--esp-color-text);
|
|
82
82
|
color: oklch(from var(--_esp-avatar-fallback-base) var(--esp-l-ink) c h);
|
|
83
|
-
font-family: var(
|
|
83
|
+
font-family: var(
|
|
84
|
+
--_esp-font-headings-effective,
|
|
85
|
+
var(
|
|
86
|
+
--esp-font-headings,
|
|
87
|
+
var(--_esp-font-body-effective, var(--esp-font-body, var(--_esp-font-body-fallback)))
|
|
88
|
+
)
|
|
89
|
+
);
|
|
84
90
|
font-size: calc(var(--_esp-avatar-resolved-size) * 0.38);
|
|
85
91
|
font-weight: var(--esp-font-weight-headings);
|
|
86
92
|
line-height: 1;
|
|
@@ -29,7 +29,10 @@ var i=function(n,e,t,p){var o=arguments.length,s=o<3?e:p===null?p=Object.getOwnP
|
|
|
29
29
|
gap: var(--esp-size-tiny-to-small);
|
|
30
30
|
min-width: 0;
|
|
31
31
|
max-width: 100%;
|
|
32
|
-
font-family: var(
|
|
32
|
+
font-family: var(
|
|
33
|
+
--_esp-font-body-effective,
|
|
34
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
35
|
+
);
|
|
33
36
|
font-size: var(--esp-size-font);
|
|
34
37
|
color: var(--esp-color-text);
|
|
35
38
|
}
|
package/dist/badge/esp-badge.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var l=s.length-1;l>=0;l--)(a=s[l])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{css as h,html as m,nothing as f}from"lit";import{customElement as g,property as p}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{ref as b}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{intentSurfaceTokens as
|
|
1
|
+
var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var l=s.length-1;l>=0;l--)(a=s[l])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{css as h,html as m,nothing as f}from"lit";import{customElement as g,property as p}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{ref as b}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{intentSurfaceTokens as v}from"../shared/style-fragments.js";import{syncNormalizedAttribute as z}from"../shared/attribute-helpers.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as _}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as w}from"../shared/svgs/render-sprite-icon.js";function S(s){return s==="medium"?"medium":"small"}let r=class extends d{constructor(){super(...arguments),this.intentEmitsTokens=!1,this.iconSlot=new _(this),this.sizeBacker="small",this.icon=""}get size(){return this.sizeBacker}set size(e){const t=this.sizeBacker;this.sizeBacker=S(e),this.requestUpdate("size",t),z(this,"size",this.sizeBacker)}render(){const e=y(this.icon,this),t=this.iconSlot.hasSlottedIcon(),o=t||e.length>0,n={badge:!0,[`intent-${this.intent}`]:!0,[`size-${this.size}`]:!0,"has-icon":o};return m`
|
|
2
2
|
<span part="badge" class=${u(n)}>
|
|
3
3
|
<span part="icon" class="icon" aria-hidden="true">
|
|
4
4
|
<slot
|
|
@@ -6,11 +6,11 @@ var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnP
|
|
|
6
6
|
${b(this.iconSlot.slotRef)}
|
|
7
7
|
@slotchange=${this.iconSlot.handleSlotChange}
|
|
8
8
|
></slot>
|
|
9
|
-
${!t&&e?
|
|
9
|
+
${!t&&e?w(e):f}
|
|
10
10
|
</span>
|
|
11
11
|
<span part="label" class="label"><slot></slot></span>
|
|
12
12
|
</span>
|
|
13
|
-
`}};r.styles=[...d.styles,
|
|
13
|
+
`}};r.styles=[...d.styles,v,h`
|
|
14
14
|
:host {
|
|
15
15
|
display: inline-flex;
|
|
16
16
|
max-width: 100%;
|
|
@@ -30,7 +30,10 @@ var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnP
|
|
|
30
30
|
border-radius: var(--esp-badge-border-radius, 999px);
|
|
31
31
|
background: var(--_esp-badge-background);
|
|
32
32
|
color: var(--_esp-badge-color);
|
|
33
|
-
font-family: var(
|
|
33
|
+
font-family: var(
|
|
34
|
+
--_esp-font-body-effective,
|
|
35
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
36
|
+
);
|
|
34
37
|
font-weight: var(--esp-font-weight-headings);
|
|
35
38
|
line-height: 1.2;
|
|
36
39
|
white-space: nowrap;
|
package/dist/box/esp-box.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
75
75
|
* font-size: var(--esp-size-big-to-large);
|
|
76
76
|
* padding: var(--esp-size-padding);
|
|
77
77
|
* line-height: 1.1;
|
|
78
|
-
* font-family: var(--esp-font-headings);
|
|
78
|
+
* font-family: var(--esp-font-headings, var(--esp-font-body, system-ui, sans-serif));
|
|
79
79
|
* }
|
|
80
80
|
* esp-box.card-box div {
|
|
81
81
|
* padding: var(--esp-size-padding);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i=function(l,e,s,c){var a=arguments.length,o=a<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,s):c,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(l,e,s,c);else for(var h=l.length-1;h>=0;h--)(n=l[h])&&(o=(a<3?n(o):a>3?n(e,s,o):n(e,s))||o);return a>3&&o&&Object.defineProperty(e,s,o),o};import{css as p,html as m}from"lit";import{customElement as f,property as r}from"lit/decorators.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{checkboxChecked as u}from"../shared/svgs/checkbox-checked.js";import{checkboxUnchecked as b}from"../shared/svgs/checkbox-unchecked.js";import{checkboxIndeterminate as v}from"../shared/svgs/checkbox-indeterminate.js";import{FormFieldController as k}from"../shared/form-field-controller.js";import{FormFieldDescriptionController as g}from"../shared/form-field-description-controller.js";import{disabledControl as y,focusRing as x}from"../shared/style-fragments.js";let t=class extends d{constructor(){super(...arguments),this.internals=this.attachInternals(),this.formCtrl=new k({host:this,internals:this.internals,getFormValue:()=>this.checked?this.value||"on":null,getValidity:()=>this.required&&!this.checked?{flags:{valueMissing:!0},message:this.requiredMessage||"Please check this box to continue."}:null,onReset:()=>{this.checked=!1,this.indeterminate=!1},onRestore:e=>{this.checked=e==="on"||e===this.value},onDisabled:e=>{this.disabled=e}}),this.formItemDescription=new g({host:this,getTarget:()=>this.shadowRoot?.querySelector(".checkbox-control")}),this.checked=!1,this.value="",this.name="",this.required=!1,this.requiredMessage="",this.disabled=!1,this.indeterminate=!1}focus(e){this.focusShadowElementAfterUpdate(".checkbox-control",e)}setFormItemDescription(e){this.formItemDescription.setDescription(e)}validate(){this.formCtrl.validate()}checkValidity(){return this.formCtrl.checkValidity()}toggle(){this.disabled||(this.indeterminate=!1,this.checked=!this.checked,this.formCtrl.syncValue(),this.emitValueChanged({checked:this.checked,value:this.value}))}handleKeyDown(e){e.key===" "&&(e.preventDefault(),this.toggle())}getSvg(){return this.indeterminate?v:this.checked?u:b}formResetCallback(){this.formCtrl.handleFormReset()}formStateRestoreCallback(e){this.formCtrl.handleFormStateRestore(e)}formDisabledCallback(e){this.formCtrl.handleFormDisabled(e)}render(){return m`
|
|
2
2
|
<div
|
|
3
3
|
class="checkbox-control"
|
|
4
4
|
role="checkbox"
|
|
@@ -22,7 +22,10 @@ var o=function(l,e,s,c){var n=arguments.length,i=n<3?e:c===null?c=Object.getOwnP
|
|
|
22
22
|
align-items: center;
|
|
23
23
|
gap: var(--esp-size-tiny);
|
|
24
24
|
cursor: pointer;
|
|
25
|
-
font-family: var(
|
|
25
|
+
font-family: var(
|
|
26
|
+
--_esp-font-body-effective,
|
|
27
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
28
|
+
);
|
|
26
29
|
font-size: var(--esp-size-font);
|
|
27
30
|
color: var(--esp-color-text);
|
|
28
31
|
outline: none;
|
|
@@ -44,4 +47,4 @@ var o=function(l,e,s,c){var n=arguments.length,i=n<3?e:c===null?c=Object.getOwnP
|
|
|
44
47
|
line-height: 1.3;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
|
-
`],
|
|
50
|
+
`],i([r({type:Boolean,reflect:!0})],t.prototype,"checked",void 0),i([r({type:String})],t.prototype,"value",void 0),i([r({type:String,reflect:!0})],t.prototype,"name",void 0),i([r({type:Boolean,reflect:!0})],t.prototype,"required",void 0),i([r({attribute:"required-message"})],t.prototype,"requiredMessage",void 0),i([r({type:Boolean,reflect:!0})],t.prototype,"disabled",void 0),i([r({type:Boolean,reflect:!0})],t.prototype,"indeterminate",void 0),t=i([f("esp-checkbox")],t);export{t as EspalierCheckbox};
|
|
@@ -91,7 +91,7 @@ var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnP
|
|
|
91
91
|
font-weight: 400;
|
|
92
92
|
opacity: 0.7;
|
|
93
93
|
font-size: 0.85em;
|
|
94
|
-
font-family: var(--esp-font-monospace);
|
|
94
|
+
font-family: var(--_esp-font-monospace-effective, var(--esp-font-monospace, monospace));
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
#hue-slider {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var c=function(a,e,s,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(a,e,s,n);else for(var i=a.length-1;i>=0;i--)(l=a[i])&&(t=(r<3?l(t):r>3?l(e,s,t):l(e,s))||t);return r>3&&t&&Object.defineProperty(e,s,t),t};import{css as h,html as m}from"lit";import{customElement as y,property as f,state as u}from"lit/decorators.js";import{classMap as
|
|
2
|
-
<span part="cell" class=${
|
|
1
|
+
var c=function(a,e,s,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(a,e,s,n);else for(var i=a.length-1;i>=0;i--)(l=a[i])&&(t=(r<3?l(t):r>3?l(e,s,t):l(e,s))||t);return r>3&&t&&Object.defineProperty(e,s,t),t};import{css as h,html as m}from"lit";import{customElement as y,property as f,state as u}from"lit/decorators.js";import{classMap as v}from"lit/directives/class-map.js";import{createRef as g,ref as p}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{SlottedIconController as S}from"../shared/slotted-icon-controller.js";import{slotHasContent as w}from"../shared/slot-content.js";let o=class extends d{constructor(){super(...arguments),this.iconSlot=new S(this),this.secondarySlot=g(),this.hasSecondary=!1,this.truncate=!1,this.handleSecondarySlotChange=()=>{this.hasSecondary=w(this.secondarySlot.value)}}firstUpdated(e){super.firstUpdated(e),this.iconSlot.handleSlotChange(),this.handleSecondarySlotChange()}render(){const e={cell:!0,"has-icon":this.iconSlot.hasAssignedSlotContent,"has-secondary":this.hasSecondary,truncate:this.truncate};return m`
|
|
2
|
+
<span part="cell" class=${v(e)}>
|
|
3
3
|
<span part="icon" class="icon">
|
|
4
4
|
<slot
|
|
5
5
|
name="icon"
|
|
@@ -31,7 +31,10 @@ var c=function(a,e,s,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnP
|
|
|
31
31
|
min-width: 0;
|
|
32
32
|
gap: var(--esp-size-tiny);
|
|
33
33
|
color: var(--esp-color-text);
|
|
34
|
-
font-family: var(
|
|
34
|
+
font-family: var(
|
|
35
|
+
--_esp-font-body-effective,
|
|
36
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
37
|
+
);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
.cell.has-icon {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import{css as e}from"lit";const
|
|
1
|
+
import{css as e}from"lit";const r=e`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.temporal-error {
|
|
5
|
-
font-family: var(
|
|
5
|
+
font-family: var(
|
|
6
|
+
--_esp-font-body-effective,
|
|
7
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
8
|
+
);
|
|
6
9
|
font-size: var(--esp-type-small);
|
|
7
10
|
color: var(--esp-color-danger-text);
|
|
8
11
|
padding: var(--esp-size-padding);
|
|
@@ -45,7 +48,10 @@ import{css as e}from"lit";const o=e`
|
|
|
45
48
|
background: var(--esp-color-layer-1);
|
|
46
49
|
box-shadow: 0 4px 16px var(--esp-color-shadow);
|
|
47
50
|
color: var(--esp-color-text);
|
|
48
|
-
font-family: var(
|
|
51
|
+
font-family: var(
|
|
52
|
+
--_esp-font-body-effective,
|
|
53
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
54
|
+
);
|
|
49
55
|
font-size: var(--esp-size-font);
|
|
50
56
|
opacity: 0;
|
|
51
57
|
transition: opacity 150ms ease-in;
|
|
@@ -256,4 +262,4 @@ import{css as e}from"lit";const o=e`
|
|
|
256
262
|
color: var(--esp-color-headings);
|
|
257
263
|
padding: 0 2px;
|
|
258
264
|
}
|
|
259
|
-
`;export{
|
|
265
|
+
`;export{r as datePickerStyles};
|
|
@@ -87,15 +87,15 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
87
87
|
* <li>Toggle a checkbox, click Apply, and repeat the sort — the viewport should remain stable.</li>
|
|
88
88
|
* </ol>
|
|
89
89
|
* </esp-info>
|
|
90
|
-
* <div style="height:40vh; background:repeating-linear-gradient(180deg,var(--esp-color-layer-2) 0 1px,transparent 1px 2rem); display:flex; align-items:center; justify-content:center; color:oklch(from var(--esp-color-text) l c h / 0.5); font-family:var(--esp-font-body);">
|
|
90
|
+
* <div style="height:40vh; background:repeating-linear-gradient(180deg,var(--esp-color-layer-2) 0 1px,transparent 1px 2rem); display:flex; align-items:center; justify-content:center; color:oklch(from var(--esp-color-text) l c h / 0.5); font-family:var(--esp-font-body,system-ui,sans-serif);">
|
|
91
91
|
* ↑ Spacer — scroll down to reach the filter panel ↑
|
|
92
92
|
* </div>
|
|
93
93
|
* <esp-details summary="Advanced filters">
|
|
94
94
|
* <div style="display:flex; flex-direction:column; gap:var(--esp-size-small);">
|
|
95
|
-
* <label style="display:flex; align-items:center; gap:var(--esp-size-tiny); font-family:var(--esp-font-body); color:var(--esp-color-text);">
|
|
95
|
+
* <label style="display:flex; align-items:center; gap:var(--esp-size-tiny); font-family:var(--esp-font-body,system-ui,sans-serif); color:var(--esp-color-text);">
|
|
96
96
|
* <input type="checkbox" value="active" /> Active only
|
|
97
97
|
* </label>
|
|
98
|
-
* <label style="display:flex; align-items:center; gap:var(--esp-size-tiny); font-family:var(--esp-font-body); color:var(--esp-color-text);">
|
|
98
|
+
* <label style="display:flex; align-items:center; gap:var(--esp-size-tiny); font-family:var(--esp-font-body,system-ui,sans-serif); color:var(--esp-color-text);">
|
|
99
99
|
* <input type="checkbox" value="flagged" /> Flagged
|
|
100
100
|
* </label>
|
|
101
101
|
* <esp-button id="scroll-test-apply" label="Apply filters"></esp-button>
|
|
@@ -106,7 +106,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
106
106
|
* <esp-grid-column header="Title" field-name="title" sortable width="200px" grow></esp-grid-column>
|
|
107
107
|
* <esp-grid-column header="Status" field-name="status" width="120px"></esp-grid-column>
|
|
108
108
|
* </esp-grid>
|
|
109
|
-
* <div style="height:60vh; background:repeating-linear-gradient(180deg,var(--esp-color-layer-2) 0 1px,transparent 1px 2rem); display:flex; align-items:center; justify-content:center; color:oklch(from var(--esp-color-text) l c h / 0.5); font-family:var(--esp-font-body);">
|
|
109
|
+
* <div style="height:60vh; background:repeating-linear-gradient(180deg,var(--esp-color-layer-2) 0 1px,transparent 1px 2rem); display:flex; align-items:center; justify-content:center; color:oklch(from var(--esp-color-text) l c h / 0.5); font-family:var(--esp-font-body,system-ui,sans-serif);">
|
|
110
110
|
* ↓ Spacer — extra page length below the grid ↓
|
|
111
111
|
* </div>
|
|
112
112
|
* <script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,e,o,s);else for(var l=i.length-1;l>=0;l--)(n=i[l])&&(r=(t<3?n(r):t>3?n(e,o,r):n(e,o))||r);return t>3&&r&&Object.defineProperty(e,o,r),r};import{css as h,html as
|
|
1
|
+
var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,e,o,s);else for(var l=i.length-1;l>=0;l--)(n=i[l])&&(r=(t<3?n(r):t>3?n(e,o,r):n(e,o))||r);return t>3&&r&&Object.defineProperty(e,o,r),r};import{css as h,html as f}from"lit";import{customElement as b,property as c}from"lit/decorators.js";import{EspalierElementBase as m}from"../shared/esp-element-base.js";import{ESP_EVENTS as u}from"../shared/events.js";import{disabledControl as v}from"../shared/style-fragments.js";let a=class extends m{constructor(){super(...arguments),this.summary="",this.open=!1,this.disabled=!1,this._toggleFromClick=!1}close(){this.open=!1}getScrollParent(){let e=this.assignedSlot?.parentElement??(this.parentNode instanceof ShadowRoot?this.parentNode.host:this.parentElement);for(;e&&e!==document.documentElement;){const s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)return e;e=e.assignedSlot?.parentElement??(e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentElement)}return null}handleToggle(e){const o=e.target;if(this.disabled){o.open=this.open;return}if(this._toggleFromClick){this._toggleFromClick=!1;return}this.open=o.open,this.dispatchEvent(new CustomEvent(u.DETAILS_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0}))}handleSummaryClick(e){if(e.preventDefault(),this.disabled)return;const o=e.currentTarget,s=o.getBoundingClientRect().top,t=this.getScrollParent(),r=t?t.scrollTop:window.scrollY;this._toggleFromClick=!0,this.open=!this.open,this.updateComplete.then(()=>{this._toggleFromClick=!1,this.dispatchEvent(new CustomEvent(u.DETAILS_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0}));const l=o.getBoundingClientRect().top-s;if(Math.abs(l)>1)if(t){const p=t.scrollTop;Math.abs(p-r)>1&&(t.scrollTop=r)}else{const p=window.scrollY;Math.abs(p-r)>1&&window.scrollBy(0,l)}})}render(){return f`
|
|
2
2
|
<details ?open=${this.open} @toggle=${this.handleToggle}>
|
|
3
3
|
<summary @click=${this.handleSummaryClick}>
|
|
4
4
|
<span class="indicator"></span>
|
|
@@ -8,7 +8,7 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
8
8
|
<slot></slot>
|
|
9
9
|
</div>
|
|
10
10
|
</details>
|
|
11
|
-
`}};a.styles=[...m.styles,
|
|
11
|
+
`}};a.styles=[...m.styles,v(":host([disabled]) summary"),h`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
overflow-anchor: none;
|
|
@@ -41,7 +41,10 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
41
41
|
cursor: pointer;
|
|
42
42
|
user-select: none;
|
|
43
43
|
list-style: none;
|
|
44
|
-
font-family: var(
|
|
44
|
+
font-family: var(
|
|
45
|
+
--_esp-font-body-effective,
|
|
46
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
47
|
+
);
|
|
45
48
|
font-size: var(--esp-size-font);
|
|
46
49
|
font-weight: 600;
|
|
47
50
|
color: var(--esp-color-headings);
|
|
@@ -89,7 +92,10 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
89
92
|
|
|
90
93
|
.content {
|
|
91
94
|
padding: var(--esp-details-size-padding, var(--esp-size-padding));
|
|
92
|
-
font-family: var(
|
|
95
|
+
font-family: var(
|
|
96
|
+
--_esp-font-body-effective,
|
|
97
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
98
|
+
);
|
|
93
99
|
font-size: var(--esp-size-font);
|
|
94
100
|
color: var(--esp-color-text);
|
|
95
101
|
border-top: 1px solid var(--esp-details-color-border, var(--esp-color-border));
|
|
@@ -113,4 +119,4 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
113
119
|
:host([in-group]:last-of-type) details {
|
|
114
120
|
border-bottom: none;
|
|
115
121
|
}
|
|
116
|
-
`],d([c({type:String})],a.prototype,"summary",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"open",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),a=d([
|
|
122
|
+
`],d([c({type:String})],a.prototype,"summary",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"open",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),a=d([b("esp-details")],a);export{a as EspalierDetails};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var l=function(
|
|
2
|
-
<section part="empty-state" class=${
|
|
1
|
+
var l=function(s,e,t,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,n);else for(var c=s.length-1;c>=0;c--)(r=s[c])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i};import{css as f,html as m,nothing as g}from"lit";import{customElement as v,property as h,state as y}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{EspalierElementBase as p}from"../shared/esp-element-base.js";import{getIconHrefForHost as z}from"../shared/intent-values.js";import{syncNormalizedAttribute as S}from"../shared/attribute-helpers.js";import{SlottedIconController as b}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as E}from"../shared/svgs/render-sprite-icon.js";import{createRef as _,ref as d}from"lit/directives/ref.js";function w(s){return s==="large"?"large":"medium"}let o=class extends p{constructor(){super(...arguments),this.iconSlot=new b(this),this.actionSlot=_(),this.sizeBacker="medium",this.hasSlottedAction=!1,this.icon="",this.handleActionSlotChange=()=>{this.hasSlottedAction=(this.actionSlot.value?.assignedElements({flatten:!0}).length??0)>0}}get size(){return this.sizeBacker}set size(e){const t=this.sizeBacker;this.sizeBacker=w(e),this.requestUpdate("size",t),S(this,"size",this.sizeBacker)}render(){const e=z(this.icon,this),t=this.iconSlot.hasSlottedIcon(),n=t||e.length>0,a=this.hasSlottedAction||this.querySelector('[slot="action"]')!==null,i={"empty-state":!0,[`size-${this.size}`]:!0,"has-icon":n,"has-action":a};return m`
|
|
2
|
+
<section part="empty-state" class=${u(i)}>
|
|
3
3
|
<span part="icon" class="icon" aria-hidden="true">
|
|
4
4
|
<slot
|
|
5
5
|
name="icon"
|
|
6
6
|
${d(this.iconSlot.slotRef)}
|
|
7
7
|
@slotchange=${this.iconSlot.handleSlotChange}
|
|
8
8
|
></slot>
|
|
9
|
-
${!e
|
|
9
|
+
${!t&&e?E(e):g}
|
|
10
10
|
</span>
|
|
11
11
|
<div part="heading" class="heading"><slot name="heading"></slot></div>
|
|
12
12
|
<div part="body" class="body"><slot></slot></div>
|
|
@@ -18,11 +18,14 @@ var l=function(o,t,e,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnP
|
|
|
18
18
|
></slot>
|
|
19
19
|
</div>
|
|
20
20
|
</section>
|
|
21
|
-
`}};
|
|
21
|
+
`}};o.styles=[...p.styles,f`
|
|
22
22
|
:host {
|
|
23
23
|
display: block;
|
|
24
24
|
color: var(--esp-color-text);
|
|
25
|
-
font-family: var(
|
|
25
|
+
font-family: var(
|
|
26
|
+
--_esp-font-body-effective,
|
|
27
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
28
|
+
);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
.empty-state {
|
|
@@ -71,7 +74,13 @@ var l=function(o,t,e,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnP
|
|
|
71
74
|
|
|
72
75
|
.heading {
|
|
73
76
|
color: var(--esp-color-text);
|
|
74
|
-
font-family: var(
|
|
77
|
+
font-family: var(
|
|
78
|
+
--_esp-font-headings-effective,
|
|
79
|
+
var(
|
|
80
|
+
--esp-font-headings,
|
|
81
|
+
var(--_esp-font-body-effective, var(--esp-font-body, var(--_esp-font-body-fallback)))
|
|
82
|
+
)
|
|
83
|
+
);
|
|
75
84
|
font-size: var(--esp-type-medium);
|
|
76
85
|
font-weight: var(--esp-font-weight-headings);
|
|
77
86
|
line-height: 1.2;
|
|
@@ -96,4 +105,4 @@ var l=function(o,t,e,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnP
|
|
|
96
105
|
.has-action .action {
|
|
97
106
|
display: flex;
|
|
98
107
|
}
|
|
99
|
-
`],l([
|
|
108
|
+
`],l([y()],o.prototype,"hasSlottedAction",void 0),l([h({type:String})],o.prototype,"icon",void 0),l([h({type:String,reflect:!0})],o.prototype,"size",null),o=l([v("esp-empty-state")],o);export{o as EspalierEmptyState};
|
|
@@ -31,7 +31,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
31
31
|
@starting-style {
|
|
32
32
|
translate: 100% 0;
|
|
33
33
|
}
|
|
34
|
-
`;let a=class extends A{constructor(){super(...arguments),this.open=!1,this.heading="",this.mode="auto",this.pageOverlayRequested=!1,this.fullHeight=!1,this.matchSurface=!1,this.standalone=!1,this.scope="outermost",this.lastGeneratedAriaLabel=null,this.boundKeydown=e=>this.handleKeydown(e),this.boundShowRequest=e=>this.handleShowRequest(e),this.boundCloseRequest=()=>this.close(),this.boundOverlayMediaChange=()=>{this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry(),this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))},this.boundAnchorViewportChange=()=>this.scheduleAnchorGeometrySync(),this.boundFullHeightRequest=e=>{e.stopPropagation(),this.fullHeight=!0},this.anchorGeometryFrame=new B(()=>this.syncAnchorGeometry()),this.trackingAnchorPosition=!1,this.busSubscribed=!1,this.panelRef=L(),this.overlay=new H({host:this,getFocusTrapContainer:()=>this.panelRef.value??null,getFocusFallback:()=>this.panelRef.value??null,promote:!1}),this.overlayActive=!1,this.baseRole="complementary"}get effectiveOverlay(){return this.mode==="overlay"||this.pageOverlayRequested||(this.overlayMediaQuery?.matches??!1)}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","complementary"),this.baseRole=this.getAttribute("role")??"complementary",!this.overlayMediaQuery&&typeof window<"u"&&"matchMedia"in window&&(this.overlayMediaQuery=window.matchMedia($)),this.overlayMediaQuery?.addEventListener("change",this.boundOverlayMediaChange),this.syncBusSubscription(),document.addEventListener("keydown",this.boundKeydown),this.addEventListener(k,this.boundFullHeightRequest),this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeBus(),this.overlayMediaQuery?.removeEventListener("change",this.boundOverlayMediaChange),document.removeEventListener("keydown",this.boundKeydown),this.removeEventListener(k,this.boundFullHeightRequest),this.stopAnchorTracking(),this.overlayActive&&(this.overlayActive=!1,this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel()),this.overlayReturnFocusTo=void 0}syncBusSubscription(){if(this.standalone||!this.isConnected){this.unsubscribeBus();return}this.busSubscribed||(y().subscribe("show-flyout",this.boundShowRequest),y().subscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!0)}unsubscribeBus(){this.busSubscribed&&(y().unsubscribe("show-flyout",this.boundShowRequest),y().unsubscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!1)}show(){this.open||(this.open=!0,this.dispatchEvent(new CustomEvent(f.FLYOUT_OPENED,{detail:{},bubbles:!0,composed:!0})))}close(e="programmatic"){if(this.open){if(this.open=!1,this.overlayActive)this.overlayReturnFocusTo=this.returnFocusTo;else{const t=this.focusIsInside();this.overlay.close(),t&&this.returnFocusTo?.focus()}this.returnFocusTo=void 0,this.dispatchEvent(new CustomEvent(f.FLYOUT_CLOSED,{detail:{reason:e},bubbles:!0,composed:!0}))}}toggle(){this.open?this.close():this.show()}handleShowRequest(e){this.shouldHandleShowRequest(e)&&(M(e),e.heading!==void 0&&(this.heading=e.heading),e.content!==void 0&&this.replaceChildren(typeof e.content=="string"?document.createTextNode(e.content):e.content),this.anchor=e.anchor,this.fullHeight=e.fullHeight??!1,this.returnFocusTo=e.returnFocusTo,this.show())}shouldHandleShowRequest(e){const t=v(this,"esp-page"),s=e.anchor??e.returnFocusTo;if(!s){if(!t)return!0;const i=this.getPageChain(t);return this.scope==="outermost"&&i[i.length-1]===t}const o=this.getPageChain(s);if(o.length===0)return t===null;const r=o.find(i=>this.hasNearestScopeFlyout(i)),n=r??o[o.length-1];return t!==n?!1:r?this.scope==="nearest":this.scope==="outermost"}getPageChain(e){const t=[];let s=e;for(;s;){const o=v(s,"esp-page");if(!o||t.includes(o))break;t.push(o),s=this.composedParent(o)}return t}hasNearestScopeFlyout(e){return Array.from(e.querySelectorAll("esp-flyout")).some(t=>!t.standalone&&t.scope==="nearest"&&v(t,"esp-page")===e)}handleKeydown(e){if(this.open){if(this.overlayActive&&e.key==="Tab"){this.overlay.trapFocus(e);return}e.key!=="Escape"||e.defaultPrevented||(e.preventDefault(),this.close("escape"))}}focusIsInside(){const e=document.activeElement;return e&&this.contains(e)?!0:this.shadowRoot?.activeElement!=null}updated(e){super.updated(e),e.has("standalone")&&this.syncBusSubscription(),e.has("heading")&&this.updateGeneratedAriaLabel(),(e.has("anchor")||e.has("fullHeight")||e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&(this.syncAnchorTracking(),this.syncAnchorGeometry()),(e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&this.syncOverlayModal(),(e.has("open")||e.has("mode")||e.has("anchor")||e.has("fullHeight")||e.has("pageOverlayRequested"))&&this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))}syncAnchorGeometry(){const e=v(this,"esp-page"),t=this.anchor?this.getPageChain(this.anchor):[],s=e?.shadowRoot?.querySelector(".esp-page-main"),o=this.panelRef.value;if(!this.open||this.effectiveOverlay||!o){this.clearAnchorGeometry();return}const r=this.getVisibleBlockBounds(),n=Math.max(0,r.bottom-r.top);if(this.setGeometryProperty("--_esp-flyout-max-block-size",`${n}px`),this.fullHeight){this.clearAnchorPlacementGeometry();return}if(!this.anchor||!e||!t.includes(e)||!s){this.clearAnchorGeometry();return}const i=this.anchor.getBoundingClientRect(),d=Math.max(0,i.top-s.getBoundingClientRect().top),c=Number.isFinite(i.height)?i.height:0;this.setGeometryProperty("--_esp-flyout-anchor-offset",`${d}px`),this.setGeometryProperty("--_esp-flyout-anchor-block-size",`${c}px`);const m=o.getBoundingClientRect().height||n,T=Math.max(0,i.top+m-r.bottom),C=Math.max(0,m-c),g=Math.min(T,C);this.setGeometryProperty("--_esp-flyout-viewport-shift",`${g}px`);const
|
|
34
|
+
`;let a=class extends A{constructor(){super(...arguments),this.open=!1,this.heading="",this.mode="auto",this.pageOverlayRequested=!1,this.fullHeight=!1,this.matchSurface=!1,this.standalone=!1,this.scope="outermost",this.lastGeneratedAriaLabel=null,this.boundKeydown=e=>this.handleKeydown(e),this.boundShowRequest=e=>this.handleShowRequest(e),this.boundCloseRequest=()=>this.close(),this.boundOverlayMediaChange=()=>{this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry(),this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))},this.boundAnchorViewportChange=()=>this.scheduleAnchorGeometrySync(),this.boundFullHeightRequest=e=>{e.stopPropagation(),this.fullHeight=!0},this.anchorGeometryFrame=new B(()=>this.syncAnchorGeometry()),this.trackingAnchorPosition=!1,this.busSubscribed=!1,this.panelRef=L(),this.overlay=new H({host:this,getFocusTrapContainer:()=>this.panelRef.value??null,getFocusFallback:()=>this.panelRef.value??null,promote:!1}),this.overlayActive=!1,this.baseRole="complementary"}get effectiveOverlay(){return this.mode==="overlay"||this.pageOverlayRequested||(this.overlayMediaQuery?.matches??!1)}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","complementary"),this.baseRole=this.getAttribute("role")??"complementary",!this.overlayMediaQuery&&typeof window<"u"&&"matchMedia"in window&&(this.overlayMediaQuery=window.matchMedia($)),this.overlayMediaQuery?.addEventListener("change",this.boundOverlayMediaChange),this.syncBusSubscription(),document.addEventListener("keydown",this.boundKeydown),this.addEventListener(k,this.boundFullHeightRequest),this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeBus(),this.overlayMediaQuery?.removeEventListener("change",this.boundOverlayMediaChange),document.removeEventListener("keydown",this.boundKeydown),this.removeEventListener(k,this.boundFullHeightRequest),this.stopAnchorTracking(),this.overlayActive&&(this.overlayActive=!1,this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel()),this.overlayReturnFocusTo=void 0}syncBusSubscription(){if(this.standalone||!this.isConnected){this.unsubscribeBus();return}this.busSubscribed||(y().subscribe("show-flyout",this.boundShowRequest),y().subscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!0)}unsubscribeBus(){this.busSubscribed&&(y().unsubscribe("show-flyout",this.boundShowRequest),y().unsubscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!1)}show(){this.open||(this.open=!0,this.dispatchEvent(new CustomEvent(f.FLYOUT_OPENED,{detail:{},bubbles:!0,composed:!0})))}close(e="programmatic"){if(this.open){if(this.open=!1,this.overlayActive)this.overlayReturnFocusTo=this.returnFocusTo;else{const t=this.focusIsInside();this.overlay.close(),t&&this.returnFocusTo?.focus()}this.returnFocusTo=void 0,this.dispatchEvent(new CustomEvent(f.FLYOUT_CLOSED,{detail:{reason:e},bubbles:!0,composed:!0}))}}toggle(){this.open?this.close():this.show()}handleShowRequest(e){this.shouldHandleShowRequest(e)&&(M(e),e.heading!==void 0&&(this.heading=e.heading),e.content!==void 0&&this.replaceChildren(typeof e.content=="string"?document.createTextNode(e.content):e.content),this.anchor=e.anchor,this.fullHeight=e.fullHeight??!1,this.returnFocusTo=e.returnFocusTo,this.show())}shouldHandleShowRequest(e){const t=v(this,"esp-page"),s=e.anchor??e.returnFocusTo;if(!s){if(!t)return!0;const i=this.getPageChain(t);return this.scope==="outermost"&&i[i.length-1]===t}const o=this.getPageChain(s);if(o.length===0)return t===null;const r=o.find(i=>this.hasNearestScopeFlyout(i)),n=r??o[o.length-1];return t!==n?!1:r?this.scope==="nearest":this.scope==="outermost"}getPageChain(e){const t=[];let s=e;for(;s;){const o=v(s,"esp-page");if(!o||t.includes(o))break;t.push(o),s=this.composedParent(o)}return t}hasNearestScopeFlyout(e){return Array.from(e.querySelectorAll("esp-flyout")).some(t=>!t.standalone&&t.scope==="nearest"&&v(t,"esp-page")===e)}handleKeydown(e){if(this.open){if(this.overlayActive&&e.key==="Tab"){this.overlay.trapFocus(e);return}e.key!=="Escape"||e.defaultPrevented||(e.preventDefault(),this.close("escape"))}}focusIsInside(){const e=document.activeElement;return e&&this.contains(e)?!0:this.shadowRoot?.activeElement!=null}updated(e){super.updated(e),e.has("standalone")&&this.syncBusSubscription(),e.has("heading")&&this.updateGeneratedAriaLabel(),(e.has("anchor")||e.has("fullHeight")||e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&(this.syncAnchorTracking(),this.syncAnchorGeometry()),(e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&this.syncOverlayModal(),(e.has("open")||e.has("mode")||e.has("anchor")||e.has("fullHeight")||e.has("pageOverlayRequested"))&&this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))}syncAnchorGeometry(){const e=v(this,"esp-page"),t=this.anchor?this.getPageChain(this.anchor):[],s=e?.shadowRoot?.querySelector(".esp-page-main"),o=this.panelRef.value;if(!this.open||this.effectiveOverlay||!o){this.clearAnchorGeometry();return}const r=this.getVisibleBlockBounds(),n=Math.max(0,r.bottom-r.top);if(this.setGeometryProperty("--_esp-flyout-max-block-size",`${n}px`),this.fullHeight){this.clearAnchorPlacementGeometry();return}if(!this.anchor||!e||!t.includes(e)||!s){this.clearAnchorGeometry();return}const i=this.anchor.getBoundingClientRect(),d=Math.max(0,i.top-s.getBoundingClientRect().top),c=Number.isFinite(i.height)?i.height:0;this.setGeometryProperty("--_esp-flyout-anchor-offset",`${d}px`),this.setGeometryProperty("--_esp-flyout-anchor-block-size",`${c}px`);const m=o.getBoundingClientRect().height||n,T=Math.max(0,i.top+m-r.bottom),C=Math.max(0,m-c),g=Math.min(T,C);this.setGeometryProperty("--_esp-flyout-viewport-shift",`${g}px`);const _=i.top-g,b=8,z=i.top+c/2,P=Math.min(Math.max(b,m-b),Math.max(b,z-_));this.setGeometryProperty("--_esp-flyout-anchor-marker-offset",`${P}px`)}getVisibleBlockBounds(){const e=window.visualViewport;let t=e?.offsetTop??0,s=t+(e?.height??window.innerHeight);for(let o=this.composedParent(this);o;o=this.composedParent(o)){const r=getComputedStyle(o).overflowY;if(r!=="auto"&&r!=="scroll")continue;const n=o.getBoundingClientRect(),i=o instanceof HTMLElement?o.clientTop:0,d=o instanceof HTMLElement?o.clientHeight:n.height;if(d<=0)continue;const c=n.top+i;t=Math.max(t,c),s=Math.min(s,c+d)}return{top:t,bottom:Math.max(t,s)}}composedParent(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}setGeometryProperty(e,t){this.style.getPropertyValue(e)!==t&&this.style.setProperty(e,t)}clearAnchorGeometry(){this.clearAnchorPlacementGeometry(),this.style.removeProperty("--_esp-flyout-max-block-size")}clearAnchorPlacementGeometry(){this.style.removeProperty("--_esp-flyout-anchor-offset"),this.style.removeProperty("--_esp-flyout-viewport-shift"),this.style.removeProperty("--_esp-flyout-anchor-block-size"),this.style.removeProperty("--_esp-flyout-anchor-marker-offset")}scheduleAnchorGeometrySync(){this.isConnected&&this.anchorGeometryFrame.schedule()}syncAnchorTracking(){if(!(this.isConnected&&this.open&&(!!this.anchor||this.fullHeight)&&!this.effectiveOverlay)){this.stopAnchorTracking();return}this.trackingAnchorPosition||(this.trackingAnchorPosition=!0,window.addEventListener("scroll",this.boundAnchorViewportChange,{capture:!0,passive:!0}),window.addEventListener("resize",this.boundAnchorViewportChange,{passive:!0}));const t=this.panelRef.value;t&&t!==this.observedAnchorPanel&&typeof ResizeObserver<"u"&&(this.anchorResizeObserver??=new ResizeObserver(this.boundAnchorViewportChange),this.anchorResizeObserver.disconnect(),this.anchorResizeObserver.observe(t),this.observedAnchorPanel=t)}stopAnchorTracking(){this.trackingAnchorPosition&&(window.removeEventListener("scroll",this.boundAnchorViewportChange,{capture:!0}),window.removeEventListener("resize",this.boundAnchorViewportChange),this.trackingAnchorPosition=!1),this.anchorGeometryFrame.cancel(),this.anchorResizeObserver?.disconnect(),this.observedAnchorPanel=void 0}syncOverlayModal(){const e=this.isConnected&&this.open&&this.effectiveOverlay;if(e===this.overlayActive){!e&&!this.open&&this.overlay.close();return}e?(this.overlayActive=!0,this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.updateGeneratedAriaLabel(),this.overlay.open(),this.updateComplete.then(()=>{this.overlayActive&&this.overlay.moveFocusInto()})):(this.overlayActive=!1,this.overlay.close(),this.overlayReturnFocusTo&&(this.overlayReturnFocusTo.focus(),this.overlayReturnFocusTo=void 0),this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel())}updateGeneratedAriaLabel(){const e=this.getAttribute("aria-label");if(e!==null&&e!==this.lastGeneratedAriaLabel)return;const t=this.heading||(this.overlayActive?V:"");t?(this.setAttribute("aria-label",t),this.lastGeneratedAriaLabel=t):(this.removeAttribute("aria-label"),this.lastGeneratedAriaLabel=null)}render(){return w`
|
|
35
35
|
<div class="vellum" aria-hidden="true" @click=${()=>this.close("vellum")}></div>
|
|
36
36
|
<div
|
|
37
37
|
class=${F({panel:!0,anchored:!!this.anchor,"full-height":this.fullHeight})}
|
|
@@ -87,7 +87,10 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
87
87
|
border-start-end-radius: var(--esp-flyout-radius, var(--esp-size-border-radius));
|
|
88
88
|
border-end-end-radius: var(--esp-flyout-radius, var(--esp-size-border-radius));
|
|
89
89
|
box-shadow: var(--esp-flyout-shadow, none);
|
|
90
|
-
font-family: var(
|
|
90
|
+
font-family: var(
|
|
91
|
+
--_esp-font-body-effective,
|
|
92
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
93
|
+
);
|
|
91
94
|
color: var(--esp-color-text);
|
|
92
95
|
|
|
93
96
|
&.anchored {
|
|
@@ -38,6 +38,7 @@ export declare const getGoogleFonts: () => Promise<Array<GoogleFont>>;
|
|
|
38
38
|
* on picker items to match the preview `@font-face` name.
|
|
39
39
|
*/
|
|
40
40
|
export declare const previewFontFamily: (family: string) => string;
|
|
41
|
+
export declare const getFontPreviewFamily: (font: FontPickerFont) => string;
|
|
41
42
|
/**
|
|
42
43
|
* Font picker component backed by the Google Fonts catalog by default.
|
|
43
44
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var u=function(t,e,o,
|
|
1
|
+
var u=function(t,e,o,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(l=t[c])&&(i=(n<3?l(i):n>3?l(e,o,i):l(e,o))||i);return n>3&&i&&Object.defineProperty(e,o,i),i};import"../pickers/esp-pick-one.js";import{customElement as E,property as m,state as G}from"lit/decorators.js";import{EspalierElementBase as L}from"../shared/esp-element-base.js";import{html as N}from"lit";import{getFallbackFont as V,removeRuntimeGoogleFontLink as A,syncRuntimeGoogleFontLink as x}from"../shared/font-helpers.js";import{fontFallbackAliases as D}from"../shared/font-plan.js";const w=[{family:"Arial / Helvetica",stack:"Arial, Helvetica, sans-serif",category:"sans-serif",kind:"web-safe"},{family:"Georgia / Times New Roman",stack:'Georgia, "Times New Roman", Times, serif',category:"serif",kind:"web-safe"},{family:"Verdana / Geneva",stack:"Verdana, Geneva, sans-serif",category:"sans-serif",kind:"web-safe"},{family:"Tahoma / Geneva",stack:"Tahoma, Geneva, sans-serif",category:"sans-serif",kind:"web-safe"},{family:"Trebuchet MS",stack:'"Trebuchet MS", Arial, sans-serif',category:"sans-serif",kind:"web-safe"},{family:"Courier New",stack:'"Courier New", Courier, monospace',category:"monospace",kind:"web-safe"},{family:"System Sans",stack:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',category:"sans-serif",kind:"web-safe"},{family:"System Serif",stack:'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',category:"serif",kind:"web-safe"},{family:"System Monospace",stack:'ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", "Courier New", monospace',category:"monospace",kind:"web-safe"}];let f,p=!1;const U=async()=>{if(f)return f;if(p){for(;!f;)await new Promise(s=>setTimeout(s,100));return f}p=!0;const t=document.getElementsByTagName("esp-root")[0];if(!t)throw new Error("<esp-font-picker> requires an <esp-root> ancestor. Wrap your application in <esp-root> to use the font picker.");const e=t.fontDefinitionsUrl||`${t.fontCSSRoot}font-definitions.json`,o=await fetch(e);if(!o.ok)throw p=!1,new Error(`Failed to load font definitions from ${e} (${o.status}). Run 'npm run build-fonts' to generate the font catalog.`);return f=await o.json(),f},k="esp-preview-",B=t=>`${k}${t}`,d=new Map,g=async t=>{if(d.has(t))return!0;try{const e=document.getElementsByTagName("esp-root")[0];if(!e)return!1;const o=t.replaceAll(" ","-"),s=await fetch(`${e.fontCSSRoot}${o}.css`);if(!s.ok)return!1;let n=await s.text();n=n.replace(/font-family:\s*'([^']+)'/g,(l,c)=>`font-family: '${k}${c}'`);const i=document.createElement("style");return i.textContent=n,i.dataset.font=t,document.head.appendChild(i),d.set(t,i),!0}catch(e){return console.warn(`Failed to load CSS for font ${t}:`,e),!1}},F=t=>{const e=d.get(t);e&&(e.remove(),d.delete(t))},v="data-esp-font-picker",b="data-esp-font-picker-root",I=t=>t.closest("esp-root"),R=t=>I(t)?.correlationId??"",M=(t,e)=>`link[${v}="${CSS.escape(t)}"][${b}="${CSS.escape(e)}"]`,C=(t,e)=>`picker:${e}:${t}`,S=(t,e)=>{if(!e)return;const o=I(t),s=o?.correlationId??"";if(o?.googleFontLoading==="none"){h(t,e);return}x({owner:C(e,s),family:e,enabled:!0,attributes:{[v]:e,[b]:s}})},h=(t,e)=>{if(!e)return;const o=R(t);Array.from(document.getElementsByTagName("esp-font-picker")).some(n=>R(n)===o&&n.fontSource==="google"&&n.value===e)||(A(C(e,o)),document.head.querySelector(M(e,o))?.remove())},_=t=>t.kind!=="web-safe",y=t=>_(t)?t.family:t.stack,O=t=>{if(!_(t))return t.stack;const e=D(t.family,400,t.category);return[`"${t.family}"`,...e,`"${B(t.family)}"`,V(t.category)].join(", ")},$=(t,e)=>t.filter(o=>{switch(e){case"not-display":return o.category!=="display";default:return o.category===e}});let r=class extends L{constructor(){super(...arguments),this.loadedFonts=new Set,this.formItemDescription=null,this.formItemLabel=null,this._rangeGeneration=0,this._initGeneration=0,this._fontsReady=Promise.resolve(),this.fonts=[],this.category=null,this.fontSource="google",this.value="",this.placeholder="Choose a font...",this.handleItemsInViewEvent=e=>{e.stopPropagation(),this.handleItemsInView(e.detail)}}focus(){this.shadowRoot?.querySelector("esp-pick-one")?.focus()}setFormItemDescription(e){this.formItemDescription=e,this.syncFormItemDescription()}setFormItemLabel(e){this.formItemLabel=e,this.syncFormItemDescription()}syncFormItemDescription(){const e=this.shadowRoot?.querySelector("esp-pick-one");e?.setFormItemDescription?.(this.formItemDescription),e?.setFormItemLabel?.(this.formItemLabel)}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this._fontsReady,e}firstUpdated(e){super.firstUpdated(e),this._fontsReady=this.initFonts()}updated(e){super.updated(e),this.syncFormItemDescription();const o=e.has("fontSource")&&e.get("fontSource")!==void 0,s=e.has("category")&&e.get("category")!==void 0;if(o||s){if(e.get("fontSource")==="google"&&this.fontSource==="web-safe"){const n=this.value;for(const i of this.loadedFonts)F(i);this.loadedFonts.clear(),this.value="",n&&h(this,n)}this._fontsReady=this.initFonts()}if(e.has("value")&&this.value&&this.fontSource==="google"){const n=e.get("value");n!==this.value&&this.ensureFontLoaded(this.value,n)}}async ensureFontLoaded(e,o){await g(e)&&this.loadedFonts.add(e),this.value===e&&(S(this,e),o&&o!==e&&h(this,o))}async initFonts(){const e=++this._initGeneration;if(this.fontSource==="web-safe"){this.fonts=this.category?$(w,this.category):w;return}const o=await U();if(!(e!==this._initGeneration||this.fontSource!=="google")&&(this.fonts=this.category?$(o,this.category):o,this.value&&this.fonts.some(s=>y(s)===this.value))){const s=this.value;if(await g(s)){if(e!==this._initGeneration||this.fontSource!=="google"||this.value!==s){F(s);return}this.loadedFonts.add(s)}if(e!==this._initGeneration||this.fontSource!=="google"||this.value!==s)return;S(this,s)}}async handleItemsInView(e){if(this.fontSource==="web-safe")return;const o=++this._rangeGeneration,s=3,n=e.items??[],i=new Set,l=Math.max(0,e.first),c=Math.min(e.last+s,n.length);for(let a=l;a<c;a++)i.add(n[a].value);for(const a of i)this.loadedFonts.has(a)||await g(a)&&this.loadedFonts.add(a);if(o!==this._rangeGeneration)return;const T=new Set(Array.from(document.getElementsByTagName("esp-font-picker")).map(a=>a.value).filter(Boolean));for(const a of this.loadedFonts)T.has(a)||i.has(a)||(this.loadedFonts.delete(a),F(a))}render(){return N`<esp-pick-one
|
|
2
2
|
typeahead
|
|
3
|
-
.pickerItems=${this.fonts.map(e=>({text:e.family,value:y(e),selected:this.value===y(e),styles:{fontFamily:
|
|
3
|
+
.pickerItems=${this.fonts.map(e=>({text:e.family,value:y(e),selected:this.value===y(e),styles:{fontFamily:O(e)}}))}
|
|
4
4
|
.value=${this.value}
|
|
5
5
|
.placeholder=${this.placeholder}
|
|
6
6
|
@esp-picker-menu-range-changed=${this.handleItemsInViewEvent}
|
|
7
|
-
@esp-value-changed=${async e=>{e.stopPropagation();const o=this.value;if(!e.detail){this.value="",o&&h(this,o),this.emitValueChanged(void 0);return}const
|
|
7
|
+
@esp-value-changed=${async e=>{e.stopPropagation();const o=this.value;if(!e.detail){this.value="",o&&h(this,o),this.emitValueChanged(void 0);return}const s=this.fonts.find(n=>y(n)===e.detail.value);this.value=e.detail.value,this.fontSource==="google"&&(await g(this.value)&&this.loadedFonts.add(this.value),S(this,this.value),o&&o!==this.value&&h(this,o)),this.emitValueChanged(s)}}
|
|
8
8
|
>
|
|
9
|
-
</esp-pick-one>`}};u([G()],r.prototype,"fonts",void 0),u([m({attribute:"category",type:String})],r.prototype,"category",void 0),u([m({attribute:"font-source",type:String})],r.prototype,"fontSource",void 0),u([m({type:String})],r.prototype,"value",void 0),u([m({type:String})],r.prototype,"placeholder",void 0),r=u([
|
|
9
|
+
</esp-pick-one>`}};u([G()],r.prototype,"fonts",void 0),u([m({attribute:"category",type:String})],r.prototype,"category",void 0),u([m({attribute:"font-source",type:String})],r.prototype,"fontSource",void 0),u([m({type:String})],r.prototype,"value",void 0),u([m({type:String})],r.prototype,"placeholder",void 0),r=u([E("esp-font-picker")],r);const J=()=>{f=void 0,p=!1;for(const t of document.head.querySelectorAll("style[data-font]"))t.remove();d.clear();for(const t of document.head.querySelectorAll(`link[${v}]`))t.remove()};export{r as EspalierFontPicker,w as WEB_SAFE_FONTS,O as getFontPreviewFamily,U as getGoogleFonts,B as previewFontFamily,J as resetFontCache};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=function(t,o,r,n){var s=arguments.length,e=s<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,r):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(t,o,r,n);else for(var a=t.length-1;a>=0;a--)(l=t[a])&&(e=(s<3?l(e):s>3?l(o,r,e):l(o,r))||e);return s>3&&e&&Object.defineProperty(o,r,e),e};import{css as h,html as d,nothing as p}from"lit";import{customElement as g,property as u}from"lit/decorators.js";import{EspalierElementBase as c}from"../shared/esp-element-base.js";const v="esp-footer-link-group-heading";let i=class extends c{constructor(){super(...arguments),this.heading=""}render(){return d`
|
|
2
2
|
<nav
|
|
3
3
|
part="nav"
|
|
4
|
-
aria-labelledby=${this.heading?
|
|
4
|
+
aria-labelledby=${this.heading?v:p}
|
|
5
5
|
aria-label=${this.heading?p:"Footer links"}
|
|
6
6
|
>
|
|
7
|
-
${this.heading?
|
|
7
|
+
${this.heading?d`<h2 part="heading" id=${v}>${this.heading}</h2>`:p}
|
|
8
8
|
<div part="links" class="links"><slot></slot></div>
|
|
9
9
|
</nav>
|
|
10
|
-
`}};i.styles=[...c.styles,
|
|
10
|
+
`}};i.styles=[...c.styles,h`
|
|
11
11
|
:host {
|
|
12
12
|
display: block;
|
|
13
13
|
min-inline-size: 0;
|
|
@@ -23,7 +23,13 @@ var d=function(t,o,r,n){var s=arguments.length,e=s<3?o:n===null?n=Object.getOwnP
|
|
|
23
23
|
h2 {
|
|
24
24
|
margin: 0;
|
|
25
25
|
color: var(--esp-footer-heading-color, var(--esp-color-headings));
|
|
26
|
-
font-family: var(
|
|
26
|
+
font-family: var(
|
|
27
|
+
--_esp-font-headings-effective,
|
|
28
|
+
var(
|
|
29
|
+
--esp-font-headings,
|
|
30
|
+
var(--_esp-font-body-effective, var(--esp-font-body, var(--_esp-font-body-fallback)))
|
|
31
|
+
)
|
|
32
|
+
);
|
|
27
33
|
font-size: var(--esp-type-normal);
|
|
28
34
|
font-weight: var(--esp-font-weight-headings);
|
|
29
35
|
line-height: 1.25;
|
|
@@ -54,4 +60,4 @@ var d=function(t,o,r,n){var s=arguments.length,e=s<3?o:n===null?n=Object.getOwnP
|
|
|
54
60
|
outline: var(--esp-footer-focus-outline, 2px solid var(--esp-color-link));
|
|
55
61
|
outline-offset: 3px;
|
|
56
62
|
}
|
|
57
|
-
`],
|
|
63
|
+
`],f([u({type:String})],i.prototype,"heading",void 0),i=f([g("esp-footer-link-group")],i);export{i as EspalierFooterLinkGroup};
|