@santi020k/lumen-astro 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -103,12 +103,15 @@ The stylesheet defaults `--ui-font` to `"Montserrat", "Avenir Next", "Segoe UI",
103
103
  It declares the family stack but does not bundle or load font files. Load Montserrat once through
104
104
  your preferred delivery path, or override `--ui-font` in application CSS.
105
105
 
106
- With Tailwind, keep the Lumen import in the same shared CSS entry:
106
+ With Tailwind CSS v4, keep the Lumen imports in the same shared CSS entry. The optional
107
+ `tailwind.css` bridge (Lumen 4.3+) maps semantic colors to utilities such as `bg-surface` and
108
+ `text-ink`, including nested themes. See the [Tailwind guide](https://lumen.santi020k.com/docs/web/tailwind):
107
109
 
108
110
  ```css
109
111
  @import "@santi020k/lumen-astro/layers.css";
110
112
  @import "tailwindcss";
111
113
  @import "@santi020k/lumen-astro/styles.css";
114
+ @import "@santi020k/lumen-astro/tailwind.css";
112
115
  ```
113
116
 
114
117
  ```astro
@@ -324,6 +327,9 @@ import { Button, Icon } from '@santi020k/lumen-astro'
324
327
 
325
328
  `Anchor` accepts heading `depth`, `index`, and `description` metadata plus an `activationOffset`.
326
329
  Its current link stays synchronized on click and scroll, including at the end of the document.
330
+ The activation line uses the greater of `activationOffset` and the root `scroll-padding-top` plus
331
+ each heading's `scroll-margin-top`, with a one CSS pixel rounding tolerance. Styles are read live so
332
+ text resizing and responsive headers keep native fragment links and the current section aligned.
327
333
  `ScrollProgress` derives reading progress from the document and pins the indicator to the top or
328
334
  bottom viewport edge. Both use the single root `UIPrimitives` runtime.
329
335
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@santi020k/lumen-astro",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,7 +9,9 @@
9
9
  "sideEffects": [
10
10
  "./styles/lumen.css",
11
11
  "./styles/critical.css",
12
- "./styles.css"
12
+ "./styles.css",
13
+ "./styles/tailwind.css",
14
+ "./styles/layers.css"
13
15
  ],
14
16
  "types": "./index.ts",
15
17
  "exports": {
@@ -26,7 +28,8 @@
26
28
  "./layers.css": "./styles/layers.css",
27
29
  "./styles.css": "./styles/lumen.css",
28
30
  "./styles/critical.css": "./styles/critical.css",
29
- "./package.json": "./package.json"
31
+ "./package.json": "./package.json",
32
+ "./tailwind.css": "./styles/tailwind.css"
30
33
  },
31
34
  "files": [
32
35
  "bin",
@@ -43,8 +46,8 @@
43
46
  "lumen": "./bin/lumen.mjs"
44
47
  },
45
48
  "dependencies": {
46
- "@santi020k/lumen": "^4.1.0",
47
- "@santi020k/lumen-core": "^4.1.0",
49
+ "@santi020k/lumen": "^4.3.0",
50
+ "@santi020k/lumen-core": "^4.3.0",
48
51
  "uqr": "^0.1.3"
49
52
  },
50
53
  "devDependencies": {
@@ -1,11 +1,4 @@
1
- const decodeFragment = (fragment: string): string => {
2
- try {
3
- return decodeURIComponent(fragment)
4
- } catch {
5
- // A literal percent sign can still identify a section; isolate malformed escapes.
6
- return fragment
7
- }
8
- }
1
+ import { decodeLumenAnchorFragment, getLumenActiveAnchorIndex } from '@santi020k/lumen-core'
9
2
 
10
3
  interface AnchorDispatcher {
11
4
  callbacks: WeakMap<HTMLElement, () => void>
@@ -56,7 +49,7 @@ const initAnchors = (scope: ParentNode): void => {
56
49
 
57
50
  for (const link of links) {
58
51
  const fragment = link.getAttribute('href')?.slice(1) ?? ''
59
- const id = decodeFragment(fragment)
52
+ const id = decodeLumenAnchorFragment(fragment)
60
53
  const target = id ? ownerDocument.getElementById(id) : null
61
54
 
62
55
  if (target) {
@@ -66,6 +59,8 @@ const initAnchors = (scope: ParentNode): void => {
66
59
 
67
60
  if (!targets.length) continue
68
61
 
62
+ const headings = targets.map(({ target }) => target)
63
+
69
64
  const setActive = (active: HTMLAnchorElement): void => {
70
65
  for (const link of links) {
71
66
  const isActive = link === active
@@ -81,21 +76,8 @@ const initAnchors = (scope: ParentNode): void => {
81
76
  }
82
77
 
83
78
  const update = (): void => {
84
- const scrollingElement = ownerDocument.scrollingElement ?? ownerDocument.documentElement
85
- const maximum = scrollingElement.scrollHeight - scrollingElement.clientHeight
86
- const atEnd = maximum > 0 && scrollingElement.scrollTop >= maximum - 1
87
- const offset = Number(root.dataset.uiAnchorOffset) || 0
88
- let active = targets[0]?.link
89
-
90
- if (atEnd) {
91
- active = targets.at(-1)?.link
92
- } else {
93
- for (const item of targets) {
94
- if (item.target.getBoundingClientRect().top > offset) break
95
-
96
- active = item.link
97
- }
98
- }
79
+ const index = getLumenActiveAnchorIndex(headings, Number(root.dataset.uiAnchorOffset))
80
+ const active = targets[index]?.link
99
81
 
100
82
  if (active) setActive(active)
101
83
  }
@@ -837,6 +837,10 @@
837
837
  width: min(100%, 34rem);
838
838
  }
839
839
 
840
+ lumen-date-picker.ui-date-picker-field {
841
+ display: block;
842
+ }
843
+
840
844
  .ui-combobox > .ui-input {
841
845
  width: 100%;
842
846
  }
@@ -0,0 +1 @@
1
+ @import "@santi020k/lumen/tailwind.css";