@taprootio/espalier 7.2.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/custom-elements.json +36241 -46953
  3. package/dist/badge/esp-badge.d.ts +46 -0
  4. package/dist/badge/esp-badge.js +41 -6
  5. package/dist/breadcrumbs/breadcrumb-separators.d.ts +4 -0
  6. package/dist/breadcrumbs/breadcrumb-separators.js +1 -0
  7. package/dist/breadcrumbs/esp-breadcrumb.d.ts +14 -14
  8. package/dist/breadcrumbs/esp-breadcrumb.js +14 -7
  9. package/dist/breadcrumbs/esp-breadcrumbs.d.ts +16 -9
  10. package/dist/breadcrumbs/esp-breadcrumbs.js +9 -6
  11. package/dist/cli/theme-check.js +2 -2
  12. package/dist/font-picker/esp-font-picker.d.ts +11 -14
  13. package/dist/font-picker/esp-font-picker.js +5 -5
  14. package/dist/footer/esp-footer-link-group.js +12 -9
  15. package/dist/footer/esp-footer.d.ts +8 -3
  16. package/dist/footer/esp-footer.js +20 -12
  17. package/dist/footer/paint-registration.js +1 -1
  18. package/dist/header/esp-header-button.js +3 -3
  19. package/dist/header/esp-header.js +9 -9
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +1 -1
  22. package/dist/pickers/esp-picker-item.js +1 -1
  23. package/dist/root/esp-root.d.ts +8 -1
  24. package/dist/root/esp-root.js +80 -13
  25. package/dist/root/helpers/compute-semantic-properties.js +1 -1
  26. package/dist/root/helpers/compute-theme-properties.js +1 -1
  27. package/dist/root/helpers/data-companion-properties.js +1 -1
  28. package/dist/root/helpers/lightness-ramp-properties.js +1 -1
  29. package/dist/shared/blockquote-styles.d.ts +3 -0
  30. package/dist/shared/blockquote-styles.js +4 -4
  31. package/dist/shared/color-engine.js +1 -1
  32. package/dist/shared/component-property-compiler.js +1 -0
  33. package/dist/shared/component-property-diagnostics.js +1 -0
  34. package/dist/shared/component-property-normalizer.js +1 -0
  35. package/dist/shared/component-property-resets.js +1 -0
  36. package/dist/shared/document-sprite.js +1 -1
  37. package/dist/shared/esp-element-base.d.ts +3 -0
  38. package/dist/shared/esp-element-base.js +3 -3
  39. package/dist/shared/font-helpers.d.ts +3 -3
  40. package/dist/shared/font-helpers.js +1 -1
  41. package/dist/shared/font-plan.d.ts +1 -1
  42. package/dist/shared/footer-ink-styles.js +18 -0
  43. package/dist/shared/footer-ink.js +1 -0
  44. package/dist/shared/governing-root.d.ts +24 -0
  45. package/dist/shared/governing-root.js +1 -0
  46. package/dist/shared/intent-values.js +1 -1
  47. package/dist/shared/paint-catalog.js +1 -1
  48. package/dist/shared/paint-fit.js +1 -1
  49. package/dist/shared/public-token-catalog.generated.js +1 -0
  50. package/dist/shared/root-event-subscription.d.ts +11 -0
  51. package/dist/shared/scoped-style-declarations.js +1 -0
  52. package/dist/shared/semantic-color-names.d.ts +16 -0
  53. package/dist/shared/semantic-color-names.js +1 -0
  54. package/dist/shared/settable-component-properties.js +1 -0
  55. package/dist/shared/theme-core.d.ts +808 -0
  56. package/dist/shared/theme-core.js +1 -0
  57. package/dist/shared/theme-fit-report.d.ts +34 -6
  58. package/dist/shared/theme-fit-report.js +1 -1
  59. package/dist/shared/theme-mapping-grammar.d.ts +16 -0
  60. package/dist/shared/theme-mapping-grammar.js +1 -0
  61. package/dist/shared/theme-properties.d.ts +3 -1
  62. package/dist/shared/theme-properties.js +1 -1
  63. package/dist/shared/theme-validation.d.ts +52 -0
  64. package/dist/shared/theme-validation.js +1 -0
  65. package/dist/shared/theme.d.ts +4 -876
  66. package/dist/shared/theme.js +1 -1
  67. package/dist/shared/token-pairings.d.ts +1 -1
  68. package/dist/testing/observe-paint.iife.js +2 -2
  69. package/espalier.css-data.json +109 -5
  70. package/espalier.token-manifest.json +5914 -32
  71. package/package.json +5 -1
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"./section/esp-section.js";export*from"./stack/esp-stack.js";export*from"./row/esp-row.js";export*from"./columns/esp-columns.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"./image-picker/esp-image-picker.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"./video/esp-video.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 io,DEFAULT_ICON_VIEW_BOX as Fo,INTENT_VARIANTS as lo,normalizeIntentVariant as no,getIconHrefForHost as Ao,getIconSpriteUrl as So,getIconSpriteReference as so}from"./shared/intent-values.js";import{EspalierElementBase as Ro}from"./shared/esp-element-base.js";import{VALIDITY_CHANGED_EVENT as co}from"./shared/validation.js";import{FormFieldController as go}from"./shared/form-field-controller.js";import{traverseToClosest as Mo}from"./shared/utilities.js";import{showToast as Ho}from"./shared/toast-events.js";import{showFlyout as uo,closeFlyout as Uo}from"./shared/flyout-events.js";import{requestHelp as bo}from"./shared/help-events.js";import{getEspBus as Vo}from"./shared/bus-events.js";export*from"./shared/events.js";import{getImageDetails as vo,releasePreviewUrl as yo}from"./image-upload/image-helpers.js";import{calculateAlbumLayout as Bo,DEFAULT_ALBUM_MAX_ROW_HEIGHT_VH as zo,normalizeAlbumMaxRowHeightVh as Ko,normalizeMaxImagesPerRow as Xo}from"./shared/justified-layout.js";import{encodeTheme as Yo,parseTheme as jo,mergePartials as Jo,layerThemes as Qo,validateThemePair as Zo,resolveContextTheme as $o,isObjectRecord as oe,isSemanticColorName as ee,buildTaprootLightTheme as re,buildTaprootDarkTheme as te,NESTED_THEME_KEYS as me}from"./shared/theme.js";import{auditDataPalette as fe,describePaletteCollision as xe,generateSequentialRamp as Te,generateDivergingRamp as _e,COLOR_VISION_SIMULATIONS as Ee,DATA_SERIES_KEYS as ae,DEFAULT_DATA_PALETTE as Ie,DEFAULT_DATA_RAMP_STEPS as ie,DEFAULT_DIVERGING_NEUTRAL as Fe,MAX_DATA_RAMP_STEPS as le,MIN_DATA_COLOR_DISTANCE as ne,MIN_DATA_RAMP_LIGHTNESS_STEP as Ae,MIN_DATA_RAMP_STEPS as Se}from"./shared/data-colors.js";import{canonicalFontStack as Le,classifyFontStack as Re,customWebSafeFont as De,isDeviceFontStack as ce,matchWebSafeFont as Ne,parseFontStack as ge,webSafeFontWeights as he}from"./shared/font-stacks.js";import{WEIGHT_LABELS as Pe,extractWeights as He,normalizeWeight as Oe,bestAvailableWeight as ue,extractFamily as Ue,getFallbackFont as Ce,googleFontStylesheetUrl as be,isLocalFontFamily as Ge,normalizeFontFaceWeight as Ve,removeRuntimeGoogleFontLink as ke,removeRuntimeGoogleFontLinks as We,syncRuntimeGoogleFontLink as de,RUNTIME_GOOGLE_FONT_OWNER_ATTR as ve}from"./shared/font-helpers.js";import{compileFontPlan as we,fontFallbackAliases as Be,fontFallbackBaseIndexes as ze,fontFaceRequestKey as Ke}from"./shared/font-plan.js";import{getGoogleFonts as qe}from"./font-picker/esp-font-picker.js";import{ROOT_SURFACE as je,THEME_FIT_ANCHOR_FIELDS as Je,THEME_FIT_APCA_FIELDS as Qe,THEME_FIT_DATA_PALETTE_LINT_FIELDS as Ze,THEME_FIT_DATA_PALETTE_LINT_IDS as $e,THEME_FIT_EXPLICIT_VALUES as or,THEME_FIT_LINT_FIELDS as er,THEME_FIT_LINT_IDS as rr,THEME_FIT_LINT_SEVERITIES as tr,THEME_FIT_PAIRING_VALUES as mr,THEME_FIT_REPORT_FIELDS as pr,THEME_FIT_SUITE_FIELDS as fr,THEME_FIT_TOKEN_FIELDS as xr,themeFitReport as Tr,themeFitRows as _r,themeFitLints as Er,themeFitReportSuite as ar,printThemeFitReport as Ir}from"./shared/theme-fit-report.js";import{ICON_SPRITE as Fr,ICON_SPRITE_ID as lr,installIconSprite as nr}from"./icons/index.js";import{deriveLightnessRamp as Sr,themeFromSwatches as sr}from"./shared/theme-swatches.js";export{Ee as COLOR_VISION_SIMULATIONS,ae as DATA_SERIES_KEYS,zo as DEFAULT_ALBUM_MAX_ROW_HEIGHT_VH,Ie as DEFAULT_DATA_PALETTE,ie as DEFAULT_DATA_RAMP_STEPS,Fe as DEFAULT_DIVERGING_NEUTRAL,io as DEFAULT_ICON_SPRITE_URL,Fo as DEFAULT_ICON_VIEW_BOX,Ro as EspalierElementBase,go as FormFieldController,Fr as ICON_SPRITE,lr as ICON_SPRITE_ID,lo as INTENT_VARIANTS,le as MAX_DATA_RAMP_STEPS,ne as MIN_DATA_COLOR_DISTANCE,Ae as MIN_DATA_RAMP_LIGHTNESS_STEP,Se as MIN_DATA_RAMP_STEPS,me as NESTED_THEME_KEYS,je as ROOT_SURFACE,ve as RUNTIME_GOOGLE_FONT_OWNER_ATTR,Je as THEME_FIT_ANCHOR_FIELDS,Qe as THEME_FIT_APCA_FIELDS,Ze as THEME_FIT_DATA_PALETTE_LINT_FIELDS,$e as THEME_FIT_DATA_PALETTE_LINT_IDS,or as THEME_FIT_EXPLICIT_VALUES,er as THEME_FIT_LINT_FIELDS,rr as THEME_FIT_LINT_IDS,tr as THEME_FIT_LINT_SEVERITIES,mr as THEME_FIT_PAIRING_VALUES,pr as THEME_FIT_REPORT_FIELDS,fr as THEME_FIT_SUITE_FIELDS,xr as THEME_FIT_TOKEN_FIELDS,co as VALIDITY_CHANGED_EVENT,Pe as WEIGHT_LABELS,fe as auditDataPalette,ue as bestAvailableWeight,te as buildTaprootDarkTheme,re as buildTaprootLightTheme,Bo as calculateAlbumLayout,Le as canonicalFontStack,Re as classifyFontStack,Uo as closeFlyout,we as compileFontPlan,De as customWebSafeFont,Sr as deriveLightnessRamp,xe as describePaletteCollision,Yo as encodeTheme,Ue as extractFamily,He as extractWeights,Ke as fontFaceRequestKey,Be as fontFallbackAliases,ze as fontFallbackBaseIndexes,_e as generateDivergingRamp,Te as generateSequentialRamp,Vo as getEspBus,Ce as getFallbackFont,qe as getGoogleFonts,Ao as getIconHrefForHost,so as getIconSpriteReference,So as getIconSpriteUrl,vo as getImageDetails,be as googleFontStylesheetUrl,nr as installIconSprite,ce as isDeviceFontStack,Ge as isLocalFontFamily,oe as isObjectRecord,ee as isSemanticColorName,Qo as layerThemes,Ne as matchWebSafeFont,Jo as mergePartials,Ko as normalizeAlbumMaxRowHeightVh,Ve as normalizeFontFaceWeight,no as normalizeIntentVariant,Xo as normalizeMaxImagesPerRow,Oe as normalizeWeight,ge as parseFontStack,jo as parseTheme,Ir as printThemeFitReport,yo as releasePreviewUrl,ke as removeRuntimeGoogleFontLink,We as removeRuntimeGoogleFontLinks,bo as requestHelp,$o as resolveContextTheme,uo as showFlyout,Ho as showToast,de as syncRuntimeGoogleFontLink,Er as themeFitLints,Tr as themeFitReport,ar as themeFitReportSuite,_r as themeFitRows,sr as themeFromSwatches,Mo as traverseToClosest,Zo as validateThemePair,he as webSafeFontWeights};
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"./breadcrumbs/breadcrumb-separators.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"./section/esp-section.js";export*from"./stack/esp-stack.js";export*from"./row/esp-row.js";export*from"./columns/esp-columns.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"./image-picker/esp-image-picker.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"./video/esp-video.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 io,DEFAULT_ICON_VIEW_BOX as lo,INTENT_VARIANTS as no,normalizeIntentVariant as Ao,getIconHrefForHost as So,getIconSpriteUrl as so,getIconSpriteReference as Lo}from"./shared/intent-values.js";import{EspalierElementBase as Do}from"./shared/esp-element-base.js";import{VALIDITY_CHANGED_EVENT as co}from"./shared/validation.js";import{FormFieldController as Po}from"./shared/form-field-controller.js";import{traverseToClosest as ho}from"./shared/utilities.js";import{showToast as Ho}from"./shared/toast-events.js";import{showFlyout as uo,closeFlyout as Uo}from"./shared/flyout-events.js";import{requestHelp as Go}from"./shared/help-events.js";import{getEspBus as ko}from"./shared/bus-events.js";export*from"./shared/events.js";import{getImageDetails as yo,releasePreviewUrl as wo}from"./image-upload/image-helpers.js";import{calculateAlbumLayout as zo,DEFAULT_ALBUM_MAX_ROW_HEIGHT_VH as Ko,normalizeAlbumMaxRowHeightVh as Xo,normalizeMaxImagesPerRow as Yo}from"./shared/justified-layout.js";import{encodeTheme as jo,parseTheme as Jo,mergePartials as Qo,layerThemes as Zo,validateComponentProperties as $o,validateThemePair as oe,resolveContextTheme as ee,isObjectRecord as re,isSemanticColorName as te,buildTaprootLightTheme as me,buildTaprootDarkTheme as pe,NESTED_THEME_KEYS as Te}from"./shared/theme.js";import{auditDataPalette as fe,describePaletteCollision as Ee,generateSequentialRamp as xe,generateDivergingRamp as ae,COLOR_VISION_SIMULATIONS as Ie,DATA_SERIES_KEYS as Fe,DEFAULT_DATA_PALETTE as ie,DEFAULT_DATA_RAMP_STEPS as le,DEFAULT_DIVERGING_NEUTRAL as ne,MAX_DATA_RAMP_STEPS as Ae,MIN_DATA_COLOR_DISTANCE as Se,MIN_DATA_RAMP_LIGHTNESS_STEP as se,MIN_DATA_RAMP_STEPS as Le}from"./shared/data-colors.js";import{canonicalFontStack as De,classifyFontStack as Ne,customWebSafeFont as ce,isDeviceFontStack as Me,matchWebSafeFont as Pe,parseFontStack as ge,webSafeFontWeights as he}from"./shared/font-stacks.js";import{WEIGHT_LABELS as He,extractWeights as Ce,normalizeWeight as ue,bestAvailableWeight as Ue,extractFamily as be,getFallbackFont as Ge,googleFontStylesheetUrl as Ve,isLocalFontFamily as de,normalizeFontFaceWeight as ke,removeRuntimeGoogleFontLink as ve,removeRuntimeGoogleFontLinks as We,syncRuntimeGoogleFontLink as ye,RUNTIME_GOOGLE_FONT_OWNER_ATTR as we}from"./shared/font-helpers.js";import{compileFontPlan as ze,fontFallbackAliases as Ke,fontFallbackBaseIndexes as Xe,fontFaceRequestKey as Ye}from"./shared/font-plan.js";import{getGoogleFonts as je}from"./font-picker/esp-font-picker.js";import{ROOT_SURFACE as Qe,THEME_FIT_ANCHOR_FIELDS as Ze,THEME_FIT_APCA_FIELDS as $e,THEME_FIT_COMPONENT_APCA_FIELDS as or,THEME_FIT_COMPONENT_PROPERTY_FIELDS as er,THEME_FIT_DATA_PALETTE_LINT_FIELDS as rr,THEME_FIT_DATA_PALETTE_LINT_IDS as tr,THEME_FIT_EXPLICIT_VALUES as mr,THEME_FIT_LINT_FIELDS as pr,THEME_FIT_LINT_IDS as Tr,THEME_FIT_LINT_SEVERITIES as _r,THEME_FIT_PAIRING_VALUES as fr,THEME_FIT_REPORT_FIELDS as Er,THEME_FIT_SUITE_FIELDS as xr,THEME_FIT_TOKEN_FIELDS as ar,themeFitReport as Ir,themeFitRows as Fr,themeFitLints as ir,themeFitReportSuite as lr,printThemeFitReport as nr}from"./shared/theme-fit-report.js";import{ICON_SPRITE as Sr,ICON_SPRITE_ID as sr,installIconSprite as Lr}from"./icons/index.js";import{deriveLightnessRamp as Dr,themeFromSwatches as Nr}from"./shared/theme-swatches.js";export{Ie as COLOR_VISION_SIMULATIONS,Fe as DATA_SERIES_KEYS,Ko as DEFAULT_ALBUM_MAX_ROW_HEIGHT_VH,ie as DEFAULT_DATA_PALETTE,le as DEFAULT_DATA_RAMP_STEPS,ne as DEFAULT_DIVERGING_NEUTRAL,io as DEFAULT_ICON_SPRITE_URL,lo as DEFAULT_ICON_VIEW_BOX,Do as EspalierElementBase,Po as FormFieldController,Sr as ICON_SPRITE,sr as ICON_SPRITE_ID,no as INTENT_VARIANTS,Ae as MAX_DATA_RAMP_STEPS,Se as MIN_DATA_COLOR_DISTANCE,se as MIN_DATA_RAMP_LIGHTNESS_STEP,Le as MIN_DATA_RAMP_STEPS,Te as NESTED_THEME_KEYS,Qe as ROOT_SURFACE,we as RUNTIME_GOOGLE_FONT_OWNER_ATTR,Ze as THEME_FIT_ANCHOR_FIELDS,$e as THEME_FIT_APCA_FIELDS,or as THEME_FIT_COMPONENT_APCA_FIELDS,er as THEME_FIT_COMPONENT_PROPERTY_FIELDS,rr as THEME_FIT_DATA_PALETTE_LINT_FIELDS,tr as THEME_FIT_DATA_PALETTE_LINT_IDS,mr as THEME_FIT_EXPLICIT_VALUES,pr as THEME_FIT_LINT_FIELDS,Tr as THEME_FIT_LINT_IDS,_r as THEME_FIT_LINT_SEVERITIES,fr as THEME_FIT_PAIRING_VALUES,Er as THEME_FIT_REPORT_FIELDS,xr as THEME_FIT_SUITE_FIELDS,ar as THEME_FIT_TOKEN_FIELDS,co as VALIDITY_CHANGED_EVENT,He as WEIGHT_LABELS,fe as auditDataPalette,Ue as bestAvailableWeight,pe as buildTaprootDarkTheme,me as buildTaprootLightTheme,zo as calculateAlbumLayout,De as canonicalFontStack,Ne as classifyFontStack,Uo as closeFlyout,ze as compileFontPlan,ce as customWebSafeFont,Dr as deriveLightnessRamp,Ee as describePaletteCollision,jo as encodeTheme,be as extractFamily,Ce as extractWeights,Ye as fontFaceRequestKey,Ke as fontFallbackAliases,Xe as fontFallbackBaseIndexes,ae as generateDivergingRamp,xe as generateSequentialRamp,ko as getEspBus,Ge as getFallbackFont,je as getGoogleFonts,So as getIconHrefForHost,Lo as getIconSpriteReference,so as getIconSpriteUrl,yo as getImageDetails,Ve as googleFontStylesheetUrl,Lr as installIconSprite,Me as isDeviceFontStack,de as isLocalFontFamily,re as isObjectRecord,te as isSemanticColorName,Zo as layerThemes,Pe as matchWebSafeFont,Qo as mergePartials,Xo as normalizeAlbumMaxRowHeightVh,ke as normalizeFontFaceWeight,Ao as normalizeIntentVariant,Yo as normalizeMaxImagesPerRow,ue as normalizeWeight,ge as parseFontStack,Jo as parseTheme,nr as printThemeFitReport,wo as releasePreviewUrl,ve as removeRuntimeGoogleFontLink,We as removeRuntimeGoogleFontLinks,Go as requestHelp,ee as resolveContextTheme,uo as showFlyout,Ho as showToast,ye as syncRuntimeGoogleFontLink,ir as themeFitLints,Ir as themeFitReport,lr as themeFitReportSuite,Fr as themeFitRows,Nr as themeFromSwatches,ho as traverseToClosest,$o as validateComponentProperties,oe as validateThemePair,he as webSafeFontWeights};
@@ -1,4 +1,4 @@
1
- var c=function(e,t,o,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,o,n);else for(var h=e.length-1;h>=0;h--)(l=e[h])&&(r=(s<3?l(r):s>3?l(t,o,r):l(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};import{LitElement as u,nothing as g,css as f,html as a}from"lit";import{customElement as v,property as p}from"lit/decorators.js";import{ref as m}from"lit/directives/ref.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as x}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as b}from"../shared/svgs/render-sprite-icon.js";import{DocumentSpriteController as k}from"../shared/document-sprite.js";const S=["text","icon","styles"],d=new WeakMap;function z(e,t){d.set(e,t)}function P(e){return{text:e.text||e.getAttribute("text")||e.textContent?.trim()||"",icon:e.icon||e.getAttribute("icon")||"",styles:e.styles}}function E(e,t){return e.text===t.text&&(e.icon??"")===(t.icon??"")&&e.styles===t.styles}function H(e){return e.value||e.getAttribute("value")||""}let i=class extends u{constructor(){super(),this.internals=this.attachInternals(),this.iconSlot=new x(this),this.text="",this.icon="",this.value="",this.selected=!1,new k(this,{reactToSpriteChanges:!0}),this.internals.role="option"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","option")}updated(t){super.updated(t),S.some(o=>t.has(o))&&d.get(this)?.pickerItemChanged(this),t.has("selected")&&(this.internals.ariaSelected=String(this.selected),this.setAttribute("aria-selected",String(this.selected)))}renderHighlightedText(){const t=this.highlightRanges;if(!t||t.length===0)return this.text;const o=[...t].sort((r,l)=>r[0]-l[0]),n=[];let s=0;for(const[r,l]of o)r>s&&n.push(a`${this.text.slice(s,r)}`),n.push(a`<mark>${this.text.slice(r,l)}</mark>`),s=l;return s<this.text.length&&n.push(a`${this.text.slice(s)}`),n}render(){const t=y(this.icon,this),o=this.iconSlot.hasSlottedIcon(":scope > *");return a`<div>
1
+ var c=function(e,t,o,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,o,n);else for(var h=e.length-1;h>=0;h--)(l=e[h])&&(r=(s<3?l(r):s>3?l(t,o,r):l(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};import{LitElement as u,nothing as g,css as f,html as a}from"lit";import{customElement as v,property as p}from"lit/decorators.js";import{ref as m}from"lit/directives/ref.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as x}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as b}from"../shared/svgs/render-sprite-icon.js";import{DocumentSpriteController as k}from"../shared/document-sprite.js";const S=["text","icon","styles"],d=new WeakMap;function z(e,t){d.set(e,t)}function P(e){return{text:e.text||e.getAttribute("text")||e.textContent?.trim()||"",icon:e.icon||e.getAttribute("icon")||"",styles:e.styles}}function E(e,t){return e.text===t.text&&(e.icon??"")===(t.icon??"")&&e.styles===t.styles}function H(e){return e.value||e.getAttribute("value")||""}let i=class extends u{constructor(){super(),this.internals=this.attachInternals(),this.iconSlot=new x(this),this.text="",this.icon="",this.value="",this.selected=!1,new k(this),this.internals.role="option"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","option")}updated(t){super.updated(t),S.some(o=>t.has(o))&&d.get(this)?.pickerItemChanged(this),t.has("selected")&&(this.internals.ariaSelected=String(this.selected),this.setAttribute("aria-selected",String(this.selected)))}renderHighlightedText(){const t=this.highlightRanges;if(!t||t.length===0)return this.text;const o=[...t].sort((r,l)=>r[0]-l[0]),n=[];let s=0;for(const[r,l]of o)r>s&&n.push(a`${this.text.slice(s,r)}`),n.push(a`<mark>${this.text.slice(r,l)}</mark>`),s=l;return s<this.text.length&&n.push(a`${this.text.slice(s)}`),n}render(){const t=y(this.icon,this),o=this.iconSlot.hasSlottedIcon(":scope > *");return a`<div>
2
2
  <span class="icon">
3
3
  <slot ${m(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
4
4
  ${!o&&t?b(t):g}
@@ -1,6 +1,7 @@
1
1
  import { LitElement, type PropertyValues } from "lit";
2
2
  import { type SchemeEvents, type SeedColorRoot } from "../shared/bus-events.js";
3
- import { type EspalierTheme, type PartialTheme } from "../shared/theme.js";
3
+ import { GoverningRootObserver } from "../shared/governing-root.js";
4
+ import { type EspalierTheme, type PartialTheme } from "../shared/theme-core.js";
4
5
  import { type ImageTextureDefinition } from "../shared/image-texture-registry.js";
5
6
  export { registerImageTexture, registeredImageTextures, BUILT_IN_IMAGE_TEXTURES, type ImageTextureDefinition, } from "../shared/image-texture-registry.js";
6
7
  export type GoogleFontLoadingPolicy = "auto" | "none";
@@ -65,6 +66,10 @@ export type { SchemeEvents } from "../shared/bus-events.js";
65
66
  * @slot - Place Espalier components and content here.
66
67
  * @cssprop --esp-font-body - Always-emitted family for body and UI text. Defaults to `system-ui, sans-serif` when `fontBody` is omitted or empty.
67
68
  * @cssprop --esp-font-headings - Consumer-authored heading family. Emitted only when configured; heading recipes otherwise fall back to `--esp-font-body`.
69
+ * @cssprop --esp-heading-1-color - Color of native light-DOM h1 headings. Defaults to `var(--esp-color-headings)`.
70
+ * @cssprop --esp-heading-2-color - Color of native light-DOM h2 headings. Defaults to `var(--esp-color-headings)`.
71
+ * @cssprop --esp-heading-3-color - Color of native light-DOM h3 headings. Defaults to `var(--esp-color-headings)`.
72
+ * @cssprop --esp-heading-4-color - Color of native light-DOM h4 headings. Defaults to `var(--esp-color-headings)`.
68
73
  * @cssprop --esp-font-brand - Consumer-authored brand family. Emitted only when configured; brand recipes otherwise fall back through headings to `--esp-font-body`.
69
74
  * @cssprop --esp-font-menu - Consumer-authored navigation family. Emitted only when configured; menu items otherwise fall back to `--esp-font-body`, never to headings.
70
75
  * @cssprop --esp-font-weight-menu - Font weight for horizontal navigation menu items. Defaults to `bold`.
@@ -149,6 +154,7 @@ export declare class EspalierRoot extends LitElement implements SeedColorRoot {
149
154
  static registerTexture(name: string, definition: ImageTextureDefinition): void;
150
155
  /** Snapshot of the registered texture presets, for building pickers. */
151
156
  static registeredTextures(): Map<string, Readonly<ImageTextureDefinition>>;
157
+ protected readonly outerRootObserver: GoverningRootObserver;
152
158
  /** Unique ID for correlating bus events across multiple roots. */
153
159
  correlationId: `${string}-${string}-${string}-${string}-${string}`;
154
160
  /**
@@ -378,6 +384,7 @@ export declare class EspalierRoot extends LitElement implements SeedColorRoot {
378
384
  * `seedColor` value to change.
379
385
  */
380
386
  get seedColor(): string;
387
+ constructor();
381
388
  /** Returns the resolved theme for the active scheme. */
382
389
  get activeTheme(): EspalierTheme;
383
390
  connectedCallback(): void;
@@ -1,5 +1,5 @@
1
- var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(c,e,t,s);else for(var l=c.length-1;l>=0;l--)(d=c[l])&&(i=(h<3?d(i):h>3?d(e,t,i):d(e,t))||i);return h>3&&i&&Object.defineProperty(e,t,i),i},a;import{surfaceLayerAttributes as T}from"../shared/surface-layer.js";import{css as w,html as E,LitElement as C}from"lit";import{customElement as R,property as n,state as x}from"lit/decorators.js";import{getEspBus as m}from"../shared/bus-events.js";import{subscribeToRootEvent as A}from"../shared/root-event-subscription.js";import{DEFAULT_LIGHT_THEME as f,DEFAULT_DARK_THEME as g,encodeTheme as v,parseTheme as u,mergeTheme as y}from"../shared/theme.js";import{extractFamily as p,isLocalFontFamily as L,removeRuntimeGoogleFontLinks as S,syncRuntimeGoogleFontLink as D}from"../shared/font-helpers.js";import{computeThemeProperties as F}from"./helpers/compute-theme-properties.js";import{registerImageTexture as I,registeredImageTextures as W}from"../shared/image-texture-registry.js";import{registerImageTexture as Q,registeredImageTextures as N,BUILT_IN_IMAGE_TEXTURES as q}from"../shared/image-texture-registry.js";const k=1e3;let o=a=class extends C{constructor(){super(...arguments),this.schemeBacker="",this.schemeExplicitlySet=!1,this.resolvingDefaultScheme=!1,this.themeEventsReady=!1,this.systemSchemeQuery=null,this.lastSeedColor="",this.resolvedLightTheme={...f},this.resolvedDarkTheme={...g},this.appliedThemeProperties=new Set,this.documentClickRegistrationActive=!1,this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.lightThemeAttr="",this.darkThemeAttr="",this.fontCSSRoot="/css/fonts/",this.fontDefinitionsUrl="",this.googleFontLoading="auto",this.iconSpriteUrl="/assets/icons.svg",this.themePending=!1,this.themeReadyState=!1,this.themeSettleWaiters=[],this.warnedThemeSettleTimeout=!1,this.defaultScheme="light",this.resizeObserver=new ResizeObserver(()=>{m().publish("window-resized",{emWidth:window.innerWidth/parseFloat(getComputedStyle(document.documentElement).fontSize),emHeight:window.innerHeight/parseFloat(getComputedStyle(document.documentElement).fontSize),pxWidth:window.innerWidth,pxHeight:window.innerHeight})}),this.handleSystemSchemeChange=e=>{this.schemeExplicitlySet||this.defaultScheme!=="system"||(this.resolvingDefaultScheme=!0,this.scheme=e.matches?"dark":"light",this.resolvingDefaultScheme=!1)}}static registerTexture(e,t){I(e,t)}static registeredTextures(){return W()}subscribeScoped(e,t){return A(this,e,t)}get virtualViewportWidth(){return this.virtualViewportWidthBacker}set virtualViewportWidth(e){const t=typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,s=this.virtualViewportWidthBacker;this.virtualViewportWidthBacker=t,t===void 0?this.hasAttribute("virtual-viewport-width")&&this.removeAttribute("virtual-viewport-width"):this.getAttribute("virtual-viewport-width")!==String(t)&&this.setAttribute("virtual-viewport-width",String(t)),this.requestUpdate("virtualViewportWidth",s)}get lightTheme(){return this.lightThemeAttr?u(this.lightThemeAttr):null}set lightTheme(e){this.lightThemeAttr=e?v(e):""}get darkTheme(){return this.darkThemeAttr?u(this.darkThemeAttr):null}set darkTheme(e){this.darkThemeAttr=e?v(e):""}get themeSettled(){return this.themeReadyState}whenThemeSettled(){return this.themeReadyState?Promise.resolve():new Promise(e=>{this.themeSettleWaiters.push(e)})}get hasAuthorTheme(){return!!(this.scheme==="dark"?this.darkThemeAttr:this.lightThemeAttr)}settleTheme(){if(this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.themeReadyState)return;this.themeReadyState=!0;const e=this.themeSettleWaiters;this.themeSettleWaiters=[];for(const t of e)t()}get scheme(){return this.schemeBacker}set scheme(e){const t=e==="dark"?"dark":e==="light"?"light":"",s=this.schemeBacker,h=this.schemeExplicitlySet;this.resolvingDefaultScheme||(this.schemeExplicitlySet=t.length>0);const i=t||this.resolveDefaultScheme();h!==this.schemeExplicitlySet&&this.isConnected&&this.syncSystemSchemeListener(),i!==s&&(this.schemeBacker=i,this.requestUpdate("scheme",s),this.themeEventsReady&&m().publish("scheme-changed",{scheme:i,correlationId:this.correlationId}))}get seedColor(){return this.activeTheme.seedColor}injectGoogleFontLink(e,t,s){const h=`${this.correlationId}-${e}`,i=L(t)?"":t;D({owner:`root:${h}`,family:i,weight:s,enabled:this.googleFontLoading!=="none"})}syncGoogleFontLinks(){this.googleFontLoading==="none"&&this.removeRuntimeGoogleFontLinks();const e=this.activeTheme;this.injectGoogleFontLink("body",p(e.fontBody),e.fontWeightBody),this.injectGoogleFontLink("headings",p(e.fontHeadings),e.fontWeightHeadings),this.injectGoogleFontLink("brand",p(e.fontBrand),e.fontWeightBrand),this.injectGoogleFontLink("menu",p(e.fontMenu),e.fontWeightMenu),this.injectGoogleFontLink("monospace",p(e.fontMonospace),e.fontWeightMonospace)}removeRuntimeGoogleFontLinks(){S(`root:${this.correlationId}-`),S(`picker:${this.correlationId}:`)}get activeTheme(){return this.scheme==="dark"?this.resolvedDarkTheme:this.resolvedLightTheme}resolveThemes(){const e=this.lightThemeAttr?u(this.lightThemeAttr):null;this.resolvedLightTheme=e?y(f,e):{...f};const t=this.darkThemeAttr?u(this.darkThemeAttr):null;this.resolvedDarkTheme=t?y(g,t):{...g}}connectedCallback(){super.connectedCallback(),this.registerDocumentClickBridge(),this.resizeObserver.observe(this),this.hasUpdated&&(this.applyDefaultScheme(),this.syncGoogleFontLinks(),this.hasAuthorTheme||this.startThemeSettleTimer())}willUpdate(e){const t=["lightThemeAttr","darkThemeAttr"];(!this.lastSeedColor||t.some(l=>e.has(l)))&&(this.resolveThemes(),this.themeEventsReady&&m().publish("theme-changed",{correlationId:this.correlationId})),this.hasAuthorTheme&&this.settleTheme();const h=F(this.activeTheme,this.scheme==="dark"?"dark":"light",void 0,{viewportWidth:this.virtualViewportWidth}),i=new Set(Object.keys(h));for(const l of this.appliedThemeProperties)i.has(l)||this.style.removeProperty(l);for(const[l,b]of Object.entries(h))this.style.setProperty(l,b);this.appliedThemeProperties=i;const d=this.activeTheme.seedColor;this.themeEventsReady&&this.lastSeedColor&&this.lastSeedColor!==d&&m().publish("seed-color-changed",{seedColor:d,correlationId:this.correlationId}),this.lastSeedColor=d,this.themeEventsReady&&e.has("iconSpriteUrl")&&m().publish("icon-sprite-url-changed",{iconSpriteUrl:this.iconSpriteUrl,correlationId:this.correlationId}),this.syncGoogleFontLinks()}firstUpdated(){const e=this.activeTheme.stylesheets;if(e.length)for(const t of e){const s=document.createElement("link");s.rel="stylesheet",s.href=t,document.head.appendChild(s)}if(!document.getElementById("esp-root-base-styles")){const t=document.createElement("style");t.id="esp-root-base-styles",t.textContent=a.lightDomStyles,document.head.appendChild(t)}this.applyDefaultScheme(),this.lastSeedColor=this.activeTheme.seedColor,this.themeEventsReady=!0,this.startThemeSettleTimer()}startThemeSettleTimer(){if(this.themeReadyState||this.themeSettleTimer!==void 0)return;this.themeSettleDeadline??=performance.now()+k;const e=Math.max(0,this.themeSettleDeadline-performance.now());if(e===0){this.closeThemeWindow();return}this.themeSettleTimer=setTimeout(()=>this.closeThemeWindow(),e)}closeThemeWindow(){this.themeSettleTimer=void 0,this.themePending&&!this.warnedThemeSettleTimeout&&(this.warnedThemeSettleTimeout=!0,console.warn(`Espalier root: theme-pending was declared but no ${this.scheme} theme arrived within ${k}ms, so the default palette is rendering. Assign ${this.scheme==="dark"?"darkTheme":"lightTheme"} (or remove theme-pending).`)),this.settleTheme()}updated(e){this.toggleAttribute("data-theme-ready",this.themeReadyState),(e.has("defaultScheme")||e.has("scheme"))&&!this.schemeExplicitlySet&&this.applyDefaultScheme()}disconnectedCallback(){this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.unregisterDocumentClickBridge(),this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null,this.resizeObserver.disconnect(),this.removeRuntimeGoogleFontLinks(),super.disconnectedCallback()}registerDocumentClickBridge(){this.documentClickRegistrationActive||(this.documentClickRegistrationActive=!0,a.connectedRootCount+=1,a.connectedRootCount===1&&document.addEventListener("click",a.handleDocumentClick))}unregisterDocumentClickBridge(){this.documentClickRegistrationActive&&(this.documentClickRegistrationActive=!1,a.connectedRootCount=Math.max(0,a.connectedRootCount-1),a.connectedRootCount===0&&document.removeEventListener("click",a.handleDocumentClick))}applyDefaultScheme(){this.schemeExplicitlySet||(this.resolvingDefaultScheme=!0,this.scheme=this.resolveDefaultScheme(),this.resolvingDefaultScheme=!1,this.syncSystemSchemeListener())}resolveDefaultScheme(){return this.defaultScheme==="dark"||this.defaultScheme==="system"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}syncSystemSchemeListener(){if(this.schemeExplicitlySet||this.defaultScheme!=="system"||!window.matchMedia){this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null;return}this.systemSchemeQuery||(this.systemSchemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.systemSchemeQuery.addEventListener("change",this.handleSystemSchemeChange))}render(){return E`<slot></slot>`}};o.connectedRootCount=0,o.handleDocumentClick=c=>{const e=c.composedPath().filter(t=>t instanceof HTMLElement&&t.tagName==="ESP-POPOVER");m().publish("close-popovers",{source:c.target??void 0,skipPopovers:e})},o.lightDomStyles=`
2
- ${T("esp-root [surface-layer]").cssText}
1
+ var i=function(c,e,t,o){var h=arguments.length,s=h<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(c,e,t,o);else for(var d=c.length-1;d>=0;d--)(p=c[d])&&(s=(h<3?p(s):h>3?p(e,t,s):p(e,t))||s);return h>3&&s&&Object.defineProperty(e,t,s),s},l;import{footerHeadingFit as A,footerLinkFit as T}from"../shared/footer-ink-styles.js";import{surfaceLayerAttributes as L}from"../shared/surface-layer.js";import{css as D,html as F,LitElement as P}from"lit";import{customElement as O,property as n,state as I}from"lit/decorators.js";import{getEspBus as m}from"../shared/bus-events.js";import{GoverningRootObserver as z}from"../shared/governing-root.js";import{getComponentPropertyAnalysis as S}from"../shared/component-property-normalizer.js";import{addComponentPropertyResets as W}from"../shared/component-property-resets.js";import{ScopedStyleDeclarations as _}from"../shared/scoped-style-declarations.js";import{subscribeToRootEvent as B}from"../shared/root-event-subscription.js";import{DEFAULT_LIGHT_THEME as v,DEFAULT_DARK_THEME as y,encodeTheme as w,parseTheme as f,mergeTheme as C}from"../shared/theme-core.js";import{extractFamily as u,isLocalFontFamily as U,removeRuntimeGoogleFontLinks as x,syncRuntimeGoogleFontLink as G}from"../shared/font-helpers.js";import{computeThemeProperties as M}from"./helpers/compute-theme-properties.js";import{registerImageTexture as H,registeredImageTextures as j}from"../shared/image-texture-registry.js";import{registerImageTexture as he,registeredImageTextures as ae,BUILT_IN_IMAGE_TEXTURES as le}from"../shared/image-texture-registry.js";const E=1e3;let r=l=class extends P{static registerTexture(e,t){H(e,t)}static registeredTextures(){return j()}subscribeScoped(e,t){return B(this,e,t)}get virtualViewportWidth(){return this.virtualViewportWidthBacker}set virtualViewportWidth(e){const t=typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,o=this.virtualViewportWidthBacker;this.virtualViewportWidthBacker=t,t===void 0?this.hasAttribute("virtual-viewport-width")&&this.removeAttribute("virtual-viewport-width"):this.getAttribute("virtual-viewport-width")!==String(t)&&this.setAttribute("virtual-viewport-width",String(t)),this.requestUpdate("virtualViewportWidth",o)}get lightTheme(){return this.lightThemeAttr?f(this.lightThemeAttr):null}set lightTheme(e){this.lightThemeAttr=e?w(e):""}get darkTheme(){return this.darkThemeAttr?f(this.darkThemeAttr):null}set darkTheme(e){this.darkThemeAttr=e?w(e):""}get themeSettled(){return this.themeReadyState}whenThemeSettled(){return this.themeReadyState?Promise.resolve():new Promise(e=>{this.themeSettleWaiters.push(e)})}get hasAuthorTheme(){return!!(this.scheme==="dark"?this.darkThemeAttr:this.lightThemeAttr)}settleTheme(){if(this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.themeReadyState)return;this.themeReadyState=!0;const e=this.themeSettleWaiters;this.themeSettleWaiters=[];for(const t of e)t()}get scheme(){return this.schemeBacker}set scheme(e){const t=e==="dark"?"dark":e==="light"?"light":"",o=this.schemeBacker,h=this.schemeExplicitlySet;this.resolvingDefaultScheme||(this.schemeExplicitlySet=t.length>0);const s=t||this.resolveDefaultScheme();h!==this.schemeExplicitlySet&&this.isConnected&&this.syncSystemSchemeListener(),s!==o&&(this.schemeBacker=s,this.requestUpdate("scheme",o),this.themeEventsReady&&(this.resolveThemes(),m().publish("scheme-changed",{scheme:s,correlationId:this.correlationId})))}get seedColor(){return this.activeTheme.seedColor}injectGoogleFontLink(e,t,o){const h=`${this.correlationId}-${e}`,s=U(t)?"":t;G({owner:`root:${h}`,family:s,weight:o,enabled:this.googleFontLoading!=="none"})}syncGoogleFontLinks(){this.googleFontLoading==="none"&&this.removeRuntimeGoogleFontLinks();const e=this.activeTheme;this.injectGoogleFontLink("body",u(e.fontBody),e.fontWeightBody),this.injectGoogleFontLink("headings",u(e.fontHeadings),e.fontWeightHeadings),this.injectGoogleFontLink("brand",u(e.fontBrand),e.fontWeightBrand),this.injectGoogleFontLink("menu",u(e.fontMenu),e.fontWeightMenu),this.injectGoogleFontLink("monospace",u(e.fontMonospace),e.fontWeightMonospace)}removeRuntimeGoogleFontLinks(){x(`root:${this.correlationId}-`),x(`picker:${this.correlationId}:`,this.ownerDocument)}constructor(){super(),this.outerRootObserver=new z(this,(t,o)=>{t!==o&&(this.outerComponentCandidates=void 0,this.applyComponentProperties(),t&&this.outerRootObserver.whenReady(this.syncOuterComponentCandidates))}),this.componentDeclarations=new _(this),this.componentProperties={},this.schemeBacker="",this.schemeExplicitlySet=!1,this.resolvingDefaultScheme=!1,this.themeEventsReady=!1,this.systemSchemeQuery=null,this.lastSeedColor="",this.resolvedLightThemeAttr="",this.resolvedDarkThemeAttr="",this.resolvedLightTheme={...v},this.resolvedDarkTheme={...y},this.appliedThemeProperties=new Set,this.documentClickRegistrationActive=!1,this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.lightThemeAttr="",this.darkThemeAttr="",this.fontCSSRoot="/css/fonts/",this.fontDefinitionsUrl="",this.googleFontLoading="auto",this.iconSpriteUrl="/assets/icons.svg",this.themePending=!1,this.themeReadyState=!1,this.themeSettleWaiters=[],this.warnedThemeSettleTimeout=!1,this.defaultScheme="light",this.syncOuterComponentCandidates=t=>{const{candidates:o}=S(t.activeTheme);o!==this.outerComponentCandidates&&(this.outerComponentCandidates=o,this.applyComponentProperties())},this.resizeObserver=new ResizeObserver(()=>{m().publish("window-resized",{emWidth:window.innerWidth/parseFloat(getComputedStyle(document.documentElement).fontSize),emHeight:window.innerHeight/parseFloat(getComputedStyle(document.documentElement).fontSize),pxWidth:window.innerWidth,pxHeight:window.innerHeight})}),this.handleSystemSchemeChange=t=>{this.schemeExplicitlySet||this.defaultScheme!=="system"||(this.resolvingDefaultScheme=!0,this.scheme=t.matches?"dark":"light",this.resolvingDefaultScheme=!1)};const e=()=>{const t=this.outerRootObserver.root;t&&this.syncOuterComponentCandidates(t)};this.outerRootObserver.subscribe("scheme-changed",e),this.outerRootObserver.subscribe("theme-changed",e)}applyComponentProperties(){const e={...this.componentProperties};this.outerComponentCandidates&&W(e,this.outerComponentCandidates),this.componentDeclarations.apply(e)}get activeTheme(){return this.scheme==="dark"?this.resolvedDarkTheme:this.resolvedLightTheme}resolveThemes(){if(this.lightThemeAttr!==this.resolvedLightThemeAttr){this.resolvedLightThemeAttr=this.lightThemeAttr;const e=f(this.lightThemeAttr);this.resolvedLightTheme=e?C(v,e):{...v}}if(this.darkThemeAttr!==this.resolvedDarkThemeAttr){this.resolvedDarkThemeAttr=this.darkThemeAttr;const e=f(this.darkThemeAttr);this.resolvedDarkTheme=e?C(y,e):{...y}}}connectedCallback(){super.connectedCallback(),this.outerRootObserver.connect(),this.registerDocumentClickBridge(),this.resizeObserver.observe(this),this.hasUpdated&&(this.applyDefaultScheme(),this.syncGoogleFontLinks(),this.hasAuthorTheme||this.startThemeSettleTimer())}willUpdate(e){const t=["lightThemeAttr","darkThemeAttr"];(!this.lastSeedColor||t.some(a=>e.has(a)))&&(this.resolveThemes(),this.themeEventsReady&&m().publish("theme-changed",{correlationId:this.correlationId})),this.hasAuthorTheme&&this.settleTheme();const h=this.activeTheme,{root:s,candidates:p}=S(h),d=M(h,this.scheme==="dark"?"dark":"light",void 0,{viewportWidth:this.virtualViewportWidth},{surface:s}),b={};for(const a of p)Object.prototype.hasOwnProperty.call(d,a)&&(b[a]=d[a],delete d[a]);this.componentProperties=b,this.applyComponentProperties();const k=new Set(Object.keys(d));for(const a of this.appliedThemeProperties)k.has(a)||this.style.removeProperty(a);for(const[a,R]of Object.entries(d))this.style.setProperty(a,R);this.appliedThemeProperties=k;const g=this.activeTheme.seedColor;this.themeEventsReady&&this.lastSeedColor&&this.lastSeedColor!==g&&m().publish("seed-color-changed",{seedColor:g,correlationId:this.correlationId}),this.lastSeedColor=g,this.themeEventsReady&&e.has("iconSpriteUrl")&&m().publish("icon-sprite-url-changed",{iconSpriteUrl:this.iconSpriteUrl,correlationId:this.correlationId}),this.syncGoogleFontLinks()}firstUpdated(){const e=this.activeTheme.stylesheets;if(e.length)for(const t of e){const o=document.createElement("link");o.rel="stylesheet",o.href=t,document.head.appendChild(o)}if(!document.getElementById("esp-root-base-styles")){const t=document.createElement("style");t.id="esp-root-base-styles",t.textContent=l.lightDomStyles,document.head.appendChild(t)}this.applyDefaultScheme(),this.lastSeedColor=this.activeTheme.seedColor,this.themeEventsReady=!0,this.startThemeSettleTimer()}startThemeSettleTimer(){if(this.themeReadyState||this.themeSettleTimer!==void 0)return;this.themeSettleDeadline??=performance.now()+E;const e=Math.max(0,this.themeSettleDeadline-performance.now());if(e===0){this.closeThemeWindow();return}this.themeSettleTimer=setTimeout(()=>this.closeThemeWindow(),e)}closeThemeWindow(){this.themeSettleTimer=void 0,this.themePending&&!this.warnedThemeSettleTimeout&&(this.warnedThemeSettleTimeout=!0,console.warn(`Espalier root: theme-pending was declared but no ${this.scheme} theme arrived within ${E}ms, so the default palette is rendering. Assign ${this.scheme==="dark"?"darkTheme":"lightTheme"} (or remove theme-pending).`)),this.settleTheme()}updated(e){this.toggleAttribute("data-theme-ready",this.themeReadyState),(e.has("defaultScheme")||e.has("scheme"))&&!this.schemeExplicitlySet&&this.applyDefaultScheme()}disconnectedCallback(){this.outerRootObserver.disconnect(),this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.unregisterDocumentClickBridge(),this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null,this.resizeObserver.disconnect(),this.removeRuntimeGoogleFontLinks(),super.disconnectedCallback()}registerDocumentClickBridge(){this.documentClickRegistrationActive||(this.documentClickRegistrationActive=!0,l.connectedRootCount+=1,l.connectedRootCount===1&&document.addEventListener("click",l.handleDocumentClick))}unregisterDocumentClickBridge(){this.documentClickRegistrationActive&&(this.documentClickRegistrationActive=!1,l.connectedRootCount=Math.max(0,l.connectedRootCount-1),l.connectedRootCount===0&&document.removeEventListener("click",l.handleDocumentClick))}applyDefaultScheme(){this.schemeExplicitlySet||(this.resolvingDefaultScheme=!0,this.scheme=this.resolveDefaultScheme(),this.resolvingDefaultScheme=!1,this.syncSystemSchemeListener())}resolveDefaultScheme(){return this.defaultScheme==="dark"||this.defaultScheme==="system"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}syncSystemSchemeListener(){if(this.schemeExplicitlySet||this.defaultScheme!=="system"||!window.matchMedia){this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null;return}this.systemSchemeQuery||(this.systemSchemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.systemSchemeQuery.addEventListener("change",this.handleSystemSchemeChange))}render(){return F`<slot></slot>`}};r.connectedRootCount=0,r.handleDocumentClick=c=>{const e=c.composedPath().filter(t=>t instanceof HTMLElement&&t.tagName==="ESP-POPOVER");m().publish("close-popovers",{source:c.target??void 0,skipPopovers:e})},r.lightDomStyles=`
2
+ ${L("esp-root [surface-layer]").cssText}
3
3
 
4
4
 
5
5
  esp-root {
@@ -48,6 +48,33 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
48
48
  }
49
49
 
50
50
 
51
+ esp-root a[data-esp-badge-link]:has(> esp-badge[linked]:defined) {
52
+ background-color: transparent;
53
+ text-decoration: none;
54
+ }
55
+
56
+ esp-root a[data-esp-badge-link]:focus-visible:has(> esp-badge[linked]:defined) {
57
+ outline: none;
58
+ }
59
+
60
+ esp-root a:focus-visible > esp-badge[linked]::part(badge) {
61
+ background: var(--esp-badge-link-focus-background, var(--esp-color-link-hover-bg));
62
+ border-color: var(--esp-badge-link-focus-border-color, var(--esp-color-link-hover));
63
+ color: var(--esp-badge-link-focus-color, var(--esp-color-link-hover));
64
+ }
65
+
66
+ esp-root a[data-esp-badge-link]:focus-visible > esp-badge[linked]:defined::part(badge) {
67
+ outline: 2px solid var(--esp-badge-link-focus-ring-color, var(--esp-color-link));
68
+ outline-offset: 3px;
69
+ }
70
+
71
+ @media (forced-colors: active) {
72
+ esp-root a[data-esp-badge-link]:focus-visible > esp-badge[linked]:defined::part(badge) {
73
+ outline-color: Highlight;
74
+ }
75
+ }
76
+
77
+
51
78
  esp-root input,
52
79
  esp-root button,
53
80
  esp-root textarea,
@@ -78,15 +105,34 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
78
105
  )
79
106
  );
80
107
  font-weight: var(--esp-font-weight-headings);
81
- color: var(--esp-color-headings);
82
108
  margin: var(--esp-size-small-to-normal) 0 var(--esp-size-tiny-to-small);
83
109
  }
