@threadlabs/looma 0.51.3 → 0.51.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/catalog.json CHANGED
@@ -533,7 +533,7 @@
533
533
  ],
534
534
  "schemaVersion": 1,
535
535
  "package": "@threadlabs/looma",
536
- "version": "0.51.3",
536
+ "version": "0.51.5",
537
537
  "groups": [
538
538
  {
539
539
  "id": "layout",
@@ -3334,6 +3334,9 @@
3334
3334
  background: var(--ui-nav-hover-surface);
3335
3335
  color: var(--ui-text-primary);
3336
3336
  }
3337
+ :scope:where([data-component~="ui-disclosure"])[data-ui-disclosure-state~="variant=navigation"][data-ui-disclosure-state~="internalOpen"] .panel-inner {
3338
+ padding-block: 0 !important;
3339
+ }
3337
3340
  :scope:where([data-component~="ui-disclosure"])[data-ui-disclosure-state~="variant=navigation"] :is(.leading, .indicator) {
3338
3341
  inline-size: var(--ui-nav-icon-size);
3339
3342
  font-size: var(--ui-nav-icon-size);
package/editor/index.js CHANGED
@@ -12077,12 +12077,47 @@ function connect$2(host) {
12077
12077
  host.state.internalOpen = Boolean(external);
12078
12078
  let groupName = "";
12079
12079
  let disposed = false;
12080
+ let motionFrame = 0;
12081
+ let takeoverMotion;
12082
+ const view = document.defaultView;
12083
+ const reducedMotion = view?.matchMedia?.("(prefers-reduced-motion: reduce)");
12084
+ const stopTakeoverMotion = () => {
12085
+ view?.cancelAnimationFrame(motionFrame);
12086
+ motionFrame = 0;
12087
+ takeoverMotion?.cancel();
12088
+ };
12089
+ const onMotionPreferenceChange = () => {
12090
+ if (reducedMotion.matches) stopTakeoverMotion();
12091
+ };
12092
+ reducedMotion?.addEventListener("change", onMotionPreferenceChange);
12093
+ const animateFillTakeover = () => {
12094
+ if (motionFrame || !host.props.fill.value || !view || !host.element.animate) return;
12095
+ const previousTop = host.refs.heading.getBoundingClientRect().top;
12096
+ takeoverMotion?.cancel();
12097
+ if (reducedMotion?.matches) return;
12098
+ motionFrame = view.requestAnimationFrame(() => {
12099
+ motionFrame = 0;
12100
+ if (disposed || !host.element.isConnected) return;
12101
+ const delta = previousTop - host.refs.heading.getBoundingClientRect().top;
12102
+ if (Math.abs(delta) < 1) return;
12103
+ const style = view.getComputedStyle(host.element);
12104
+ const duration = style.transitionDuration.split(",")[0].trim();
12105
+ const milliseconds = parseFloat(duration) * (duration.endsWith("ms") ? 1 : 1e3);
12106
+ if (!(milliseconds > 0)) return;
12107
+ takeoverMotion = host.element.animate([{ translate: `0 ${delta}px` }, { translate: "0 0" }], {
12108
+ duration: milliseconds,
12109
+ easing: style.transitionTimingFunction,
12110
+ fill: "none"
12111
+ });
12112
+ });
12113
+ };
12080
12114
  const member = {
12081
12115
  isOpen: () => Boolean(host.state.internalOpen),
12082
12116
  required: () => Boolean(host.props.requiredOpen.value),
12083
12117
  disabled: () => Boolean(host.props.disabled.value),
12084
12118
  open() {
12085
12119
  if (disposed || host.state.internalOpen) return;
12120
+ animateFillTakeover();
12086
12121
  host.state.internalOpen = true;
12087
12122
  syncGroup("programmatic", "programmatic");
12088
12123
  host.dispatch("open", {
@@ -12093,6 +12128,7 @@ function connect$2(host) {
12093
12128
  },
12094
12129
  close(reason, how) {
12095
12130
  if (!host.state.internalOpen) return;
12131
+ animateFillTakeover();
12096
12132
  host.state.internalOpen = false;
12097
12133
  host.dispatch("close", {
12098
12134
  open: false,
@@ -12121,7 +12157,10 @@ function connect$2(host) {
12121
12157
  const stop = host.effect(() => {
12122
12158
  if (host.props.open.value !== external) {
12123
12159
  external = host.props.open.value;
12124
- if (external || mayClose()) host.state.internalOpen = Boolean(external);
12160
+ if (external || mayClose()) {
12161
+ animateFillTakeover();
12162
+ host.state.internalOpen = Boolean(external);
12163
+ }
12125
12164
  }
12126
12165
  const level = Number(host.props.headingLevel.value);
12127
12166
  host.state.headingRole = Number.isInteger(level) && level >= 2 && level <= 6 ? "heading" : null;
@@ -12135,6 +12174,7 @@ function connect$2(host) {
12135
12174
  const open = !host.state.internalOpen;
12136
12175
  if (!open && !mayClose()) return;
12137
12176
  const how = trigger();
12177
+ animateFillTakeover();
12138
12178
  host.state.internalOpen = open;
12139
12179
  if (open) syncGroup("action", how);
12140
12180
  host.dispatch(open ? "open" : "close", {
@@ -12145,6 +12185,7 @@ function connect$2(host) {
12145
12185
  };
12146
12186
  const onBeforematch = () => queueMicrotask(() => {
12147
12187
  if (disposed || host.state.internalOpen) return;
12188
+ animateFillTakeover();
12148
12189
  host.state.internalOpen = true;
12149
12190
  syncGroup("programmatic", "programmatic");
12150
12191
  host.dispatch("open", {
@@ -12162,6 +12203,8 @@ function connect$2(host) {
12162
12203
  measureHeading();
12163
12204
  return () => {
12164
12205
  disposed = true;
12206
+ stopTakeoverMotion();
12207
+ reducedMotion?.removeEventListener("change", onMotionPreferenceChange);
12165
12208
  headingObserver?.disconnect();
12166
12209
  stop();
12167
12210
  stopTracking();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.51.3",
3
+ "version": "0.51.5",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -167,6 +167,9 @@
167
167
  background: var(--ui-nav-hover-surface);
168
168
  color: var(--ui-text-primary);
169
169
  }
170
+ :scope:where([data-component~="ui-disclosure"])[data-ui-disclosure-state~="variant=navigation"][data-ui-disclosure-state~="internalOpen"] .panel-inner {
171
+ padding-block: 0 !important;
172
+ }
170
173
  :scope:where([data-component~="ui-disclosure"])[data-ui-disclosure-state~="variant=navigation"] :is(.leading, .indicator) {
171
174
  inline-size: var(--ui-nav-icon-size);
172
175
  font-size: var(--ui-nav-icon-size);
package/theme-system.css CHANGED
@@ -36,6 +36,10 @@
36
36
  }
37
37
 
38
38
  :where(:root, [data-theme], [data-contrast]) {
39
+ /* Reading content stays lighter than surrounding application chrome, even when
40
+ a theme uses the same canvas and raised surface. Both follow the canvas hue. */
41
+ --ui-surface-content: color-mix(in oklab, var(--ui-surface) 92%, white);
42
+ --ui-surface-chrome: color-mix(in oklab, var(--ui-surface) 94%, black);
39
43
  /* Controls use a ratio. Spacing uses an independent curve, so increasing the size
40
44
  contrast cannot unexpectedly turn linear spacing into quadratic spacing. */
41
45
  --ui-control-size: calc(var(--_ui-root-font-unit) * var(--ui-control-roominess));
package/tokens.css CHANGED
@@ -519,3 +519,12 @@
519
519
  }
520
520
 
521
521
  }
522
+
523
+ @layer tokens {
524
+ :where(:root, [data-theme], [data-contrast]) {
525
+ /* Reading content stays lighter than surrounding application chrome, even when
526
+ a theme uses the same canvas and raised surface. Both follow the canvas hue. */
527
+ --ui-surface-content: color-mix(in oklab, var(--ui-surface) 92%, white);
528
+ --ui-surface-chrome: color-mix(in oklab, var(--ui-surface) 94%, black);
529
+ }
530
+ }