@taprootio/espalier 2.3.1 → 2.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.
@@ -1,4 +1,4 @@
1
- var o=function(d,t,e,i){var a=arguments.length,r=a<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,t,e,i);else for(var h=d.length-1;h>=0;h--)(l=d[h])&&(r=(a<3?l(r):a>3?l(t,e,r):l(t,e))||r);return a>3&&r&&Object.defineProperty(t,e,r),r},p;import{css as v,html as c}from"lit";import{customElement as y,property as n,state as f}from"lit/decorators.js";import{createRef as m,ref as u}from"lit/directives/ref.js";import{classMap as w}from"lit/directives/class-map.js";import{styleMap as _}from"lit/directives/style-map.js";import{ifDefined as g}from"lit/directives/if-defined.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{FormFieldController as S}from"../shared/form-field-controller.js";import{FormFieldDescriptionController as x}from"../shared/form-field-description-controller.js";import{disabledControl as k,focusRing as C}from"../shared/style-fragments.js";let s=p=class extends b{constructor(){super(...arguments),this.internals=this.attachInternals(),this.formCtrl=new S({host:this,internals:this.internals,getFormValue:()=>this.value||null,getValidity:()=>null,onReset:()=>{this.value=String(this._low)},onRestore:t=>{this.value=t},onDisabled:t=>{this.disabled=t}}),this.formItemDescription=new x({host:this,getTarget:()=>this._thumbRef.value}),this.min=0,this.max=100,this.step=1,this.value="0",this.name="",this.disabled=!1,this.label="",this._dragging=!1,this._hasSlotContent=!1,this._trackRef=m(),this._thumbRef=m(),this._slotRef=m(),this._labelId=`esp-slider-label-${p._nextId++}`}get _safeStep(){return Number.isFinite(this.step)&&this.step>0?this.step:1}get _safeMin(){return Number.isFinite(this.min)?this.min:0}get _safeMax(){return Number.isFinite(this.max)?this.max:100}get _stepPrecision(){const t=String(this._safeStep),e=/^(\d+\.?(\d*))e-(\d+)$/.exec(t);if(e){const a=e[2].length,r=Number(e[3]);return a+r}const i=t.indexOf(".");return i===-1?0:t.length-i-1}get _low(){return Math.min(this._safeMin,this._safeMax)}get _high(){return Math.max(this._safeMin,this._safeMax)}_snapToStep(t){const e=this._safeStep,i=this._low,a=this._high,r=Math.round((t-i)/e)*e+i,l=Math.max(i,Math.min(a,r)),h=10**this._stepPrecision;return Math.round(l*h)/h}get numericValue(){const t=Number(this.value);return Number.isNaN(t)?this._snapToStep(this._low):this._snapToStep(t)}get percentage(){const t=this._high-this._low;return t<=0?0:(this.numericValue-this._low)/t*100}_normalizeValue(){const t=String(this.numericValue);t!==this.value&&(this.value=t),this.formCtrl.syncValueSilently()}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("min")||t.has("max")||t.has("step"))&&this._normalizeValue()}firstUpdated(t){super.firstUpdated(t),this._syncSlotContent()}focus(t){this.focusResolvedElementAfterUpdate(()=>this._thumbRef.value,t)}setFormItemDescription(t){this.formItemDescription.setDescription(t)}validate(){this.formCtrl.validate()}checkValidity(){return this.formCtrl.checkValidity()}_setValueAndNotify(t){const e=String(this._snapToStep(t));e!==this.value&&(this.value=e,this.formCtrl.syncValue(),this.emitValueChanged(e))}_handleKeyDown(t){if(this.disabled)return;const e=this._safeStep;let i=0;switch(t.key){case"ArrowRight":case"ArrowUp":i=e;break;case"ArrowLeft":case"ArrowDown":i=-e;break;case"Home":this._setValueAndNotify(this._low),t.preventDefault();return;case"End":this._setValueAndNotify(this._high),t.preventDefault();return;case"PageUp":i=e*10;break;case"PageDown":i=-e*10;break;default:return}t.preventDefault(),this._setValueAndNotify(this.numericValue+i)}_handlePointerDown(t){if(this.disabled)return;const e=this._thumbRef.value,i=this._trackRef.value;if(!e||!i)return;const a=t.composedPath().includes(e);t.pointerType==="touch"&&!a||(t.preventDefault(),this._dragging=!0,e.setPointerCapture(t.pointerId),e.focus({preventScroll:!0}),this._updateValueFromPointer(t))}_handlePointerMove(t){this._dragging&&this._updateValueFromPointer(t)}_handlePointerUp(){this._endDrag()}_handleLostPointerCapture(){this._endDrag()}_endDrag(){this._dragging&&(this._dragging=!1)}_updateValueFromPointer(t){const e=this._trackRef.value;if(!e)return;const i=e.getBoundingClientRect();if(i.width<=0)return;const a=Math.max(0,Math.min(1,(t.clientX-i.left)/i.width)),r=this._low+a*(this._high-this._low);this._setValueAndNotify(r)}_handleSlotChange(){this._syncSlotContent()}_syncSlotContent(){const t=this._slotRef.value;if(!t)return;const e=t.assignedNodes({flatten:!0});this._hasSlotContent=e.some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim())}formResetCallback(){this.formCtrl.handleFormReset()}formStateRestoreCallback(t){this.formCtrl.handleFormStateRestore(t)}formDisabledCallback(t){this.formCtrl.handleFormDisabled(t)}render(){const t=this.percentage,e=this._hasSlotContent?this._labelId:void 0,i=this._hasSlotContent?void 0:this.label||void 0;return c`
1
+ var o=function(d,t,e,i){var a=arguments.length,r=a<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,t,e,i);else for(var h=d.length-1;h>=0;h--)(l=d[h])&&(r=(a<3?l(r):a>3?l(t,e,r):l(t,e))||r);return a>3&&r&&Object.defineProperty(t,e,r),r},p;import{css as v,html as c}from"lit";import{customElement as y,property as n,state as f}from"lit/decorators.js";import{createRef as m,ref as u}from"lit/directives/ref.js";import{classMap as w}from"lit/directives/class-map.js";import{styleMap as _}from"lit/directives/style-map.js";import{ifDefined as g}from"lit/directives/if-defined.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{FormFieldController as S}from"../shared/form-field-controller.js";import{FormFieldDescriptionController as k}from"../shared/form-field-description-controller.js";import{disabledControl as x,focusRing as C}from"../shared/style-fragments.js";import{slotHasContent as $}from"../shared/slot-content.js";let s=p=class extends b{constructor(){super(...arguments),this.internals=this.attachInternals(),this.formCtrl=new S({host:this,internals:this.internals,getFormValue:()=>this.value||null,getValidity:()=>null,onReset:()=>{this.value=String(this._low)},onRestore:t=>{this.value=t},onDisabled:t=>{this.disabled=t}}),this.formItemDescription=new k({host:this,getTarget:()=>this._thumbRef.value}),this.min=0,this.max=100,this.step=1,this.value="0",this.name="",this.disabled=!1,this.label="",this._dragging=!1,this._hasSlotContent=!1,this._trackRef=m(),this._thumbRef=m(),this._slotRef=m(),this._labelId=`esp-slider-label-${p._nextId++}`}get _safeStep(){return Number.isFinite(this.step)&&this.step>0?this.step:1}get _safeMin(){return Number.isFinite(this.min)?this.min:0}get _safeMax(){return Number.isFinite(this.max)?this.max:100}get _stepPrecision(){const t=String(this._safeStep),e=/^(\d+\.?(\d*))e-(\d+)$/.exec(t);if(e){const a=e[2].length,r=Number(e[3]);return a+r}const i=t.indexOf(".");return i===-1?0:t.length-i-1}get _low(){return Math.min(this._safeMin,this._safeMax)}get _high(){return Math.max(this._safeMin,this._safeMax)}_snapToStep(t){const e=this._safeStep,i=this._low,a=this._high,r=Math.round((t-i)/e)*e+i,l=Math.max(i,Math.min(a,r)),h=10**this._stepPrecision;return Math.round(l*h)/h}get numericValue(){const t=Number(this.value);return Number.isNaN(t)?this._snapToStep(this._low):this._snapToStep(t)}get percentage(){const t=this._high-this._low;return t<=0?0:(this.numericValue-this._low)/t*100}_normalizeValue(){const t=String(this.numericValue);t!==this.value&&(this.value=t),this.formCtrl.syncValueSilently()}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("min")||t.has("max")||t.has("step"))&&this._normalizeValue()}firstUpdated(t){super.firstUpdated(t),this._syncSlotContent()}focus(t){this.focusResolvedElementAfterUpdate(()=>this._thumbRef.value,t)}setFormItemDescription(t){this.formItemDescription.setDescription(t)}validate(){this.formCtrl.validate()}checkValidity(){return this.formCtrl.checkValidity()}_setValueAndNotify(t){const e=String(this._snapToStep(t));e!==this.value&&(this.value=e,this.formCtrl.syncValue(),this.emitValueChanged(e))}_handleKeyDown(t){if(this.disabled)return;const e=this._safeStep;let i=0;switch(t.key){case"ArrowRight":case"ArrowUp":i=e;break;case"ArrowLeft":case"ArrowDown":i=-e;break;case"Home":this._setValueAndNotify(this._low),t.preventDefault();return;case"End":this._setValueAndNotify(this._high),t.preventDefault();return;case"PageUp":i=e*10;break;case"PageDown":i=-e*10;break;default:return}t.preventDefault(),this._setValueAndNotify(this.numericValue+i)}_handlePointerDown(t){if(this.disabled)return;const e=this._thumbRef.value,i=this._trackRef.value;if(!e||!i)return;const a=t.composedPath().includes(e);t.pointerType==="touch"&&!a||(t.preventDefault(),this._dragging=!0,e.setPointerCapture(t.pointerId),e.focus({preventScroll:!0}),this._updateValueFromPointer(t))}_handlePointerMove(t){this._dragging&&this._updateValueFromPointer(t)}_handlePointerUp(){this._endDrag()}_handleLostPointerCapture(){this._endDrag()}_endDrag(){this._dragging&&(this._dragging=!1)}_updateValueFromPointer(t){const e=this._trackRef.value;if(!e)return;const i=e.getBoundingClientRect();if(i.width<=0)return;const a=Math.max(0,Math.min(1,(t.clientX-i.left)/i.width)),r=this._low+a*(this._high-this._low);this._setValueAndNotify(r)}_handleSlotChange(){this._syncSlotContent()}_syncSlotContent(){const t=this._slotRef.value;t&&(this._hasSlotContent=$(t))}formResetCallback(){this.formCtrl.handleFormReset()}formStateRestoreCallback(t){this.formCtrl.handleFormStateRestore(t)}formDisabledCallback(t){this.formCtrl.handleFormDisabled(t)}render(){const t=this.percentage,e=this._hasSlotContent?this._labelId:void 0,i=this._hasSlotContent?void 0:this.label||void 0;return c`
2
2
  <div