84
110
 
85
- esp-root h5 { font-size: var(--esp-type-small); line-height: 1.4; }
86
- esp-root h4 { font-size: var(--esp-type-medium); line-height: 1.3; }
87
- esp-root h3 { font-size: var(--esp-type-big); line-height: 1.2; }
88
- esp-root h2 { font-size: var(--esp-type-large); line-height: 1.15; }
89
- esp-root h1 { font-size: var(--esp-type-huge); line-height: 1.1; }
111
+ esp-root h5 {
112
+ font-size: var(--esp-type-small);
113
+ line-height: 1.4;
114
+ color: var(--esp-color-headings);
115
+ }
116
+ esp-root h4 {
117
+ font-size: var(--esp-type-medium);
118
+ line-height: 1.3;
119
+ color: var(--esp-heading-4-color, var(--esp-color-headings));
120
+ }
121
+ esp-root h3 {
122
+ font-size: var(--esp-type-big);
123
+ line-height: 1.2;
124
+ color: var(--esp-heading-3-color, var(--esp-color-headings));
125
+ }
126
+ esp-root h2 {
127
+ font-size: var(--esp-type-large);
128
+ line-height: 1.15;
129
+ color: var(--esp-heading-2-color, var(--esp-color-headings));
130
+ }
131
+ esp-root h1 {
132
+ font-size: var(--esp-type-huge);
133
+ line-height: 1.1;
134
+ color: var(--esp-heading-1-color, var(--esp-color-headings));
135
+ }
90
136
 
