@taprootio/espalier 2.19.0 → 2.20.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/custom-elements.json +12157 -3346
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/root/helpers/compute-semantic-properties.js +1 -0
- package/dist/root/helpers/compute-theme-properties.js +1 -1
- package/dist/shared/esp-element-base.d.ts +12 -6
- package/dist/shared/esp-element-base.js +2 -2
- package/dist/shared/theme.d.ts +32 -3
- package/dist/shared/theme.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export * from "./shared/events.js";
|
|
|
70
70
|
export { getImageDetails, releasePreviewUrl, type EspalierUploadImage, type ImageDetailsOptions, type SelectedUploadImage, type ExistingUploadImage, type ExistingImage, type ResponsiveImageUrl, type UploadCallbacks, type UploadEventDetail, } from "./image-upload/image-helpers.js";
|
|
71
71
|
export { calculatePhotoLayout, type LayoutImage, type PhotoRow, } from "./shared/justified-layout.js";
|
|
72
72
|
export { type TypeaheadFetchItems } from "./pickers/types.js";
|
|
73
|
-
export { type EspalierTheme, type PartialTheme, type VariantColorSource, encodeTheme, parseTheme, mergePartials, layerThemes, buildTaprootLightTheme, buildTaprootDarkTheme, NESTED_THEME_KEYS, } from "./shared/theme.js";
|
|
73
|
+
export { type EspalierTheme, type PartialTheme, type PartialThemeContexts, type ThemeContext, type ThemeContexts, type VariantColorSource, encodeTheme, parseTheme, mergePartials, layerThemes, validateThemePair, buildTaprootLightTheme, buildTaprootDarkTheme, NESTED_THEME_KEYS, } from "./shared/theme.js";
|
|
74
74
|
export { auditDataPalette, generateSequentialRamp, generateDivergingRamp, COLOR_VISION_SIMULATIONS, DATA_SERIES_KEYS, DEFAULT_DATA_PALETTE, DEFAULT_DATA_RAMP_STEPS, DEFAULT_DIVERGING_NEUTRAL, MAX_DATA_RAMP_STEPS, MIN_DATA_COLOR_DISTANCE, MIN_DATA_RAMP_LIGHTNESS_STEP, MIN_DATA_RAMP_STEPS, type ColorVisionSimulation, type DataPalette, type DataPaletteIssue, type DataRamp, type DataRamps, type DataSeriesKey, type DivergingDataRamp, type DivergingRampOptions, type PartialDataRamp, type PartialDataRamps, type SequentialDataRamp, type SequentialRampOptions, } from "./shared/data-colors.js";
|
|
75
75
|
export { WEIGHT_LABELS, extractWeights, normalizeWeight, bestAvailableWeight, extractFamily, getFallbackFont, } from "./shared/font-helpers.js";
|
|
76
76
|
export { getGoogleFonts } from "./font-picker/esp-font-picker.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./box/esp-box.js";export*from"./action-menu/esp-action-menu.js";export*from"./action-menu/esp-action-menu-item.js";export*from"./avatar/esp-avatar.js";export*from"./avatar/esp-profile-chip.js";export*from"./badge/esp-badge.js";export*from"./checkbox/esp-checkbox.js";export*from"./checkbox/esp-checkbox-group.js";export*from"./data-cell/esp-data-cell.js";export*from"./radio-button/esp-radio-button.js";export*from"./radio-button/esp-radio-button-group.js";export*from"./repeater/esp-repeater.js";export*from"./breadcrumbs/esp-breadcrumbs.js";export*from"./button/esp-button.js";export*from"./button/esp-button-group.js";export*from"./color-picker/esp-color-picker.js";export*from"./flyout/esp-flyout.js";export*from"./form/esp-form.js";export*from"./form-item/esp-form-item.js";export*from"./help/esp-help-button.js";export*from"./help/esp-help-provider.js";export*from"./header/index.js";export*from"./page/esp-page.js";export*from"./popover/esp-popover.js";export*from"./dialog/esp-dialog.js";export*from"./empty-state/esp-empty-state.js";export*from"./image-upload/esp-image-upload.js";export*from"./file-upload/esp-file-upload.js";export*from"./font-picker/esp-font-picker.js";export*from"./focus-picker/esp-focus-picker.js";export*from"./footer/index.js";export*from"./grid/esp-grid.js";export*from"./image/esp-image.js";export*from"./image/image-focus.js";export*from"./lightbox/esp-lightbox.js";export*from"./info/esp-info.js";export*from"./input/esp-input.js";export*from"./textarea/esp-textarea.js";export*from"./pickers/esp-pick-one.js";export*from"./pickers/esp-pick-some.js";export*from"./pickers/esp-picker-menu.js";export*from"./pickers/esp-picker-item.js";export*from"./root/esp-root.js";export*from"./menu/index.js";export*from"./burger/esp-burger.js";export*from"./date-picker/esp-date-picker.js";export*from"./details/esp-details.js";export*from"./details/esp-details-group.js";export*from"./tabs/esp-tab.js";export*from"./tabs/esp-tab-group.js";export*from"./slider/esp-slider.js";export*from"./switch/esp-switch.js";export*from"./toaster/esp-toaster.js";export*from"./tooltip/esp-tooltip.js";export*from"./progress/esp-progress.js";export*from"./search/esp-search.js";export*from"./status-indicator/esp-status-indicator.js";export*from"./tree/esp-tree.js";export*from"./tree/esp-tree-item.js";import{DEFAULT_ICON_SPRITE_URL as
|
|
1
|
+
export*from"./box/esp-box.js";export*from"./action-menu/esp-action-menu.js";export*from"./action-menu/esp-action-menu-item.js";export*from"./avatar/esp-avatar.js";export*from"./avatar/esp-profile-chip.js";export*from"./badge/esp-badge.js";export*from"./checkbox/esp-checkbox.js";export*from"./checkbox/esp-checkbox-group.js";export*from"./data-cell/esp-data-cell.js";export*from"./radio-button/esp-radio-button.js";export*from"./radio-button/esp-radio-button-group.js";export*from"./repeater/esp-repeater.js";export*from"./breadcrumbs/esp-breadcrumbs.js";export*from"./button/esp-button.js";export*from"./button/esp-button-group.js";export*from"./color-picker/esp-color-picker.js";export*from"./flyout/esp-flyout.js";export*from"./form/esp-form.js";export*from"./form-item/esp-form-item.js";export*from"./help/esp-help-button.js";export*from"./help/esp-help-provider.js";export*from"./header/index.js";export*from"./page/esp-page.js";export*from"./popover/esp-popover.js";export*from"./dialog/esp-dialog.js";export*from"./empty-state/esp-empty-state.js";export*from"./image-upload/esp-image-upload.js";export*from"./file-upload/esp-file-upload.js";export*from"./font-picker/esp-font-picker.js";export*from"./focus-picker/esp-focus-picker.js";export*from"./footer/index.js";export*from"./grid/esp-grid.js";export*from"./image/esp-image.js";export*from"./image/image-focus.js";export*from"./lightbox/esp-lightbox.js";export*from"./info/esp-info.js";export*from"./input/esp-input.js";export*from"./textarea/esp-textarea.js";export*from"./pickers/esp-pick-one.js";export*from"./pickers/esp-pick-some.js";export*from"./pickers/esp-picker-menu.js";export*from"./pickers/esp-picker-item.js";export*from"./root/esp-root.js";export*from"./menu/index.js";export*from"./burger/esp-burger.js";export*from"./date-picker/esp-date-picker.js";export*from"./details/esp-details.js";export*from"./details/esp-details-group.js";export*from"./tabs/esp-tab.js";export*from"./tabs/esp-tab-group.js";export*from"./slider/esp-slider.js";export*from"./switch/esp-switch.js";export*from"./toaster/esp-toaster.js";export*from"./tooltip/esp-tooltip.js";export*from"./progress/esp-progress.js";export*from"./search/esp-search.js";export*from"./status-indicator/esp-status-indicator.js";export*from"./tree/esp-tree.js";export*from"./tree/esp-tree-item.js";import{DEFAULT_ICON_SPRITE_URL as xr,DEFAULT_ICON_VIEW_BOX as Tr,INTENT_VARIANTS as ar,normalizeIntentVariant as _r,getIconHref as Ar,getIconHrefForHost as Er,getIconSpriteUrl as lr}from"./shared/intent-values.js";import{EspalierElementBase as Ir}from"./shared/esp-element-base.js";import{VALIDITY_CHANGED_EVENT as sr}from"./shared/validation.js";import{FormFieldController as gr}from"./shared/form-field-controller.js";import{traverseToClosest as Fr}from"./shared/utilities.js";import{showToast as Nr}from"./shared/toast-events.js";import{showFlyout as hr,closeFlyout as Pr}from"./shared/flyout-events.js";import{requestHelp as ur}from"./shared/help-events.js";import{getEspBus as Ur}from"./shared/bus-events.js";export*from"./shared/events.js";import{getImageDetails as Hr,releasePreviewUrl as Vr}from"./image-upload/image-helpers.js";import{calculatePhotoLayout as Gr}from"./shared/justified-layout.js";import{encodeTheme as vr,parseTheme as yr,mergePartials as Wr,layerThemes as wr,validateThemePair as Br,buildTaprootLightTheme as Yr,buildTaprootDarkTheme as kr,NESTED_THEME_KEYS as qr}from"./shared/theme.js";import{auditDataPalette as Kr,generateSequentialRamp as Xr,generateDivergingRamp as jr,COLOR_VISION_SIMULATIONS as Jr,DATA_SERIES_KEYS as Qr,DEFAULT_DATA_PALETTE as Zr,DEFAULT_DATA_RAMP_STEPS as $r,DEFAULT_DIVERGING_NEUTRAL as ro,MAX_DATA_RAMP_STEPS as oo,MIN_DATA_COLOR_DISTANCE as eo,MIN_DATA_RAMP_LIGHTNESS_STEP as to,MIN_DATA_RAMP_STEPS as mo}from"./shared/data-colors.js";import{WEIGHT_LABELS as fo,extractWeights as xo,normalizeWeight as To,bestAvailableWeight as ao,extractFamily as _o,getFallbackFont as Ao}from"./shared/font-helpers.js";import{getGoogleFonts as lo}from"./font-picker/esp-font-picker.js";import{themeFitReport as Io,themeFitRows as So,printThemeFitReport as so}from"./shared/theme-fit-report.js";export{Jr as COLOR_VISION_SIMULATIONS,Qr as DATA_SERIES_KEYS,Zr as DEFAULT_DATA_PALETTE,$r as DEFAULT_DATA_RAMP_STEPS,ro as DEFAULT_DIVERGING_NEUTRAL,xr as DEFAULT_ICON_SPRITE_URL,Tr as DEFAULT_ICON_VIEW_BOX,Ir as EspalierElementBase,gr as FormFieldController,ar as INTENT_VARIANTS,oo as MAX_DATA_RAMP_STEPS,eo as MIN_DATA_COLOR_DISTANCE,to as MIN_DATA_RAMP_LIGHTNESS_STEP,mo as MIN_DATA_RAMP_STEPS,qr as NESTED_THEME_KEYS,sr as VALIDITY_CHANGED_EVENT,fo as WEIGHT_LABELS,Kr as auditDataPalette,ao as bestAvailableWeight,kr as buildTaprootDarkTheme,Yr as buildTaprootLightTheme,Gr as calculatePhotoLayout,Pr as closeFlyout,vr as encodeTheme,_o as extractFamily,xo as extractWeights,jr as generateDivergingRamp,Xr as generateSequentialRamp,Ur as getEspBus,Ao as getFallbackFont,lo as getGoogleFonts,Ar as getIconHref,Er as getIconHrefForHost,lr as getIconSpriteUrl,Hr as getImageDetails,wr as layerThemes,Wr as mergePartials,_r as normalizeIntentVariant,To as normalizeWeight,yr as parseTheme,so as printThemeFitReport,Vr as releasePreviewUrl,ur as requestHelp,hr as showFlyout,Nr as showToast,Io as themeFitReport,So as themeFitRows,Fr as traverseToClosest,Br as validateThemePair};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{deriveSemantic as C,deriveSemanticWithContrast as M,serializeOklch as d}from"../../shared/color-engine.js";import{SEMANTIC_COLOR_NAMES as v,TOKEN_PAIRINGS as S,semanticToCSS as R}from"../../shared/theme.js";import{resolveMappingSource as k}from"./compute-variants.js";function x(r,m,t={}){const i={},u={},p=(o,e)=>{const c=t.effectiveSource?.(o,e)??e,s=k(c,m,r.anchors);return s||t.onUnresolvedSource?.(c),{color:s??m.primary,resolved:s!==null,source:c}};for(const o of v){if(S[o])continue;const e=r.semanticMappings[o],c=r.chroma[o],s=p(o,e.source),n=r.lightness[e.lightness],l=C(s.color,n,c.min,c.max),a=R(o);u[o]=l,i[a]=d(l),t.trace&&t.trace.push({token:o,property:a,resolved:i[a],source:s.source,lightness:e.lightness,sourceResolved:s.resolved,base:s.color})}for(const o of v){const e=S[o];if(!e)continue;const c=r.semanticMappings[o],s=r.chroma[o],n=p(o,c.source),l=r.lightness[c.lightness],a=u[e.bg];let f;const h=M(n.color,l,s.min,s.max,a,e.targetLc,t.trace&&(b=>{f=b})),g=R(o);u[o]=h,i[g]=d(h),t.trace&&t.trace.push({token:o,property:g,resolved:i[g],source:n.source,lightness:c.lightness,sourceResolved:n.resolved,base:n.color,requested:f,contrast:{against:e.bg,background:a,targetLc:e.targetLc}})}return i}export{x as computeSemanticProperties};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseCssColor as
|
|
1
|
+
import{parseCssColor as g,serializeOklch as l,gamutMapToSRGB as f}from"../../shared/color-engine.js";import{generateScaleProperties as k}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as u,DEFAULT_DATA_PALETTE as v,generateDivergingRamp as B,generateSequentialRamp as R}from"../../shared/data-colors.js";import{LIGHTNESS_KEYS as w,resolveDataColorSource as E}from"../../shared/theme.js";import{lightnessKeyToCSS as $}from"./lightness-key-to-css.js";import{computeVariants as I}from"./compute-variants.js";import{computeSemanticProperties as O}from"./compute-semantic-properties.js";function T(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function j(o,S,b){const i=g(o.seedColor);if(!i)return{};const e={};e["--esp-scheme"]=S,e["--esp-seed-color"]=o.seedColor;const c=I(i,o);for(const[a,n]of Object.entries(c))e[`--esp-color-${a}`]=l(f(n));const d=new Set,t=(a,n)=>{const r=typeof a=="string"?E(a,o.anchors):null;if(r)return r;const s=typeof a=="string"?a:String(a);return d.has(s)||(d.add(s),console.warn(`Espalier theme: ${n} color source "${s}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor},m=o.dataPalette??v;for(let a=0;a<u.length;a+=1){const n=u[a],r=g(t(m[n],`dataPalette.${n}`))??i;e[`--esp-color-series-${a+1}`]=l(f(r))}for(const[a,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?R(t(n.source,`dataRamps.${a}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):B(t(n.start,`dataRamps.${a}.start`),t(n.end,`dataRamps.${a}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:t(n.neutral,`dataRamps.${a}.neutral`)})).forEach((s,y)=>{e[`--esp-color-ramp-${a}-${y+1}`]=s})}catch(r){console.warn(`Espalier theme: dataRamps.${a} cannot be generated \u2014 ${r instanceof Error?r.message:String(r)}`)}for(const a of w)e[$(a)]=`${Math.round(o.lightness[a]*100)}%`;const p=new Set;return Object.assign(e,O(o,c,{trace:b,onUnresolvedSource:a=>{p.has(a)||(p.add(a),console.warn(`Espalier theme: color source "${a}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),Object.assign(e,k(T(o))),o.fontBody&&(e["--esp-font-body"]=o.fontBody),o.fontHeadings&&(e["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(e["--esp-font-brand"]=o.fontBrand),o.fontMonospace&&(e["--esp-font-monospace"]=o.fontMonospace),e["--esp-font-weight-body"]=o.fontWeightBody,e["--esp-font-weight-headings"]=o.fontWeightHeadings,e["--esp-font-weight-brand"]=o.fontWeightBrand,e["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(e["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(e["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(e["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(e["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(e["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(e["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(e["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),e}export{j as computeThemeProperties};
|
|
@@ -39,6 +39,13 @@ export declare class EspalierElementBase extends LitElement implements SeedColor
|
|
|
39
39
|
*/
|
|
40
40
|
get variant(): EspalierVariant;
|
|
41
41
|
set variant(val: EspalierVariant);
|
|
42
|
+
/**
|
|
43
|
+
* A theme-defined color zone. The selected context rebinds designer-facing
|
|
44
|
+
* roles and emits a complete, contrast-enforced semantic token table on this
|
|
45
|
+
* host for descendants to inherit.
|
|
46
|
+
*/
|
|
47
|
+
get context(): string;
|
|
48
|
+
set context(value: string);
|
|
42
49
|
connectedCallback(): void;
|
|
43
50
|
disconnectedCallback(): void;
|
|
44
51
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
@@ -51,14 +58,13 @@ export declare class EspalierElementBase extends LitElement implements SeedColor
|
|
|
51
58
|
*/
|
|
52
59
|
traverseToClosest(selector: string): Element | null;
|
|
53
60
|
/**
|
|
54
|
-
* Compute and apply variant-specific semantic color tokens.
|
|
61
|
+
* Compute and apply context- and variant-specific semantic color tokens.
|
|
55
62
|
*
|
|
56
|
-
*
|
|
57
|
-
* cascade from `<esp-root>`
|
|
63
|
+
* With no context and the **primary** variant (or none), all semantic
|
|
64
|
+
* tokens cascade from `<esp-root>` and previous overrides are cleared.
|
|
58
65
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* as inline styles on the host element.
|
|
66
|
+
* A non-primary legacy variant is then computed over the contextual theme
|
|
67
|
+
* and applied as the final inline layer until ESP0166 removes re-seeding.
|
|
62
68
|
*/
|
|
63
69
|
protected applyVariantTokens(): void;
|
|
64
70
|
protected getVariantColorSource(): ColorSource | "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=function(u,e,t,o){var r=arguments.length,s=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(u,e,t,o);else for(var i=u.length-1;i>=0;i--)(n=u[i])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};import{css as R,LitElement as T}from"lit";import{property as d,state as C}from"lit/decorators.js";import{subscribeToRootEvent as p}from"./root-event-subscription.js";import{traverseToClosest as f}from"./utilities.js";import{parseCssColor as S,serializeOklch as x,gamutMapToSRGB as V}from"./color-engine.js";import{computeVariants as g}from"../root/helpers/compute-variants.js";import{computeSemanticProperties as b}from"../root/helpers/compute-semantic-properties.js";import{ROLE_NAMES as w,mergeTheme as P}from"./theme.js";import{alignAttributeTextInheritance as E,focusRing as U}from"./style-fragments.js";const v=new WeakMap;class a extends T{constructor(){super(...arguments),this.seedColorBacker="oklch(0.7 0.125 216)",this.espRoot=null,this.contextBacker="",this.scopedTokenOriginalValues=new Map,this.warnedUnknownContexts=new Set,this.pendingInitialThemeRoot=null,this.rootEventSubscriptionsActive=!1,this.subscribedRoot=null,this.rootEventUnsubscribers=[],this.variantBacker="primary",this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.scheme="light",this.handleSeedColorChanged=e=>{this.syncRootFromDom(!1)&&(this.seedColor=e.seedColor,this.applyVariantTokens())},this.handleSchemeChanged=e=>{!this.syncRootFromDom(!1)||this.scheme===e.scheme||(this.scheme=e.scheme,this.applyVariantTokens())},this.handleThemeChanged=()=>{this.syncRootFromDom(!1)&&this.applyVariantTokens()},this.handleIconSpriteUrlChanged=()=>{this.syncRootFromDom(!1)&&this.requestUpdate()}}get seedColor(){return this.seedColorBacker}set seedColor(e){this.seedColorBacker=e}focusResolvedElementAfterUpdate(e,t){const o=()=>{const r=e();return r?(r.focus(t),!0):!1};o()||this.updateComplete.then(()=>{o()})}focusShadowElementAfterUpdate(e,t){this.focusResolvedElementAfterUpdate(()=>this.shadowRoot?.querySelector(e),t)}emitValueChanged(e){this.dispatchEvent(new CustomEvent("value-changed",{detail:e,bubbles:!0,composed:!0}))}get variant(){return this.variantBacker}set variant(e){this.variantBacker=e,this.applyTokensWhenRootReady()}get context(){return this.contextBacker}set context(e){const t=e??"";t!==this.contextBacker&&(this.contextBacker=t,this.applyTokensWhenRootReady())}connectedCallback(){super.connectedCallback();const e=this.syncRootFromDom(!1);e&&this.subscribeToRootEvents(e)}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromRootEvents()}firstUpdated(e){this.syncRootFromDom(!0),this.applyTokensWhenRootReady()}syncRootFromDom(e){const t=f(this,"esp-root");if(!t){if(this.espRoot&&this.clearScopedTokens(),this.unsubscribeFromRootEvents(),this.espRoot=null,!e)return null;throw new Error("No esp-root ancestor found. Espalier components must be placed inside an <esp-root> element.")}const o=t!==this.espRoot,s=t.scheme==="dark"?"dark":"light",n=this.scheme!==s,i=this.seedColor!==t.seedColor;return this.espRoot=t,o&&this.isConnected&&this.subscribeToRootEvents(t),(o||n||i)&&(this.scheme=s,this.seedColor=t.seedColor,this.applyTokensWhenRootReady()),o&&this.requestUpdate(),t}applyTokensWhenRootReady(){const e=this.espRoot;if(e&&(!e.hasUpdated||e.isUpdatePending)){this.applyTokensAfterInitialRootUpdate(e);return}this.applyVariantTokens()}applyTokensAfterInitialRootUpdate(e){if(this.pendingInitialThemeRoot===e)return;this.pendingInitialThemeRoot=e;const t=e.updateComplete;if(!t){this.pendingInitialThemeRoot=null,this.applyVariantTokens();return}t.then(()=>{this.pendingInitialThemeRoot===e&&(this.pendingInitialThemeRoot=null),!(!this.isConnected||this.espRoot!==e)&&(this.scheme=e.scheme==="dark"?"dark":"light",this.seedColor=e.seedColor,this.applyVariantTokens())})}subscribeToRootEvents(e){this.rootEventSubscriptionsActive&&this.subscribedRoot===e||(this.unsubscribeFromRootEvents(),this.subscribedRoot=e,this.rootEventUnsubscribers=[p(e,"seed-color-changed",this.handleSeedColorChanged),p(e,"scheme-changed",this.handleSchemeChanged),p(e,"theme-changed",this.handleThemeChanged),p(e,"icon-sprite-url-changed",this.handleIconSpriteUrlChanged)],this.rootEventSubscriptionsActive=!0)}unsubscribeFromRootEvents(){if(this.rootEventSubscriptionsActive){for(const e of this.rootEventUnsubscribers)e();this.rootEventUnsubscribers=[],this.subscribedRoot=null,this.rootEventSubscriptionsActive=!1}}traverseToClosest(e){return f(this,e)}applyVariantTokens(){if(!this.espRoot)return;const e=this.getVariantColorSource();if(!e&&!this.context.trim()){this.clearScopedTokens();return}const t=this.espRoot.activeTheme;if(!t){this.clearScopedTokens();return}const o=this.resolveContextTheme(t),r=o.theme,s=S(r.seedColor);if(!s)return;const n=g(s,r),i={};if(!e){o.applied&&Object.assign(i,b(r,n)),this.applyScopedTokenProperties(i);return}const l=n[e];if(!l){this.clearScopedTokens();return}i["--esp-color-primary"]=x(V(l));const h=g(l,r),y=a.statusVariantSources.has(e);Object.assign(i,b(r,h,{effectiveSource:(m,k)=>this.effectiveVariantTokenSource(m,k,y)})),this.applyScopedTokenProperties(i)}resolveContextTheme(e){const t=this.context.trim();if(!t)return{applied:!1,theme:e};const o=e.contexts&&Object.prototype.hasOwnProperty.call(e.contexts,t)?e.contexts[t]:void 0;if(o){let r=v.get(e);const s=r?.get(t);if(s)return{applied:!0,theme:s};const n={};for(const l of w){const h=o[l];h!==void 0&&(n[l]=h)}const i=P(e,{lightness:o.lightness,roles:n});return r||(r=new Map,v.set(e,r)),r.set(t,i),{applied:!0,theme:i}}return this.warnedUnknownContexts.has(t)||(this.warnedUnknownContexts.add(t),console.warn(`Espalier context: "${t}" is not defined by the active theme; inheriting root tokens.`)),{applied:!1,theme:e}}effectiveVariantTokenSource(e,t,o){return o&&a.semanticActionTokens.has(e)?"primary":t}getVariantColorSource(){switch(this.variant){case"":case"primary":case"neutral":return"";case"info":return"complementary";default:return this.variant}}applyScopedTokenProperties(e){for(const t of this.scopedTokenOriginalValues.keys())t in e||this.restoreScopedTokenProperty(t);for(const[t,o]of Object.entries(e))this.setScopedTokenProperty(t,o)}setScopedTokenProperty(e,t){const o=this.scopedTokenOriginalValues.get(e);if(o){const r=this.style.getPropertyValue(e),s=this.style.getPropertyPriority(e);(r!==o.generatedValue||s!==o.generatedPriority)&&(o.originalValue=r.length?r:null,o.originalPriority=s),o.generatedValue=t,o.generatedPriority=""}else{const r=this.style.getPropertyValue(e);this.scopedTokenOriginalValues.set(e,{generatedPriority:"",generatedValue:t,originalPriority:this.style.getPropertyPriority(e),originalValue:r.length?r:null})}this.style.setProperty(e,t)}restoreScopedTokenProperty(e){const t=this.scopedTokenOriginalValues.get(e);if(!t)return;const o=this.style.getPropertyValue(e),r=this.style.getPropertyPriority(e);(o!==t.generatedValue||r!==t.generatedPriority)&&(t.originalValue=o.length?o:null,t.originalPriority=r),t.originalValue===null?this.style.removeProperty(e):this.style.setProperty(e,t.originalValue,t.originalPriority),this.scopedTokenOriginalValues.delete(e)}clearScopedTokens(){for(const e of[...this.scopedTokenOriginalValues.keys()])this.restoreScopedTokenProperty(e)}}a.statusVariantSources=new Set(["danger","success","warning"]),a.semanticActionTokens=new Set(["actionBackground","actionText"]),a.styles=[U(".esp-field:focus-within","--esp-field-focus-shadow"),E,R`
|
|
2
2
|
:host {
|
|
3
3
|
|
|
4
4
|
--_esp-field-resolved-hover-bg: var(
|
|
@@ -122,4 +122,4 @@ var p=function(v,e,t,o){var r=arguments.length,s=r<3?e:o===null?o=Object.getOwnP
|
|
|
122
122
|
.esp-field:has(textarea:disabled):hover {
|
|
123
123
|
background-color: var(--esp-field-background, var(--esp-color-layer-2));
|
|
124
124
|
}
|
|
125
|
-
`],
|
|
125
|
+
`],c([C()],a.prototype,"seedColor",null),c([d({attribute:!1})],a.prototype,"correlationId",void 0),c([d({type:String,reflect:!0})],a.prototype,"scheme",void 0),c([d({type:String,attribute:"variant",reflect:!0})],a.prototype,"variant",null),c([d({type:String,attribute:"context",reflect:!0})],a.prototype,"context",null);export{a as EspalierElementBase};
|
package/dist/shared/theme.d.ts
CHANGED
|
@@ -205,6 +205,20 @@ export type RoleBinding<R extends RoleName = RoleName> = MappingSource | ({
|
|
|
205
205
|
export type ThemeRoles = {
|
|
206
206
|
[R in RoleName]?: RoleBinding<R>;
|
|
207
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* One named zone-level rebinding of the designer-facing color roles.
|
|
210
|
+
*
|
|
211
|
+
* A context may also carry a partial lightness ramp. Color sources alone
|
|
212
|
+
* cannot make a dark zone inside a light scheme because semantic derivation
|
|
213
|
+
* deliberately takes lightness from the ramp rather than from an anchor.
|
|
214
|
+
*/
|
|
215
|
+
export type ThemeContext = ThemeRoles & {
|
|
216
|
+
lightness?: Partial<LightnessMap>;
|
|
217
|
+
};
|
|
218
|
+
/** Named role-rebinding zones available to `context` attributes. */
|
|
219
|
+
export type ThemeContexts = Record<string, ThemeContext>;
|
|
220
|
+
/** Context declarations while partial themes are being layered. */
|
|
221
|
+
export type PartialThemeContexts = Record<string, ThemeContext | undefined>;
|
|
208
222
|
/** Ordered role names, for validation and iteration. */
|
|
209
223
|
export declare const ROLE_NAMES: readonly RoleName[];
|
|
210
224
|
/**
|
|
@@ -394,6 +408,12 @@ export interface EspalierTheme {
|
|
|
394
408
|
* See {@link ThemeRoles} and ADR-016.
|
|
395
409
|
*/
|
|
396
410
|
roles: ThemeRoles;
|
|
411
|
+
/**
|
|
412
|
+
* Named zone-level role rebindings. A base-derived element selects one with
|
|
413
|
+
* its `context` attribute; the selected context is resolved against this
|
|
414
|
+
* scheme's complete theme and re-enforces every semantic ink pairing.
|
|
415
|
+
*/
|
|
416
|
+
contexts: ThemeContexts;
|
|
397
417
|
/**
|
|
398
418
|
* Eight stable categorical data-series colors. Each value is a CSS color or
|
|
399
419
|
* an `anchor:<name>[.<slot>]` reference. Emitted as
|
|
@@ -427,8 +447,9 @@ export interface EspalierTheme {
|
|
|
427
447
|
* carry slot-only anchor overrides, which the resolved
|
|
428
448
|
* {@link ThemeAnchor} deliberately does not permit.
|
|
429
449
|
*/
|
|
430
|
-
export type PartialTheme = Omit<DeepPartial<EspalierTheme>, "anchors" | "dataRamps"> & {
|
|
450
|
+
export type PartialTheme = Omit<DeepPartial<EspalierTheme>, "anchors" | "contexts" | "dataRamps"> & {
|
|
431
451
|
anchors?: PartialThemeAnchors;
|
|
452
|
+
contexts?: PartialThemeContexts;
|
|
432
453
|
dataRamps?: PartialDataRamps;
|
|
433
454
|
};
|
|
434
455
|
/** Validation result returned by {@link validateTheme}. */
|
|
@@ -556,7 +577,7 @@ export declare function encodeTheme(partial: PartialTheme): string;
|
|
|
556
577
|
* Deep-merge a {@link PartialTheme} over a set of defaults.
|
|
557
578
|
*
|
|
558
579
|
* Primitive fields are replaced; nested objects (`angles`,
|
|
559
|
-
* `semanticHues`, `lightness`, `chroma`, `semanticMappings`)
|
|
580
|
+
* `semanticHues`, `lightness`, `chroma`, `semanticMappings`, `contexts`)
|
|
560
581
|
* are merged key-by-key. Arrays (`stylesheets`) are replaced
|
|
561
582
|
* wholesale.
|
|
562
583
|
*
|
|
@@ -578,12 +599,20 @@ export declare function mergeTheme(defaults: EspalierTheme, overrides: PartialTh
|
|
|
578
599
|
* and `warnings`.
|
|
579
600
|
*/
|
|
580
601
|
export declare function validateTheme(base64: string): ThemeValidationResult;
|
|
602
|
+
/**
|
|
603
|
+
* Validate the light and dark partials that form one scheme-paired theme.
|
|
604
|
+
*
|
|
605
|
+
* Each partial first passes through {@link validateTheme}. Once both are
|
|
606
|
+
* structurally valid, their context-name sets must match exactly so a stable
|
|
607
|
+
* `context` attribute cannot silently change meaning when the scheme changes.
|
|
608
|
+
*/
|
|
609
|
+
export declare function validateThemePair(lightBase64: string, darkBase64: string): ThemeValidationResult;
|
|
581
610
|
/**
|
|
582
611
|
* Keys of {@link EspalierTheme} whose values are nested objects
|
|
583
612
|
* and therefore need key-by-key merging instead of wholesale
|
|
584
613
|
* replacement when combining two {@link PartialTheme} objects.
|
|
585
614
|
*/
|
|
586
|
-
export declare const NESTED_THEME_KEYS: readonly ["anchors", "angles", "dataPalette", "dataRamps", "roles", "chroma", "lightness", "semanticHues", "semanticMappings", "variantChroma"];
|
|
615
|
+
export declare const NESTED_THEME_KEYS: readonly ["anchors", "angles", "contexts", "dataPalette", "dataRamps", "roles", "chroma", "lightness", "semanticHues", "semanticMappings", "variantChroma"];
|
|
587
616
|
/**
|
|
588
617
|
* Deep-merge two {@link PartialTheme} objects.
|
|
589
618
|
*
|
package/dist/shared/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ACCEPTED_COLOR_FORMS as T,apcaContrast as ae,deriveSemantic as re,parseCssColor as v,parseOklch as ie,serializeOklch as ce}from"./color-engine.js";import{computeVariants as ue,parseAnchorSource as le,resolveAnchorColor as fe,resolveMappingSource as pe}from"./variant-engine.js";import{auditDataPalette as me,DATA_SERIES_KEYS as B,DEFAULT_DATA_PALETTE as H,DEFAULT_DATA_RAMP_STEPS as ge,MAX_DATA_RAMP_STEPS as P,MIN_DATA_RAMP_LIGHTNESS_STEP as U,MIN_DATA_RAMP_STEPS as L}from"./data-colors.js";const C=/^[a-z][a-z0-9-]*$/;function G(n){return le(n)}function de(n,e){return fe(n,e)}function he(n,e){const c=G(n);if(c){const a=de(e,c);return a&&v(a)?a:null}return v(n)?n:null}const D=["canvas","ink","accent","action","structure"],V={canvas:{color:[["background","surface"],["layer1","raised1"],["layer2","raised2"],["layer3","raised3"],["layer4","raised4"]]},ink:{color:[["text","text"],["inputSelection","text"]],heading:[["headings","muted"],["headingsHover","ink"]]},accent:{color:[["linkHoverBg","raised2"],["inputSelectionBg","raised2"],["inputCaret","ink"]],text:[["link","accent"],["linkHover","text"]]},action:{color:[["actionBackground","muted"]],ink:[["actionText","surface"]]},structure:{color:[["border","border"],["shadow","shadow"]]}},ye=new Set(["action.color"]),be={canvas:"background",ink:"text",accent:"link",action:"actionBackground",structure:"border"},$e={"action.ink":{role:"canvas",slot:"color"}},Se=.45;function J(n,e){const c=Y.actionText,a=[...R].sort((m,h)=>n[m]-n[h]||R.indexOf(m)-R.indexOf(h)),u=e?a.filter(m=>e(m)>=c.targetLc):a,s=u.length>0?u:a;let l,f=1/0;for(const m of s){const h=Math.abs(n[m]-Se);h<f&&(f=h,l=m)}return l??"muted"}function ke(n,e){const c=e[n]>.5;let a=R[0];for(const u of R)(c?e[u]<e[a]:e[u]>e[a])&&(a=u);return a}function _(n,e){if(n===void 0)return;if(typeof n=="string")return e==="color"?n:void 0;const c=n[e];return typeof c=="string"?c:void 0}function q(n,e,c,a={}){const u={},s={};for(const[l,f]of Object.entries(a.explicitMappings??{}))f!==void 0&&(s[l]=f.lightness);for(const l of D){const f=n[l];if(f!==void 0)for(const[m,h]of Object.entries(V[l])){const S=$e[`${l}.${m}`];let y=_(f,m),A=!1;if(y===void 0&&(S&&(y=_(n[S.role],S.slot),y??=c[be[S.role]]?.source,A=y!==void 0),y??=_(f,"color")),y!==void 0)for(const[t,o]of h){let r=o;if(ye.has(`${l}.${m}`))r=J(e,a.actionSurfaceContrast?i=>a.actionSurfaceContrast(y,i):void 0);else if(A&&S){const i=Y[t],p=(i&&s[i.bg])??J(e,a.actionSurfaceContrast?d=>a.actionSurfaceContrast(_(f,"color"),d):void 0);r=ke(p,e)}u[t]={source:y,lightness:r}}}}return u}const Y={text:{bg:"background",targetLc:75},dangerText:{bg:"background",targetLc:75},headings:{bg:"background",targetLc:60},headingsHover:{bg:"background",targetLc:60},link:{bg:"background",targetLc:75},linkHover:{bg:"background",targetLc:75},actionText:{bg:"actionBackground",targetLc:75},inputCaret:{bg:"layer2",targetLc:60},inputSelection:{bg:"inputSelectionBg",targetLc:60}},N=["background","layer1","layer2","layer3","layer4","actionBackground","actionText","border","shadow","text","dangerText","headings","headingsHover","link","linkHover","linkHoverBg","inputCaret","inputSelection","inputSelectionBg"],F=["primary","analogous-left","analogous-right","complementary","split-complementary-left","split-complementary-right","triadic-left","triadic-right","danger","success","warning"],Ae=["analogous-left","analogous-right","complementary","split-complementary-left","split-complementary-right","triadic-left","triadic-right","danger","success","warning"],R=["surface","raised1","raised2","raised3","raised4","accent","muted","text","border","ink","shadow"],xe={surface:.99,raised1:.97,raised2:.9,raised3:.8,raised4:.72,accent:.5,muted:.45,text:.35,border:.3,ink:.25,shadow:.2},ve={surface:.15,raised1:.2,raised2:.3,raised3:.4,raised4:.36,accent:.6,muted:.75,text:.85,border:.7,ink:.95,shadow:.6},W={background:{source:"primary",lightness:"surface"},layer1:{source:"primary",lightness:"raised1"},layer2:{source:"primary",lightness:"raised2"},layer3:{source:"primary",lightness:"raised3"},layer4:{source:"primary",lightness:"raised4"},actionBackground:{source:"primary",lightness:"raised3"},actionText:{source:"primary",lightness:"ink"},border:{source:"primary",lightness:"border"},shadow:{source:"primary",lightness:"shadow"},text:{source:"primary",lightness:"text"},dangerText:{source:"danger",lightness:"text"},headings:{source:"primary",lightness:"muted"},headingsHover:{source:"primary",lightness:"text"},link:{source:"complementary",lightness:"accent"},linkHover:{source:"complementary",lightness:"text"},linkHoverBg:{source:"triadic-left",lightness:"raised2"},inputCaret:{source:"triadic-right",lightness:"ink"},inputSelection:{source:"complementary",lightness:"text"},inputSelectionBg:{source:"triadic-left",lightness:"raised2"}},O=.4;function z(){const n={};for(const e of N)n[e]={min:0,max:O};return n}const X={seedColor:"oklch(0.7 0.125 216)",fontBody:"",fontHeadings:"",fontBrand:"",fontMonospace:"",fontWeightBody:"normal",fontWeightHeadings:"bold",fontWeightBrand:"bold",fontWeightMonospace:"normal",stylesheets:[],rootFontSize:16,typeRatio:1.25,spaceRatio:1.618,borderRadius:.2,viewportMin:320,viewportMax:1200,angles:{analogous:30,complementary:180,splitComplementary:30,triadic:120},semanticHues:{danger:27,success:150,warning:90},variantChroma:{},chroma:z(),semanticMappings:{...W},anchors:{},roles:{},dataPalette:{...H},dataRamps:{}},Z={...X,chroma:z(),semanticMappings:{...W},anchors:{},roles:{},dataPalette:{...H},dataRamps:{},lightness:{...xe}},Re={...X,chroma:z(),semanticMappings:{...W},anchors:{},roles:{},dataPalette:{...H},dataRamps:{},lightness:{...ve}},I=new WeakMap;I.set(Z,new Set),I.set(Re,new Set);const Q=new Set(["__proto__","constructor","prototype"]);function g(n){return!Q.has(n)}function Ce(n,e){return Q.has(n)?void 0:e}function Le(n){return`--esp-color-${n.replace(/([A-Z])/g,"-$1").replace(/(\d)/g,"-$1").toLowerCase()}`}function Oe(n){try{const e=atob(n),c=JSON.parse(e,Ce);return typeof c!="object"||c===null||Array.isArray(c)?null:c}catch{return null}}function K(n){return btoa(JSON.stringify(n))}function w(n){if(ie(n))return n;const e=v(n);return e?ce(e):n}function ee(n,e){const c={};for(const[a,u]of Object.entries(n))g(a)&&(c[a]=u);if(!e)return c;for(const[a,u]of Object.entries(e)){if(u===void 0||!g(a))continue;const s=c[a];if(s!==void 0&&typeof u=="object"&&u!==null){const l={};if(typeof s=="string")l.color=s;else for(const[f,m]of Object.entries(s))g(f)&&(l[f]=m);for(const[f,m]of Object.entries(u))m!==void 0&&g(f)&&(l[f]=m);c[a]=l;continue}c[a]=u}return c}function Me(n){const e={};for(const[c,a]of Object.entries(n)){if(!g(c))continue;if(typeof a=="string"){e[c]=w(a);continue}const u={};for(const[s,l]of Object.entries(a))g(s)&&(u[s]=typeof l=="string"?w(l):l);e[c]=u}return e}function M(n){return typeof n!="string"?"":n.startsWith("anchor:")?n:w(n)}function je(n){const e={};for(const c of B)e[c]=M(n[c]);return e}function te(n,e){const c={};for(const[a,u]of Object.entries(n))g(a)&&C.test(a)&&u&&typeof u=="object"&&!Array.isArray(u)&&(c[a]={...u});if(!e)return c;for(const[a,u]of Object.entries(e)){if(!g(a)||!C.test(a)||!u||typeof u!="object"||Array.isArray(u))continue;const s=c[a],l=s!==void 0&&u.type!==void 0&&u.type!==s.type;c[a]={...l?{}:s??{},...u}}return c}function Ee(n){const e={};for(const[c,a]of Object.entries(n))if(g(c)){if(a.type==="sequential"&&typeof a.source=="string"){e[c]={...a,source:M(a.source)};continue}if(a.type==="diverging"&&typeof a.start=="string"&&typeof a.end=="string"){e[c]={...a,start:M(a.start),end:M(a.end),...typeof a.neutral=="string"?{neutral:M(a.neutral)}:{}};continue}e[c]={...a}}return e}function ne(n){const e=v(n.seedColor);if(!e)return;const c=ue(e,n);return(a,u)=>{const s=pe(a,c,n.anchors)??c.primary,l=n.chroma.actionBackground,f=re(s,n.lightness[u],l.min,l.max),m={l:f.l>.5?0:1,c:0,h:0};return Math.abs(ae(m,f))}}function Te(n){const e=I.get(n);if(e)return new Set(e);const c=new Set,a=q(n.roles,n.lightness,n.semanticMappings,{actionSurfaceContrast:ne(n)});for(const[u,s]of Object.entries(a)){const l=n.semanticMappings[u];(l.source!==s.source||l.lightness!==s.lightness)&&c.add(u)}return c}function Be(n,e){const c={...n.roles,...e.roles},a={...n.lightness,...e.lightness},u=Me(ee(n.anchors,e.anchors)),s=typeof e.seedColor=="string"?w(e.seedColor):n.seedColor,l=e.semanticMappings,f={...n.angles,...e.angles},m={...n.semanticHues,...e.semanticHues},h={...n.variantChroma,...e.variantChroma},S=j(n.chroma,e.chroma),y=je(j(n.dataPalette,e.dataPalette)),A=Ee(te(n.dataRamps,e.dataRamps)),t=Te(n),o=new Set(t),r={};for(const k of t)r[k]=n.semanticMappings[k];for(const[k,E]of Object.entries(l??{}))E!==void 0&&(o.add(k),r[k]=E);const i=j(n.semanticMappings,l),p=ne({angles:f,anchors:u,chroma:S,lightness:a,seedColor:s,semanticHues:m,variantChroma:h}),d=q(c,a,i,{explicitMappings:r,actionSurfaceContrast:p}),b={};for(const[k,E]of Object.entries(d))o.has(k)||(b[k]=E);const x=j(j(n.semanticMappings,b),l),$={...n,seedColor:s,fontBody:e.fontBody??n.fontBody,fontHeadings:e.fontHeadings??n.fontHeadings,fontBrand:e.fontBrand??n.fontBrand,fontMonospace:e.fontMonospace??n.fontMonospace,fontWeightBody:String(e.fontWeightBody??n.fontWeightBody),fontWeightHeadings:String(e.fontWeightHeadings??n.fontWeightHeadings),fontWeightBrand:String(e.fontWeightBrand??n.fontWeightBrand),fontWeightMonospace:String(e.fontWeightMonospace??n.fontWeightMonospace),stylesheets:e.stylesheets??[...n.stylesheets],rootFontSize:e.rootFontSize??n.rootFontSize,typeRatio:e.typeRatio??n.typeRatio,spaceRatio:e.spaceRatio??n.spaceRatio,borderRadius:e.borderRadius??n.borderRadius,viewportMin:e.viewportMin??n.viewportMin,viewportMax:e.viewportMax??n.viewportMax,angles:f,semanticHues:m,variantChroma:h,lightness:a,chroma:S,semanticMappings:x,anchors:u,roles:c,dataPalette:y,dataRamps:A};return e.pageBackgroundImage!==void 0&&($.pageBackgroundImage=e.pageBackgroundImage),e.pageBackgroundImageOpacity!==void 0&&($.pageBackgroundImageOpacity=e.pageBackgroundImageOpacity),e.boxBackgroundImage!==void 0&&($.boxBackgroundImage=e.boxBackgroundImage),e.boxBackgroundImageOpacity!==void 0&&($.boxBackgroundImageOpacity=e.boxBackgroundImageOpacity),e.vellumOpacity!==void 0&&($.vellumOpacity=e.vellumOpacity),e.vellumBackgroundImage!==void 0&&($.vellumBackgroundImage=e.vellumBackgroundImage),e.vellumBackgroundImageOpacity!==void 0&&($.vellumBackgroundImageOpacity=e.vellumBackgroundImageOpacity),I.set($,new Set(o)),$}function j(n,e){if(!e)return{...n};const c={...n};for(const a of Object.keys(e)){const u=e[a];u!==void 0&&(c[a]=u)}return c}function De(n){const e=[],c=[];let a;try{a=atob(n)}catch{return e.push("Failed to decode Base64 string."),{valid:!1,errors:e,warnings:c}}let u;try{u=JSON.parse(a)}catch{return e.push("Decoded string is not valid JSON."),{valid:!1,errors:e,warnings:c}}if(typeof u!="object"||u===null||Array.isArray(u))return e.push("Theme must be a JSON object."),{valid:!1,errors:e,warnings:c};const s=u;"seedColor"in s&&(typeof s.seedColor!="string"?e.push("seedColor must be a string."):v(s.seedColor)||e.push(`seedColor is not a valid CSS color: "${s.seedColor}". Accepted forms: ${T}.`));for(const t of["fontBody","fontHeadings","fontBrand","fontMonospace"])t in s&&typeof s[t]!="string"&&e.push(`${t} must be a string.`);const l=["normal","bold","lighter","bolder"],f=["inherit","initial","unset","revert","revert-layer"];for(const t of["fontWeightBody","fontWeightHeadings","fontWeightBrand","fontWeightMonospace"])if(t in s){const o=s[t];if(typeof o=="number")(o<1||o>1e3)&&e.push(`${t} numeric value must be 1\u20131000 (got ${o}).`);else if(typeof o=="string"){const r=l.includes(o)||f.includes(o);if(/^\d+$/.test(o)){const p=Number(o);(p<1||p>1e3)&&e.push(`${t} numeric value must be 1\u20131000 (got "${o}").`)}else r||c.push(`${t} = "${o}" is not a standard font-weight value.`)}else e.push(`${t} must be a string or number.`)}"stylesheets"in s&&(Array.isArray(s.stylesheets)?s.stylesheets.some(t=>typeof t!="string")&&e.push("Every entry in stylesheets must be a string."):e.push("stylesheets must be an array of strings."));const m=[["rootFontSize",1,100],["borderRadius",0,10],["viewportMin",100,1e4],["viewportMax",200,1e4]];for(const[t,o,r]of m)if(t in s)if(typeof s[t]!="number"||!isFinite(s[t]))e.push(`${t} must be a finite number.`);else{const i=s[t];o!==void 0&&i<o&&e.push(`${t} must be \u2265 ${o} (got ${i}).`),r!==void 0&&i>r&&c.push(`${t} = ${i} is unusually high (max ${r}).`)}for(const t of["typeRatio","spaceRatio"])if(t in s)if(typeof s[t]!="number"||!isFinite(s[t]))e.push(`${t} must be a finite number.`);else{const o=s[t];o<=1&&e.push(`${t} must be > 1 (got ${o}).`);const r=t==="typeRatio"?1.3:2;o>r&&c.push(`${t} = ${o} is very high (max ${r}); scales may be extreme.`)}if("viewportMin"in s&&"viewportMax"in s){const t=s.viewportMin,o=s.viewportMax;typeof t=="number"&&typeof o=="number"&&t>=o&&e.push(`viewportMin (${t}) must be less than viewportMax (${o}).`)}if("angles"in s)if(typeof s.angles!="object"||s.angles===null)e.push("angles must be an object.");else{const t=s.angles;for(const o of["analogous","complementary","splitComplementary","triadic"])if(o in t)if(typeof t[o]!="number"||!isFinite(t[o]))e.push(`angles.${o} must be a finite number.`);else{const r=t[o];(r<0||r>360)&&c.push(`angles.${o} = ${r} is outside 0\u2013360.`)}}if("semanticHues"in s)if(typeof s.semanticHues!="object"||s.semanticHues===null)e.push("semanticHues must be an object.");else{const t=s.semanticHues;for(const o of["danger","success","warning"])if(o in t)if(typeof t[o]!="number"||!isFinite(t[o]))e.push(`semanticHues.${o} must be a finite number.`);else{const r=t[o];(r<0||r>360)&&c.push(`semanticHues.${o} = ${r} is outside 0\u2013360.`)}}if("variantChroma"in s)if(typeof s.variantChroma!="object"||s.variantChroma===null)e.push("variantChroma must be an object.");else{const t=s.variantChroma;for(const o of Ae)if(o in t)if(typeof t[o]!="number"||!isFinite(t[o]))e.push(`variantChroma["${o}"] must be a finite number.`);else{const r=t[o];r<0&&e.push(`variantChroma["${o}"] must be \u2265 0 (got ${r}).`),r>O&&c.push(`variantChroma["${o}"] = ${r} exceeds ${O}.`)}}if("lightness"in s)if(typeof s.lightness!="object"||s.lightness===null)e.push("lightness must be an object.");else{const t=s.lightness;for(const o of R)if(o in t)if(typeof t[o]!="number"||!isFinite(t[o]))e.push(`lightness.${o} must be a finite number.`);else{const r=t[o];(r<0||r>1)&&e.push(`lightness.${o} must be 0\u20131 (got ${r}).`)}}if("chroma"in s)if(typeof s.chroma!="object"||s.chroma===null)e.push("chroma must be an object.");else{const t=s.chroma;for(const o of N)if(o in t){const r=t[o];if(typeof r!="object"||r===null){e.push(`chroma.${o} must be { min, max }.`);continue}const i=r;(typeof i.min!="number"||i.min<0)&&e.push(`chroma.${o}.min must be \u2265 0.`),(typeof i.max!="number"||i.max<0||i.max>O)&&e.push(`chroma.${o}.max must be 0\u2013${O}.`),typeof i.min=="number"&&typeof i.max=="number"&&i.min>i.max&&e.push(`chroma.${o}.min (${i.min}) must be \u2264 max (${i.max}).`)}}if("anchors"in s)if(typeof s.anchors!="object"||s.anchors===null||Array.isArray(s.anchors))e.push("anchors must be an object of named colors.");else for(const[t,o]of Object.entries(s.anchors))if(g(t)?C.test(t)||e.push(`anchors: "${t}" is not a valid anchor name; use a lowercase slug (letters, digits, hyphens).`):e.push(`anchors: "${t}" is a reserved JavaScript property name and cannot be an anchor name; rename it.`),F.includes(t)&&e.push(`anchors: "${t}" collides with a reserved color source name.`),typeof o=="string")v(o)||e.push(`anchors.${t} is not a valid CSS color: "${o}". Accepted forms: ${T}.`);else if(typeof o=="object"&&o!==null&&!Array.isArray(o)){const r=o;typeof r.color!="string"&&e.push(`anchors.${t} must declare its base "color".`);for(const[i,p]of Object.entries(r))g(i)?i!=="color"&&!C.test(i)&&e.push(`anchors.${t}: "${i}" is not a valid slot name; use a lowercase slug.`):e.push(`anchors.${t}: "${i}" is a reserved JavaScript property name and cannot be a slot name; rename it.`),typeof p!="string"?e.push(`anchors.${t}.${i} must be a CSS color string.`):v(p)||e.push(`anchors.${t}.${i} is not a valid CSS color: "${p}". Accepted forms: ${T}.`)}else e.push(`anchors.${t} must be a color string or a { color, \u2026slots } object.`);const h=new Map;if("anchors"in s&&typeof s.anchors=="object"&&s.anchors!==null&&!Array.isArray(s.anchors))for(const[t,o]of Object.entries(s.anchors))h.set(t,o);function S(t,o){const r=G(t);if(!r){e.push(`${o} "${t}" is not valid anchor syntax; use anchor:<name> or anchor:<name>.<slot>.`);return}if(!h.has(r.name)){const i=[...h.keys()];e.push(`${o} references undeclared anchor "${r.name}". Declared anchors: ${i.length>0?i.join(", "):"(none)"}.`);return}if(r.slot!==void 0){const i=h.get(r.name);if(typeof(typeof i=="object"&&i!==null&&!Array.isArray(i)?i[r.slot]:void 0)!="string"){const d=typeof i=="object"&&i!==null?Object.keys(i).filter(b=>b!=="color"):[];e.push(`${o} references unknown slot "${r.slot}" on anchor "${r.name}". Declared slots: ${d.length>0?d.join(", "):"(none)"}.`)}}}function y(t,o){if(t.startsWith("anchor:")){S(t,o);return}F.includes(t)||e.push(`${o} must be one of: ${F.join(", ")}, or a declared anchor as anchor:<name> / anchor:<name>.<slot>.`)}function A(t,o){if(t.startsWith("anchor:")){S(t,o);return}v(t)||e.push(`${o} is not a valid CSS color: "${t}". Accepted forms: ${T}, or a declared anchor as anchor:<name> / anchor:<name>.<slot>.`)}if("dataPalette"in s)if(typeof s.dataPalette!="object"||s.dataPalette===null||Array.isArray(s.dataPalette))e.push("dataPalette must be an object with series1\u2013series8 color values.");else{const t=s.dataPalette;for(const[o,r]of Object.entries(t)){if(!B.includes(o)){e.push(`dataPalette.${o} is not a series slot; expected one of: ${B.join(", ")}.`);continue}typeof r!="string"?e.push(`dataPalette.${o} must be a CSS color or anchor reference string.`):A(r,`dataPalette.${o}`)}}if("dataRamps"in s)if(typeof s.dataRamps!="object"||s.dataRamps===null||Array.isArray(s.dataRamps))e.push("dataRamps must be an object of named ramp declarations.");else for(const[t,o]of Object.entries(s.dataRamps)){if(g(t)?C.test(t)||e.push(`dataRamps: "${t}" is not a valid ramp name; use a lowercase slug (letters, digits, hyphens).`):e.push(`dataRamps: "${t}" is a reserved JavaScript property name and cannot be a ramp name; rename it.`),typeof o!="object"||o===null||Array.isArray(o)){e.push(`dataRamps.${t} must be a sequential or diverging ramp object.`);continue}const r=o,i=r.steps??ge;if((typeof i!="number"||!Number.isInteger(i)||i<L||i>P)&&e.push(`dataRamps.${t}.steps must be an integer from ${L} through ${P}.`),r.type==="sequential"){typeof r.source!="string"?e.push(`dataRamps.${t}.source must be a CSS color or anchor reference string.`):A(r.source,`dataRamps.${t}.source`);const p=r.lightnessStart??.95,d=r.lightnessEnd??.25;for(const[b,x]of[["lightnessStart",p],["lightnessEnd",d]])(typeof x!="number"||!Number.isFinite(x)||x<0||x>1)&&e.push(`dataRamps.${t}.${b} must be a finite number from 0 through 1.`);typeof p=="number"&&typeof d=="number"&&p<=d?e.push(`dataRamps.${t}.lightnessStart must be greater than lightnessEnd.`):typeof p=="number"&&Number.isFinite(p)&&typeof d=="number"&&Number.isFinite(d)&&typeof i=="number"&&Number.isInteger(i)&&i>=L&&i<=P&&(p-d)/(i-1)<=U&&e.push(`dataRamps.${t} lightness bounds must leave more than ${U} lightness between serialized stops.`);continue}if(r.type==="diverging"){typeof i=="number"&&Number.isInteger(i)&&i%2===0&&e.push(`dataRamps.${t}.steps must be odd so the neutral is the exact midpoint.`);for(const p of["start","end"])typeof r[p]!="string"?e.push(`dataRamps.${t}.${p} must be a CSS color or anchor reference string.`):A(r[p],`dataRamps.${t}.${p}`);"neutral"in r&&(typeof r.neutral!="string"?e.push(`dataRamps.${t}.neutral must be a CSS color or anchor reference string.`):A(r.neutral,`dataRamps.${t}.neutral`));continue}e.push(`dataRamps.${t}.type must be "sequential" or "diverging".`)}if("dataPalette"in s&&e.length===0){const t=Be(Z,s),o={};let r=!0;for(const i of B){const p=he(t.dataPalette[i],t.anchors);if(!p){r=!1;break}o[i]=p}if(r)for(const i of me(o))c.push(`dataPalette.${i.series[0]} and dataPalette.${i.series[1]} are only ${i.distance.toFixed(4)} apart under ${i.simulation} simulation (minimum ${i.threshold.toFixed(4)}); also distinguish the series with labels, shapes, or patterns.`)}if("roles"in s)if(typeof s.roles!="object"||s.roles===null||Array.isArray(s.roles))e.push("roles must be an object.");else{const t=s.roles;for(const[o,r]of Object.entries(t)){if(!D.includes(o)){e.push(`roles.${o} is not a role; expected one of: ${D.join(", ")}. (The status family is reserved and is not a role.)`);continue}const i=o,p=V[i];if(typeof r=="string"){y(r,`roles.${i}`);continue}if(typeof r!="object"||r===null||Array.isArray(r)){e.push(`roles.${i} must be a color source or a { color, \u2026slots } object.`);continue}const d=r;typeof d.color!="string"&&e.push(`roles.${i} must declare its base "color".`);for(const[b,x]of Object.entries(d)){if(!Object.prototype.hasOwnProperty.call(p,b)||!g(b)){const $=Object.keys(p).filter(k=>k!=="color");e.push(`roles.${i}.${b} is not a slot of the ${i} role. Declared slots: ${$.length>0?$.join(", "):"(none)"}.`);continue}typeof x!="string"?e.push(`roles.${i}.${b} must be a color source string.`):y(x,`roles.${i}.${b}`)}}}if("semanticMappings"in s)if(typeof s.semanticMappings!="object"||s.semanticMappings===null)e.push("semanticMappings must be an object.");else{const t=s.semanticMappings;for(const o of N)if(o in t){const r=t[o];if(typeof r!="object"||r===null){e.push(`semanticMappings.${o} must be { source, lightness }.`);continue}const i=r;typeof i.source!="string"?e.push(`semanticMappings.${o}.source must be a string.`):y(i.source,`semanticMappings.${o}.source`),(typeof i.lightness!="string"||!R.includes(i.lightness))&&e.push(`semanticMappings.${o}.lightness must be one of: ${R.join(", ")}.`)}}for(const t of["pageBackgroundImage","boxBackgroundImage","vellumBackgroundImage"])t in s&&typeof s[t]!="string"&&e.push(`${t} must be a string.`);for(const t of["pageBackgroundImageOpacity","boxBackgroundImageOpacity","vellumOpacity","vellumBackgroundImageOpacity"])if(t in s)if(typeof s[t]!="number"||!isFinite(s[t]))e.push(`${t} must be a finite number.`);else{const o=s[t];(o<0||o>1)&&e.push(`${t} must be 0\u20131 (got ${o}).`)}return{valid:e.length===0,errors:e,warnings:c}}const _e=["anchors","angles","dataPalette","dataRamps","roles","chroma","lightness","semanticHues","semanticMappings","variantChroma"];function Ie(n,e){const c={};for(const[a,u]of Object.entries(n))g(a)&&(c[a]=u);for(const[a,u]of Object.entries(e))u!==void 0&&g(a)&&(c[a]=u);for(const a of _e){const u=n[a],s=e[a];if(u&&typeof u=="object"&&!Array.isArray(u)&&s&&typeof s=="object"&&!Array.isArray(s)){if(a==="anchors"){c[a]=ee(u,s);continue}if(a==="dataRamps"){c[a]=te(u,s);continue}const l={};for(const[f,m]of Object.entries(u))g(f)&&(l[f]=m);for(const[f,m]of Object.entries(s))m!==void 0&&g(f)&&(l[f]=m);c[a]=l}}return c}function Ne(...n){let e={};for(const c of n){if(!c)continue;const a=Oe(c);a&&(e=Ie(e,a))}return K(e)}function oe(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const se={borderRadius:.1,fontBody:'"Noto Sans", sans-serif',fontWeightBody:"normal",fontHeadings:'"Inika", serif',fontWeightHeadings:"normal",fontBrand:'"Inika", serif',fontWeightBrand:"normal",fontMonospace:'"JetBrains Mono", monospace',fontWeightMonospace:"normal",seedColor:"oklch(.07 0.15 216)"};function Fe(n){return K({...se,pageBackgroundImage:`url("${oe(n)}")`,pageBackgroundImageOpacity:.5})}function We(n){return K({...se,pageBackgroundImage:`url("${oe(n)}")`,pageBackgroundImageOpacity:.55})}export{C as ANCHOR_SLUG_PATTERN,F as COLOR_SOURCES,ve as DEFAULT_DARK_LIGHTNESS,Re as DEFAULT_DARK_THEME,xe as DEFAULT_LIGHT_LIGHTNESS,Z as DEFAULT_LIGHT_THEME,W as DEFAULT_SEMANTIC_MAPPINGS,R as LIGHTNESS_KEYS,_e as NESTED_THEME_KEYS,D as ROLE_NAMES,$e as ROLE_PAIRED_INK,V as ROLE_TOKEN_PLAN,N as SEMANTIC_COLOR_NAMES,Y as TOKEN_PAIRINGS,Ae as VARIANT_COLOR_SOURCES,We as buildTaprootDarkTheme,Fe as buildTaprootLightTheme,q as compileRoles,K as encodeTheme,Ne as layerThemes,Ie as mergePartials,Be as mergeTheme,G as parseAnchorSource,Oe as parseTheme,de as resolveAnchorColor,he as resolveDataColorSource,Le as semanticToCSS,De as validateTheme};
|
|
1
|
+
import{ACCEPTED_COLOR_FORMS as w,apcaContrast as de,deriveSemantic as he,parseCssColor as M,parseOklch as ye,serializeOklch as be}from"./color-engine.js";import{computeVariants as $e,parseAnchorSource as xe,resolveAnchorColor as ke,resolveMappingSource as Se}from"./variant-engine.js";import{auditDataPalette as Ae,DATA_SERIES_KEYS as I,DEFAULT_DATA_PALETTE as N,DEFAULT_DATA_RAMP_STEPS as je,MAX_DATA_RAMP_STEPS as F,MIN_DATA_RAMP_LIGHTNESS_STEP as X,MIN_DATA_RAMP_STEPS as W}from"./data-colors.js";const A=/^[a-z][a-z0-9-]*$/;function Z(n){return xe(n)}function Re(n,e){return ke(n,e)}function Oe(n,e){const a=Z(n);if(a){const r=Re(e,a);return r&&M(r)?r:null}return M(n)?n:null}const P=["canvas","ink","accent","action","structure"],Q={canvas:{color:[["background","surface"],["layer1","raised1"],["layer2","raised2"],["layer3","raised3"],["layer4","raised4"]]},ink:{color:[["text","text"],["inputSelection","text"]],heading:[["headings","muted"],["headingsHover","ink"]]},accent:{color:[["linkHoverBg","raised2"],["inputSelectionBg","raised2"],["inputCaret","ink"]],text:[["link","accent"],["linkHover","text"]]},action:{color:[["actionBackground","muted"]],ink:[["actionText","surface"]]},structure:{color:[["border","border"],["shadow","shadow"]]}},Ce=new Set(["action.color"]),Me={canvas:"background",ink:"text",accent:"link",action:"actionBackground",structure:"border"},ve={"action.ink":{role:"canvas",slot:"color"}},Ee=.45;function ee(n,e){const a=ne.actionText,r=[...j].sort((m,b)=>n[m]-n[b]||j.indexOf(m)-j.indexOf(b)),i=e?r.filter(m=>e(m)>=a.targetLc):r,o=i.length>0?i:r;let l,p=1/0;for(const m of o){const b=Math.abs(n[m]-Ee);b<p&&(p=b,l=m)}return l??"muted"}function Te(n,e){const a=e[n]>.5;let r=j[0];for(const i of j)(a?e[i]<e[r]:e[i]>e[r])&&(r=i);return r}function H(n,e){if(n===void 0)return;if(typeof n=="string")return e==="color"?n:void 0;const a=n[e];return typeof a=="string"?a:void 0}function te(n,e,a,r={}){const i={},o={};for(const[l,p]of Object.entries(r.explicitMappings??{}))p!==void 0&&(o[l]=p.lightness);for(const l of P){const p=n[l];if(p!==void 0)for(const[m,b]of Object.entries(Q[l])){const h=ve[`${l}.${m}`];let $=H(p,m),R=!1;if($===void 0&&(h&&($=H(n[h.role],h.slot),$??=a[Me[h.role]]?.source,R=$!==void 0),$??=H(p,"color")),$!==void 0)for(const[S,O]of b){let t=O;if(Ce.has(`${l}.${m}`))t=ee(e,r.actionSurfaceContrast?s=>r.actionSurfaceContrast($,s):void 0);else if(R&&h){const s=ne[S],u=(s&&o[s.bg])??ee(e,r.actionSurfaceContrast?c=>r.actionSurfaceContrast(H(p,"color"),c):void 0);t=Te(u,e)}i[S]={source:$,lightness:t}}}}return i}const ne={text:{bg:"background",targetLc:75},dangerText:{bg:"background",targetLc:75},headings:{bg:"background",targetLc:60},headingsHover:{bg:"background",targetLc:60},link:{bg:"background",targetLc:75},linkHover:{bg:"background",targetLc:75},actionText:{bg:"actionBackground",targetLc:75},inputCaret:{bg:"layer2",targetLc:60},inputSelection:{bg:"inputSelectionBg",targetLc:60}},z=["background","layer1","layer2","layer3","layer4","actionBackground","actionText","border","shadow","text","dangerText","headings","headingsHover","link","linkHover","linkHoverBg","inputCaret","inputSelection","inputSelectionBg"],K=["primary","analogous-left","analogous-right","complementary","split-complementary-left","split-complementary-right","triadic-left","triadic-right","danger","success","warning"],Be=["analogous-left","analogous-right","complementary","split-complementary-left","split-complementary-right","triadic-left","triadic-right","danger","success","warning"],j=["surface","raised1","raised2","raised3","raised4","accent","muted","text","border","ink","shadow"],_e={surface:.99,raised1:.97,raised2:.9,raised3:.8,raised4:.72,accent:.5,muted:.45,text:.35,border:.3,ink:.25,shadow:.2},we={surface:.15,raised1:.2,raised2:.3,raised3:.4,raised4:.36,accent:.6,muted:.75,text:.85,border:.7,ink:.95,shadow:.6},U={background:{source:"primary",lightness:"surface"},layer1:{source:"primary",lightness:"raised1"},layer2:{source:"primary",lightness:"raised2"},layer3:{source:"primary",lightness:"raised3"},layer4:{source:"primary",lightness:"raised4"},actionBackground:{source:"primary",lightness:"raised3"},actionText:{source:"primary",lightness:"ink"},border:{source:"primary",lightness:"border"},shadow:{source:"primary",lightness:"shadow"},text:{source:"primary",lightness:"text"},dangerText:{source:"danger",lightness:"text"},headings:{source:"primary",lightness:"muted"},headingsHover:{source:"primary",lightness:"text"},link:{source:"complementary",lightness:"accent"},linkHover:{source:"complementary",lightness:"text"},linkHoverBg:{source:"triadic-left",lightness:"raised2"},inputCaret:{source:"triadic-right",lightness:"ink"},inputSelection:{source:"complementary",lightness:"text"},inputSelectionBg:{source:"triadic-left",lightness:"raised2"}},T=.4;function G(){const n={};for(const e of z)n[e]={min:0,max:T};return n}const oe={seedColor:"oklch(0.7 0.125 216)",fontBody:"",fontHeadings:"",fontBrand:"",fontMonospace:"",fontWeightBody:"normal",fontWeightHeadings:"bold",fontWeightBrand:"bold",fontWeightMonospace:"normal",stylesheets:[],rootFontSize:16,typeRatio:1.25,spaceRatio:1.618,borderRadius:.2,viewportMin:320,viewportMax:1200,angles:{analogous:30,complementary:180,splitComplementary:30,triadic:120},semanticHues:{danger:27,success:150,warning:90},variantChroma:{},chroma:G(),semanticMappings:{...U},anchors:{},roles:{},contexts:{},dataPalette:{...N},dataRamps:{}},se={...oe,chroma:G(),semanticMappings:{...U},anchors:{},roles:{},contexts:{},dataPalette:{...N},dataRamps:{},lightness:{..._e}},Ie={...oe,chroma:G(),semanticMappings:{...U},anchors:{},roles:{},contexts:{},dataPalette:{...N},dataRamps:{},lightness:{...we}},L=new WeakMap;L.set(se,new Set),L.set(Ie,new Set);const re=new Set(["__proto__","constructor","prototype"]);function g(n){return!re.has(n)}function Pe(n,e){return re.has(n)?void 0:e}function qe(n){return`--esp-color-${n.replace(/([A-Z])/g,"-$1").replace(/(\d)/g,"-$1").toLowerCase()}`}function V(n){try{const e=atob(n),a=JSON.parse(e,Pe);return typeof a!="object"||a===null||Array.isArray(a)?null:a}catch{return null}}function J(n){return btoa(JSON.stringify(n))}function D(n){if(ye(n))return n;const e=M(n);return e?be(e):n}function ae(n,e){const a={};for(const[r,i]of Object.entries(n))g(r)&&(a[r]=i);if(!e)return a;for(const[r,i]of Object.entries(e)){if(i===void 0||!g(r))continue;const o=a[r];if(o!==void 0&&typeof i=="object"&&i!==null){const l={};if(typeof o=="string")l.color=o;else for(const[p,m]of Object.entries(o))g(p)&&(l[p]=m);for(const[p,m]of Object.entries(i))m!==void 0&&g(p)&&(l[p]=m);a[r]=l;continue}a[r]=i}return a}function ie(n){if(typeof n!="object"||n===null||Array.isArray(n))return null;const e=n,a={};for(const r of P){const i=e[r];i!==void 0&&(a[r]=i)}if(typeof e.lightness=="object"&&e.lightness!==null&&!Array.isArray(e.lightness)){const r={};for(const i of j){const o=e.lightness[i];o!==void 0&&(r[i]=o)}a.lightness=r}return a}function He(n,e){const a={};for(const[r,i]of Object.entries(n)){if(!g(r)||!A.test(r))continue;const o=ie(i);o&&(a[r]=o)}if(!e)return a;for(const[r,i]of Object.entries(e)){if(!g(r)||!A.test(r)||i===void 0)continue;const o=ie(i);if(!o)continue;const l=a[r];a[r]={...l??{},...o,...l?.lightness||o.lightness?{lightness:{...l?.lightness,...o.lightness}}:{}}}return a}function v(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function E(n){const e={};for(const[a,r]of Object.entries(n))r!==void 0&&g(a)&&(e[a]=r);return e}function ce(n){if(!v(n))return n;const e=E(n);return v(n.lightness)&&(e.lightness=E(n.lightness)),e}function Le(n,e){const a={};for(const[r,i]of Object.entries(n))g(r)&&(a[r]=ce(i));if(!e)return a;for(const[r,i]of Object.entries(e)){if(!g(r)||i===void 0)continue;const o=a[r];if(!v(o)||!v(i)){a[r]=ce(i);continue}const l={...E(o),...E(i)};v(o.lightness)&&v(i.lightness)?l.lightness={...E(o.lightness),...E(i.lightness)}:v(i.lightness)&&(l.lightness=E(i.lightness)),a[r]=l}return a}function De(n){const e={};for(const[a,r]of Object.entries(n)){if(!g(a))continue;if(typeof r=="string"){e[a]=D(r);continue}const i={};for(const[o,l]of Object.entries(r))g(o)&&(i[o]=typeof l=="string"?D(l):l);e[a]=i}return e}function B(n){return typeof n!="string"?"":n.startsWith("anchor:")?n:D(n)}function Ne(n){const e={};for(const a of I)e[a]=B(n[a]);return e}function ue(n,e){const a={};for(const[r,i]of Object.entries(n))g(r)&&A.test(r)&&i&&typeof i=="object"&&!Array.isArray(i)&&(a[r]={...i});if(!e)return a;for(const[r,i]of Object.entries(e)){if(!g(r)||!A.test(r)||!i||typeof i!="object"||Array.isArray(i))continue;const o=a[r],l=o!==void 0&&i.type!==void 0&&i.type!==o.type;a[r]={...l?{}:o??{},...i}}return a}function Fe(n){const e={};for(const[a,r]of Object.entries(n))if(g(a)){if(r.type==="sequential"&&typeof r.source=="string"){e[a]={...r,source:B(r.source)};continue}if(r.type==="diverging"&&typeof r.start=="string"&&typeof r.end=="string"){e[a]={...r,start:B(r.start),end:B(r.end),...typeof r.neutral=="string"?{neutral:B(r.neutral)}:{}};continue}e[a]={...r}}return e}function le(n){const e=M(n.seedColor);if(!e)return;const a=$e(e,n);return(r,i)=>{const o=Se(r,a,n.anchors)??a.primary,l=n.chroma.actionBackground,p=he(o,n.lightness[i],l.min,l.max),m={l:p.l>.5?0:1,c:0,h:0};return Math.abs(de(m,p))}}function We(n){const e=L.get(n);if(e)return new Set(e);const a=new Set,r=te(n.roles,n.lightness,n.semanticMappings,{actionSurfaceContrast:le(n)});for(const[i,o]of Object.entries(r)){const l=n.semanticMappings[i];(l.source!==o.source||l.lightness!==o.lightness)&&a.add(i)}return a}function ze(n,e){const a={...n.roles,...e.roles},r=He(n.contexts,e.contexts),i={...n.lightness,...e.lightness},o=De(ae(n.anchors,e.anchors)),l=typeof e.seedColor=="string"?D(e.seedColor):n.seedColor,p=e.semanticMappings,m={...n.angles,...e.angles},b={...n.semanticHues,...e.semanticHues},h={...n.variantChroma,...e.variantChroma},$=_(n.chroma,e.chroma),R=Ne(_(n.dataPalette,e.dataPalette)),S=Fe(ue(n.dataRamps,e.dataRamps)),O=We(n),t=new Set(O),s={};for(const x of O)s[x]=n.semanticMappings[x];for(const[x,k]of Object.entries(p??{}))k!==void 0&&(t.add(x),s[x]=k);const u=_(n.semanticMappings,p),c=le({angles:m,anchors:o,chroma:$,lightness:i,seedColor:l,semanticHues:b,variantChroma:h}),f=te(a,i,u,{explicitMappings:s,actionSurfaceContrast:c}),d={};for(const[x,k]of Object.entries(f))t.has(x)||(d[x]=k);const C=_(_(n.semanticMappings,d),p),y={...n,seedColor:l,fontBody:e.fontBody??n.fontBody,fontHeadings:e.fontHeadings??n.fontHeadings,fontBrand:e.fontBrand??n.fontBrand,fontMonospace:e.fontMonospace??n.fontMonospace,fontWeightBody:String(e.fontWeightBody??n.fontWeightBody),fontWeightHeadings:String(e.fontWeightHeadings??n.fontWeightHeadings),fontWeightBrand:String(e.fontWeightBrand??n.fontWeightBrand),fontWeightMonospace:String(e.fontWeightMonospace??n.fontWeightMonospace),stylesheets:e.stylesheets??[...n.stylesheets],rootFontSize:e.rootFontSize??n.rootFontSize,typeRatio:e.typeRatio??n.typeRatio,spaceRatio:e.spaceRatio??n.spaceRatio,borderRadius:e.borderRadius??n.borderRadius,viewportMin:e.viewportMin??n.viewportMin,viewportMax:e.viewportMax??n.viewportMax,angles:m,semanticHues:b,variantChroma:h,lightness:i,chroma:$,semanticMappings:C,anchors:o,roles:a,contexts:r,dataPalette:R,dataRamps:S};return e.pageBackgroundImage!==void 0&&(y.pageBackgroundImage=e.pageBackgroundImage),e.pageBackgroundImageOpacity!==void 0&&(y.pageBackgroundImageOpacity=e.pageBackgroundImageOpacity),e.boxBackgroundImage!==void 0&&(y.boxBackgroundImage=e.boxBackgroundImage),e.boxBackgroundImageOpacity!==void 0&&(y.boxBackgroundImageOpacity=e.boxBackgroundImageOpacity),e.vellumOpacity!==void 0&&(y.vellumOpacity=e.vellumOpacity),e.vellumBackgroundImage!==void 0&&(y.vellumBackgroundImage=e.vellumBackgroundImage),e.vellumBackgroundImageOpacity!==void 0&&(y.vellumBackgroundImageOpacity=e.vellumBackgroundImageOpacity),L.set(y,new Set(t)),y}function _(n,e){if(!e)return{...n};const a={...n};for(const r of Object.keys(e)){const i=e[r];i!==void 0&&(a[r]=i)}return a}function fe(n){const e=[],a=[];let r;try{r=atob(n)}catch{return e.push("Failed to decode Base64 string."),{valid:!1,errors:e,warnings:a}}let i;try{i=JSON.parse(r)}catch{return e.push("Decoded string is not valid JSON."),{valid:!1,errors:e,warnings:a}}if(typeof i!="object"||i===null||Array.isArray(i))return e.push("Theme must be a JSON object."),{valid:!1,errors:e,warnings:a};const o=i;"seedColor"in o&&(typeof o.seedColor!="string"?e.push("seedColor must be a string."):M(o.seedColor)||e.push(`seedColor is not a valid CSS color: "${o.seedColor}". Accepted forms: ${w}.`));for(const t of["fontBody","fontHeadings","fontBrand","fontMonospace"])t in o&&typeof o[t]!="string"&&e.push(`${t} must be a string.`);const l=["normal","bold","lighter","bolder"],p=["inherit","initial","unset","revert","revert-layer"];for(const t of["fontWeightBody","fontWeightHeadings","fontWeightBrand","fontWeightMonospace"])if(t in o){const s=o[t];if(typeof s=="number")(s<1||s>1e3)&&e.push(`${t} numeric value must be 1\u20131000 (got ${s}).`);else if(typeof s=="string"){const u=l.includes(s)||p.includes(s);if(/^\d+$/.test(s)){const f=Number(s);(f<1||f>1e3)&&e.push(`${t} numeric value must be 1\u20131000 (got "${s}").`)}else u||a.push(`${t} = "${s}" is not a standard font-weight value.`)}else e.push(`${t} must be a string or number.`)}"stylesheets"in o&&(Array.isArray(o.stylesheets)?o.stylesheets.some(t=>typeof t!="string")&&e.push("Every entry in stylesheets must be a string."):e.push("stylesheets must be an array of strings."));const m=[["rootFontSize",1,100],["borderRadius",0,10],["viewportMin",100,1e4],["viewportMax",200,1e4]];for(const[t,s,u]of m)if(t in o)if(typeof o[t]!="number"||!isFinite(o[t]))e.push(`${t} must be a finite number.`);else{const c=o[t];s!==void 0&&c<s&&e.push(`${t} must be \u2265 ${s} (got ${c}).`),u!==void 0&&c>u&&a.push(`${t} = ${c} is unusually high (max ${u}).`)}for(const t of["typeRatio","spaceRatio"])if(t in o)if(typeof o[t]!="number"||!isFinite(o[t]))e.push(`${t} must be a finite number.`);else{const s=o[t];s<=1&&e.push(`${t} must be > 1 (got ${s}).`);const u=t==="typeRatio"?1.3:2;s>u&&a.push(`${t} = ${s} is very high (max ${u}); scales may be extreme.`)}if("viewportMin"in o&&"viewportMax"in o){const t=o.viewportMin,s=o.viewportMax;typeof t=="number"&&typeof s=="number"&&t>=s&&e.push(`viewportMin (${t}) must be less than viewportMax (${s}).`)}if("angles"in o)if(typeof o.angles!="object"||o.angles===null)e.push("angles must be an object.");else{const t=o.angles;for(const s of["analogous","complementary","splitComplementary","triadic"])if(s in t)if(typeof t[s]!="number"||!isFinite(t[s]))e.push(`angles.${s} must be a finite number.`);else{const u=t[s];(u<0||u>360)&&a.push(`angles.${s} = ${u} is outside 0\u2013360.`)}}if("semanticHues"in o)if(typeof o.semanticHues!="object"||o.semanticHues===null)e.push("semanticHues must be an object.");else{const t=o.semanticHues;for(const s of["danger","success","warning"])if(s in t)if(typeof t[s]!="number"||!isFinite(t[s]))e.push(`semanticHues.${s} must be a finite number.`);else{const u=t[s];(u<0||u>360)&&a.push(`semanticHues.${s} = ${u} is outside 0\u2013360.`)}}if("variantChroma"in o)if(typeof o.variantChroma!="object"||o.variantChroma===null)e.push("variantChroma must be an object.");else{const t=o.variantChroma;for(const s of Be)if(s in t)if(typeof t[s]!="number"||!isFinite(t[s]))e.push(`variantChroma["${s}"] must be a finite number.`);else{const u=t[s];u<0&&e.push(`variantChroma["${s}"] must be \u2265 0 (got ${u}).`),u>T&&a.push(`variantChroma["${s}"] = ${u} exceeds ${T}.`)}}function b(t,s){if(typeof t!="object"||t===null||Array.isArray(t)){e.push(`${s} must be an object.`);return}const u=t;for(const c of j)if(c in u)if(typeof u[c]!="number"||!isFinite(u[c]))e.push(`${s}.${c} must be a finite number.`);else{const f=u[c];(f<0||f>1)&&e.push(`${s}.${c} must be 0\u20131 (got ${f}).`)}}if("lightness"in o&&b(o.lightness,"lightness"),"chroma"in o)if(typeof o.chroma!="object"||o.chroma===null)e.push("chroma must be an object.");else{const t=o.chroma;for(const s of z)if(s in t){const u=t[s];if(typeof u!="object"||u===null){e.push(`chroma.${s} must be { min, max }.`);continue}const c=u;(typeof c.min!="number"||c.min<0)&&e.push(`chroma.${s}.min must be \u2265 0.`),(typeof c.max!="number"||c.max<0||c.max>T)&&e.push(`chroma.${s}.max must be 0\u2013${T}.`),typeof c.min=="number"&&typeof c.max=="number"&&c.min>c.max&&e.push(`chroma.${s}.min (${c.min}) must be \u2264 max (${c.max}).`)}}if("anchors"in o)if(typeof o.anchors!="object"||o.anchors===null||Array.isArray(o.anchors))e.push("anchors must be an object of named colors.");else for(const[t,s]of Object.entries(o.anchors))if(g(t)?A.test(t)||e.push(`anchors: "${t}" is not a valid anchor name; use a lowercase slug (letters, digits, hyphens).`):e.push(`anchors: "${t}" is a reserved JavaScript property name and cannot be an anchor name; rename it.`),K.includes(t)&&e.push(`anchors: "${t}" collides with a reserved color source name.`),typeof s=="string")M(s)||e.push(`anchors.${t} is not a valid CSS color: "${s}". Accepted forms: ${w}.`);else if(typeof s=="object"&&s!==null&&!Array.isArray(s)){const u=s;typeof u.color!="string"&&e.push(`anchors.${t} must declare its base "color".`);for(const[c,f]of Object.entries(u))g(c)?c!=="color"&&!A.test(c)&&e.push(`anchors.${t}: "${c}" is not a valid slot name; use a lowercase slug.`):e.push(`anchors.${t}: "${c}" is a reserved JavaScript property name and cannot be a slot name; rename it.`),typeof f!="string"?e.push(`anchors.${t}.${c} must be a CSS color string.`):M(f)||e.push(`anchors.${t}.${c} is not a valid CSS color: "${f}". Accepted forms: ${w}.`)}else e.push(`anchors.${t} must be a color string or a { color, \u2026slots } object.`);const h=new Map;if("anchors"in o&&typeof o.anchors=="object"&&o.anchors!==null&&!Array.isArray(o.anchors))for(const[t,s]of Object.entries(o.anchors))h.set(t,s);function $(t,s){const u=Z(t);if(!u){e.push(`${s} "${t}" is not valid anchor syntax; use anchor:<name> or anchor:<name>.<slot>.`);return}if(!h.has(u.name)){const c=[...h.keys()];e.push(`${s} references undeclared anchor "${u.name}". Declared anchors: ${c.length>0?c.join(", "):"(none)"}.`);return}if(u.slot!==void 0){const c=h.get(u.name);if(typeof(typeof c=="object"&&c!==null&&!Array.isArray(c)?c[u.slot]:void 0)!="string"){const d=typeof c=="object"&&c!==null?Object.keys(c).filter(C=>C!=="color"):[];e.push(`${s} references unknown slot "${u.slot}" on anchor "${u.name}". Declared slots: ${d.length>0?d.join(", "):"(none)"}.`)}}}function R(t,s){if(t.startsWith("anchor:")){$(t,s);return}K.includes(t)||e.push(`${s} must be one of: ${K.join(", ")}, or a declared anchor as anchor:<name> / anchor:<name>.<slot>.`)}function S(t,s){if(t.startsWith("anchor:")){$(t,s);return}M(t)||e.push(`${s} is not a valid CSS color: "${t}". Accepted forms: ${w}, or a declared anchor as anchor:<name> / anchor:<name>.<slot>.`)}if("dataPalette"in o)if(typeof o.dataPalette!="object"||o.dataPalette===null||Array.isArray(o.dataPalette))e.push("dataPalette must be an object with series1\u2013series8 color values.");else{const t=o.dataPalette;for(const[s,u]of Object.entries(t)){if(!I.includes(s)){e.push(`dataPalette.${s} is not a series slot; expected one of: ${I.join(", ")}.`);continue}typeof u!="string"?e.push(`dataPalette.${s} must be a CSS color or anchor reference string.`):S(u,`dataPalette.${s}`)}}if("dataRamps"in o)if(typeof o.dataRamps!="object"||o.dataRamps===null||Array.isArray(o.dataRamps))e.push("dataRamps must be an object of named ramp declarations.");else for(const[t,s]of Object.entries(o.dataRamps)){if(g(t)?A.test(t)||e.push(`dataRamps: "${t}" is not a valid ramp name; use a lowercase slug (letters, digits, hyphens).`):e.push(`dataRamps: "${t}" is a reserved JavaScript property name and cannot be a ramp name; rename it.`),typeof s!="object"||s===null||Array.isArray(s)){e.push(`dataRamps.${t} must be a sequential or diverging ramp object.`);continue}const u=s,c=u.steps??je;if((typeof c!="number"||!Number.isInteger(c)||c<W||c>F)&&e.push(`dataRamps.${t}.steps must be an integer from ${W} through ${F}.`),u.type==="sequential"){typeof u.source!="string"?e.push(`dataRamps.${t}.source must be a CSS color or anchor reference string.`):S(u.source,`dataRamps.${t}.source`);const f=u.lightnessStart??.95,d=u.lightnessEnd??.25;for(const[C,y]of[["lightnessStart",f],["lightnessEnd",d]])(typeof y!="number"||!Number.isFinite(y)||y<0||y>1)&&e.push(`dataRamps.${t}.${C} must be a finite number from 0 through 1.`);typeof f=="number"&&typeof d=="number"&&f<=d?e.push(`dataRamps.${t}.lightnessStart must be greater than lightnessEnd.`):typeof f=="number"&&Number.isFinite(f)&&typeof d=="number"&&Number.isFinite(d)&&typeof c=="number"&&Number.isInteger(c)&&c>=W&&c<=F&&(f-d)/(c-1)<=X&&e.push(`dataRamps.${t} lightness bounds must leave more than ${X} lightness between serialized stops.`);continue}if(u.type==="diverging"){typeof c=="number"&&Number.isInteger(c)&&c%2===0&&e.push(`dataRamps.${t}.steps must be odd so the neutral is the exact midpoint.`);for(const f of["start","end"])typeof u[f]!="string"?e.push(`dataRamps.${t}.${f} must be a CSS color or anchor reference string.`):S(u[f],`dataRamps.${t}.${f}`);"neutral"in u&&(typeof u.neutral!="string"?e.push(`dataRamps.${t}.neutral must be a CSS color or anchor reference string.`):S(u.neutral,`dataRamps.${t}.neutral`));continue}e.push(`dataRamps.${t}.type must be "sequential" or "diverging".`)}if("dataPalette"in o&&e.length===0){const t=ze(se,o),s={};let u=!0;for(const c of I){const f=Oe(t.dataPalette[c],t.anchors);if(!f){u=!1;break}s[c]=f}if(u)for(const c of Ae(s))a.push(`dataPalette.${c.series[0]} and dataPalette.${c.series[1]} are only ${c.distance.toFixed(4)} apart under ${c.simulation} simulation (minimum ${c.threshold.toFixed(4)}); also distinguish the series with labels, shapes, or patterns.`)}function O(t,s){if(typeof t!="object"||t===null||Array.isArray(t)){e.push(`${s} must be an object.`);return}const u=t;for(const[c,f]of Object.entries(u)){const d=`${s}.${c}`;if(!P.includes(c)){e.push(`${d} is not a role; expected one of: ${P.join(", ")}. (The status family is reserved and is not a role.)`);continue}const C=c,y=Q[C];if(typeof f=="string"){R(f,d);continue}if(typeof f!="object"||f===null||Array.isArray(f)){e.push(`${d} must be a color source or a { color, \u2026slots } object.`);continue}const x=f;typeof x.color!="string"&&e.push(`${d} must declare its base "color".`);for(const[k,q]of Object.entries(x)){if(!Object.prototype.hasOwnProperty.call(y,k)||!g(k)){const Y=Object.keys(y).filter(ge=>ge!=="color");e.push(`${d}.${k} is not a slot of the ${C} role. Declared slots: ${Y.length>0?Y.join(", "):"(none)"}.`);continue}typeof q!="string"?e.push(`${d}.${k} must be a color source string.`):R(q,`${d}.${k}`)}}}if("roles"in o&&O(o.roles,"roles"),"contexts"in o)if(typeof o.contexts!="object"||o.contexts===null||Array.isArray(o.contexts))e.push("contexts must be an object.");else for(const[t,s]of Object.entries(o.contexts)){if(!g(t)||!A.test(t)){e.push(`contexts.${t} must be a lowercase slug matching ${A.source}.`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){O(s,`contexts.${t}`);continue}const u=s,c=Object.fromEntries(Object.entries(u).filter(([f])=>f!=="lightness"));O(c,`contexts.${t}`),"lightness"in u&&b(u.lightness,`contexts.${t}.lightness`)}if("semanticMappings"in o)if(typeof o.semanticMappings!="object"||o.semanticMappings===null)e.push("semanticMappings must be an object.");else{const t=o.semanticMappings;for(const s of z)if(s in t){const u=t[s];if(typeof u!="object"||u===null){e.push(`semanticMappings.${s} must be { source, lightness }.`);continue}const c=u;typeof c.source!="string"?e.push(`semanticMappings.${s}.source must be a string.`):R(c.source,`semanticMappings.${s}.source`),(typeof c.lightness!="string"||!j.includes(c.lightness))&&e.push(`semanticMappings.${s}.lightness must be one of: ${j.join(", ")}.`)}}for(const t of["pageBackgroundImage","boxBackgroundImage","vellumBackgroundImage"])t in o&&typeof o[t]!="string"&&e.push(`${t} must be a string.`);for(const t of["pageBackgroundImageOpacity","boxBackgroundImageOpacity","vellumOpacity","vellumBackgroundImageOpacity"])if(t in o)if(typeof o[t]!="number"||!isFinite(o[t]))e.push(`${t} must be a finite number.`);else{const s=o[t];(s<0||s>1)&&e.push(`${t} must be 0\u20131 (got ${s}).`)}return{valid:e.length===0,errors:e,warnings:a}}function Ye(n,e){const a=fe(n),r=fe(e),i=[...a.errors.map(l=>`light: ${l}`),...r.errors.map(l=>`dark: ${l}`)],o=[...a.warnings.map(l=>`light: ${l}`),...r.warnings.map(l=>`dark: ${l}`)];if(a.valid&&r.valid){const l=new Set(Object.keys(V(n)?.contexts??{})),p=new Set(Object.keys(V(e)?.contexts??{})),m=[...p].filter(h=>!l.has(h)).sort(),b=[...l].filter(h=>!p.has(h)).sort();(m.length>0||b.length>0)&&i.push(`contexts must declare the same names in both schemes. Missing from light: ${m.join(", ")||"(none)"}. Missing from dark: ${b.join(", ")||"(none)"}.`)}return{valid:i.length===0,errors:i,warnings:o}}const Ke=["anchors","angles","contexts","dataPalette","dataRamps","roles","chroma","lightness","semanticHues","semanticMappings","variantChroma"];function Ue(n,e){const a={};for(const[r,i]of Object.entries(n))g(r)&&(a[r]=i);for(const[r,i]of Object.entries(e))i!==void 0&&g(r)&&(a[r]=i);for(const r of Ke){const i=n[r],o=e[r];if(i&&typeof i=="object"&&!Array.isArray(i)&&o&&typeof o=="object"&&!Array.isArray(o)){if(r==="anchors"){a[r]=ae(i,o);continue}if(r==="contexts"){a[r]=Le(i,o);continue}if(r==="dataRamps"){a[r]=ue(i,o);continue}const l={};for(const[p,m]of Object.entries(i))g(p)&&(l[p]=m);for(const[p,m]of Object.entries(o))m!==void 0&&g(p)&&(l[p]=m);a[r]=l}}return a}function Xe(...n){let e={};for(const a of n){if(!a)continue;const r=V(a);r&&(e=Ue(e,r))}return J(e)}function pe(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const me={borderRadius:.1,fontBody:'"Noto Sans", sans-serif',fontWeightBody:"normal",fontHeadings:'"Inika", serif',fontWeightHeadings:"normal",fontBrand:'"Inika", serif',fontWeightBrand:"normal",fontMonospace:'"JetBrains Mono", monospace',fontWeightMonospace:"normal",seedColor:"oklch(.07 0.15 216)"};function Ze(n){return J({...me,pageBackgroundImage:`url("${pe(n)}")`,pageBackgroundImageOpacity:.5})}function Qe(n){return J({...me,pageBackgroundImage:`url("${pe(n)}")`,pageBackgroundImageOpacity:.55})}export{A as ANCHOR_SLUG_PATTERN,K as COLOR_SOURCES,we as DEFAULT_DARK_LIGHTNESS,Ie as DEFAULT_DARK_THEME,_e as DEFAULT_LIGHT_LIGHTNESS,se as DEFAULT_LIGHT_THEME,U as DEFAULT_SEMANTIC_MAPPINGS,j as LIGHTNESS_KEYS,Ke as NESTED_THEME_KEYS,P as ROLE_NAMES,ve as ROLE_PAIRED_INK,Q as ROLE_TOKEN_PLAN,z as SEMANTIC_COLOR_NAMES,ne as TOKEN_PAIRINGS,Be as VARIANT_COLOR_SOURCES,Qe as buildTaprootDarkTheme,Ze as buildTaprootLightTheme,te as compileRoles,J as encodeTheme,Xe as layerThemes,Ue as mergePartials,ze as mergeTheme,Z as parseAnchorSource,V as parseTheme,Re as resolveAnchorColor,Oe as resolveDataColorSource,qe as semanticToCSS,fe as validateTheme,Ye as validateThemePair};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/espalier",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.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",
|