3
3
  class=${w({"slider-container":!0,dragging:this._dragging})}
4
4
  @pointerdown=${this._handlePointerDown}
@@ -29,7 +29,7 @@ var o=function(d,t,e,i){var a=arguments.length,r=a<3?t:i===null?i=Object.getOwnP
29
29
  ${this._hasSlotContent?c`<span class="label" id=${this._labelId}>
30
30
  <slot ${u(this._slotRef)} @slotchange=${this._handleSlotChange}></slot>
31
31
  </span>`:c`<slot ${u(this._slotRef)} @slotchange=${this._handleSlotChange} hidden></slot>`}
32
- `}};s.formAssociated=!0,s._nextId=0,s.styles=[...b.styles,C(".thumb:focus-visible","--esp-slider-focus-shadow","0 0 0 3px","var(--esp-slider-thumb-shadow, 0 1px 3px oklch(0 0 0 / 0.2)),"),k(".slider-container"),v`
32
+ `}};s.formAssociated=!0,s._nextId=0,s.styles=[...b.styles,C(".thumb:focus-visible","--esp-slider-focus-shadow","0 0 0 3px","var(--esp-slider-thumb-shadow, 0 1px 3px oklch(0 0 0 / 0.2)),"),x(".slider-container"),v`
33
33
  :host {
34
34
  display: block;
35
35
  }
@@ -536,6 +536,150 @@
536
536
  "category": "root-theme",
537
537
  "description": ""
538
538
  },
