@taprootio/espalier 7.3.0 → 7.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 +9 -0
- package/custom-elements.json +1432 -1230
- package/dist/badge/esp-badge.d.ts +39 -0
- package/dist/badge/esp-badge.js +35 -6
- package/dist/breadcrumbs/esp-breadcrumb.d.ts +1 -0
- package/dist/breadcrumbs/esp-breadcrumb.js +11 -3
- package/dist/breadcrumbs/esp-breadcrumbs.js +6 -6
- package/dist/cli/theme-check.js +2 -2
- package/dist/footer/esp-footer-link-group.js +11 -8
- package/dist/footer/esp-footer.d.ts +3 -3
- package/dist/footer/esp-footer.js +11 -9
- package/dist/footer/paint-registration.js +1 -1
- package/dist/root/esp-root.js +37 -7
- package/dist/root/helpers/compute-semantic-properties.js +1 -1
- package/dist/root/helpers/compute-theme-properties.js +1 -1
- package/dist/shared/color-engine.js +1 -1
- package/dist/shared/component-property-diagnostics.js +1 -1
- package/dist/shared/component-property-normalizer.js +1 -1
- package/dist/shared/esp-element-base.js +2 -2
- package/dist/shared/footer-ink-styles.js +18 -0
- package/dist/shared/footer-ink.js +1 -0
- package/dist/shared/paint-catalog.js +1 -1
- package/dist/shared/paint-fit.js +1 -1
- package/dist/shared/public-token-catalog.generated.js +1 -1
- package/dist/shared/settable-component-properties.js +1 -1
- package/dist/shared/theme-fit-report.d.ts +6 -4
- package/dist/shared/theme-fit-report.js +1 -1
- package/dist/testing/observe-paint.iife.js +2 -2
- package/espalier.css-data.json +47 -3
- package/espalier.token-manifest.json +190 -3
- package/package.json +1 -1
|
@@ -9,6 +9,16 @@ export type EspalierBadgeSize = "small" | "medium";
|
|
|
9
9
|
* constrains them. Leave enough inline space for critical status text
|
|
10
10
|
* that must remain fully visible.
|
|
11
11
|
*
|
|
12
|
+
* Put a badge inside an anchor and set `linked` for link styling. A
|
|
13
|
+
* small chain mark identifies the link without relying on color. In the
|
|
14
|
+
* light DOM under `esp-root`, add `data-esp-badge-link` to an anchor that
|
|
15
|
+
* contains only the badge to put the interaction paint and focus ring on it.
|
|
16
|
+
* The anchor owns navigation and keyboard focus.
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <a href="#badge" data-esp-badge-link><esp-badge linked>Soups</esp-badge></a>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
12
22
|
* ```html
|
|
13
23
|
* <div style="display: flex; flex-wrap: wrap; gap: var(--esp-size-tiny);">
|
|
14
24
|
* <esp-badge>Draft</esp-badge>
|
|
@@ -28,6 +38,33 @@ export type EspalierBadgeSize = "small" | "medium";
|
|
|
28
38
|
* @cssprop --esp-badge-color - Text color of a neutral badge. Defaults to
|
|
29
39
|
* `var(--esp-color-text)`. The theme fits it against the neutral badge
|
|
30
40
|
* background at APCA Lc 75 when either property is set in the theme.
|
|
41
|
+
* @cssprop --esp-badge-link-background - Resting fill of a linked badge.
|
|
42
|
+
* Defaults to `var(--esp-color-background)`.
|
|
43
|
+
* @cssprop --esp-badge-link-border-color - Resting border of a linked badge.
|
|
44
|
+
* Defaults to `var(--esp-color-link)`.
|
|
45
|
+
* @cssprop --esp-badge-link-color - Resting ink of a linked badge.
|
|
46
|
+
* Defaults to `var(--esp-color-link)`. The theme fits this ink against
|
|
47
|
+
* the resting fill at APCA Lc 75 when either property is set.
|
|
48
|
+
* @cssprop --esp-badge-link-hover-background - Hover fill of a linked badge.
|
|
49
|
+
* Defaults to `var(--esp-color-link-hover-bg)`.
|
|
50
|
+
* @cssprop --esp-badge-link-hover-border-color - Hover border of a linked badge.
|
|
51
|
+
* Defaults to `var(--esp-color-link-hover)`.
|
|
52
|
+
* @cssprop --esp-badge-link-hover-color - Hover ink of a linked badge.
|
|
53
|
+
* Defaults to `var(--esp-color-link-hover)`. The theme fits this ink
|
|
54
|
+
* against the hover fill at APCA Lc 75 when either property is set.
|
|
55
|
+
* @cssprop --esp-badge-link-focus-background - Focus fill of a linked badge.
|
|
56
|
+
* Defaults to `var(--esp-color-link-hover-bg)`.
|
|
57
|
+
* @cssprop --esp-badge-link-focus-border-color - Focus border of a linked badge.
|
|
58
|
+
* Defaults to `var(--esp-color-link-hover)`.
|
|
59
|
+
* @cssprop --esp-badge-link-focus-color - Keyboard focus ink of a linked badge
|
|
60
|
+
* inside the light DOM of `esp-root`.
|
|
61
|
+
* Defaults to `var(--esp-color-link-hover)`.
|
|
62
|
+
* The theme fits this ink against the focus fill at APCA Lc 75 when either
|
|
63
|
+
* property is set.
|
|
64
|
+
* @cssprop --esp-badge-link-focus-ring-color - Color of the outer keyboard
|
|
65
|
+
* focus ring on a badge inside a light-DOM anchor marked `data-esp-badge-link`.
|
|
66
|
+
* Defaults to `var(--esp-color-link)`. Choose a color with at least 3:1
|
|
67
|
+
* contrast against the surface surrounding the badge.
|
|
31
68
|
* @cssprop --esp-badge-border-color - Border color of a neutral badge.
|
|
32
69
|
* Defaults to `var(--esp-color-border)`.
|
|
33
70
|
* @cssprop --esp-badge-border-radius - Border radius of the badge
|
|
@@ -52,6 +89,8 @@ export declare class EspalierBadge extends EspalierElementBase {
|
|
|
52
89
|
*/
|
|
53
90
|
get size(): EspalierBadgeSize;
|
|
54
91
|
set size(value: EspalierBadgeSize | string | null);
|
|
92
|
+
/** Use the linked color set in place of the neutral and intent colors inside a native anchor. */
|
|
93
|
+
linked: boolean;
|
|
55
94
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
56
95
|
static styles: import("lit").CSSResult[];
|
|
57
96
|
}
|
package/dist/badge/esp-badge.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
<span part="badge" class=${
|
|
1
|
+
var l=function(s,e,o,i){var a=arguments.length,r=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,o,i);else for(var d=s.length-1;d>=0;d--)(n=s[d])&&(r=(a<3?n(r):a>3?n(e,o,r):n(e,o))||r);return a>3&&r&&Object.defineProperty(e,o,r),r};import{css as b,html as p,nothing as g}from"lit";import{customElement as v,property as c}from"lit/decorators.js";import{classMap as m}from"lit/directives/class-map.js";import{ref as f}from"lit/directives/ref.js";import{EspalierElementBase as h}from"../shared/esp-element-base.js";import{intentSurfaceTokens as u}from"../shared/style-fragments.js";import{syncNormalizedAttribute as k}from"../shared/attribute-helpers.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as z}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as _}from"../shared/svgs/render-sprite-icon.js";function w(s){return s==="medium"?"medium":"small"}let t=class extends h{constructor(){super(...arguments),this.intentEmitsTokens=!1,this.iconSlot=new z(this),this.sizeBacker="small",this.icon="",this.linked=!1}get size(){return this.sizeBacker}set size(e){const o=this.sizeBacker;this.sizeBacker=w(e),this.requestUpdate("size",o),k(this,"size",this.sizeBacker)}render(){const e=y(this.icon,this),o=this.iconSlot.hasSlottedIcon(),i=o||e.length>0,a={badge:!0,[`intent-${this.intent}`]:!0,[`size-${this.size}`]:!0,"has-icon":i};return p`
|
|
2
|
+
<span part="badge" class=${m(a)}>
|
|
3
3
|
<span part="icon" class="icon" aria-hidden="true">
|
|
4
4
|
<slot
|
|
5
5
|
name="icon"
|
|
6
|
-
${
|
|
6
|
+
${f(this.iconSlot.slotRef)}
|
|
7
7
|
@slotchange=${this.iconSlot.handleSlotChange}
|
|
8
8
|
></slot>
|
|
9
|
-
${!
|
|
9
|
+
${!o&&e?_(e):g}
|
|
10
10
|
</span>
|
|
11
11
|
<span part="label" class="label"><slot></slot></span>
|
|
12
|
+
${this.linked?p`<svg
|
|
13
|
+
class="link-mark"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
viewBox="0 0 24 24"
|
|
16
|
+
fill="none"
|
|
17
|
+
stroke="currentColor"
|
|
18
|
+
stroke-width="2"
|
|
19
|
+
stroke-linecap="round"
|
|
20
|
+
>
|
|
21
|
+
<path d="M9 15l6-6M11 6l1-1a5 5 0 0 1 7 7l-1 1M13 18l-1 1a5 5 0 0 1-7-7l1-1"></path>
|
|
22
|
+
</svg>`:g}
|
|
12
23
|
</span>
|
|
13
|
-
`}};
|
|
24
|
+
`}};t.styles=[...h.styles,u,b`
|
|
14
25
|
:host {
|
|
15
26
|
display: inline-flex;
|
|
16
27
|
max-width: 100%;
|
|
@@ -45,6 +56,18 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
|
|
|
45
56
|
--_esp-badge-color: var(--esp-badge-color, var(--esp-color-text));
|
|
46
57
|
}
|
|
47
58
|
|
|
59
|
+
:host([linked]) .badge {
|
|
60
|
+
--_esp-badge-background: var(--esp-badge-link-background, var(--esp-color-background));
|
|
61
|
+
--_esp-badge-border-color: var(--esp-badge-link-border-color, var(--esp-color-link));
|
|
62
|
+
--_esp-badge-color: var(--esp-badge-link-color, var(--esp-color-link));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([linked]:hover) .badge {
|
|
66
|
+
--_esp-badge-background: var(--esp-badge-link-hover-background, var(--esp-color-link-hover-bg));
|
|
67
|
+
--_esp-badge-border-color: var(--esp-badge-link-hover-border-color, var(--esp-color-link-hover));
|
|
68
|
+
--_esp-badge-color: var(--esp-badge-link-hover-color, var(--esp-color-link-hover));
|
|
69
|
+
}
|
|
70
|
+
|
|
48
71
|
.size-small {
|
|
49
72
|
gap: calc(var(--esp-size-tiny) / 2);
|
|
50
73
|
padding: calc(var(--esp-size-tiny) / 2) var(--esp-size-tiny);
|
|
@@ -66,6 +89,12 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
|
|
|
66
89
|
height: 1em;
|
|
67
90
|
}
|
|
68
91
|
|
|
92
|
+
.link-mark {
|
|
93
|
+
flex: none;
|
|
94
|
+
width: 1em;
|
|
95
|
+
height: 1em;
|
|
96
|
+
}
|
|
97
|
+
|
|
69
98
|
.has-icon .icon {
|
|
70
99
|
display: inline-flex;
|
|
71
100
|
}
|
|
@@ -81,4 +110,4 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
|
|
|
81
110
|
overflow: hidden;
|
|
82
111
|
text-overflow: ellipsis;
|
|
83
112
|
}
|
|
84
|
-
`],
|
|
113
|
+
`],l([c({type:String})],t.prototype,"icon",void 0),l([c({type:String,reflect:!0})],t.prototype,"size",null),l([c({type:Boolean,reflect:!0})],t.prototype,"linked",void 0),t=l([v("esp-badge")],t);export{t as EspalierBadge};
|
|
@@ -46,6 +46,7 @@ import { LitElement } from "lit";
|
|
|
46
46
|
* to recolor a single icon.
|
|
47
47
|
* @cssprop --esp-breadcrumb-separator-size - Width and height of a separator icon.
|
|
48
48
|
* Defaults to `var(--esp-size-normal-to-medium)`. The settable range is 0.5rem to 2rem.
|
|
49
|
+
* @cssprop --esp-breadcrumb-separator-stroke-width - Built-in line mark weight, from 0.5 to 6 in SVG units. Defaults to `2`.
|
|
49
50
|
* @docPageTitle Breadcrumb
|
|
50
51
|
* @docUrl /components/breadcrumbs/breadcrumb
|
|
51
52
|
* @menuGroup Navigation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,r,i);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(t=(n<3?l(t):n>3?l(e,r,t):l(e,r))||t);return n>3&&t&&Object.defineProperty(e,r,t),t};import{LitElement as u,css as
|
|
1
|
+
var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,r,i);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(t=(n<3?l(t):n>3?l(e,r,t):l(e,r))||t);return n>3&&t&&Object.defineProperty(e,r,t),t};import{LitElement as u,css as d,html as h}from"lit";import{customElement as m,property as p}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{unsafeSVG as v}from"lit/directives/unsafe-svg.js";let a=class extends u{constructor(){super(...arguments),this.label="",this.url="",this.automaticSeparator="",this.isLastElement=!1}get separator(){return this.authoredSeparator===void 0?this.automaticSeparator:this.authoredSeparator}set separator(e){const r=this.separator;this.authoredSeparator=e,this.requestUpdate("separator",r)}setAutomaticSeparator(e){const r=this.separator;this.automaticSeparator=e,this.authoredSeparator||(this.authoredSeparator=void 0),this.requestUpdate("separator",r)}_renderLink(){return this.url?h`<a href=${this.url}>${this.label}</a>`:h`<span aria-current="page">${this.label}</span>`}render(){const e={crumb:!0,"is-current":!this.url};return h`<div class=${b(e)}>
|
|
2
2
|
${this._renderLink()}${this.separator?v(this.separator):""}
|
|
3
|
-
</div>`}};a.styles=
|
|
3
|
+
</div>`}};a.styles=d`
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
display: block;
|
|
@@ -58,4 +58,12 @@ var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnP
|
|
|
58
58
|
height: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
|
|
59
59
|
width: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
svg[data-built-in-stroke] {
|
|
63
|
+
stroke-width: var(--esp-breadcrumb-separator-stroke-width, 2);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host(:dir(rtl)) svg[data-mirror-rtl] {
|
|
67
|
+
scale: -1 1;
|
|
68
|
+
}
|
|
69
|
+
`,o([p({type:String})],a.prototype,"label",void 0),o([p({type:String})],a.prototype,"url",void 0),o([p({type:String,noAccessor:!0})],a.prototype,"separator",null),o([p({attribute:"is-last-element",type:Boolean})],a.prototype,"isLastElement",void 0),a=o([m("esp-breadcrumb")],a);export{a as EspalierBreadcrumb};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var p=function(l,t,s
|
|
1
|
+
var p=function(l,t,a,s){var n=arguments.length,e=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,a):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(l,t,a,s);else for(var i=l.length-1;i>=0;i--)(r=l[i])&&(e=(n<3?r(e):n>3?r(t,a,e):r(t,a))||e);return n>3&&e&&Object.defineProperty(t,a,e),e};import{css as v,html as w}from"lit";import{customElement as g,property as d}from"lit/decorators.js";import{EspalierElementBase as h}from"../shared/esp-element-base.js";import{createRef as b,ref as S}from"lit/directives/ref.js";import{BREADCRUMB_SEPARATOR_STYLES as m,BREADCRUMB_TRAIL_ENDS as c}from"./breadcrumb-separators.js";import{EspalierBreadcrumb as y}from"./esp-breadcrumb.js";export*from"./esp-breadcrumb.js";const E=`<svg aria-hidden="true" data-mirror-rtl xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
2
2
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
3
3
|
<path
|
|
4
4
|
d="M12.089 3.634a2 2 0 0 0 -1.089 1.78l-.001 2.586h-6.999a2 2 0 0 0 -2 2v4l.005 .15a2 2 0 0 0 1.995 1.85l6.999 -.001l.001 2.587a2 2 0 0 0 3.414 1.414l6.586 -6.586a2 2 0 0 0 0 -2.828l-6.586 -6.586a2 2 0 0 0 -2.18 -.434l-.145 .068z" />
|
|
5
|
-
</svg>`,x=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
5
|
+
</svg>`,x=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
6
6
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
7
7
|
<path
|
|
8
8
|
d="M10 2l-.15 .005a2 2 0 0 0 -1.85 1.995v6.999l-2.586 .001a2 2 0 0 0 -1.414 3.414l6.586 6.586a2 2 0 0 0 2.828 0l6.586 -6.586a2 2 0 0 0 .434 -2.18l-.068 -.145a2 2 0 0 0 -1.78 -1.089l-2.586 -.001v-6.999a2 2 0 0 0 -2 -2h-4z"
|
|
9
9
|
/>
|
|
10
|
-
</svg>`;function
|
|
10
|
+
</svg>`;function f(l,t){return`<svg aria-hidden="true" data-built-in-stroke${t?" data-mirror-rtl":""} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
|
|
11
11
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
12
12
|
<path d="${l}" />
|
|
13
|
-
</svg>`}const B={"arrow-filled":E,chevron:
|
|
13
|
+
</svg>`}const B={"arrow-filled":E,chevron:f("M9 6l6 6-6 6",!0),"line-arrow":f("M5 12h14m-6-6 6 6-6 6",!0),slash:f("M15 5l-6 14",!1),none:""};let o=class extends h{constructor(){super(...arguments),this.itemsSlot=b(),this.ariaLabel=null,this.separatorStyle=m[0],this.trailEnd=c[0]}updated(t){super.updated(t),(t.has("separatorStyle")||t.has("trailEnd"))&&this.assignSeparators()}assignSeparators(){const t=this.itemsSlot.value?.assignedElements().filter(r=>r instanceof y)??[],a=m.find(r=>r===this.separatorStyle)??m[0],s=B[a],n={"arrow-down-filled":x,same:s,none:""},e=c.find(r=>r===this.trailEnd)??c[0];for(const[r,i]of t.entries()){const u=r===t.length-1;i.isLastElement=u,i.setAutomaticSeparator(u?n[e]:s)}}render(){return w`
|
|
14
14
|
<nav aria-label=${this.ariaLabel??"Breadcrumb"}>
|
|
15
15
|
<slot ${S(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
|
|
16
16
|
</nav>
|
|
17
|
-
`}};
|
|
17
|
+
`}};o.styles=[...h.styles,v`
|
|
18
18
|
nav {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-wrap: wrap;
|
|
@@ -22,4 +22,4 @@ var p=function(l,t,s,o){var n=arguments.length,r=n<3?t:o===null?o=Object.getOwnP
|
|
|
22
22
|
gap: var(--esp-size-tiny-to-small);
|
|
23
23
|
font-size: var(--esp-size-small-to-normal);
|
|
24
24
|
}
|
|
25
|
-
`],p([
|
|
25
|
+
`],p([d({attribute:"aria-label",type:String})],o.prototype,"ariaLabel",void 0),p([d({attribute:"separator-style",type:String})],o.prototype,"separatorStyle",void 0),p([d({attribute:"trail-end",type:String})],o.prototype,"trailEnd",void 0),o=p([g("esp-breadcrumbs")],o);export{o as EspalierBreadcrumbs};
|
package/dist/cli/theme-check.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{encodeTheme as W,isObjectRecord as d,isSemanticColorName as j,parseAnchorSource as
|
|
2
|
-
`)}catch(c){return t.error(`Cannot write ${e.updateExpect}: ${c instanceof Error?c.message:String(c)}`),2}i(`Wrote fit tables to ${e.updateExpect}.`)}if(e.expect!==void 0){let c;try{c=t.readFile(e.expect)}catch{return t.error(`Expected fit tables not found at ${e.expect} \u2014 create them with --update-expect ${e.expect}.`),2}let a;try{a=JSON.parse(c)}catch{return t.error(`${e.expect} is not JSON.`),2}if(!ke(a))return t.error(`${e.expect} is not a fit-table suite \u2014 regenerate it with --update-expect ${e.expect}.`),2;for(const u of[...a.light,...a.dark])u.componentProperties??=[];const f=Oe(a,n);if(f.length>0){s>0&&ze(n,s,t);for(const u of f)t.error(`drift: ${u}`);return t.error(`Fit tables drifted from ${e.expect} (${f.length} difference(s)). Review, then refresh deliberately with --update-expect.`),1}i(`Fit tables match ${e.expect}.`)}return e.json?(t.log(JSON.stringify(n,null,2)),s>0?1:0):(We(n,s,t),s>0?1:0)}function ke(e){if(!d(e)||!L.every(({field:r,kind:o})=>S(e[String(r)],o)))return!1;const t=e;if(!I(t.surfaces))return!1;for(const r of["light","dark"]){const n=t.paletteLints[r].map(k);if(!I(n))return!1;const s=t[r],i=new Set;for(const c of s){if(!xe(c,r)||!t.surfaces.includes(c.surface)||i.has(c.surface))return!1;i.add(c.surface)}}return!0}function U(e){return typeof e=="number"&&Number.isFinite(e)}function Ee(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function I(e){return new Set(e).size===e.length}function Te(e){return d(e)&&V.every(({field:t,kind:r})=>S(e[String(t)],r))}function _e(e){return d(e)&&K.every(({field:t,kind:r})=>S(e[String(t)],r))}function Fe(e){return d(e)&&P.every(({field:t,kind:r})=>S(e[String(t)],r))}const G=new Set(["requested","adjusted","apca","targetLc"]);function Le(e){if(!d(e)||!R(e.name))return!1;const t=de[e.name].pairsWith!==void 0;return!t&&(e.authored===null||Object.keys(e).some(r=>G.has(r)))||t&&(!U(e.targetLc)||e.targetLc<=0)?!1:N.every(({field:r,kind:o})=>!t&&G.has(r)||S(e[r],o))}function Ae(e){if(e===null||typeof e=="string")return!0;if(!d(e)||Object.keys(e).length!==2)return!1;const{source:t,lightness:r}=e;if(!ge(r)&&he(r)===null)return!1;if(le(t))return!0;const o=typeof t=="string"?v(t):null;return o!==null&&z(o.name)&&(o.slot===void 0||z(o.slot))}function S(e,t){switch(t){case"anchor":return e===void 0||J(e,M);case"anchor-record":return d(e)&&Object.keys(e).every(pe)&&Object.values(e).every(r=>typeof r=="string");case"apca":return e===void 0||J(e,D);case"boolean":return typeof e=="boolean";case"component-apca":return J(e,H);case"component-property-array":return e===void 0||Array.isArray(e)&&e.every(Le);case"component-property-name":return R(e);case"component-property-value":return Ae(e);case"contrast-ground":return typeof e=="string"&&(me.has(e)||R(e));case"data-palette-record":return d(e)?["light","dark"].every(r=>{const o=e[r];return d(o)&&w.every(n=>typeof o[n]=="string")}):!1;case"explicit":return e===void 0||re.includes(e);case"fit-lint-id":return ne.includes(e);case"fit-lint-token-array":return Array.isArray(e)&&e.every(r=>j(r)||R(r));case"lint-array":return Array.isArray(e)&&e.every(_e);case"message":case"string":return typeof e=="string";case"number":return U(e);case"paint-record":return e===void 0||Ie(e);case"pairing":return e===void 0||ie.includes(e);case"palette-lint-id":return te.includes(e);case"palette-lint-record":return d(e)&&["light","dark"].every(r=>Array.isArray(e[r])&&e[r].every(Te));case"report-array":return Array.isArray(e);case"scheme":return e==="light"||e==="dark";case"semantic":return j(e);case"semantic-array":return Array.isArray(e)&&e.every(j);case"series-pair":return we(e);case"simulation":return ce.includes(e);case"string-array":return Ee(e);case"token-array":return Array.isArray(e)&&e.every(Fe);case"warning":return oe.includes(e);default:{const r=t;return!1}}}function Ie(e){return d(e)?["light","dark"].every(t=>{const r=e[t];if(!Array.isArray(r))return!1;const o=new Set;for(const n of r){if(!d(n)||!A(n.role)||o.has(n.role)||n.context!==null&&!A(n.context)||!Array.isArray(n.pairs)||!Array.from(n.pairs).every(Pe))return!1;o.add(n.role)}return!0}):!1}function Pe(e){return d(e)&&A(e.element)&&A(e.foreground)&&A(e.background)&&A(e.state)&&fe(e.kind)&&U(e.ratio)&&e.ratio>=1&&e.ratio<=21&&e.required===ue(e.kind)}function J(e,t){return d(e)&&t.every(({field:r,kind:o})=>S(e[String(r)],o))}function we(e){if(!Array.isArray(e)||e.length!==2)return!1;const t=w.indexOf(e[0]),r=w.indexOf(e[1]);return t>=0&&r>t}function xe(e,t){if(!d(e)||!F.every(({field:n,kind:s})=>S(e[String(n)],s)))return!1;const r=e;if(r.scheme!==t)return!1;const o=r.componentProperties??[];return o.every(n=>n.surface===r.surface)&&I(o.map(n=>n.name))&&I(r.tokens.map(n=>n.token))&&I(r.adjustedTokens)&&I(r.lints.map(n=>n.id))}function Oe({paint:e,...t},{paint:r,...o}){const n=[];for(const i of L)i.compared&&Ce(n,i,t,o);return($(Q(t))!==$(Q(o))||n.length===0&&$(t)!==$(o))&&n.push("fit tables differ outside compared fields"),n}function Ce(e,t,r,o){const{field:n,kind:s}=t;if(s==="string-array"){const i=r[n],c=o[n];Y(e,String(n),i,c),E(e,String(n),i,c);return}if(s==="data-palette-record"){const i=r[n],c=o[n];for(const a of["light","dark"])for(const f of w)B(e,`${a}/${String(n)}/${f}`,i[a][f],c[a][f]);return}if(s==="palette-lint-record"){const i=r[n],c=o[n];for(const a of["light","dark"])He(e,a,String(n),i[a],c[a]),E(e,`${a}/${String(n)}`,i[a].map(k),c[a].map(k));return}if(s==="report-array"&&(n==="light"||n==="dark")){Ne(e,n,r[n],o[n]);return}T(e,"fit tables",String(n),r[n],o[n],s)}function Ne(e,t,r,o){const n=new Map(r.map(i=>[i.surface,i])),s=new Map(o.map(i=>[i.surface,i]));E(e,`${t}/reports`,r.map(i=>i.surface),o.map(i=>i.surface));for(const i of _(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: surface ${c?"removed":"added"}`);continue}Re(e,f,c,a)}}function Re(e,t,r,o){for(const n of F){const{compared:s,field:i,kind:c}=n;if(!(!s||i==="scheme"||i==="surface")){if(c==="anchor-record"){Ve(e,`${t}/${String(i)}`,r[i],o[i]);continue}if(c==="semantic-array"){const a=r[i],f=o[i];Y(e,`${t}/${String(i)}`,a,f),E(e,`${t}/${String(i)}`,a,f);continue}if(c==="lint-array"){const a=r[i],f=o[i];De(e,t,String(i),a,f),E(e,`${t}/${String(i)}`,a.map(u=>u.id),f.map(u=>u.id));continue}if(c==="component-property-array"){be(e,`${t}/${String(i)}`,r.componentProperties,o.componentProperties);continue}if(c==="token-array"){je(e,t,String(i),r[i],o[i]);continue}T(e,t,String(i),r[i],o[i],c)}}}function be(e,t,r,o){const n=new Map(r.map(i=>[i.name,i])),s=new Map(o.map(i=>[i.name,i]));E(e,t,[...n.keys()],[...s.keys()]);for(const i of _(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: property ${c?"removed":"added"}`);continue}for(const{compared:u,field:l,kind:p}of N)!u||l==="name"||(l==="apca"?q(e,f,l,c.apca,a.apca,H):T(e,f,l,c[l],a[l],p))}}function je(e,t,r,o,n){const s=new Map(o.map(a=>[a.token,a])),i=new Map(n.map(a=>[a.token,a]));E(e,`${t}/${r}`,o.map(a=>a.token),n.map(a=>a.token));const c=r==="tokens"?t:`${t}/${r}`;for(const a of _(s.keys(),i.keys())){const f=s.get(a),u=i.get(a),l=`${c}/${a}`;if(!f||!u){e.push(`${l}: token ${f?"removed":"added"}`);continue}Me(e,l,f,u)}}function Me(e,t,r,o){for(const{compared:n,field:s,kind:i}of P)if(!(!n||s==="token")){if(i==="anchor"){q(e,t,"anchor",r.anchor,o.anchor,M);continue}if(i==="apca"){q(e,t,"apca",r.apca,o.apca,D);continue}T(e,t,String(s),r[s],o[s],i)}}function q(e,t,r,o,n,s){const i=o,c=n;for(const{compared:a,field:f,kind:u}of s)a&&T(e,t,`${r}.${String(f)}`,i?.[f],c?.[f],u)}function De(e,t,r,o,n){const s=new Map(o.map(c=>[c.id,c])),i=new Map(n.map(c=>[c.id,c]));for(const c of _(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:C}of K)if(!(!l||p==="id")){if(C==="fit-lint-token-array"){Ke(e,u,String(p),a[p],f[p]);continue}T(e,u,String(p),a[p],f[p],C)}}}function He(e,t,r,o,n){const s=new Map(o.map(c=>[k(c),c])),i=new Map(n.map(c=>[k(c),c]));for(const c of _(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:C}of V)!l||p==="id"||p==="series"||p==="simulation"||T(e,u,String(p),a[p],f[p],C)}}function k(e){return`${e.id}/${e.series[0]}+${e.series[1]}/${e.simulation}`}function Ve(e,t,r,o){for(const n of _(Object.keys(r),Object.keys(o)))B(e,`${t}/${n}`,r[n],o[n])}function Y(e,t,r,o){const n=new Set(r),s=new Set(o);for(const i of _(n,s))n.has(i)!==s.has(i)&&e.push(`${t}/${i}: ${n.has(i)?"removed":"added"}`)}function E(e,t,r,o){const n=new Set(r),s=new Set(o),i=r.filter(a=>s.has(a)),c=o.filter(a=>n.has(a));i.some((a,f)=>a!==c[f])&&e.push(`${t}: order changed`)}function Ke(e,t,r,o,n){const s=Math.max(o.length,n.length);for(let i=0;i<s;i+=1)X(e,t,`${r}[${i}]`,o[i],n[i])}function B(e,t,r,o){r!==o&&e.push(`${t}: ${b(r)} \u2192 ${b(o)}`)}function X(e,t,r,o,n,s){if(!Object.is(o,n)){if(s==="message"){e.push(`${t}: message changed`);return}e.push(`${t}: ${r} ${b(o)} \u2192 ${b(n)}`)}}function Ue(e,t,r,o,n){$(o)!==$(n)&&e.push(`${t}: ${r} changed`)}function T(e,t,r,o,n,s){if(qe(s)){X(e,t,r,o,n,s);return}Ue(e,t,r,o,n)}const Je={anchor:!1,"anchor-record":!1,apca:!1,boolean:!0,"component-apca":!1,"component-property-array":!1,"component-property-name":!0,"component-property-value":!1,"contrast-ground":!0,"data-palette-record":!1,explicit:!0,"fit-lint-id":!0,"fit-lint-token-array":!1,"lint-array":!1,message:!0,number:!0,"paint-record":!1,pairing:!0,"palette-lint-id":!0,"palette-lint-record":!1,"report-array":!1,scheme:!0,semantic:!0,"semantic-array":!1,"series-pair":!1,simulation:!0,string:!0,"string-array":!1,"token-array":!1,warning:!0};function qe(e){return Je[e]===!0}function b(e){return e===void 0?"(absent)":e===""?'""':String(e)}function _(e,t){return[...new Set([...e,...t])].sort()}function $(e){return Array.isArray(e)?`[${e.map($).join(",")}]`:d(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${$(e[t])}`).join(",")}}`:JSON.stringify(e)??"undefined"}function Q(e){const t=g(e,h(L)),r=["light","dark"];if(y(L,"dataPalette")){const o=g(e.dataPalette,r);for(const n of r)m(o,n,g(e.dataPalette[n],w));m(t,"dataPalette",o)}if(y(L,"paletteLints")){const o=g(e.paletteLints,r);for(const n of r)m(o,n,Z(e.paletteLints[n],k,h(V)));m(t,"paletteLints",o)}for(const o of r){if(!y(L,o))continue;const n=O();for(const s of e[o]){const i=g(s,h(F));if(y(F,"tokens")){const c=O();for(const a of s.tokens){const f=g(a,h(P));a.anchor&&y(P,"anchor")&&m(f,"anchor",g(a.anchor,h(M))),a.apca&&y(P,"apca")&&m(f,"apca",g(a.apca,h(D))),m(c,a.token,f)}m(i,"tokens",c)}if(y(F,"componentProperties")){const c=O();for(const a of s.componentProperties){const f=g(a,h(N));a.apca&&y(N,"apca")&&m(f,"apca",g(a.apca,h(H))),m(c,a.name,f)}m(i,"componentProperties",c)}y(F,"lints")&&m(i,"lints",Z(s.lints,c=>c.id,h(K))),m(n,s.surface,i)}m(t,o,n)}return t}function Z(e,t,r){const o=O();for(const n of e)m(o,t(n),g(n,r));return o}function h(e){return e.filter(({compared:t})=>t).map(({field:t})=>t)}function y(e,t){return e.some(r=>r.field===t&&r.compared)}function g(e,t){const r=new Set(t.map(String)),o=O();for(const[n,s]of Object.entries(e))r.has(n)||(o[n]=s);return o}function O(){return Object.create(null)}function m(e,t,r){Object.keys(r).length>0&&(e[t]=r)}function We(e,t,r){for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.log(` ${o} lint(${n.id}): ${n.message}`);for(const n of e[o]){r.log(Be(o,n));for(const s of n.lints)r.log(` lint(${s.id}): ${s.message}`)}}r.log(`Checked ${e.surfaces.length} surface(s) \xD7 2 schemes \u2014 `+(t===0?"no lints.":`${t} lint(s), listed above.`))}function ze(e,t,r){r.error(`${t} theme lint(s) are standing while fit-table drift is present:`);for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.error(`lint: ${o}/paletteLints/${k(n)}: ${n.message}`);for(const n of e[o])for(const s of n.lints)r.error(`lint: ${o}/${n.surface}/lints/${s.id}: ${s.message}`)}}function Ge(e){return[...e.light,...e.dark].reduce((r,o)=>r+o.lints.length,0)+e.paletteLints.light.length+e.paletteLints.dark.length}function Ye(e,t){return["light","dark"].some(r=>{const o=`${r}: `;if(!e.startsWith(o))return!1;const n=e.slice(o.length);return t.paletteLints[r].some(s=>ae(n,s))})}function Be(e,t){const r=t.adjustedTokens.length===0?"contrast enforcement moved nothing":`contrast enforcement moved ${t.adjustedTokens.join(", ")}`,o=t.tokens.filter(s=>s.explicit==="inherited").length,n=o===0?"":`; ${o} inherited explicit pin(s) \u2014 see the fit tables`;return`${e}/${t.surface}: ${t.tokens.length} tokens, ${r}${n}.`}export{ot as runEspalierCli};
|
|
1
|
+
import{encodeTheme as W,isObjectRecord as d,isSemanticColorName as j,parseAnchorSource as ee,validateThemePair as te}from"../shared/theme.js";import{THEME_FIT_ANCHOR_FIELDS as M,THEME_FIT_APCA_FIELDS as D,THEME_FIT_COMPONENT_APCA_FIELDS as H,THEME_FIT_COMPONENT_PROPERTY_FIELDS as R,THEME_FIT_DATA_PALETTE_LINT_FIELDS as K,THEME_FIT_DATA_PALETTE_LINT_IDS as re,THEME_FIT_EXPLICIT_VALUES as ne,THEME_FIT_LINT_FIELDS as V,THEME_FIT_LINT_IDS as oe,THEME_FIT_LINT_SEVERITIES as ie,THEME_FIT_PAIRING_VALUES as se,THEME_FIT_REPORT_FIELDS as A,THEME_FIT_SUITE_FIELDS as L,THEME_FIT_TOKEN_FIELDS as P,themeFitReportSuite as ce}from"../shared/theme-fit-report.js";import{COLOR_VISION_SIMULATIONS as ae,DATA_SERIES_KEYS as w,isPaletteCollisionDescription as fe}from"../shared/data-colors.js";import{isPaintKind as ue,isPaintName as I}from"../shared/paint-catalog.js";import{FOOTER_HEADING_INK as pe,FOOTER_LINK_INK as de}from"../shared/footer-ink.js";import{paintRequiredRatio as me}from"../shared/paint-color.js";import{isSafeKey as le}from"../shared/unsafe-keys.js";import{isSettableComponentPropertyName as C,SETTABLE_COMPONENT_PROPERTIES as ge,SEMANTIC_COLOR_PROPERTIES as he}from"../shared/settable-component-properties.js";import{isColorSource as ye,isLightnessKey as $e,isThemeSlug as z,toneReferenceName as Se}from"../shared/theme-mapping-grammar.js";const O="usage: espalier theme check <theme.json> [--json] [--expect <fit.json>] [--update-expect <fit.json>]";function ct(e,t){const[r,o,...n]=e;if(r!=="theme"||o!=="check")return t.error(O),2;const s=ke(n,t);return s?Ee(s,t):2}function ke(e,t){const r={file:"",json:!1};for(let o=0;o<e.length;o+=1){const n=e[o];if(n==="--json")r.json=!0;else if(n==="--expect"||n==="--update-expect"){const s=e[o+1];if(s===void 0)return t.error(`${n} requires a file path. ${O}`),null;n==="--expect"?r.expect=s:r.updateExpect=s,o+=1}else if(!n.startsWith("--")&&r.file==="")r.file=n;else return t.error(`Unknown argument "${n}". ${O}`),null}return r.file===""?(t.error(O),null):r.expect!==void 0&&r.updateExpect!==void 0?(t.error(`--expect checks the committed fit tables and --update-expect rewrites them \u2014 pick one. ${O}`),null):r}function Te(e,t){let r;try{r=t.readFile(e)}catch(s){return t.error(`Cannot read ${e}: ${s instanceof Error?s.message:String(s)}`),null}let o;try{o=JSON.parse(r)}catch(s){return t.error(`${e} is not JSON: ${s instanceof Error?s.message:String(s)}`),null}if(typeof o!="object"||o===null||Array.isArray(o))return t.error(`${e} must contain a theme object.`),null;const n=o;if("light"in n||"dark"in n){for(const s of["light","dark"]){const i=n[s];if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))return t.error(`${e}: "${s}" must be a theme object.`),null}return{light:n.light??{},dark:n.dark??{}}}return{light:n,dark:n}}function Ee(e,t){const r=Te(e.file,t);if(!r)return 2;const o=te(W(r.light),W(r.dark));if(!o.valid){for(const c of o.warnings)t.error(`warning: ${c}`);for(const c of o.errors)t.error(`error: ${c}`);return t.error(`${e.file}: ${o.errors.length} validation error(s).`),1}const n=ce(r.light,r.dark);for(const c of o.warnings)Xe(c,n)||t.error(`warning: ${c}`);const s=Be(n),i=e.json?t.error:t.log;if(e.updateExpect!==void 0){try{t.writeFile(e.updateExpect,`${JSON.stringify(n,null,2)}
|
|
2
|
+
`)}catch(c){return t.error(`Cannot write ${e.updateExpect}: ${c instanceof Error?c.message:String(c)}`),2}i(`Wrote fit tables to ${e.updateExpect}.`)}if(e.expect!==void 0){let c;try{c=t.readFile(e.expect)}catch{return t.error(`Expected fit tables not found at ${e.expect} \u2014 create them with --update-expect ${e.expect}.`),2}let a;try{a=JSON.parse(c)}catch{return t.error(`${e.expect} is not JSON.`),2}if(!_e(a))return t.error(`${e.expect} is not a fit-table suite \u2014 regenerate it with --update-expect ${e.expect}.`),2;for(const u of[...a.light,...a.dark])u.componentProperties??=[];const f=Re(a,n);if(f.length>0){s>0&&Ye(n,s,t);for(const u of f)t.error(`drift: ${u}`);return t.error(`Fit tables drifted from ${e.expect} (${f.length} difference(s)). Review, then refresh deliberately with --update-expect.`),1}i(`Fit tables match ${e.expect}.`)}return e.json?(t.log(JSON.stringify(n,null,2)),s>0?1:0):(Ge(n,s,t),s>0?1:0)}function _e(e){if(!d(e)||!L.every(({field:r,kind:o})=>k(e[String(r)],o)))return!1;const t=e;if(!S(t.surfaces))return!1;for(const r of["light","dark"]){const n=t.paletteLints[r].map(T);if(!S(n))return!1;const s=t[r],i=new Set;for(const c of s){if(!Ne(c,r)||!t.surfaces.includes(c.surface)||i.has(c.surface))return!1;i.add(c.surface)}}return!0}function U(e){return typeof e=="number"&&Number.isFinite(e)}function Fe(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function S(e){return new Set(e).size===e.length}function Ae(e){return d(e)&&K.every(({field:t,kind:r})=>k(e[String(t)],r))}function Le(e){return d(e)&&V.every(({field:t,kind:r})=>k(e[String(t)],r))}function G(e){return d(e)&&P.every(({field:t,kind:r})=>k(e[String(t)],r))}const Y=new Set(["requested","adjusted","apca","targetLc"]);function Ie(e){if(!d(e)||!C(e.name))return!1;const t=ge[e.name].pairsWith!==void 0;return!t&&(e.authored===null||Object.keys(e).some(r=>Y.has(r)))||t&&(!U(e.targetLc)||e.targetLc<=0)?!1:R.every(({field:r,kind:o})=>!t&&Y.has(r)||k(e[r],o))}function Pe(e){if(e===null||typeof e=="string")return!0;if(!d(e)||Object.keys(e).length!==2)return!1;const{source:t,lightness:r}=e;if(!$e(r)&&Se(r)===null)return!1;if(ye(t))return!0;const o=typeof t=="string"?ee(t):null;return o!==null&&z(o.name)&&(o.slot===void 0||z(o.slot))}function k(e,t){switch(t){case"anchor":return e===void 0||J(e,M);case"anchor-record":return d(e)&&Object.keys(e).every(le)&&Object.values(e).every(r=>typeof r=="string");case"apca":return e===void 0||J(e,D);case"boolean":return typeof e=="boolean";case"component-apca":return J(e,H);case"component-property-array":return e===void 0||Array.isArray(e)&&e.every(Ie);case"component-property-name":return C(e);case"component-property-value":return Pe(e);case"contrast-ground":return typeof e=="string"&&(he.has(e)||C(e));case"data-palette-record":return d(e)?["light","dark"].every(r=>{const o=e[r];return d(o)&&w.every(n=>typeof o[n]=="string")}):!1;case"explicit":return e===void 0||ne.includes(e);case"fit-lint-id":return oe.includes(e);case"fit-lint-token-array":return Array.isArray(e)&&e.every(r=>j(r)||C(r)||r===pe||r===de);case"lint-array":return Array.isArray(e)&&e.every(Le);case"message":case"string":return typeof e=="string";case"number":return U(e);case"optional-token-array":return e===void 0||Array.isArray(e)&&e.every(G);case"paint-record":return e===void 0||we(e);case"pairing":return e===void 0||se.includes(e);case"palette-lint-id":return re.includes(e);case"palette-lint-record":return d(e)&&["light","dark"].every(r=>Array.isArray(e[r])&&e[r].every(Ae));case"report-array":return Array.isArray(e);case"scheme":return e==="light"||e==="dark";case"semantic":return j(e);case"semantic-array":return Array.isArray(e)&&e.every(j);case"series-pair":return xe(e);case"simulation":return ae.includes(e);case"string-array":return Fe(e);case"token-array":return Array.isArray(e)&&e.every(G);case"warning":return ie.includes(e);default:{const r=t;return!1}}}function we(e){return d(e)?["light","dark"].every(t=>{const r=e[t];if(!Array.isArray(r))return!1;const o=new Set;for(const n of r){if(!d(n)||!I(n.role)||o.has(n.role)||n.context!==null&&!I(n.context)||!Array.isArray(n.pairs)||!Array.from(n.pairs).every(Oe))return!1;o.add(n.role)}return!0}):!1}function Oe(e){return d(e)&&I(e.element)&&I(e.foreground)&&I(e.background)&&I(e.state)&&ue(e.kind)&&U(e.ratio)&&e.ratio>=1&&e.ratio<=21&&e.required===me(e.kind)}function J(e,t){return d(e)&&t.every(({field:r,kind:o})=>k(e[String(r)],o))}function xe(e){if(!Array.isArray(e)||e.length!==2)return!1;const t=w.indexOf(e[0]),r=w.indexOf(e[1]);return t>=0&&r>t}function Ne(e,t){if(!d(e)||!A.every(({field:n,kind:s})=>k(e[String(n)],s)))return!1;const r=e;if(r.scheme!==t)return!1;const o=r.componentProperties??[];return o.every(n=>n.surface===r.surface)&&S(o.map(n=>n.name))&&S(r.tokens.map(n=>n.token))&&S((r.footerTokens??[]).map(n=>n.token))&&S(r.adjustedTokens)&&S(r.lints.map(n=>n.id))}function Re({paint:e,...t},{paint:r,...o}){const n=[];for(const i of L)i.compared&&Ce(n,i,t,o);return($(Z(t))!==$(Z(o))||n.length===0&&$(t)!==$(o))&&n.push("fit tables differ outside compared fields"),n}function Ce(e,t,r,o){const{field:n,kind:s}=t;if(s==="string-array"){const i=r[n],c=o[n];B(e,String(n),i,c),E(e,String(n),i,c);return}if(s==="data-palette-record"){const i=r[n],c=o[n];for(const a of["light","dark"])for(const f of w)X(e,`${a}/${String(n)}/${f}`,i[a][f],c[a][f]);return}if(s==="palette-lint-record"){const i=r[n],c=o[n];for(const a of["light","dark"])Ve(e,a,String(n),i[a],c[a]),E(e,`${a}/${String(n)}`,i[a].map(T),c[a].map(T));return}if(s==="report-array"&&(n==="light"||n==="dark")){be(e,n,r[n],o[n]);return}_(e,"fit tables",String(n),r[n],o[n],s)}function be(e,t,r,o){const n=new Map(r.map(i=>[i.surface,i])),s=new Map(o.map(i=>[i.surface,i]));E(e,`${t}/reports`,r.map(i=>i.surface),o.map(i=>i.surface));for(const i of F(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: surface ${c?"removed":"added"}`);continue}je(e,f,c,a)}}function je(e,t,r,o){for(const n of A){const{compared:s,field:i,kind:c}=n;if(!(!s||i==="scheme"||i==="surface")){if(c==="anchor-record"){Ue(e,`${t}/${String(i)}`,r[i],o[i]);continue}if(c==="semantic-array"){const a=r[i],f=o[i];B(e,`${t}/${String(i)}`,a,f),E(e,`${t}/${String(i)}`,a,f);continue}if(c==="lint-array"){const a=r[i],f=o[i];Ke(e,t,String(i),a,f),E(e,`${t}/${String(i)}`,a.map(u=>u.id),f.map(u=>u.id));continue}if(c==="component-property-array"){Me(e,`${t}/${String(i)}`,r.componentProperties,o.componentProperties);continue}if(c==="token-array"||c==="optional-token-array"){De(e,t,String(i),r[i]??[],o[i]??[]);continue}_(e,t,String(i),r[i],o[i],c)}}}function Me(e,t,r,o){const n=new Map(r.map(i=>[i.name,i])),s=new Map(o.map(i=>[i.name,i]));E(e,t,[...n.keys()],[...s.keys()]);for(const i of F(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: property ${c?"removed":"added"}`);continue}for(const{compared:u,field:l,kind:p}of R)!u||l==="name"||(l==="apca"?q(e,f,l,c.apca,a.apca,H):_(e,f,l,c[l],a[l],p))}}function De(e,t,r,o,n){const s=new Map(o.map(a=>[a.token,a])),i=new Map(n.map(a=>[a.token,a]));E(e,`${t}/${r}`,o.map(a=>a.token),n.map(a=>a.token));const c=r==="tokens"?t:`${t}/${r}`;for(const a of F(s.keys(),i.keys())){const f=s.get(a),u=i.get(a),l=`${c}/${a}`;if(!f||!u){e.push(`${l}: token ${f?"removed":"added"}`);continue}He(e,l,f,u)}}function He(e,t,r,o){for(const{compared:n,field:s,kind:i}of P)if(!(!n||s==="token")){if(i==="anchor"){q(e,t,"anchor",r.anchor,o.anchor,M);continue}if(i==="apca"){q(e,t,"apca",r.apca,o.apca,D);continue}_(e,t,String(s),r[s],o[s],i)}}function q(e,t,r,o,n,s){const i=o,c=n;for(const{compared:a,field:f,kind:u}of s)a&&_(e,t,`${r}.${String(f)}`,i?.[f],c?.[f],u)}function Ke(e,t,r,o,n){const s=new Map(o.map(c=>[c.id,c])),i=new Map(n.map(c=>[c.id,c]));for(const c of F(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:N}of V)if(!(!l||p==="id")){if(N==="fit-lint-token-array"){Je(e,u,String(p),a[p],f[p]);continue}_(e,u,String(p),a[p],f[p],N)}}}function Ve(e,t,r,o,n){const s=new Map(o.map(c=>[T(c),c])),i=new Map(n.map(c=>[T(c),c]));for(const c of F(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:N}of K)!l||p==="id"||p==="series"||p==="simulation"||_(e,u,String(p),a[p],f[p],N)}}function T(e){return`${e.id}/${e.series[0]}+${e.series[1]}/${e.simulation}`}function Ue(e,t,r,o){for(const n of F(Object.keys(r),Object.keys(o)))X(e,`${t}/${n}`,r[n],o[n])}function B(e,t,r,o){const n=new Set(r),s=new Set(o);for(const i of F(n,s))n.has(i)!==s.has(i)&&e.push(`${t}/${i}: ${n.has(i)?"removed":"added"}`)}function E(e,t,r,o){const n=new Set(r),s=new Set(o),i=r.filter(a=>s.has(a)),c=o.filter(a=>n.has(a));i.some((a,f)=>a!==c[f])&&e.push(`${t}: order changed`)}function Je(e,t,r,o,n){const s=Math.max(o.length,n.length);for(let i=0;i<s;i+=1)Q(e,t,`${r}[${i}]`,o[i],n[i])}function X(e,t,r,o){r!==o&&e.push(`${t}: ${b(r)} \u2192 ${b(o)}`)}function Q(e,t,r,o,n,s){if(!Object.is(o,n)){if(s==="message"){e.push(`${t}: message changed`);return}e.push(`${t}: ${r} ${b(o)} \u2192 ${b(n)}`)}}function qe(e,t,r,o,n){$(o)!==$(n)&&e.push(`${t}: ${r} changed`)}function _(e,t,r,o,n,s){if(ze(s)){Q(e,t,r,o,n,s);return}qe(e,t,r,o,n)}const We={anchor:!1,"anchor-record":!1,apca:!1,boolean:!0,"component-apca":!1,"component-property-array":!1,"component-property-name":!0,"component-property-value":!1,"contrast-ground":!0,"data-palette-record":!1,explicit:!0,"fit-lint-id":!0,"fit-lint-token-array":!1,"lint-array":!1,message:!0,number:!0,"optional-token-array":!1,"paint-record":!1,pairing:!0,"palette-lint-id":!0,"palette-lint-record":!1,"report-array":!1,scheme:!0,semantic:!0,"semantic-array":!1,"series-pair":!1,simulation:!0,string:!0,"string-array":!1,"token-array":!1,warning:!0};function ze(e){return We[e]===!0}function b(e){return e===void 0?"(absent)":e===""?'""':String(e)}function F(e,t){return[...new Set([...e,...t])].sort()}function $(e){return Array.isArray(e)?`[${e.map($).join(",")}]`:d(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${$(e[t])}`).join(",")}}`:JSON.stringify(e)??"undefined"}function Z(e){const t=g(e,h(L)),r=["light","dark"];if(y(L,"dataPalette")){const o=g(e.dataPalette,r);for(const n of r)m(o,n,g(e.dataPalette[n],w));m(t,"dataPalette",o)}if(y(L,"paletteLints")){const o=g(e.paletteLints,r);for(const n of r)m(o,n,v(e.paletteLints[n],T,h(K)));m(t,"paletteLints",o)}for(const o of r){if(!y(L,o))continue;const n=x();for(const s of e[o]){const i=g(s,h(A));for(const c of["tokens","footerTokens"]){if(!y(A,c))continue;const a=x();for(const f of s[c]??[]){const u=g(f,h(P));f.anchor&&y(P,"anchor")&&m(u,"anchor",g(f.anchor,h(M))),f.apca&&y(P,"apca")&&m(u,"apca",g(f.apca,h(D))),m(a,f.token,u)}m(i,c,a)}if(y(A,"componentProperties")){const c=x();for(const a of s.componentProperties){const f=g(a,h(R));a.apca&&y(R,"apca")&&m(f,"apca",g(a.apca,h(H))),m(c,a.name,f)}m(i,"componentProperties",c)}y(A,"lints")&&m(i,"lints",v(s.lints,c=>c.id,h(V))),m(n,s.surface,i)}m(t,o,n)}return t}function v(e,t,r){const o=x();for(const n of e)m(o,t(n),g(n,r));return o}function h(e){return e.filter(({compared:t})=>t).map(({field:t})=>t)}function y(e,t){return e.some(r=>r.field===t&&r.compared)}function g(e,t){const r=new Set(t.map(String)),o=x();for(const[n,s]of Object.entries(e))r.has(n)||(o[n]=s);return o}function x(){return Object.create(null)}function m(e,t,r){Object.keys(r).length>0&&(e[t]=r)}function Ge(e,t,r){for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.log(` ${o} lint(${n.id}): ${n.message}`);for(const n of e[o]){r.log(Qe(o,n));for(const s of n.lints)r.log(` lint(${s.id}): ${s.message}`)}}r.log(`Checked ${e.surfaces.length} surface(s) \xD7 2 schemes \u2014 `+(t===0?"no lints.":`${t} lint(s), listed above.`))}function Ye(e,t,r){r.error(`${t} theme lint(s) are standing while fit-table drift is present:`);for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.error(`lint: ${o}/paletteLints/${T(n)}: ${n.message}`);for(const n of e[o])for(const s of n.lints)r.error(`lint: ${o}/${n.surface}/lints/${s.id}: ${s.message}`)}}function Be(e){return[...e.light,...e.dark].reduce((r,o)=>r+o.lints.length,0)+e.paletteLints.light.length+e.paletteLints.dark.length}function Xe(e,t){return["light","dark"].some(r=>{const o=`${r}: `;if(!e.startsWith(o))return!1;const n=e.slice(o.length);return t.paletteLints[r].some(s=>fe(n,s))})}function Qe(e,t){const r=t.adjustedTokens.length===0?"contrast enforcement moved nothing":`contrast enforcement moved ${t.adjustedTokens.join(", ")}`,o=t.tokens.filter(s=>s.explicit==="inherited").length,n=o===0?"":`; ${o} inherited explicit pin(s) \u2014 see the fit tables`;return`${e}/${t.surface}: ${t.tokens.length} tokens, ${r}${n}.`}export{ct as runEspalierCli};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var n=function(
|
|
1
|
+
var n=function(o,e,r,a){var s=arguments.length,l=s<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,r):a,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(o,e,r,a);else for(var g=o.length-1;g>=0;g--)(p=o[g])&&(l=(s<3?p(l):s>3?p(e,r,l):p(e,r))||l);return s>3&&l&&Object.defineProperty(e,r,l),l};import{FooterAlignmentController as m,footerAlignmentStyles as k,footerAlignmentHostStyles as v}from"../shared/footer-alignment.js";import{css as b,html as d,nothing as c}from"lit";import{customElement as x,property as i}from"lit/decorators.js";import{footerHeadingFit as A,footerLinkFit as f}from"../shared/footer-ink-styles.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";const h="esp-footer-link-group-heading";let t=class extends u{constructor(){super(...arguments),this.alignment=new m(this,"group"),this.heading=""}get inlineAlign(){return this.alignment.get("inline-align")}set inlineAlign(e){this.alignment.set("inlineAlign","inline-align",e,"placement")}get inlineAlignWrapped(){return this.alignment.get("inline-align-wrapped")}set inlineAlignWrapped(e){this.alignment.set("inlineAlignWrapped","inline-align-wrapped",e,"placement")}get inlineAlignStacked(){return this.alignment.get("inline-align-stacked")}set inlineAlignStacked(e){this.alignment.set("inlineAlignStacked","inline-align-stacked",e,"placement")}get blockAlign(){return this.alignment.get("block-align")}set blockAlign(e){this.alignment.set("blockAlign","block-align",e,"placement")}get blockAlignWrapped(){return this.alignment.get("block-align-wrapped")}set blockAlignWrapped(e){this.alignment.set("blockAlignWrapped","block-align-wrapped",e,"placement")}get blockAlignStacked(){return this.alignment.get("block-align-stacked")}set blockAlignStacked(e){this.alignment.set("blockAlignStacked","block-align-stacked",e,"placement")}get textAlign(){return this.alignment.get("text-align")}set textAlign(e){this.alignment.set("textAlign","text-align",e,"text")}get textAlignWrapped(){return this.alignment.get("text-align-wrapped")}set textAlignWrapped(e){this.alignment.set("textAlignWrapped","text-align-wrapped",e,"text")}get textAlignStacked(){return this.alignment.get("text-align-stacked")}set textAlignStacked(e){this.alignment.set("textAlignStacked","text-align-stacked",e,"text")}render(){return d`
|
|
2
2
|
<div class="alignment-scope">
|
|
3
3
|
<nav
|
|
4
4
|
class="alignment-content"
|
|
5
5
|
part="nav"
|
|
6
|
-
aria-labelledby=${this.heading?
|
|
6
|
+
aria-labelledby=${this.heading?h:c}
|
|
7
7
|
aria-label=${this.heading?c:"Footer links"}
|
|
8
8
|
>
|
|
9
|
-
${this.heading?d`<h2 part="heading" id=${
|
|
9
|
+
${this.heading?d`<h2 part="heading" id=${h}>${this.heading}</h2>`:c}
|
|
10
10
|
<div part="links" class="links"><slot></slot></div>
|
|
11
11
|
</nav>
|
|
12
12
|
</div>
|
|
13
|
-
`}};t.styles=[...
|
|
13
|
+
`}};t.styles=[...u.styles,k,v,b`
|
|
14
14
|
:host {
|
|
15
15
|
display: block;
|
|
16
16
|
min-inline-size: 0;
|
|
@@ -33,8 +33,9 @@ var n=function(a,e,r,o){var s=arguments.length,l=s<3?e:o===null?o=Object.getOwnP
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
h2 {
|
|
36
|
+
${A}
|
|
36
37
|
margin: 0;
|
|
37
|
-
color: var(--esp-footer-heading-color, var(--esp-color-headings));
|
|
38
|
+
color: var(--esp-footer-heading-color, var(--_esp-footer-local-fitted-heading-color, var(--esp-color-headings)));
|
|
38
39
|
font-family: var(
|
|
39
40
|
--_esp-font-headings-effective,
|
|
40
41
|
var(
|
|
@@ -56,10 +57,11 @@ var n=function(a,e,r,o){var s=arguments.length,l=s<3?e:o===null?o=Object.getOwnP
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
::slotted(a) {
|
|
60
|
+
${f}
|
|
59
61
|
text-align: var(--_esp-footer-text-css, inherit);
|
|
60
62
|
inline-size: fit-content;
|
|
61
63
|
max-inline-size: 100%;
|
|
62
|
-
color: var(--esp-footer-link-color, var(--esp-color-link));
|
|
64
|
+
color: var(--esp-footer-link-color, var(--_esp-footer-local-fitted-link-color, var(--esp-color-link)));
|
|
63
65
|
overflow-wrap: anywhere;
|
|
64
66
|
text-decoration: none;
|
|
65
67
|
text-underline-offset: 0.18em;
|
|
@@ -71,11 +73,12 @@ var n=function(a,e,r,o){var s=arguments.length,l=s<3?e:o===null?o=Object.getOwnP
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
::slotted(a:focus-visible) {
|
|
76
|
+
${f}
|
|
74
77
|
border-radius: var(--esp-size-border-radius);
|
|
75
78
|
outline: var(
|
|
76
79
|
--esp-footer-focus-outline,
|
|
77
|
-
2px solid var(--esp-footer-link-color, var(--esp-color-link))
|
|
80
|
+
2px solid var(--esp-footer-link-color, var(--_esp-footer-local-fitted-link-color, var(--esp-color-link)))
|
|
78
81
|
);
|
|
79
82
|
outline-offset: 3px;
|
|
80
83
|
}
|
|
81
|
-
`],n([i({attribute:"inline-align",reflect:!0})],t.prototype,"inlineAlign",null),n([i({attribute:"inline-align-wrapped",reflect:!0})],t.prototype,"inlineAlignWrapped",null),n([i({attribute:"inline-align-stacked",reflect:!0})],t.prototype,"inlineAlignStacked",null),n([i({attribute:"block-align",reflect:!0})],t.prototype,"blockAlign",null),n([i({attribute:"block-align-wrapped",reflect:!0})],t.prototype,"blockAlignWrapped",null),n([i({attribute:"block-align-stacked",reflect:!0})],t.prototype,"blockAlignStacked",null),n([i({attribute:"text-align",reflect:!0})],t.prototype,"textAlign",null),n([i({attribute:"text-align-wrapped",reflect:!0})],t.prototype,"textAlignWrapped",null),n([i({attribute:"text-align-stacked",reflect:!0})],t.prototype,"textAlignStacked",null),n([i({type:String})],t.prototype,"heading",void 0),t=n([
|
|
84
|
+
`],n([i({attribute:"inline-align",reflect:!0})],t.prototype,"inlineAlign",null),n([i({attribute:"inline-align-wrapped",reflect:!0})],t.prototype,"inlineAlignWrapped",null),n([i({attribute:"inline-align-stacked",reflect:!0})],t.prototype,"inlineAlignStacked",null),n([i({attribute:"block-align",reflect:!0})],t.prototype,"blockAlign",null),n([i({attribute:"block-align-wrapped",reflect:!0})],t.prototype,"blockAlignWrapped",null),n([i({attribute:"block-align-stacked",reflect:!0})],t.prototype,"blockAlignStacked",null),n([i({attribute:"text-align",reflect:!0})],t.prototype,"textAlign",null),n([i({attribute:"text-align-wrapped",reflect:!0})],t.prototype,"textAlignWrapped",null),n([i({attribute:"text-align-stacked",reflect:!0})],t.prototype,"textAlignStacked",null),n([i({type:String})],t.prototype,"heading",void 0),t=n([x("esp-footer-link-group")],t);export{t as EspalierFooterLinkGroup};
|
|
@@ -213,16 +213,16 @@ import "./esp-footer-link-group.js";
|
|
|
213
213
|
* @csspart bottom - The final legal/utility region.
|
|
214
214
|
* @cssprop --esp-footer-background - Base footer color. Defaults to `var(--esp-color-layer-2)`.
|
|
215
215
|
* @cssprop --esp-footer-color - Body text color. Defaults to `var(--esp-color-text)`.
|
|
216
|
-
* @cssprop --esp-footer-heading-color - Heading and configured-brand color.
|
|
216
|
+
* @cssprop --esp-footer-heading-color - Heading and configured-brand color. The theme fits its headings color to the default footer surface.
|
|
217
217
|
* @cssprop --esp-footer-heading-size - Size step for link-group headings and slotted `h2` headings: `small`, `normal`, `medium`, `big`, or `large`. Defaults to `normal`.
|
|
218
218
|
* @cssprop --esp-footer-heading-font-size - Font size derived from the authored heading step. Defaults to `var(--esp-type-normal)`.
|
|
219
|
-
* @cssprop --esp-footer-link-color - Link color.
|
|
219
|
+
* @cssprop --esp-footer-link-color - Link color. The theme fits its link color to the default footer surface.
|
|
220
220
|
* @cssprop --esp-footer-link-decoration - Resting decoration of bare footer links and the configured brand link: `none` or `underline`. Bare links default to `underline` and the brand defaults to `none`. All supported links underline on hover.
|
|
221
221
|
* @cssprop --esp-footer-link-underline-offset - Underline offset of supported links, from `0em` to `0.5em`. Defaults to `0.18em` for group links and brand hover, and `auto` elsewhere.
|
|
222
222
|
* @cssprop --esp-footer-link-underline-thickness - Underline thickness of supported links, from `0em` to `0.2em` or `auto`. Defaults to `auto`.
|
|
223
223
|
* @cssprop --esp-footer-link-hover-color - Hovered link color. Defaults to `var(--esp-color-link-hover)`.
|
|
224
224
|
* @cssprop --esp-footer-link-hover-bg - Hovered link background. Defaults to `var(--esp-color-link-hover-bg)`.
|
|
225
|
-
* @cssprop --esp-footer-focus-outline - Focus-visible outline for footer links. Defaults to
|
|
225
|
+
* @cssprop --esp-footer-focus-outline - Focus-visible outline for footer links. Defaults to a 2px solid outline in the footer link color.
|
|
226
226
|
* @cssprop --esp-footer-border - Block-start footer border. Defaults to `1px solid var(--esp-color-border)`.
|
|
227
227
|
* @cssprop --esp-footer-padding-block - Content block padding. Defaults to `var(--esp-size-padding-page)`.
|
|
228
228
|
* @cssprop --esp-footer-padding-inline - Content inline padding. Defaults to `var(--esp-size-padding-page)`.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,a):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(p,e,a,r);else for(var d=p.length-1;d>=0;d--)(s=p[d])&&(l=(o<3?s(l):o>3?s(e,a,l):s(e,a))||l);return o>3&&l&&Object.defineProperty(e,a,l),l};import{FooterAlignmentController as h,footerAlignmentStyles as k}from"../shared/footer-alignment.js";import{FooterLogoGeometryController as x,footerNaturalLogoStyles as
|
|
1
|
+
var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,a):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(p,e,a,r);else for(var d=p.length-1;d>=0;d--)(s=p[d])&&(l=(o<3?s(l):o>3?s(e,a,l):s(e,a))||l);return o>3&&l&&Object.defineProperty(e,a,l),l};import{FooterAlignmentController as h,footerAlignmentStyles as k}from"../shared/footer-alignment.js";import{FooterLogoGeometryController as x,footerNaturalLogoStyles as v,normalizeFooterLogoSizing as A}from"../shared/footer-logo-geometry.js";import{footerHeadingFit as y,footerInkLayerStyles as S,footerLinkFit as w}from"../shared/footer-ink-styles.js";import{paintedSurface as B}from"../shared/surface-layer.js";import{css as _,html as z,nothing as T}from"lit";import{customElement as W,property as i,state as I}from"lit/decorators.js";import{styleMap as g}from"lit/directives/style-map.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as L,configuredBrandLogoGeometry as C,renderConfiguredBrand as $,resolveConfiguredBrand as O}from"../shared/configured-brand.js";import{syncNormalizedAttribute as c}from"../shared/attribute-helpers.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{slotHasContent as m}from"../shared/slot-content.js";import{renderVisualOverlay as N,visualOverlayStyles as E}from"../shared/visual-overlay.js";import"./esp-footer-column.js";import"./esp-footer-link-group.js";const u={media:!1,brand:!1,groups:!1,aside:!1,bottom:!1};let t=class extends b{get layout(){return this.alignment.layout}constructor(){super(),this.alignment=new h(this,"footer"),this.brandLogoSizingBacker="fixed",this.slotContent={...u},this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandSpanBacker=1,this.asideSpanBacker=1,this.fullBleedContent=!1,this.landmarkLabel="",this.handleSlotChange=e=>{if(!(e.target instanceof HTMLSlotElement))return;const a=this.slotRegion(e.target);if(!a)return;const r=m(e.target);this.slotContent[a]!==r&&(this.slotContent={...this.slotContent,[a]:r})},new x(this,()=>({sizing:this.brandLogoSizing,scheme:this.scheme,lightSource:this.lightBrandLogo||this.brandLogo,darkSource:this.darkBrandLogo||this.brandLogo}))}get inlineAlign(){return this.alignment.get("inline-align")}set inlineAlign(e){this.alignment.set("inlineAlign","inline-align",e,"placement")}get inlineAlignWrapped(){return this.alignment.get("inline-align-wrapped")}set inlineAlignWrapped(e){this.alignment.set("inlineAlignWrapped","inline-align-wrapped",e,"placement")}get inlineAlignStacked(){return this.alignment.get("inline-align-stacked")}set inlineAlignStacked(e){this.alignment.set("inlineAlignStacked","inline-align-stacked",e,"placement")}get blockAlign(){return this.alignment.get("block-align")}set blockAlign(e){this.alignment.set("blockAlign","block-align",e,"placement")}get blockAlignWrapped(){return this.alignment.get("block-align-wrapped")}set blockAlignWrapped(e){this.alignment.set("blockAlignWrapped","block-align-wrapped",e,"placement")}get blockAlignStacked(){return this.alignment.get("block-align-stacked")}set blockAlignStacked(e){this.alignment.set("blockAlignStacked","block-align-stacked",e,"placement")}get textAlign(){return this.alignment.get("text-align")}set textAlign(e){this.alignment.set("textAlign","text-align",e,"text")}get textAlignWrapped(){return this.alignment.get("text-align-wrapped")}set textAlignWrapped(e){this.alignment.set("textAlignWrapped","text-align-wrapped",e,"text")}get textAlignStacked(){return this.alignment.get("text-align-stacked")}set textAlignStacked(e){this.alignment.set("textAlignStacked","text-align-stacked",e,"text")}get brandInlineAlign(){return this.alignment.get("brand-inline-align")}set brandInlineAlign(e){this.alignment.set("brandInlineAlign","brand-inline-align",e,"placement")}get brandInlineAlignWrapped(){return this.alignment.get("brand-inline-align-wrapped")}set brandInlineAlignWrapped(e){this.alignment.set("brandInlineAlignWrapped","brand-inline-align-wrapped",e,"placement")}get brandInlineAlignStacked(){return this.alignment.get("brand-inline-align-stacked")}set brandInlineAlignStacked(e){this.alignment.set("brandInlineAlignStacked","brand-inline-align-stacked",e,"placement")}get brandBlockAlign(){return this.alignment.get("brand-block-align")}set brandBlockAlign(e){this.alignment.set("brandBlockAlign","brand-block-align",e,"placement")}get brandBlockAlignWrapped(){return this.alignment.get("brand-block-align-wrapped")}set brandBlockAlignWrapped(e){this.alignment.set("brandBlockAlignWrapped","brand-block-align-wrapped",e,"placement")}get brandBlockAlignStacked(){return this.alignment.get("brand-block-align-stacked")}set brandBlockAlignStacked(e){this.alignment.set("brandBlockAlignStacked","brand-block-align-stacked",e,"placement")}get brandTextAlign(){return this.alignment.get("brand-text-align")}set brandTextAlign(e){this.alignment.set("brandTextAlign","brand-text-align",e,"text")}get brandTextAlignWrapped(){return this.alignment.get("brand-text-align-wrapped")}set brandTextAlignWrapped(e){this.alignment.set("brandTextAlignWrapped","brand-text-align-wrapped",e,"text")}get brandTextAlignStacked(){return this.alignment.get("brand-text-align-stacked")}set brandTextAlignStacked(e){this.alignment.set("brandTextAlignStacked","brand-text-align-stacked",e,"text")}get asideInlineAlign(){return this.alignment.get("aside-inline-align")}set asideInlineAlign(e){this.alignment.set("asideInlineAlign","aside-inline-align",e,"placement")}get asideInlineAlignWrapped(){return this.alignment.get("aside-inline-align-wrapped")}set asideInlineAlignWrapped(e){this.alignment.set("asideInlineAlignWrapped","aside-inline-align-wrapped",e,"placement")}get asideInlineAlignStacked(){return this.alignment.get("aside-inline-align-stacked")}set asideInlineAlignStacked(e){this.alignment.set("asideInlineAlignStacked","aside-inline-align-stacked",e,"placement")}get asideBlockAlign(){return this.alignment.get("aside-block-align")}set asideBlockAlign(e){this.alignment.set("asideBlockAlign","aside-block-align",e,"placement")}get asideBlockAlignWrapped(){return this.alignment.get("aside-block-align-wrapped")}set asideBlockAlignWrapped(e){this.alignment.set("asideBlockAlignWrapped","aside-block-align-wrapped",e,"placement")}get asideBlockAlignStacked(){return this.alignment.get("aside-block-align-stacked")}set asideBlockAlignStacked(e){this.alignment.set("asideBlockAlignStacked","aside-block-align-stacked",e,"placement")}get asideTextAlign(){return this.alignment.get("aside-text-align")}set asideTextAlign(e){this.alignment.set("asideTextAlign","aside-text-align",e,"text")}get asideTextAlignWrapped(){return this.alignment.get("aside-text-align-wrapped")}set asideTextAlignWrapped(e){this.alignment.set("asideTextAlignWrapped","aside-text-align-wrapped",e,"text")}get asideTextAlignStacked(){return this.alignment.get("aside-text-align-stacked")}set asideTextAlignStacked(e){this.alignment.set("asideTextAlignStacked","aside-text-align-stacked",e,"text")}get bottomInlineAlign(){return this.alignment.get("bottom-inline-align")}set bottomInlineAlign(e){this.alignment.set("bottomInlineAlign","bottom-inline-align",e,"placement")}get bottomInlineAlignWrapped(){return this.alignment.get("bottom-inline-align-wrapped")}set bottomInlineAlignWrapped(e){this.alignment.set("bottomInlineAlignWrapped","bottom-inline-align-wrapped",e,"placement")}get bottomInlineAlignStacked(){return this.alignment.get("bottom-inline-align-stacked")}set bottomInlineAlignStacked(e){this.alignment.set("bottomInlineAlignStacked","bottom-inline-align-stacked",e,"placement")}get bottomTextAlign(){return this.alignment.get("bottom-text-align")}set bottomTextAlign(e){this.alignment.set("bottomTextAlign","bottom-text-align",e,"text")}get bottomTextAlignWrapped(){return this.alignment.get("bottom-text-align-wrapped")}set bottomTextAlignWrapped(e){this.alignment.set("bottomTextAlignWrapped","bottom-text-align-wrapped",e,"text")}get bottomTextAlignStacked(){return this.alignment.get("bottom-text-align-stacked")}set bottomTextAlignStacked(e){this.alignment.set("bottomTextAlignStacked","bottom-text-align-stacked",e,"text")}get brandLogoSizing(){return this.brandLogoSizingBacker}set brandLogoSizing(e){const a=this.brandLogoSizingBacker;this.brandLogoSizingBacker=A(e),this.requestUpdate("brandLogoSizing",this.hasAttribute("brand-logo-sizing")?a:void 0),c(this,"brand-logo-sizing",this.brandLogoSizingBacker)}get brandSpan(){return this.brandSpanBacker}set brandSpan(e){const a=this.brandSpanBacker;this.brandSpanBacker=Number.isInteger(e)&&e>=1&&e<=3?e:1,this.requestUpdate("brandSpan",this.hasAttribute("brand-span")?a:void 0),c(this,"brand-span",String(this.brandSpanBacker))}get asideSpan(){return this.asideSpanBacker}set asideSpan(e){const a=this.asideSpanBacker;this.asideSpanBacker=Number.isInteger(e)&&e>=1&&e<=2?e:1,this.requestUpdate("asideSpan",this.hasAttribute("aside-span")?a:void 0),c(this,"aside-span",String(this.asideSpanBacker))}slotRegion(e){return e.name?["media","brand","aside","bottom"].includes(e.name)?e.name:null:"groups"}firstUpdated(e){super.firstUpdated(e);const a={...u};for(const r of this.shadowRoot?.querySelectorAll("slot")??[]){const o=this.slotRegion(r);o&&(a[o]=m(r))}Object.entries(a).some(([r,o])=>this.slotContent[r]!==o)&&(this.slotContent=a)}render(){const{media:e,brand:a,groups:r,aside:o,bottom:l}=this.slotContent,s=O({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor}),d=a||!!(s.brandLogo||this.brandText),f=d||r||o;return z`
|
|
2
2
|
<footer
|
|
3
3
|
part="footer"
|
|
4
|
-
aria-label=${this.landmarkLabel||
|
|
4
|
+
aria-label=${this.landmarkLabel||T}
|
|
5
5
|
style=${g({"--_esp-footer-brand-color":s.brandColor||null})}
|
|
6
6
|
>
|
|
7
|
-
${
|
|
7
|
+
${N({className:"background",rootPart:"background"})}
|
|
8
8
|
<div part="content" class="content-frame">
|
|
9
9
|
<div class="content">
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
22
22
|
>
|
|
23
23
|
<div class="alignment-content">
|
|
24
24
|
<slot name="brand" @slotchange=${this.handleSlotChange}
|
|
25
|
-
>${
|
|
25
|
+
>${$({brandLogo:s.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt})}</slot
|
|
26
26
|
>
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
@@ -54,7 +54,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</footer>
|
|
57
|
-
`}};t.styles=[...b.styles,
|
|
57
|
+
`}};t.styles=[...b.styles,B(2),S,C,k,v,_`
|
|
58
58
|
:host {
|
|
59
59
|
display: block;
|
|
60
60
|
min-inline-size: 0;
|
|
@@ -201,6 +201,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
.configured-brand {
|
|
204
|
+
${y}
|
|
204
205
|
|
|
205
206
|
display: var(--_esp-footer-lockup-display, inline-flex);
|
|
206
207
|
align-items: var(--_esp-footer-lockup-block, center);
|
|
@@ -208,7 +209,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
208
209
|
max-inline-size: 100%;
|
|
209
210
|
color: var(
|
|
210
211
|
--_esp-footer-brand-color,
|
|
211
|
-
var(--esp-footer-heading-color, var(--esp-color-headings))
|
|
212
|
+
var(--esp-footer-heading-color, var(--_esp-footer-local-fitted-heading-color, var(--esp-color-headings)))
|
|
212
213
|
);
|
|
213
214
|
font-family: var(
|
|
214
215
|
--_esp-font-brand-effective,
|
|
@@ -247,10 +248,11 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
a.configured-brand:focus-visible {
|
|
251
|
+
${w}
|
|
250
252
|
border-radius: var(--esp-size-border-radius);
|
|
251
253
|
outline: var(
|
|
252
254
|
--esp-footer-focus-outline,
|
|
253
|
-
2px solid var(--esp-footer-link-color, var(--esp-color-link))
|
|
255
|
+
2px solid var(--esp-footer-link-color, var(--_esp-footer-local-fitted-link-color, var(--esp-color-link)))
|
|
254
256
|
);
|
|
255
257
|
outline-offset: 3px;
|
|
256
258
|
}
|
|
@@ -258,7 +260,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
258
260
|
.brand-logo {
|
|
259
261
|
|
|
260
262
|
aspect-ratio: auto
|
|
261
|
-
var(--esp-footer-brand-logo-aspect-ratio, ${
|
|
263
|
+
var(--esp-footer-brand-logo-aspect-ratio, ${L});
|
|
262
264
|
display: block;
|
|
263
265
|
inline-size: auto;
|
|
264
266
|
|
|
@@ -316,4 +318,4 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
|
|
|
316
318
|
);
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
|
|
321
|
+
`,E],n([i({attribute:"inline-align",reflect:!0})],t.prototype,"inlineAlign",null),n([i({attribute:"inline-align-wrapped",reflect:!0})],t.prototype,"inlineAlignWrapped",null),n([i({attribute:"inline-align-stacked",reflect:!0})],t.prototype,"inlineAlignStacked",null),n([i({attribute:"block-align",reflect:!0})],t.prototype,"blockAlign",null),n([i({attribute:"block-align-wrapped",reflect:!0})],t.prototype,"blockAlignWrapped",null),n([i({attribute:"block-align-stacked",reflect:!0})],t.prototype,"blockAlignStacked",null),n([i({attribute:"text-align",reflect:!0})],t.prototype,"textAlign",null),n([i({attribute:"text-align-wrapped",reflect:!0})],t.prototype,"textAlignWrapped",null),n([i({attribute:"text-align-stacked",reflect:!0})],t.prototype,"textAlignStacked",null),n([i({attribute:"brand-inline-align",reflect:!0})],t.prototype,"brandInlineAlign",null),n([i({attribute:"brand-inline-align-wrapped",reflect:!0})],t.prototype,"brandInlineAlignWrapped",null),n([i({attribute:"brand-inline-align-stacked",reflect:!0})],t.prototype,"brandInlineAlignStacked",null),n([i({attribute:"brand-block-align",reflect:!0})],t.prototype,"brandBlockAlign",null),n([i({attribute:"brand-block-align-wrapped",reflect:!0})],t.prototype,"brandBlockAlignWrapped",null),n([i({attribute:"brand-block-align-stacked",reflect:!0})],t.prototype,"brandBlockAlignStacked",null),n([i({attribute:"brand-text-align",reflect:!0})],t.prototype,"brandTextAlign",null),n([i({attribute:"brand-text-align-wrapped",reflect:!0})],t.prototype,"brandTextAlignWrapped",null),n([i({attribute:"brand-text-align-stacked",reflect:!0})],t.prototype,"brandTextAlignStacked",null),n([i({attribute:"aside-inline-align",reflect:!0})],t.prototype,"asideInlineAlign",null),n([i({attribute:"aside-inline-align-wrapped",reflect:!0})],t.prototype,"asideInlineAlignWrapped",null),n([i({attribute:"aside-inline-align-stacked",reflect:!0})],t.prototype,"asideInlineAlignStacked",null),n([i({attribute:"aside-block-align",reflect:!0})],t.prototype,"asideBlockAlign",null),n([i({attribute:"aside-block-align-wrapped",reflect:!0})],t.prototype,"asideBlockAlignWrapped",null),n([i({attribute:"aside-block-align-stacked",reflect:!0})],t.prototype,"asideBlockAlignStacked",null),n([i({attribute:"aside-text-align",reflect:!0})],t.prototype,"asideTextAlign",null),n([i({attribute:"aside-text-align-wrapped",reflect:!0})],t.prototype,"asideTextAlignWrapped",null),n([i({attribute:"aside-text-align-stacked",reflect:!0})],t.prototype,"asideTextAlignStacked",null),n([i({attribute:"bottom-inline-align",reflect:!0})],t.prototype,"bottomInlineAlign",null),n([i({attribute:"bottom-inline-align-wrapped",reflect:!0})],t.prototype,"bottomInlineAlignWrapped",null),n([i({attribute:"bottom-inline-align-stacked",reflect:!0})],t.prototype,"bottomInlineAlignStacked",null),n([i({attribute:"bottom-text-align",reflect:!0})],t.prototype,"bottomTextAlign",null),n([i({attribute:"bottom-text-align-wrapped",reflect:!0})],t.prototype,"bottomTextAlignWrapped",null),n([i({attribute:"bottom-text-align-stacked",reflect:!0})],t.prototype,"bottomTextAlignStacked",null),n([i({attribute:"brand-logo-sizing",reflect:!0,useDefault:!0})],t.prototype,"brandLogoSizing",null),n([I()],t.prototype,"slotContent",void 0),n([i({attribute:"brand-text",type:String})],t.prototype,"brandText",void 0),n([i({attribute:"brand-logo",type:String})],t.prototype,"brandLogo",void 0),n([i({attribute:"light-brand-logo",type:String})],t.prototype,"lightBrandLogo",void 0),n([i({attribute:"dark-brand-logo",type:String})],t.prototype,"darkBrandLogo",void 0),n([i({attribute:"brand-href",type:String})],t.prototype,"brandHref",void 0),n([i({attribute:"brand-alt",type:String})],t.prototype,"brandAlt",void 0),n([i({attribute:"brand-color",type:String})],t.prototype,"brandColor",void 0),n([i({attribute:"light-brand-color",type:String})],t.prototype,"lightBrandColor",void 0),n([i({attribute:"dark-brand-color",type:String})],t.prototype,"darkBrandColor",void 0),n([i({attribute:"brand-span",type:Number,reflect:!0})],t.prototype,"brandSpan",null),n([i({attribute:"aside-span",type:Number,reflect:!0})],t.prototype,"asideSpan",null),n([i({attribute:"full-bleed-content",type:Boolean,reflect:!0})],t.prototype,"fullBleedContent",void 0),n([i({attribute:"landmark-label",type:String})],t.prototype,"landmarkLabel",void 0),t=n([W("esp-footer")],t);export{t as EspalierFooter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PAINT_INTERACTIONS as
|
|
1
|
+
import{PAINT_INTERACTIONS as h,closestPaintElement as i,configuredBrandColor as m,isPaintFocus as x,isPaintHover as p}from"../menu/navigation-paint.js";import{FOOTER_HEADING_INK as d,FOOTER_INK_PROPERTIES as l,FOOTER_LINK_INK as a,FOOTER_INK_MODE as c}from"../shared/footer-ink.js";import{parsePaintColor as u}from"../shared/paint-color.js";import{TOKEN_PAIRINGS as T}from"../shared/token-pairings.js";const g={foregroundDerivations:[d],foregroundAliases:["headings"]},b={foregroundDerivations:[a],foregroundAliases:["link"]},N=({element:e,source:t})=>{const o=i(e,".brand .configured-brand");if(!(!o||!i(o,"esp-footer"))){if(t==="outline"&&e===o&&o.matches("a[href]"))return{element:"brand-link",owner:o,...b};if(t==="text"&&i(e,".brand-text"))return{element:"brand-text",owner:o,...o.matches("a[href]")?{}:{state:()=>"rest"},...o.matches("a[href]:hover")?{}:{brandColor:m(o,"--_esp-footer-brand-color"),...g}}}};function v(e){const t=e.ownerDocument,o=t.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=t.createRange();for(let n=o.nextNode();n;n=o.nextNode()){const s=n.parentElement;if(!(!s||!n.textContent?.trim()||s.closest("svg, [hidden], .sr-only"))&&t.defaultView?.getComputedStyle(s).visibility==="visible"&&(r.selectNodeContents(n),Array.from(r.getClientRects()).some(({width:f,height:k})=>f>0&&k>0)))return!0}return!1}const E=({element:e,source:t})=>{if(!i(e,"esp-footer")||i(e,"esp-button"))return;const o=i(e,"a[href]");if(o&&!o.classList.contains("configured-brand")&&(t==="text"||t==="outline"&&e===o&&v(o)))return{element:"footer-link",owner:o,...t==="outline"||!o.matches(":hover")?b:{}};if(t!=="text")return;const r=i(e,"h1, h2, h3, h4, h5, h6");if(r)return{element:"footer-heading",owner:r,state:()=>"rest",...g};if(i(e,".aside, .bottom, esp-footer-link-group"))return{element:"footer-body",owner:e,state:()=>"rest"}},O=T.linkHover.bg,A={derivations:{[d]:({readProperty:e,readColor:t})=>u(e("--esp-footer-heading-color")??(e(c)==="semantic"?void 0:e(l.headings))??t("headings")??""),[a]:({readProperty:e,readColor:t})=>u(e("--esp-footer-link-color")??(e(c)==="semantic"?void 0:e(l.link))??t("link")??"")},entriesByRole:{footer:[{element:"footer-heading",foreground:d,background:"layer2",state:"rest",kind:"text",flags:["footerHeadings"]},{element:"footer-body",foreground:"text",background:"layer2",state:"rest",kind:"text",flags:["footerBody"]},...h.flatMap(e=>{const t=p(e),o=x(e),r={foreground:t?"linkHover":a,background:t?O:"layer2",state:e,kind:"text"},n=[{...r,element:"footer-link",flags:["footerLinks"]},{...r,element:"brand-text",foreground:t?"linkHover":"brand-color",flags:e==="rest"?["brandText"]:["brandText","brandLink"]}];if(o)for(const[s,f]of[["footer-link","footerLinks"],["brand-link","brandLink"]])n.push({element:s,foreground:a,background:"layer2",state:e,kind:"ring",flags:[f]});return n})]},targets:{footer:[N,E]}};export{A as footerPaintRegistration};
|