91
137
 
92
138
  esp-root pre,
@@ -137,12 +183,28 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
137
183
  }
138
184
 
139
185
  esp-root esp-footer :is(h1, h2, h3, h4, h5, h6) {
140
- color: var(--esp-footer-heading-color, var(--esp-color-headings));
186
+ ${A.cssText}
187
+ color: var(--esp-footer-heading-color, var(--_esp-footer-local-fitted-heading-color, var(--esp-color-headings)));
188
+ }
189
+
190
+ esp-root esp-footer h2 {
191
+ font-size: var(--esp-footer-heading-font-size, var(--esp-type-normal));
141
192
  }
142
193
 
143
194
  esp-root esp-footer a,
144
195
  esp-root esp-footer a:not([class]) {
145
- color: var(--esp-footer-link-color, var(--esp-color-link));
196
+ ${T.cssText}
197
+ color: var(--esp-footer-link-color, var(--_esp-footer-local-fitted-link-color, var(--esp-color-link)));
198
+ }
199
+
200
+ esp-root esp-footer a:not([class]) {
201
+ text-decoration-line: var(--esp-footer-link-decoration, underline);
202
+ text-underline-offset: var(--esp-footer-link-underline-offset, auto);
203
+ text-decoration-thickness: var(--esp-footer-link-underline-thickness, auto);
204
+ }
205
+
206
+ esp-root esp-footer esp-footer-link-group a:not([class]) {
207
+ text-underline-offset: var(--esp-footer-link-underline-offset, 0.18em);
146
208
  }