539
+ {
540
+ "name": "--esp-footer-background",
541
+ "category": "component",
542
+ "component": "esp-footer",
543
+ "description": "Base footer color. Defaults to `var(--esp-color-layer-2)`."
544
+ },
545
+ {
546
+ "name": "--esp-footer-background-blend-mode",
547
+ "category": "component",
548
+ "component": "esp-footer",
549
+ "description": "Decorative layer blend mode. Defaults to `normal`."
550
+ },
551
+ {
552
+ "name": "--esp-footer-background-image",
553
+ "category": "component",
554
+ "component": "esp-footer",
555
+ "description": "Decorative image or gradient layer. Defaults to `none`."
556
+ },
557
+ {
558
+ "name": "--esp-footer-background-image-opacity",
559
+ "category": "component",
560
+ "component": "esp-footer",
561
+ "description": "Decorative layer opacity. Defaults to `1`."
562
+ },
563
+ {
564
+ "name": "--esp-footer-background-position",
565
+ "category": "component",
566
+ "component": "esp-footer",
567
+ "description": "Decorative layer position. Defaults to `0 0`."
568
+ },
569
+ {
570
+ "name": "--esp-footer-background-repeat",
571
+ "category": "component",
572
+ "component": "esp-footer",
573
+ "description": "Decorative layer repeat behavior. Defaults to `repeat`."
574
+ },
575
+ {
576
+ "name": "--esp-footer-background-size",
577
+ "category": "component",
578
+ "component": "esp-footer",
579
+ "description": "Decorative layer size. Defaults to `auto`."
580
+ },
581
+ {
582
+ "name": "--esp-footer-border",
583
+ "category": "component",
584
+ "component": "esp-footer",
585
+ "description": "Block-start footer border. Defaults to `1px solid var(--esp-color-border)`."
586
+ },
587
+ {
588
+ "name": "--esp-footer-brand-logo-max-width",
589
+ "category": "component",
590
+ "component": "esp-footer",
591
+ "description": "Configured logo maximum inline size. Defaults to `12rem`."
592
+ },
593
+ {
594
+ "name": "--esp-footer-brand-logo-size",
595
+ "category": "component",
596
+ "component": "esp-footer",
597
+ "description": "Configured logo block size. Defaults to `3rem`."
598
+ },
599
+ {
600
+ "name": "--esp-footer-color",
601
+ "category": "component",
602
+ "component": "esp-footer",
603
+ "description": "Body text color. Defaults to `var(--esp-color-text)`."
604
+ },
605
+ {
606
+ "name": "--esp-footer-column-gap",
607
+ "category": "component",
608
+ "component": "esp-footer",
609
+ "description": "Gap between link-group columns and major primary regions. Defaults to `var(--esp-size-padding-page)`."
610
+ },
611
+ {
612
+ "name": "--esp-footer-content-lead",
613
+ "category": "component",
614
+ "component": "esp-footer",
615
+ "description": "Fraction of surplus placed before content (`0`, `0.5`, or `1`). Defaults to `0`."
616
+ },
617
+ {
618
+ "name": "--esp-footer-content-max-width",
619
+ "category": "component",
620
+ "component": "esp-footer",
621
+ "description": "Surface-alignment cap published by `esp-page`. Defaults to `100%`."
622
+ },
623
+ {
624
+ "name": "--esp-footer-focus-outline",
625
+ "category": "component",
626
+ "component": "esp-footer",
627
+ "description": "Focus-visible outline. Defaults to `2px solid var(--esp-color-link)`."
628
+ },
629
+ {
630
+ "name": "--esp-footer-heading-color",
631
+ "category": "component",
632
+ "component": "esp-footer",
633
+ "description": "Heading and configured-brand color. Defaults to `var(--esp-color-headings)`."
634
+ },
635
+ {
636
+ "name": "--esp-footer-link-color",
637
+ "category": "component",
638
+ "component": "esp-footer",
639
+ "description": "Link color. Defaults to `var(--esp-color-link)`."
640
+ },
641
+ {
642
+ "name": "--esp-footer-link-group-gap",
643
+ "category": "component",
644
+ "component": "esp-footer",
645
+ "description": "Space between a link-group heading and its links. Defaults to `var(--esp-size-small)`."
646
+ },
647
+ {
648
+ "name": "--esp-footer-link-group-min-width",
649
+ "category": "component",
650
+ "component": "esp-footer",
651
+ "description": "Intrinsic minimum link-group column width. Defaults to `10rem`."
652
+ },
653
+ {
654
+ "name": "--esp-footer-link-hover-color",
655
+ "category": "component",
656
+ "component": "esp-footer",
657
+ "description": "Hovered link color. Defaults to `var(--esp-color-link-hover)`."
658
+ },
659
+ {
660
+ "name": "--esp-footer-padding-block",
661
+ "category": "component",
662
+ "component": "esp-footer",
663
+ "description": "Content block padding. Defaults to `var(--esp-size-padding-page)`."
664
+ },
665
+ {
666
+ "name": "--esp-footer-padding-inline",
667
+ "category": "component",
668
+ "component": "esp-footer",
669
+ "description": "Content inline padding. Defaults to `var(--esp-size-padding-page)`."
670
+ },
671
+ {
672
+ "name": "--esp-footer-row-gap",
673
+ "category": "component",
674
+ "component": "esp-footer",
675
+ "description": "Compact-layout row gap. Defaults to `var(--esp-size-big)`."
676
+ },
677
+ {
678
+ "name": "--esp-footer-section-gap",
679
+ "category": "component",
680
+ "component": "esp-footer",
681
+ "description": "Gap between media, primary, and bottom regions. Defaults to `var(--esp-size-big)`."
682
+ },
539
683
  {
540
684
  "name": "--esp-form-item-error-background",
541
685
  "category": "component",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/espalier",
3
- "version": "2.3.1",
3
+ "version": "2.5.0",
4
4
  "packageManager": "bun@1.3.12",
5
5
  "description": "Espalier — a themeable, accessible, framework-agnostic, enterprise-grade design system built on web standards and love.",
6
6
  "customElements": "custom-elements.json",
@@ -98,6 +98,14 @@
98
98
  "types": "./dist/font-picker/esp-font-picker.d.ts",
99
99
  "import": "./dist/font-picker/esp-font-picker.js"
100
100
  },
101
+ "./footer": {
102
+ "types": "./dist/footer/index.d.ts",
103
+ "import": "./dist/footer/index.js"
104
+ },
105
+ "./footer/link-group": {
106
+ "types": "./dist/footer/esp-footer-link-group.d.ts",
107
+ "import": "./dist/footer/esp-footer-link-group.js"
108
+ },
101
109
  "./form": {
102
110
  "types": "./dist/form/esp-form.d.ts",
103
111
  "import": "./dist/form/esp-form.js"
@@ -272,6 +280,7 @@
272
280
  "sideEffects": [
273
281
  "dist/index.js",
274
282
  "dist/*/esp-*.js",
283
+ "dist/footer/index.js",
275
284
  "dist/header/index.js",
276
285
  "dist/menu/index.js",
277
286
  "dist/shared/virtualizer/lit-virtualizer.js"