147
209
 
148
210
  esp-root esp-footer a:hover {
@@ -150,10 +212,15 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
150
212
  background-color: var(--esp-footer-link-hover-bg, var(--esp-color-link-hover-bg));
151
213
  }
152
214
 
215
+ esp-root esp-footer a:not([class]):hover {
216
+ text-decoration-line: underline;
217
+ }
218
+
153
219
  esp-root esp-footer a:focus-visible {
220
+ ${T.cssText}
154
221
  outline: var(
155
222
  --esp-footer-focus-outline,
156
- 2px solid var(--esp-footer-link-color, var(--esp-color-link))
223
+ 2px solid var(--esp-footer-link-color, var(--_esp-footer-local-fitted-link-color, var(--esp-color-link)))
157
224
  );
158
225
  outline-offset: 3px;
159
226
  }
@@ -162,7 +229,7 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
162
229
  esp-root esp-footer a:not([class]):focus-visible {
163
230
  border-radius: var(--esp-size-border-radius);
164
231
  }
165
- `,o.styles=w`
232
+ `,r.styles=D`
166
233
  :host {
167
234
  display: block;
168
235
  }
@@ -171,4 +238,4 @@ var r=function(c,e,t,s){var h=arguments.length,i=h<3?e:s===null?s=Object.getOwnP
171
238
  :host([theme-pending]:not([data-theme-ready])) {
172
239
  visibility: hidden;
173
240
  }
174
- `,r([n({attribute:!1})],o.prototype,"correlationId",void 0),r([n({attribute:"virtual-viewport-width",noAccessor:!0,converter:{fromAttribute:c=>{const e=c?.trim()??"";return/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)?Number(e):void 0}}})],o.prototype,"virtualViewportWidth",null),r([n({attribute:"light-theme"})],o.prototype,"lightThemeAttr",void 0),r([n({attribute:"dark-theme"})],o.prototype,"darkThemeAttr",void 0),r([n({attribute:!1})],o.prototype,"lightTheme",null),r([n({attribute:!1})],o.prototype,"darkTheme",null),r([n({attribute:"font-css-root",type:String})],o.prototype,"fontCSSRoot",void 0),r([n({attribute:"font-definitions-url",type:String})],o.prototype,"fontDefinitionsUrl",void 0),r([n({attribute:"google-font-loading",type:String})],o.prototype,"googleFontLoading",void 0),r([n({attribute:"icon-sprite-url",type:String})],o.prototype,"iconSpriteUrl",void 0),r([n({attribute:"theme-pending",reflect:!0,type:Boolean})],o.prototype,"themePending",void 0),r([x()],o.prototype,"themeReadyState",void 0),r([n({attribute:"default-scheme",type:String,reflect:!0})],o.prototype,"defaultScheme",void 0),r([n({attribute:"scheme",type:String,reflect:!0})],o.prototype,"scheme",null),o=a=r([R("esp-root")],o);export{q as BUILT_IN_IMAGE_TEXTURES,o as EspalierRoot,Q as registerImageTexture,N as registeredImageTextures};
241
+ `,i([n({attribute:!1})],r.prototype,"correlationId",void 0),i([n({attribute:"virtual-viewport-width",noAccessor:!0,converter:{fromAttribute:c=>{const e=c?.trim()??"";return/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)?Number(e):void 0}}})],r.prototype,"virtualViewportWidth",null),i([n({attribute:"light-theme"})],r.prototype,"lightThemeAttr",void 0),i([n({attribute:"dark-theme"})],r.prototype,"darkThemeAttr",void 0),i([n({attribute:!1})],r.prototype,"lightTheme",null),i([n({attribute:!1})],r.prototype,"darkTheme",null),i([n({attribute:"font-css-root",type:String})],r.prototype,"fontCSSRoot",void 0),i([n({attribute:"font-definitions-url",type:String})],r.prototype,"fontDefinitionsUrl",void 0),i([n({attribute:"google-font-loading",type:String})],r.prototype,"googleFontLoading",void 0),i([n({attribute:"icon-sprite-url",type:String})],r.prototype,"iconSpriteUrl",void 0),i([n({attribute:"theme-pending",reflect:!0,type:Boolean})],r.prototype,"themePending",void 0),i([I()],r.prototype,"themeReadyState",void 0),i([n({attribute:"default-scheme",type:String,reflect:!0})],r.prototype,"defaultScheme",void 0),i([n({attribute:"scheme",type:String,reflect:!0})],r.prototype,"scheme",null),r=l=i([O("esp-root")],r);export{le as BUILT_IN_IMAGE_TEXTURES,r as EspalierRoot,he as registerImageTexture,ae as registeredImageTextures};
@@ -1 +1 @@
1
- import{deriveSemantic as k,deriveSemanticWithContrast as A,serializeOklch as R}from"../../shared/color-engine.js";import{SEMANTIC_COLOR_NAMES as C,TOKEN_PAIRINGS as L,resolveLightnessReference as M,semanticToCSS as y}from"../../shared/theme.js";import{resolveMappingSource as E}from"./compute-variants.js";function I(o,g,r,t,i,m){return[o.l,o.c,o.h,g,r,t,i.l,i.c,i.h,m].join("|")}function K(o,g,r={}){const t={},i={},m=new Map,h=(e,s)=>{const n=r.effectiveSource?.(e,s)??s,c=E(n,g,o.anchors);return c||r.onUnresolvedSource?.(n),{color:c??g.primary,resolved:c!==null,source:n}};for(const e of C){if(L[e])continue;const s=o.semanticMappings[e],n=o.chroma[e],c=h(e,s.source),a=M(o.lightness,o.tones,s.lightness),u=k(c.color,a,n.min,n.max),l=y(e);i[e]=u,t[l]=R(u),r.trace&&r.trace.push({token:e,property:l,resolved:t[l],source:c.source,lightness:s.lightness,sourceResolved:c.resolved,base:c.color})}for(const e of C){const s=L[e];if(!s)continue;const n=o.semanticMappings[e],c=o.chroma[e],a=h(e,n.source),u=M(o.lightness,o.tones,n.lightness),l=i[s.bg],v=I(a.color,u,c.min,c.max,l,s.targetLc);let f=m.get(v);if(!f){let S;const N=A(a.color,u,c.min,c.max,l,s.targetLc,r.trace&&(O=>{S=O}));f={requested:S,semantic:N},m.set(v,f)}const{requested:x,semantic:d}=f,p=y(e);i[e]=d,t[p]=R(d),r.trace&&r.trace.push({token:e,property:p,resolved:t[p],source:a.source,lightness:n.lightness,sourceResolved:a.resolved,base:a.color,requested:x,contrast:{against:s.bg,background:l,targetLc:s.targetLc}})}return t}export{K as computeSemanticProperties};
1
+ import{deriveSemantic as A,deriveSemanticWithContrast as K,parseOklch as P,serializeOklch as N}from"../../shared/color-engine.js";import{SEMANTIC_COLOR_NAMES as _,TOKEN_PAIRINGS as S,resolveLightnessReference as x,semanticToCSS as R}from"../../shared/theme-core.js";import{FOOTER_INK_PROPERTIES as j}from"../../shared/footer-ink.js";import{resolveMappingSource as q}from"./compute-variants.js";function G(n,u,c,t,i,m,p){return[n.l,n.c,n.h,u,c,t,i.l,i.c,i.h,m,p].join("|")}function W(n,u,c={}){const t={},i={},m=new Map,p=c.trace!==void 0||c.footerTrace!==void 0,O=(e,o,r,s,a,g,l=!1)=>{const v=n.semanticMappings[e],d=n.chroma[e],f=T(e,v.source),C=x(n.lightness,n.tones,v.lightness),E=G(f.color,C,d.min,d.max,s,a,l);let h=m.get(E);if(!h){let M;const k=K(f.color,C,d.min,d.max,s,a,p?y=>{M=y}:void 0,l);h={requested:M,semantic:k},m.set(E,h)}const{requested:F,semantic:I}=h;return t[o]=N(I),g?.push({token:e,property:o,resolved:t[o],source:f.source,lightness:v.lightness,sourceResolved:f.resolved,base:f.color,requested:F,contrast:{against:r,background:s,targetLc:a}}),I},T=(e,o)=>{const r=c.effectiveSource?.(e,o)??o,s=q(r,u,n.anchors);return s||c.onUnresolvedSource?.(r),{color:s??u.primary,resolved:s!==null,source:r}};for(const e of _){if(S[e])continue;const o=n.semanticMappings[e],r=n.chroma[e],s=T(e,o.source),a=x(n.lightness,n.tones,o.lightness),g=A(s.color,a,r.min,r.max),l=R(e);i[e]=g,t[l]=N(g),c.trace&&c.trace.push({token:e,property:l,resolved:t[l],source:s.source,lightness:o.lightness,sourceResolved:s.resolved,base:s.color})}for(const e of _){const o=S[e];o&&(i[e]=O(e,R(e),o.bg,i[o.bg],o.targetLc,c.trace))}if(c.includeFooterInk!==!1){const e=P(t[R("layer2")]);for(const[o,r]of Object.entries(j)){const s=o;O(s,r,"layer2",e,S[s].targetLc,c.footerTrace,!0)}}return t}export{W as computeSemanticProperties};
@@ -1 +1 @@
1
- import{parseCssColor as u,serializeOklch as m,gamutMapToSRGB as b}from"../../shared/color-engine.js";import{generateScaleProperties as v}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as S,DEFAULT_DATA_PALETTE as k,generateDivergingRamp as O,generateSequentialRamp as B}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as R,DEFAULT_MONOSPACE_FONT_FAMILY as w,resolveDataColorSource as E}from"../../shared/theme.js";import{dataCompanionProperties as I}from"./data-companion-properties.js";import{lightnessRampProperties as $}from"./lightness-ramp-properties.js";import{surfacePolarityProperty as M}from"./surface-polarity-property.js";import{computeVariants as P}from"./compute-variants.js";import{computeSemanticProperties as T}from"./compute-semantic-properties.js";function x(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function A(o,g,l){const c={},t=o.dataPalette??k;for(let a=0;a<S.length;a+=1){const s=S[a],d=u(l(t[s],`dataPalette.${s}`))??g;c[`--esp-color-series-${a+1}`]=m(b(d))}return c}function z(o,g,l,c={}){const t=u(o.seedColor);if(!t)return{};const a={};a["--esp-scheme"]=g,a["--esp-seed-color"]=o.seedColor;const s=P(t,o);for(const[e,n]of Object.entries(s))a[`--esp-color-${e}`]=m(b(n));const d=new Set,i=(e,n)=>{const r=typeof e=="string"?E(e,o.anchors):null;if(r)return r;const p=typeof e=="string"?e:String(e);return d.has(p)||(d.add(p),console.warn(`Espalier theme: ${n} color source "${p}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor};Object.assign(a,A(o,t,i));for(const[e,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?B(i(n.source,`dataRamps.${e}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):O(i(n.start,`dataRamps.${e}.start`),i(n.end,`dataRamps.${e}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:i(n.neutral,`dataRamps.${e}.neutral`)})).forEach((p,y)=>{a[`--esp-color-ramp-${e}-${y+1}`]=p})}catch(r){console.warn(`Espalier theme: dataRamps.${e} cannot be generated \u2014 ${r instanceof Error?r.message:String(r)}`)}Object.assign(a,$(o));const f=new Set;return Object.assign(a,T(o,s,{trace:l,onUnresolvedSource:e=>{f.has(e)||(f.add(e),console.warn(`Espalier theme: color source "${e}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),Object.assign(a,M(a)),Object.assign(a,I(a)),Object.assign(a,v(x(o),c.viewportWidth)),a["--esp-font-body"]=o.fontBody||R,o.fontHeadings&&(a["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(a["--esp-font-brand"]=o.fontBrand),o.fontMenu&&(a["--esp-font-menu"]=o.fontMenu),a["--esp-font-monospace"]=o.fontMonospace||w,a["--esp-font-weight-body"]=o.fontWeightBody,a["--esp-font-weight-headings"]=o.fontWeightHeadings,a["--esp-font-weight-brand"]=o.fontWeightBrand,a["--esp-font-weight-menu"]=o.fontWeightMenu,a["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(a["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(a["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(a["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(a["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(a["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(a["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(a["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),a}export{z as computeThemeProperties,A as dataSeriesProperties};
1
+ import{parseCssColor as b,serializeOklch as S,gamutMapToSRGB as y}from"../../shared/color-engine.js";import{compileComponentProperties as k}from"../../shared/component-property-compiler.js";import{generateScaleProperties as B}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as v,DEFAULT_DATA_PALETTE as R,generateDivergingRamp as w,generateSequentialRamp as E}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as I,DEFAULT_MONOSPACE_FONT_FAMILY as P,resolveDataColorSource as $}from"../../shared/theme-core.js";import{dataCompanionProperties as M}from"./data-companion-properties.js";import{lightnessRampProperties as T}from"./lightness-ramp-properties.js";import{surfacePolarityProperty as x}from"./surface-polarity-property.js";import{computeVariants as A}from"./compute-variants.js";import{computeSemanticProperties as C}from"./compute-semantic-properties.js";function _(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function j(o,g,l){const d={},i=o.dataPalette??R;for(let t=0;t<v.length;t+=1){const s=v[t],a=b(l(i[s],`dataPalette.${s}`))??g;d[`--esp-color-series-${t+1}`]=S(y(a))}return d}function G(o,g,l,d={},i,t){const s=b(o.seedColor);if(!s)return{};const a={};a["--esp-scheme"]=g,a["--esp-seed-color"]=o.seedColor;const f=A(s,o);for(const[e,n]of Object.entries(f))a[`--esp-color-${e}`]=S(y(n));const u=new Set,p=(e,n)=>{const r=typeof e=="string"?$(e,o.anchors):null;if(r)return r;const c=typeof e=="string"?e:String(e);return u.has(c)||(u.add(c),console.warn(`Espalier theme: ${n} color source "${c}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor};Object.assign(a,j(o,s,p));for(const[e,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?E(p(n.source,`dataRamps.${e}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):w(p(n.start,`dataRamps.${e}.start`),p(n.end,`dataRamps.${e}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:p(n.neutral,`dataRamps.${e}.neutral`)})).forEach((c,O)=>{a[`--esp-color-ramp-${e}-${O+1}`]=c})}catch(r){console.warn(`Espalier theme: dataRamps.${e} cannot be generated \u2014 ${r instanceof Error?r.message:String(r)}`)}Object.assign(a,T(o));const m=new Set;return Object.assign(a,C(o,f,{trace:l,footerTrace:t,onUnresolvedSource:e=>{m.has(e)||(m.add(e),console.warn(`Espalier theme: color source "${e}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),i&&Object.assign(a,k(i.surface,{theme:o,variants:f,semanticProperties:a},i.trace)),Object.assign(a,x(a)),Object.assign(a,M(a)),Object.assign(a,B(_(o),d.viewportWidth)),a["--esp-font-body"]=o.fontBody||I,o.fontHeadings&&(a["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(a["--esp-font-brand"]=o.fontBrand),o.fontMenu&&(a["--esp-font-menu"]=o.fontMenu),a["--esp-font-monospace"]=o.fontMonospace||P,a["--esp-font-weight-body"]=o.fontWeightBody,a["--esp-font-weight-headings"]=o.fontWeightHeadings,a["--esp-font-weight-brand"]=o.fontWeightBrand,a["--esp-font-weight-menu"]=o.fontWeightMenu,a["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(a["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(a["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(a["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(a["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(a["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(a["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(a["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),a}export{G as computeThemeProperties,j as dataSeriesProperties};
@@ -1 +1 @@
1
- import{apcaContrast as s,ensureContrast as _,gamutMapToSRGB as i,oklabToOklch as T,oklchToOklab as p,parseOklch as S,serializeOklch as l}from"../../shared/color-engine.js";import{DATA_SERIES_KEYS as f}from"../../shared/data-colors.js";import{TOKEN_PAIRINGS as m}from"../../shared/theme.js";const b=.75,u=.12,E=m.text?.targetLc??75;function I(c,n){const t=_({...c},n,E);if(Math.abs(s(t,n))>=E)return t;const o=i({l:n.l>.5?1:0,c:c.c,h:c.h});return Math.abs(s(o,n))>Math.abs(s(t,n))?o:t}function A(c,n,t){const o=p(c),r=p(n);return T({L:o.L*t+r.L*(1-t),a:o.a*t+r.a*(1-t),b:o.b*t+r.b*(1-t)})}function x(c,n){const t=S(c["--esp-color-background"]??"");if(!t)return{};const o={};for(let r=1;r<=f.length;r+=1){const a=`--esp-color-series-${r}`,e=S(c[a]??n?.[a]??"");e&&(o[`${a}-wash`]=l(i(A(e,t,b))),o[`${a}-tint`]=l(i(A(e,t,u))),o[`${a}-ink`]=l(I(e,t)))}return o}export{u as DATA_TINT_SERIES_SHARE,b as DATA_WASH_SERIES_SHARE,x as dataCompanionProperties};
1
+ import{apcaContrast as s,ensureContrast as _,gamutMapToSRGB as i,oklabToOklch as T,oklchToOklab as p,parseOklch as S,serializeOklch as l}from"../../shared/color-engine.js";import{DATA_SERIES_KEYS as f}from"../../shared/data-colors.js";import{TOKEN_PAIRINGS as m}from"../../shared/theme-core.js";const b=.75,u=.12,E=m.text?.targetLc??75;function I(c,n){const t=_({...c},n,E);if(Math.abs(s(t,n))>=E)return t;const o=i({l:n.l>.5?1:0,c:c.c,h:c.h});return Math.abs(s(o,n))>Math.abs(s(t,n))?o:t}function A(c,n,t){const o=p(c),r=p(n);return T({L:o.L*t+r.L*(1-t),a:o.a*t+r.a*(1-t),b:o.b*t+r.b*(1-t)})}function x(c,n){const t=S(c["--esp-color-background"]??"");if(!t)return{};const o={};for(let r=1;r<=f.length;r+=1){const a=`--esp-color-series-${r}`,e=S(c[a]??n?.[a]??"");e&&(o[`${a}-wash`]=l(i(A(e,t,b))),o[`${a}-tint`]=l(i(A(e,t,u))),o[`${a}-ink`]=l(I(e,t)))}return o}export{u as DATA_TINT_SERIES_SHARE,b as DATA_WASH_SERIES_SHARE,x as dataCompanionProperties};
@@ -1 +1 @@
1
- import{LIGHTNESS_KEYS as s}from"../../shared/theme.js";import{lightnessKeyToCSS as e}from"./lightness-key-to-css.js";function p(t){const o={};for(const r of s)o[e(r)]=`${Math.round(t.lightness[r]*100)}%`;return o}export{p as lightnessRampProperties};
1
+ import{LIGHTNESS_KEYS as s}from"../../shared/theme-core.js";import{lightnessKeyToCSS as e}from"./lightness-key-to-css.js";function p(t){const o={};for(const r of s)o[e(r)]=`${Math.round(t.lightness[r]*100)}%`;return o}export{p as lightnessRampProperties};
@@ -20,6 +20,9 @@ import { type CSSResult } from "lit";
20
20
  * Base and child rules have zero specificity. A selected light-DOM paragraph
21
21
  * receives a color-only bridge over `esp-root`'s native paragraph ink. The
22
22
  * consumer keeps ownership of outer block rhythm, prose measure and font family.
23
+ *
24
+ * @cssprop --esp-blockquote-bar-color - Color of the quote's inline-start border. Defaults to `var(--esp-color-border)`.
25
+ * @cssprop --esp-blockquote-glyph-color - Ink of the opening quote mark. Defaults to `var(--esp-blockquote-bar-color, var(--esp-color-border))`.
23
26
  */
24
27
  export declare function blockquoteStyles(selector?: string, options?: {
25
28
  figureSelector?: string;
@@ -1,4 +1,4 @@
1
- import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.trim();if(!n)throw new RangeError("A blockquote selector must not be empty.");const t=s?.figureSelector?.trim();if(t==="")throw new RangeError("A figure selector must not be empty.");const e=o(n),l=o('url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Cpath%20d%3D%27M3%2025V15C3%208%207%204%2014%203v5c-4%201-6%203-6%206h6v11H3zm15%200V15c0-7%204-11%2011-12v5c-4%201-6%203-6%206h6v11H18z%27%2F%3E%3C%2Fsvg%3E")'),r=o(t??""),p=t===void 0?i``:i`
1
+ import{css as o,unsafeCSS as i}from"lit";function h(n="blockquote",s){const a=n.trim();if(!a)throw new RangeError("A blockquote selector must not be empty.");const t=s?.figureSelector?.trim();if(t==="")throw new RangeError("A figure selector must not be empty.");const e=i(a),l=i('url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Cpath%20d%3D%27M3%2025V15C3%208%207%204%2014%203v5c-4%201-6%203-6%206h6v11H3zm15%200V15c0-7%204-11%2011-12v5c-4%201-6%203-6%206h6v11H18z%27%2F%3E%3C%2Fsvg%3E")'),r=i(t??""),p=t===void 0?o``:o`
2
2
  :where(${r}) {
3
3
  margin-inline: 0;
4
4
  min-inline-size: 0;
@@ -23,11 +23,11 @@ import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.
23
23
  letter-spacing: inherit;
24
24
  color: inherit;
25
25
  }
26
- `;return i`
26
+ `;return o`
27
27
  :where(${e}) {
28
28
  position: relative;
29
29
  background: var(--esp-color-layer-1, var(--esp-color-background));
30
- border-inline-start: 0.3em solid var(--esp-color-border);
30
+ border-inline-start: 0.3em solid var(--esp-blockquote-bar-color, var(--esp-color-border));
31
31
  padding-block: var(--esp-size-small);
32
32
  padding-inline-end: var(--esp-size-small);
33
33
  padding-inline-start: calc(var(--esp-size-small) + 1.6em + var(--esp-size-tiny));
@@ -49,7 +49,7 @@ import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.
49
49
  inset-inline-start: var(--esp-size-small);
50
50
  width: 1.6em;
51
51
  height: 1.6em;
52
- background: var(--esp-color-border);
52
+ background: var(--esp-blockquote-glyph-color, var(--esp-blockquote-bar-color, var(--esp-color-border)));
53
53
  mask-image: ${l};
54
54
  mask-size: contain;
55
55
  mask-position: center;
@@ -1 +1 @@
1
- import{CSS_NAMED_COLORS as w}from"./css-named-colors.js";const B=Math.PI/180,p=1e-4,W=50,d="[+-]?(?:\\d+|\\d*\\.\\d+)(?:[eE][+-]?\\d+)?",h="[\\t\\n\\f\\r ]",z=new RegExp(h+"*,"+h+"*"),Y=new RegExp(h+"+");function _(t){return t.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," ").replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"")}const P={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360},j=.4,q=new RegExp("^oklch\\("+h+"*("+d+")(%?)"+h+"+("+d+")(%?)"+h+"+("+d+")(deg|grad|rad|turn)?"+h+"*\\)$","i");function k(t){const n=t.h*B;return{L:t.l,a:t.c*Math.cos(n),b:t.c*Math.sin(n)}}function K(t){const n=t.L+.3963377774*t.a+.2158037573*t.b,e=t.L-.1055613458*t.a-.0638541728*t.b,r=t.L-.0894841775*t.a-1.291485548*t.b,o=n*n*n,c=e*e*e,u=r*r*r;return{r:4.0767416621*o-3.3077115913*c+.2309699292*u,g:-1.2684380046*o+2.6097574011*c-.3413193965*u,b:-.0041960863*o-.7034186147*c+1.707614701*u}}function S(t){return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function J(t){return{r:S(t.r),g:S(t.g),b:S(t.b)}}function Q(t){return t.r>=-p&&t.r<=1+p&&t.g>=-p&&t.g<=1+p&&t.b>=-p&&t.b<=1+p}function f(t){return Math.max(0,Math.min(1,t))}function Z(t){const n=_(t).match(q);if(!n)return null;let e=parseFloat(n[1]);n[2]==="%"&&(e/=100);let r=parseFloat(n[3]);n[4]==="%"&&(r=r/100*j);const o=parseFloat(n[5])*P[(n[6]??"").toLowerCase()];return!isFinite(e)||!isFinite(r)||!isFinite(o)?null:{l:Math.max(0,Math.min(1,e)),c:Math.max(0,r),h:(o%360+360)%360}}function mt(t){const n=M(t.l,6),e=M(t.c,6),r=M((t.h%360+360)%360,4);return`oklch(${n} ${e} ${r})`}function R(t){return J(K(k(t)))}function A(t){return Q(R(t))}function C(t){if(t.c<=p||A(t))return{...t};let n=0,e=t.c,r={...t};for(let o=0;o<W;o++){const c=(n+e)/2;if(r={l:t.l,c,h:t.h},A(r)?n=c:e=c,e-n<p)break}return{l:t.l,c:n,h:t.h}}function tt(t,n,e){const r={l:t.l,c:Math.max(n,Math.min(e,t.c)),h:t.h};return C(r)}const b=.022,v=.012,F=.022,I=.57,y=.56,D=1.14,O=.001,L=.027;function N(t){const n=Math.pow(f(t.r),2.4),e=Math.pow(f(t.g),2.4),r=Math.pow(f(t.b),2.4);return .2126729*n+.7151522*e+.072175*r}function $(t,n){const e=R(C(t)),r=R(C(n));let o=N(e),c=N(r);if(o=o>b?o:o+Math.pow(b-o,1.414),c=c>b?c:c+Math.pow(b-c,1.414),Math.abs(c-o)<O)return 0;let u;if(c>o){const a=Math.pow(c,y),l=Math.pow(o,I);if(u=(a-l)*D,u<O)return 0;u=u<L?u-u*F*L:u-F}else{const a=Math.pow(c,y),l=Math.pow(o,I);if(u=(a-l)*D,u>-O)return 0;u=u>-L?u-u*v*L:u+v}return u*100}function nt(t,n,e=60){let r=C({...t}),o=Math.abs($(r,n));if(o>=e)return r;const c=n.l>.5,u=.01,a=c?0:1;for(let l=0;l<100;l++){if(c?r.l=Math.max(a,r.l-u):r.l=Math.min(a,r.l+u),r=C(r),o=Math.abs($(r,n)),o>=e)return r;if(r.l<=0||r.l>=1)break}return r}function Mt(t,n){return((t+n)%360+360)%360}function gt(t,n){const e=k(t),r=k(n),o=e.L-r.L,c=e.a-r.a,u=e.b-r.b;return Math.sqrt(o*o+c*c+u*u)}function rt(t,n,e,r){return tt({l:n,c:t.c,h:t.h},e,r)}function Ct(t,n,e,r,o,c=60,u){const a=rt(t,n,e,r);return u?.(a),nt(a,o,c)}function G(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function et(t){return{r:G(t.r),g:G(t.g),b:G(t.b)}}function ot({r:t,g:n,b:e}){const r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*e),o=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*e),c=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*e);return{L:.2104542553*r+.793617785*o-.0040720468*c,a:1.9779984951*r-2.428592205*o+.4505937099*c,b:.0259040371*r+.7827717662*o-.808675766*c}}function ct(t){return ot(et(t))}function V(t){const n=Math.sqrt(t.a*t.a+t.b*t.b),e=n<1e-12?0:(Math.atan2(t.b,t.a)/B%360+360)%360;return{l:t.L,c:n,h:e}}function ut(t){const n=M(t.c,4);return{l:M(t.l,3),c:n,h:n===0?0:M(t.h,1)}}function m(t){return Math.round(f(t)*255)}function at(t){const n=V(ct(t)),e=t.r===t.g&&t.g===t.b?{l:n.l,c:0,h:0}:n,r=ut(e);if(A(r)){const o=R(r);if(m(o.r)===m(t.r)&&m(o.g)===m(t.g)&&m(o.b)===m(t.b))return r}return e}function X(t,n){const e=t.slice(1),r=e.length;if(!/^[0-9a-f]+$/i.test(e)||r!==3&&r!==6&&!(n&&(r===4||r===8)))return null;const o=r<=4?1:2,c=u=>{const a=e.slice(u*o,(u+1)*o);return parseInt(o===1?a.repeat(2):a,16)/255};return{space:"srgb",color:{r:c(0),g:c(1),b:c(2)},alpha:r===4||r===8?c(3):1}}function x(t,n,e){const r=t.match(new RegExp("^"+n+"\\("+h+"*([^)]*?)"+h+"*\\)$","i"));if(!r)return null;const o=r[1],c=o.includes(","),u=o.split("/");if(u.length>2||u.length===2&&(c||!e))return null;const l=_(u[0]).split(c?z:Y),i=c&&l.length===4&&e?l.pop():u[1];if(l.length!==3||l.some(g=>g.length===0))return null;const s=i===void 0?1:H(_(i));return s===null?null:{args:l,legacy:c,alpha:s}}const st=new RegExp("^("+d+")([a-z%]*)$","i");function T(t){const n=t.match(st);if(!n)return null;const e=parseFloat(n[1]);return isFinite(e)?{value:e,unit:n[2].toLowerCase()}:null}function H(t){if(t.toLowerCase()==="none")return 0;const n=T(t);return!n||n.unit!==""&&n.unit!=="%"?null:f(n.unit==="%"?n.value/100:n.value)}function lt(t){if(t.unit!==""&&t.unit!=="%")return null;const n=t.unit==="%"?t.value/100:t.value/255;return Math.max(0,Math.min(1,n))}function it(t){const n=P[t.unit];return n===void 0?null:t.value*n}function U(t){return t.unit!==""&&t.unit!=="%"?null:Math.max(0,Math.min(1,t.value/100))}function ht(t,n,e){const r=(t%360+360)%360,o=c=>{const u=(c+r/30)%12,a=n*Math.min(e,1-e);return e-a*Math.max(-1,Math.min(u-3,9-u,1))};return{r:o(0),g:o(8),b:o(4)}}const xt='"#rrggbb", "#rgb", "rgb(\u2026)", "hsl(\u2026)", "oklch(\u2026)"';function dt(t){const n=pt(t,!1);return n?n.space==="oklch"?n.color:at(n.color):null}function pt(t,n){const e=_(t);if(e.startsWith("#"))return X(e,n);if(/^oklch\(/i.test(e)){const r=n?x(e,"oklch",!0):null;if(n&&(!r||r.legacy))return null;const o=Z(r?`oklch(${r.args.map(c=>c.toLowerCase()==="none"?"0":c).join(" ")})`:e);return o?{space:"oklch",color:o,alpha:r?.alpha??1}:null}if(/^rgba?\(/i.test(e)){const r=x(e,"rgba?",n);if(!r)return null;const o=r.args.map(T);if(o.some(s=>s===null))return null;const c=o;if(r.legacy&&new Set(c.map(s=>s.unit)).size>1)return null;const u=c.map(lt);if(u.some(s=>s===null))return null;const[a,l,i]=u;return{space:"srgb",color:{r:a,g:l,b:i},alpha:r.alpha}}if(/^hsla?\(/i.test(e)){const r=x(e,"hsla?",n);if(!r)return null;const o=r.args.map(T);if(o.some(g=>g===null))return null;const[c,u,a]=o;if(r.legacy&&(u.unit!=="%"||a.unit!=="%"))return null;const l=it(c),i=U(u),s=U(a);return l===null||i===null||s===null?null:{space:"srgb",color:ht(l,i,s),alpha:r.alpha}}if(n){if(/^oklab\(/i.test(e)){const c=x(e,"oklab",!0);if(!c||c.legacy)return null;const u=c.args.map(s=>T(s.toLowerCase()==="none"?"0":s));if(u.some(s=>!s||s.unit!==""&&s.unit!=="%"))return null;const[a,l,i]=u.map((s,g)=>{const E=s;return E.unit!=="%"?E.value:E.value/100*(g===0?1:.4)});return{space:"oklch",color:V({L:f(a),a:l,b:i}),alpha:c.alpha}}const r=e.toLowerCase();if(Object.prototype.hasOwnProperty.call(w,r))return X(w[r],n);if(r==="transparent")return{space:"srgb",color:{r:0,g:0,b:0},alpha:0};const o=e.match(new RegExp("^color\\("+h+"*srgb"+h+"+","i"));if(o){const c=x(`color(${e.slice(o[0].length)}`,"color",!0);if(!c||c.legacy)return null;const u=c.args.map(H);if(u.some(s=>s===null))return null;const[a,l,i]=u;return{space:"srgb",color:{r:a,g:l,b:i},alpha:c.alpha}}}return null}function M(t,n){const e=Math.pow(10,n);return Math.round(t*e)/e}export{xt as ACCEPTED_COLOR_FORMS,$ as apcaContrast,f as clampChannel,tt as clampChromaAndGamutMap,gt as deltaEOK,rt as deriveSemantic,Ct as deriveSemanticWithContrast,nt as ensureContrast,G as gammaToLinear,C as gamutMapToSRGB,A as isInSRGBGamut,ot as linearRgbToOklab,V as oklabToOklch,k as oklchToOklab,R as oklchToSRGB,dt as parseCssColor,pt as parseCssColorValue,Z as parseOklch,Mt as rotateHue,mt as serializeOklch,et as srgbToLinearRGB,ct as srgbToOklab};
1
+ import{CSS_NAMED_COLORS as P}from"./css-named-colors.js";const U={l:0,c:0,h:0},z={l:1,c:0,h:0},v=Math.PI/180,m=1e-4,q=50,_="[+-]?(?:\\d+|\\d*\\.\\d+)(?:[eE][+-]?\\d+)?",p="[\\t\\n\\f\\r ]",Y=new RegExp(p+"*,"+p+"*"),j=new RegExp(p+"+");function R(t){return t.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," ").replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"")}const F={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360},J=.4,Q=new RegExp("^oklch\\("+p+"*("+_+")(%?)"+p+"+("+_+")(%?)"+p+"+("+_+")(deg|grad|rad|turn)?"+p+"*\\)$","i");function k(t){const n=t.h*v;return{L:t.l,a:t.c*Math.cos(n),b:t.c*Math.sin(n)}}function Z(t){const n=t.L+.3963377774*t.a+.2158037573*t.b,r=t.L-.1055613458*t.a-.0638541728*t.b,e=t.L-.0894841775*t.a-1.291485548*t.b,c=n*n*n,o=r*r*r,s=e*e*e;return{r:4.0767416621*c-3.3077115913*o+.2309699292*s,g:-1.2684380046*c+2.6097574011*o-.3413193965*s,b:-.0041960863*c-.7034186147*o+1.707614701*s}}function A(t){return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function tt(t){return{r:A(t.r),g:A(t.g),b:A(t.b)}}function nt(t){return t.r>=-m&&t.r<=1+m&&t.g>=-m&&t.g<=1+m&&t.b>=-m&&t.b<=1+m}function M(t){return Math.max(0,Math.min(1,t))}function rt(t){const n=R(t).match(Q);if(!n)return null;let r=parseFloat(n[1]);n[2]==="%"&&(r/=100);let e=parseFloat(n[3]);n[4]==="%"&&(e=e/100*J);const c=parseFloat(n[5])*F[(n[6]??"").toLowerCase()];return!isFinite(r)||!isFinite(e)||!isFinite(c)?null:{l:Math.max(0,Math.min(1,r)),c:Math.max(0,e),h:(c%360+360)%360}}function xt(t){const n=x(t.l,6),r=x(t.c,6),e=x((t.h%360+360)%360,4);return`oklch(${n} ${r} ${e})`}function T(t){return tt(Z(k(t)))}function S(t){return nt(T(t))}function C(t){if(t.c<=m||S(t))return{...t};let n=0,r=t.c,e={...t};for(let c=0;c<q;c++){const o=(n+r)/2;if(e={l:t.l,c:o,h:t.h},S(e)?n=o:r=o,r-n<m)break}return{l:t.l,c:n,h:t.h}}function et(t,n,r){const e={l:t.l,c:Math.max(n,Math.min(r,t.c)),h:t.h};return C(e)}const L=.022,I=.012,N=.022,D=.57,y=.56,$=1.14,O=.001,b=.027;function H(t){const n=Math.pow(M(t.r),2.4),r=Math.pow(M(t.g),2.4),e=Math.pow(M(t.b),2.4);return .2126729*n+.7151522*r+.072175*e}function G(t,n){const r=T(C(t)),e=T(C(n));let c=H(r),o=H(e);if(c=c>L?c:c+Math.pow(L-c,1.414),o=o>L?o:o+Math.pow(L-o,1.414),Math.abs(o-c)<O)return 0;let s;if(o>c){const l=Math.pow(o,y),a=Math.pow(c,D);if(s=(l-a)*$,s<O)return 0;s=s<b?s-s*N*b:s-N}else{const l=Math.pow(o,y),a=Math.pow(c,D);if(s=(l-a)*$,s>-O)return 0;s=s>-b?s-s*I*b:s+I}return s*100}function ot(t,n,r=60,e=!1){const c=C({...t}),o=f=>Math.abs(G(f,n))>=r;if(o(c))return c;const s=f=>{let h={...c};for(let B=0;B<100&&(h.l=f?Math.max(0,h.l-.01):Math.min(1,h.l+.01),h=C(h),!(o(h)||h.l<=0||h.l>=1));B++);return h},l=n.l>.5,a=s(l);if(!e||o(a))return a;const i=l?z:U;if(!o(i))return Math.abs(G(i,n))>Math.abs(G(a,n))?{...i}:a;const u=s(!l);return o(u)?u:{...i}}function Ct(t,n){return((t+n)%360+360)%360}function dt(t,n){const r=k(t),e=k(n),c=r.L-e.L,o=r.a-e.a,s=r.b-e.b;return Math.sqrt(c*c+o*o+s*s)}function ct(t,n,r,e){return et({l:n,c:t.c,h:t.h},r,e)}function _t(t,n,r,e,c,o=60,s,l=!1){const a=ct(t,n,r,e);return s?.(a),ot(a,c,o,l)}function w(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function st(t){return{r:w(t.r),g:w(t.g),b:w(t.b)}}function at({r:t,g:n,b:r}){const e=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),c=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return{L:.2104542553*e+.793617785*c-.0040720468*o,a:1.9779984951*e-2.428592205*c+.4505937099*o,b:.0259040371*e+.7827717662*c-.808675766*o}}function ut(t){return at(st(t))}function V(t){const n=Math.sqrt(t.a*t.a+t.b*t.b),r=n<1e-12?0:(Math.atan2(t.b,t.a)/v%360+360)%360;return{l:t.L,c:n,h:r}}function lt(t){const n=x(t.c,4);return{l:x(t.l,3),c:n,h:n===0?0:x(t.h,1)}}function g(t){return Math.round(M(t)*255)}function it(t){const n=V(ut(t)),r=t.r===t.g&&t.g===t.b?{l:n.l,c:0,h:0}:n,e=lt(r);if(S(e)){const c=T(e);if(g(c.r)===g(t.r)&&g(c.g)===g(t.g)&&g(c.b)===g(t.b))return e}return r}function W(t,n){const r=t.slice(1),e=r.length;if(!/^[0-9a-f]+$/i.test(r)||e!==3&&e!==6&&!(n&&(e===4||e===8)))return null;const c=e<=4?1:2,o=s=>{const l=r.slice(s*c,(s+1)*c);return parseInt(c===1?l.repeat(2):l,16)/255};return{space:"srgb",color:{r:o(0),g:o(1),b:o(2)},alpha:e===4||e===8?o(3):1}}function d(t,n,r){const e=t.match(new RegExp("^"+n+"\\("+p+"*([^)]*?)"+p+"*\\)$","i"));if(!e)return null;const c=e[1],o=c.includes(","),s=c.split("/");if(s.length>2||s.length===2&&(o||!r))return null;const a=R(s[0]).split(o?Y:j),i=o&&a.length===4&&r?a.pop():s[1];if(a.length!==3||a.some(f=>f.length===0))return null;const u=i===void 0?1:X(R(i));return u===null?null:{args:a,legacy:o,alpha:u}}const ht=new RegExp("^("+_+")([a-z%]*)$","i");function E(t){const n=t.match(ht);if(!n)return null;const r=parseFloat(n[1]);return isFinite(r)?{value:r,unit:n[2].toLowerCase()}:null}function X(t){if(t.toLowerCase()==="none")return 0;const n=E(t);return!n||n.unit!==""&&n.unit!=="%"?null:M(n.unit==="%"?n.value/100:n.value)}function pt(t){if(t.unit!==""&&t.unit!=="%")return null;const n=t.unit==="%"?t.value/100:t.value/255;return Math.max(0,Math.min(1,n))}function ft(t){const n=F[t.unit];return n===void 0?null:t.value*n}function K(t){return t.unit!==""&&t.unit!=="%"?null:Math.max(0,Math.min(1,t.value/100))}function mt(t,n,r){const e=(t%360+360)%360,c=o=>{const s=(o+e/30)%12,l=n*Math.min(r,1-r);return r-l*Math.max(-1,Math.min(s-3,9-s,1))};return{r:c(0),g:c(8),b:c(4)}}const Rt='"#rrggbb", "#rgb", "rgb(\u2026)", "hsl(\u2026)", "oklch(\u2026)"';function Tt(t){const n=Mt(t,!1);return n?n.space==="oklch"?n.color:it(n.color):null}function Mt(t,n){const r=R(t);if(r.startsWith("#"))return W(r,n);if(/^oklch\(/i.test(r)){const e=n?d(r,"oklch",!0):null;if(n&&(!e||e.legacy))return null;const c=rt(e?`oklch(${e.args.map(o=>o.toLowerCase()==="none"?"0":o).join(" ")})`:r);return c?{space:"oklch",color:c,alpha:e?.alpha??1}:null}if(/^rgba?\(/i.test(r)){const e=d(r,"rgba?",n);if(!e)return null;const c=e.args.map(E);if(c.some(u=>u===null))return null;const o=c;if(e.legacy&&new Set(o.map(u=>u.unit)).size>1)return null;const s=o.map(pt);if(s.some(u=>u===null))return null;const[l,a,i]=s;return{space:"srgb",color:{r:l,g:a,b:i},alpha:e.alpha}}if(/^hsla?\(/i.test(r)){const e=d(r,"hsla?",n);if(!e)return null;const c=e.args.map(E);if(c.some(f=>f===null))return null;const[o,s,l]=c;if(e.legacy&&(s.unit!=="%"||l.unit!=="%"))return null;const a=ft(o),i=K(s),u=K(l);return a===null||i===null||u===null?null:{space:"srgb",color:mt(a,i,u),alpha:e.alpha}}if(n){if(/^oklab\(/i.test(r)){const o=d(r,"oklab",!0);if(!o||o.legacy)return null;const s=o.args.map(u=>E(u.toLowerCase()==="none"?"0":u));if(s.some(u=>!u||u.unit!==""&&u.unit!=="%"))return null;const[l,a,i]=s.map((u,f)=>{const h=u;return h.unit!=="%"?h.value:h.value/100*(f===0?1:.4)});return{space:"oklch",color:V({L:M(l),a,b:i}),alpha:o.alpha}}const e=r.toLowerCase();if(Object.prototype.hasOwnProperty.call(P,e))return W(P[e],n);if(e==="transparent")return{space:"srgb",color:{r:0,g:0,b:0},alpha:0};const c=r.match(new RegExp("^color\\("+p+"*srgb"+p+"+","i"));if(c){const o=d(`color(${r.slice(c[0].length)}`,"color",!0);if(!o||o.legacy)return null;const s=o.args.map(X);if(s.some(u=>u===null))return null;const[l,a,i]=s;return{space:"srgb",color:{r:l,g:a,b:i},alpha:o.alpha}}}return null}function x(t,n){const r=Math.pow(10,n);return Math.round(t*r)/r}export{Rt as ACCEPTED_COLOR_FORMS,U as BLACK_INK,z as WHITE_INK,G as apcaContrast,M as clampChannel,et as clampChromaAndGamutMap,dt as deltaEOK,ct as deriveSemantic,_t as deriveSemanticWithContrast,ot as ensureContrast,w as gammaToLinear,C as gamutMapToSRGB,S as isInSRGBGamut,at as linearRgbToOklab,V as oklabToOklch,k as oklchToOklab,T as oklchToSRGB,Tt as parseCssColor,Mt as parseCssColorValue,rt as parseOklch,Ct as rotateHue,xt as serializeOklch,st as srgbToLinearRGB,ut as srgbToOklab};
@@ -0,0 +1 @@
1
+ import{apcaContrast as k,BLACK_INK as I,deriveSemantic as T,ensureContrast as y,parseOklch as O,serializeOklch as h,WHITE_INK as S}from"./color-engine.js";import{SEMANTIC_COLOR_PROPERTIES as _,SETTABLE_COMPONENT_PROPERTIES as N}from"./settable-component-properties.js";import{resolveLightnessReference as j}from"./theme-core.js";import{resolveMappingSource as x}from"./variant-engine.js";function E(e,{theme:i,variants:d,semanticProperties:r}){if(typeof e=="string")return _.has(e)?r[e]:e;const o=x(e.source,d,i.anchors);if(!o)return;const l=j(i.lightness,i.tones,e.lightness);return h(T(o,l,0,o.c))}function M(e,i,d){const r=t=>Math.abs(k(t,i)),o=r(e);if(o>=d)return{resolved:h(e),fromLc:o,toLc:o};let l=h(y(e,i,d)),u=r(O(l));if(u<d)for(const t of[I,S]){const n=r(t);n>u&&(l=h(t),u=n)}return{resolved:l,fromLc:o,toLc:u}}function w(e,i,d,r=N){const o={},l=Object.entries(e.values);if(l.length===0)return o;const u=(t,n,s,c)=>{o[t]=s,d?.push({name:t,context:e.context,authored:n,resolved:s,overridesRoot:n!==null&&(e.winners.get(t)?.overridesRoot??!1),...c})};for(const[t,n]of l){const s=r[t];if(s.pairsWith!==void 0)continue;let c;if(s.syntax==="color"?c=E(n,i):typeof n=="string"&&(c=n),c===void 0)continue;u(t,n,c);const f=s.derives;f&&typeof n=="string"&&Object.prototype.hasOwnProperty.call(f.values,n)&&(o[f.property]=f.values[n])}for(const[t,{pairsWith:n,targetLc:s,fitFallback:c}]of Object.entries(r)){if(n===void 0||s===void 0||c===void 0)continue;const f=e.values[t],g=o[n];if(f===void 0&&g===void 0)continue;const{semanticProperties:m}=i,b=r[n]?.fitFallback??n,p=g??m[b],a=f===void 0?m[c]:E(f,i),v=p===void 0?null:O(p),L=a===void 0?null:O(a);if(p===void 0||a===void 0||!v||!L)continue;const{resolved:C,fromLc:P,toLc:R}=M(L,v,s);u(t,f??null,C,d?{requested:a,adjusted:a!==C,apca:{against:n,againstColor:p,fromLc:P,toLc:R},targetLc:s}:void 0)}return o}export{w as compileComponentProperties};
@@ -0,0 +1 @@
1
+ import{PUBLIC_TOKEN_NAMES as a,PUBLIC_TOKEN_PATTERNS as i}from"./public-token-catalog.generated.js";import{isSettableComponentPropertyName as l,PRIVATE_COMPONENT_PROPERTY_PREFIX as u,SETTABLE_COMPONENT_PROPERTIES as c}from"./settable-component-properties.js";import{PUBLIC_TOKEN_NAMES as S,PUBLIC_TOKEN_PATTERNS as h}from"./public-token-catalog.generated.js";const m=new Set(a),p=i.map(e=>new RegExp(e)),f=Object.keys(c);function T(e){return e.startsWith(u)?"private":l(e)?"settable":m.has(e)||p.some(t=>t.test(e))?"not_settable":"unknown"}function N(e,t){let o=Array.from({length:t.length+1},(n,s)=>s);for(let n=0;n<e.length;n+=1){const s=[n+1];for(let r=0;r<t.length;r+=1)s.push(Math.min(o[r+1]+1,s[r]+1,o[r]+ +(e[n]!==t[r])));o=s}return o[t.length]}function _(e,t=f){let o,n=1/0;for(const s of t){const r=N(e,s);(o===void 0||r<n||r===n&&s<o)&&(o=s,n=r)}return o}function b(e){if(!e)return"a JSON object of settable component property names and values";if(e.syntax==="color")return`${e.allowedValues?.join(", ")??"a semantic color token"} or a { source, lightness } mapping`;if(e.syntax==="number")return`a unitless number from ${e.min} to ${e.max} in a JSON string`;const t=e.allowedValues?.join(", ");if(e.syntax==="keyword")return`one of ${t}`;const o=`a length from ${e.min}${e.unit} to ${e.max}${e.unit}, or 0`;return t?`${o}, or one of ${t}`:o}export{S as PUBLIC_TOKEN_NAMES,h as PUBLIC_TOKEN_PATTERNS,T as classifyComponentPropertyName,b as describeAcceptedComponentPropertyValue,_ as nearestSettableComponentProperty};
@@ -0,0 +1 @@
1
+ import{parseCssColor as b}from"./color-engine.js";import{SEMANTIC_COLOR_PROPERTIES as P,SETTABLE_COMPONENT_PROPERTIES as p}from"./settable-component-properties.js";import{isColorSource as S,isLightnessKey as g,isObjectRecord as u,isThemeSlug as m,isThemeTone as y,toneReferenceName as E}from"./theme-mapping-grammar.js";import{parseAnchorSource as T}from"./variant-engine.js";const C=/[;{}]|!\s*important|(?:var|calc|url)\s*\(/i,N=/^(-?(?:\d+(?:\.\d+)?|\.\d+))(em|rem)$/,R=/^(?:\d+(?:\.\d+)?|\.\d+)$/,h=new WeakMap;function l(n,e){return u(n)&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function j(n,e){if(S(n))return!0;if(typeof n!="string")return!1;const t=T(n);if(!t||!m(t.name))return!1;const{name:o,slot:r}=t;if(r!==void 0&&!m(r))return!1;const i=l(e,o),s=typeof i=="string"&&r===void 0?i:l(i,r??"color");return typeof s=="string"&&b(s)!==null}function M(n,e){if(g(n))return!0;const t=E(n);return t!==null&&e.has(t)}function _(n,e,t){if(typeof n=="string")return(e.allowedValues?e.allowedValues.includes(n):P.has(n))?n:void 0;if(!u(n)||Reflect.ownKeys(n).length!==2)return;const o=l(n,"source"),r=l(n,"lightness");if(!(!j(o,t.anchors)||!M(r,t.tones)))return{source:o,lightness:r}}function L(n,e){if(n==="0")return!0;const t=N.exec(n);if(!t||t[0]!==n||t[2]!==e.unit)return!1;const o=Number(t[1]);return Number.isFinite(o)&&o>=e.min&&o<=e.max}function V(n,e,t){if(!(typeof n=="string"&&C.test(n))){if(e.syntax==="color")return _(n,e,t);if(typeof n=="string"){if(e.syntax==="number"){const o=Number(n);return R.exec(n)?.[0]===n&&o>=e.min&&o<=e.max?n:void 0}if(e.syntax!=="keyword"&&L(n,e)||e.syntax!=="length"&&e.allowedValues?.includes(n))return n}}}function x(n,e){const t=new Set(e);if(u(n))for(const[o,r]of Object.entries(n))y(o,r)&&t.add(o);return t}function z(n,e,t){const o=new Map,{map:r,context:i}=n;if(r===void 0)return o;if(!u(r))return t.push({context:i,property:null,code:"bad_value"}),o;for(const[s,f]of Object.entries(r)){if(!Object.prototype.hasOwnProperty.call(e,s)){t.push({context:i,property:s,code:"unregistered"}),o.set(s,{valid:!1,authored:f});continue}const c=V(f,e[s],n);c===void 0?(t.push({context:i,property:s,code:"bad_value"}),o.set(s,{valid:!1,authored:f})):o.set(s,{valid:!0,authored:c})}return o}function w(n,e,t,o,r){const i=z(n,e,o),s=new Map(r?.winners),f={...r?.values};for(const[c,a]of i)if(s.set(c,{...a,context:n.context,overridesRoot:a.valid&&(r?.declarations.has(c)??!1)}),a.valid){f[c]=a.authored,t.add(c);const{derives:d}=e[c];d&&typeof a.authored=="string"&&Object.prototype.hasOwnProperty.call(d.values,a.authored)&&t.add(d.property)}else delete f[c];return{context:n.context,supplied:n.map!==void 0||(r?.supplied??!1),declarations:i,winners:s,values:f}}function O(n,e){const t=[],o=new Set,r=n.anchors,i=x(n.tones),s=w({map:n.componentProperties,context:null,anchors:r,tones:i},e,o,t),f=new Map;if(u(n.contexts))for(const[c,a]of Object.entries(n.contexts)){if(!u(a))continue;const d={map:a.componentProperties,context:c,anchors:r,tones:x(a.tones,i)};f.set(c,w(d,e,o,t,s))}for(const[c,{pairsWith:a}]of Object.entries(e))a!==void 0&&Object.prototype.hasOwnProperty.call(e,a)&&o.has(a)&&o.add(c);return{root:s,contexts:f,findings:t,candidates:o}}function K(n,e,t=p){return{...O(n,t),scheme:e}}function W(n){let e=h.get(n);return e||(e=O(n,p),h.set(n,e)),e}export{W as getComponentPropertyAnalysis,K as normalizeComponentProperties};
@@ -0,0 +1 @@
1
+ function e(o,n){for(const t of n)Object.prototype.hasOwnProperty.call(o,t)||(o[t]="initial")}export{e as addComponentPropertyResets};
@@ -1 +1 @@
1
- import{classifyIconSpriteValue as D}from"./intent-values.js";import{traverseToClosest as L}from"./utilities.js";import{subscribeToRootEvent as P}from"./root-event-subscription.js";const E="data-esp-adopted-icons",A="http://www.w3.org/2000/svg",k=new Set;function ee(){k.clear()}function N(e,t){k.has(e)||(k.add(e),console.warn(t))}const v=new Map,g=new WeakMap;function V(e,t){const n=g.get(t);if(n===e)return;n&&C(n,t),g.set(t,e);let o=v.get(e);if(!o){const s=new Set,c=new MutationObserver(a=>{if(a.some(f=>f.target===e||e.contains(f.target)||[...f.removedNodes].some(i=>i===e||i.contains(e))||[...f.addedNodes].some(i=>i===e||i.contains(e))))for(const f of s)f.requestUpdate()});c.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0});const u=e.ownerDocument?.documentElement;u&&c.observe(u,{childList:!0,subtree:!0}),o={hosts:s,observer:c},v.set(e,o)}o.hosts.add(t)}function C(e,t){const n=v.get(e);n&&(n.hosts.delete(t),n.hosts.size===0&&(n.observer.disconnect(),v.delete(e)))}function $(e){const t=g.get(e);t&&(C(t,e),g.delete(e)),U(e)}const T=new WeakMap,w=new WeakMap;function z(e,t,n){const o=w.get(n);o&&(o.document!==e||o.spriteId!==t)&&U(n);let s=T.get(e);s||(s=new Map,T.set(e,s));let c=s.get(t);if(!c){const u=new Set,a=new MutationObserver(()=>{if(e.getElementById(t)){a.disconnect(),s.delete(t);for(const h of u)w.delete(h),h.requestUpdate()}});a.observe(e.documentElement,{childList:!0,subtree:!0}),c={hosts:u,observer:a},s.set(t,c)}c.hosts.add(n),w.set(n,{document:e,spriteId:t})}function U(e){const t=w.get(e);if(!t)return;w.delete(e);const n=T.get(t.document),o=n?.get(t.spriteId);o&&(o.hosts.delete(e),o.hosts.size===0&&(o.observer.disconnect(),n.delete(t.spriteId)))}function B(e,t,n){if(!t)return;const o=D(e?e.iconSpriteUrl:null);let s=t.querySelector(`svg[${E}]`);if(o.kind!=="document"){s?.remove(),n&&$(n);return}const c=new Set;for(const i of t.querySelectorAll("use")){if(s&&s.contains(i))continue;const l=x(i);l&&c.add(l)}if(c.size===0&&!s)return;const u=e?.ownerDocument??document,a=u.getElementById(o.spriteId);if(!a){if(N(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}" but no element with that id is in the document. Inline the sprite before setting icon-sprite-url (or set it again after), and icons will render.`),s?.remove(),n){const i=g.get(n);i&&(C(i,n),g.delete(n)),z(u,o.spriteId,n)}return}if(n&&U(n),a.namespaceURI!==A||a.localName!=="svg"){N(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}", but that element is a <${a.localName}>, not an inline SVG sprite. Icons stay empty until the id names an <svg> containing <symbol>s.`),s?.remove(),n&&$(n);return}n&&V(a,n);{const i=new Set,l=[...c];for(;l.length>0;){const r=l.pop();if(i.has(r))continue;i.add(r);const d=M(a,r);if(d)for(const m of Z(d))i.has(m)||(c.add(m),l.push(m))}}s&&s.getAttribute(E)!==o.spriteId&&(s.remove(),s=null);const h=new Map,f=i=>{const l=M(a,i);return l?{clone:K(l,a,o.spriteId,h)?l.cloneNode(!0):null,source:l}:{clone:null,source:null}};if(s){for(const i of[...s.children]){const l=i.getAttribute("id")??"",{clone:r,source:d}=c.has(l)?f(l):{clone:null,source:null};!r||!d?i.remove():i.isEqualNode(d)||s.replaceChild(r,i)}s.children.length===0&&c.size===0&&(s.remove(),s=null)}for(const i of c){if(s?.querySelector(`#${R(i)}`))continue;const{clone:l}=f(i);if(l){if(!s){s=t.ownerDocument.createElementNS(A,"svg"),s.setAttribute(E,o.spriteId),s.setAttribute("aria-hidden","true");const r=s.style;r.position="absolute",r.width="0",r.height="0",r.overflow="hidden",t.appendChild(s)}s.appendChild(l)}}}const O="http://www.w3.org/1999/xlink",F=new Set(["a","animate","animatemotion","animatetransform","discard","foreignobject","script","set","style"]),H=["href","xlink:href"],G=/url\(/giu,j=/url\(\s*(?:"#([^"\\]*)"|'#([^'\\]*)'|#([^\s)"'\\]*))\s*\)/giu;function I(e){let t=!1;const n=e.replace(/(%[0-9A-Fa-f]{2})+/gu,o=>{try{return decodeURIComponent(o)}catch{return t=!0,o}});return t?null:n}function _(e){const t=[...e.matchAll(G)].length,n=[];for(const o of e.matchAll(j)){const s=o[1]??o[2]??o[3]??"";if(s.length===0)continue;const c=I(s);c!==null&&n.push(c)}return{ids:n,ok:n.length===t}}function x(e){const t=W(e);return t===null?null:I(t)}function W(e){if(e.localName!=="use")return null;const t=e.getAttribute("href")??e.getAttribute("xlink:href")??e.getAttributeNS(O,"href");if(!t)return null;const n=t.trim();return n.startsWith("#")&&n.length>1?n.slice(1):null}function K(e,t,n,o){const s=o.get(e);if(s!==void 0)return s;const c=new Map,u=[],a=new Map,h=r=>(a.has(r)||a.set(r,M(t,r)),a.get(r)??null),f=[e];for(;f.length>0;){const r=f.pop();if(c.has(r))continue;const d=o.get(r);if(d!==void 0){c.set(r,{dependencies:[],localOk:d,missing:[]}),u.push(r);continue}const m=X(r,n),b=[],S=[];for(const q of m.dependencyIds){const y=h(q);y?(b.push(y),f.push(y)):S.push(q)}c.set(r,{dependencies:b,localOk:m.ok,missing:S}),u.push(r)}const i=new Set;for(const r of u){const d=c.get(r);(!d.localOk||d.missing.length>0)&&i.add(r)}let l=!0;for(;l;){l=!1;for(const r of u)i.has(r)||c.get(r).dependencies.some(d=>i.has(d))&&(i.add(r),l=!0)}for(const r of u){const d=c.get(r),m=!i.has(r);if(!m&&d.localOk){const b=d.missing[0]??d.dependencies.find(S=>i.has(S))?.getAttribute("id")??"?";p(r,n,d.missing.length>0?`composes or paints through #${b}, which is not in the sprite`:`composes or paints through the refused member #${b}`)}o.set(r,m)}return o.get(e)}function X(e,t){const n=[],o=[e,...e.querySelectorAll("*")];for(const s of o){if(s.namespaceURI!==A)return p(e,t,`contains the non-SVG element <${s.localName}>`),{dependencyIds:n,ok:!1};if(F.has(s.localName.toLowerCase()))return p(e,t,`contains <${s.localName}>`),{dependencyIds:n,ok:!1};let c=s.getAttributeNS(O,"href")!==null;for(const h of s.getAttributeNames()){const f=h.toLowerCase();if(f.startsWith("on"))return p(e,t,`carries the event-handler attribute ${h}`),{dependencyIds:n,ok:!1};if(H.includes(f)&&(c=!0),f==="src")return p(e,t,"carries a src attribute"),{dependencyIds:n,ok:!1};if(f==="style")return p(e,t,"carries an inline style attribute \u2014 use presentation attributes"),{dependencyIds:n,ok:!1};const i=s.getAttribute(h)??"";if(i.includes("\\"))return p(e,t,`carries a CSS escape sequence in ${h}`),{dependencyIds:n,ok:!1};const l=_(i);if(!l.ok)return p(e,t,`carries an unparseable or external url() reference in ${h}`),{dependencyIds:n,ok:!1};n.push(...l.ids)}const u=W(s),a=u===null?null:I(u);if(u!==null&&a===null)return p(e,t,`composes <use href="#${u}">, an undecodable fragment the browser resolves to nothing`),{dependencyIds:n,ok:!1};if(c&&a===null)return p(e,t,"carries an href outside a local-fragment <use> reference"),{dependencyIds:n,ok:!1};a!==null&&n.push(a)}return{dependencyIds:n,ok:!0}}function p(e,t,n){const o=e.getAttribute("id")??"(unnamed)";N(`${t}#${o}`,`Espalier icons: symbol "${o}" in "#${t}" ${n} and was not adopted \u2014 sprite symbols must be passive SVG (shapes, paths, local <use> composition).`)}function M(e,t){if(!t)return null;const o=e.querySelector(`symbol#${R(t)}`)??e.querySelector(`#${R(t)}`);return o&&o.namespaceURI===A?o:null}function Z(e){const t=new Set,n=[e,...e.querySelectorAll("*")];for(const o of n){const s=x(o);s&&t.add(s);for(const c of o.getAttributeNames())for(const u of _(o.getAttribute(c)??"").ids)t.add(u)}return t}function R(e){const t=globalThis.CSS?.escape;return t?t(e):e.replace(/[^A-Za-z0-9_-]/gu,"\\$&")}class te{constructor(t,n){this.host=t,this.options=n,this.root=null,this.unsubscribe=null,t.addController(this)}hostConnected(){this.root=L(this.host,"esp-root"),this.options.reactToSpriteChanges&&this.root&&(this.unsubscribe=P(this.root,"icon-sprite-url-changed",()=>{this.host.requestUpdate()}))}hostDisconnected(){this.unsubscribe?.(),this.unsubscribe=null,this.root=null,$(this.host)}hostUpdated(){this.root??=L(this.host,"esp-root"),B(this.root,this.host.shadowRoot,this.host)}}export{te as DocumentSpriteController,B as adoptDocumentSpriteSymbols,I as decodeFragmentId,ee as resetWarnedMissingSprites};
1
+ import{classifyIconSpriteValue as W}from"./intent-values.js";import{GoverningRootObserver as D}from"./governing-root.js";const E="data-esp-adopted-icons",A="http://www.w3.org/2000/svg",N=new Set;function Q(){N.clear()}function C(e,t){N.has(e)||(N.add(e),console.warn(t))}const y=new Map,g=new WeakMap;function P(e,t){const n=g.get(t);if(n===e)return;n&&$(n,t),g.set(t,e);let o=y.get(e);if(!o){const s=new Set,c=new MutationObserver(a=>{if(a.some(f=>f.target===e||e.contains(f.target)||[...f.removedNodes].some(i=>i===e||i.contains(e))||[...f.addedNodes].some(i=>i===e||i.contains(e))))for(const f of s)f.requestUpdate()});c.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0});const u=e.ownerDocument?.documentElement;u&&c.observe(u,{childList:!0,subtree:!0}),o={hosts:s,observer:c},y.set(e,o)}o.hosts.add(t)}function $(e,t){const n=y.get(e);n&&(n.hosts.delete(t),n.hosts.size===0&&(n.observer.disconnect(),y.delete(e)))}function w(e){const t=g.get(e);t&&($(t,e),g.delete(e)),U(e)}const O=new WeakMap,v=new WeakMap;function V(e,t,n){const o=v.get(n);o&&(o.document!==e||o.spriteId!==t)&&U(n);let s=O.get(e);s||(s=new Map,O.set(e,s));let c=s.get(t);if(!c){const u=new Set,a=new MutationObserver(()=>{if(e.getElementById(t)){a.disconnect(),s.delete(t);for(const p of u)v.delete(p),p.requestUpdate()}});a.observe(e.documentElement,{childList:!0,subtree:!0}),c={hosts:u,observer:a},s.set(t,c)}c.hosts.add(n),v.set(n,{document:e,spriteId:t})}function U(e){const t=v.get(e);if(!t)return;v.delete(e);const n=O.get(t.document),o=n?.get(t.spriteId);o&&(o.hosts.delete(e),o.hosts.size===0&&(o.observer.disconnect(),n.delete(t.spriteId)))}function z(e,t,n){if(!t)return;const o=W(e?e.iconSpriteUrl:null);let s=t.querySelector(`svg[${E}]`);if(o.kind!=="document"){s?.remove(),n&&w(n);return}const c=new Set;for(const i of t.querySelectorAll("use")){if(s&&s.contains(i))continue;const l=_(i);l&&c.add(l)}if(c.size===0&&!s){n&&w(n);return}const u=e?.ownerDocument??document,a=u.getElementById(o.spriteId);if(!a){if(C(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}" but no element with that id is in the document. Inline the sprite before setting icon-sprite-url (or set it again after), and icons will render.`),s?.remove(),n){const i=g.get(n);i&&($(i,n),g.delete(n)),V(u,o.spriteId,n)}return}if(n&&U(n),a.namespaceURI!==A||a.localName!=="svg"){C(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}", but that element is a <${a.localName}>, not an inline SVG sprite. Icons stay empty until the id names an <svg> containing <symbol>s.`),s?.remove(),n&&w(n);return}n&&P(a,n);{const i=new Set,l=[...c];for(;l.length>0;){const r=l.pop();if(i.has(r))continue;i.add(r);const d=M(a,r);if(d)for(const m of X(d))i.has(m)||(c.add(m),l.push(m))}}s&&s.getAttribute(E)!==o.spriteId&&(s.remove(),s=null);const p=new Map,f=i=>{const l=M(a,i);return l?{clone:j(l,a,o.spriteId,p)?l.cloneNode(!0):null,source:l}:{clone:null,source:null}};if(s){for(const i of[...s.children]){const l=i.getAttribute("id")??"",{clone:r,source:d}=c.has(l)?f(l):{clone:null,source:null};!r||!d?i.remove():i.isEqualNode(d)||s.replaceChild(r,i)}s.children.length===0&&c.size===0&&(s.remove(),s=null)}for(const i of c){if(s?.querySelector(`#${R(i)}`))continue;const{clone:l}=f(i);if(l){if(!s){s=t.ownerDocument.createElementNS(A,"svg"),s.setAttribute(E,o.spriteId),s.setAttribute("aria-hidden","true");const r=s.style;r.position="absolute",r.width="0",r.height="0",r.overflow="hidden",t.appendChild(s)}s.appendChild(l)}}}const q="http://www.w3.org/1999/xlink",B=new Set(["a","animate","animatemotion","animatetransform","discard","foreignobject","script","set","style"]),F=["href","xlink:href"],G=/url\(/giu,H=/url\(\s*(?:"#([^"\\]*)"|'#([^'\\]*)'|#([^\s)"'\\]*))\s*\)/giu;function I(e){let t=!1;const n=e.replace(/(%[0-9A-Fa-f]{2})+/gu,o=>{try{return decodeURIComponent(o)}catch{return t=!0,o}});return t?null:n}function L(e){const t=[...e.matchAll(G)].length,n=[];for(const o of e.matchAll(H)){const s=o[1]??o[2]??o[3]??"";if(s.length===0)continue;const c=I(s);c!==null&&n.push(c)}return{ids:n,ok:n.length===t}}function _(e){const t=x(e);return t===null?null:I(t)}function x(e){if(e.localName!=="use")return null;const t=e.getAttribute("href")??e.getAttribute("xlink:href")??e.getAttributeNS(q,"href");if(!t)return null;const n=t.trim();return n.startsWith("#")&&n.length>1?n.slice(1):null}function j(e,t,n,o){const s=o.get(e);if(s!==void 0)return s;const c=new Map,u=[],a=new Map,p=r=>(a.has(r)||a.set(r,M(t,r)),a.get(r)??null),f=[e];for(;f.length>0;){const r=f.pop();if(c.has(r))continue;const d=o.get(r);if(d!==void 0){c.set(r,{dependencies:[],localOk:d,missing:[]}),u.push(r);continue}const m=K(r,n),b=[],S=[];for(const T of m.dependencyIds){const k=p(T);k?(b.push(k),f.push(k)):S.push(T)}c.set(r,{dependencies:b,localOk:m.ok,missing:S}),u.push(r)}const i=new Set;for(const r of u){const d=c.get(r);(!d.localOk||d.missing.length>0)&&i.add(r)}let l=!0;for(;l;){l=!1;for(const r of u)i.has(r)||c.get(r).dependencies.some(d=>i.has(d))&&(i.add(r),l=!0)}for(const r of u){const d=c.get(r),m=!i.has(r);if(!m&&d.localOk){const b=d.missing[0]??d.dependencies.find(S=>i.has(S))?.getAttribute("id")??"?";h(r,n,d.missing.length>0?`composes or paints through #${b}, which is not in the sprite`:`composes or paints through the refused member #${b}`)}o.set(r,m)}return o.get(e)}function K(e,t){const n=[],o=[e,...e.querySelectorAll("*")];for(const s of o){if(s.namespaceURI!==A)return h(e,t,`contains the non-SVG element <${s.localName}>`),{dependencyIds:n,ok:!1};if(B.has(s.localName.toLowerCase()))return h(e,t,`contains <${s.localName}>`),{dependencyIds:n,ok:!1};let c=s.getAttributeNS(q,"href")!==null;for(const p of s.getAttributeNames()){const f=p.toLowerCase();if(f.startsWith("on"))return h(e,t,`carries the event-handler attribute ${p}`),{dependencyIds:n,ok:!1};if(F.includes(f)&&(c=!0),f==="src")return h(e,t,"carries a src attribute"),{dependencyIds:n,ok:!1};if(f==="style")return h(e,t,"carries an inline style attribute \u2014 use presentation attributes"),{dependencyIds:n,ok:!1};const i=s.getAttribute(p)??"";if(i.includes("\\"))return h(e,t,`carries a CSS escape sequence in ${p}`),{dependencyIds:n,ok:!1};const l=L(i);if(!l.ok)return h(e,t,`carries an unparseable or external url() reference in ${p}`),{dependencyIds:n,ok:!1};n.push(...l.ids)}const u=x(s),a=u===null?null:I(u);if(u!==null&&a===null)return h(e,t,`composes <use href="#${u}">, an undecodable fragment the browser resolves to nothing`),{dependencyIds:n,ok:!1};if(c&&a===null)return h(e,t,"carries an href outside a local-fragment <use> reference"),{dependencyIds:n,ok:!1};a!==null&&n.push(a)}return{dependencyIds:n,ok:!0}}function h(e,t,n){const o=e.getAttribute("id")??"(unnamed)";C(`${t}#${o}`,`Espalier icons: symbol "${o}" in "#${t}" ${n} and was not adopted \u2014 sprite symbols must be passive SVG (shapes, paths, local <use> composition).`)}function M(e,t){if(!t)return null;const o=e.querySelector(`symbol#${R(t)}`)??e.querySelector(`#${R(t)}`);return o&&o.namespaceURI===A?o:null}function X(e){const t=new Set,n=[e,...e.querySelectorAll("*")];for(const o of n){const s=_(o);s&&t.add(s);for(const c of o.getAttributeNames())for(const u of L(o.getAttribute(c)??"").ids)t.add(u)}return t}function R(e){const t=globalThis.CSS?.escape;return t?t(e):e.replace(/[^A-Za-z0-9_-]/gu,"\\$&")}class Y{constructor(t,n){this.host=t,this.sharedRootObserver=n,this.rootObserver=n??new D(t,(o,s)=>{o!==s&&(w(t),t.requestUpdate())}),n||this.rootObserver.subscribe("icon-sprite-url-changed",()=>t.requestUpdate()),t.addController(this)}hostConnected(){this.sharedRootObserver||this.rootObserver.connect()}hostDisconnected(){this.sharedRootObserver||this.rootObserver.disconnect(),w(this.host)}hostUpdated(){const t=this.rootObserver.refresh();z(t,this.host.shadowRoot,this.host)}}export{Y as DocumentSpriteController,z as adoptDocumentSpriteSymbols,I as decodeFragmentId,Q as resetWarnedMissingSprites};
@@ -1,5 +1,6 @@
1
1
  import { LitElement, type PropertyValues } from "lit";
2
2
  import { type SeedColorRoot } from "./bus-events.js";
3
+ import { type EspalierRoot } from "../root/esp-root.js";
3
4
  import { type EspalierIntentVariant } from "./intent-values.js";
4
5
  /**
5
6
  * Shared base class for Espalier elements.
@@ -69,6 +70,8 @@ export declare class EspalierElementBase extends LitElement implements SeedColor
69
70
  connectedCallback(): void;
70
71
  disconnectedCallback(): void;
71
72
  protected firstUpdated(_changedProperties: PropertyValues): void;
73
+ /** Called when this host gains, loses or changes its nearest root. */
74
+ protected governingRootChanged(_root: EspalierRoot | null): void;
72
75
  constructor();
73
76
  /**
74
77
  * Traverse up the DOM tree to find the closest element that