@autumnsgrove/groveengine 0.4.0 → 0.4.1
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.
|
@@ -76,13 +76,16 @@
|
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Calculate positions based on anchor locations, with collision detection
|
|
79
|
+
* Uses getBoundingClientRect() for accurate positioning regardless of offset parent chains
|
|
79
80
|
*/
|
|
80
81
|
async function updatePositions() {
|
|
81
82
|
if (!gutterElement || !contentBodyElement) return;
|
|
82
83
|
|
|
83
84
|
await tick(); // Wait for DOM to update
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
// Use getBoundingClientRect for accurate relative positioning
|
|
87
|
+
// This works regardless of offset parent chains and CSS transforms
|
|
88
|
+
const gutterRect = gutterElement.getBoundingClientRect();
|
|
86
89
|
|
|
87
90
|
let lastBottom = 0; // Track the bottom edge of the last positioned item
|
|
88
91
|
const newOverflowingAnchors = [];
|
|
@@ -94,20 +97,24 @@
|
|
|
94
97
|
if (!el && import.meta.env.DEV) {
|
|
95
98
|
console.warn(`Anchor element not found for: ${anchor}`);
|
|
96
99
|
}
|
|
100
|
+
// Use getBoundingClientRect for consistent positioning
|
|
101
|
+
const elRect = el ? el.getBoundingClientRect() : null;
|
|
97
102
|
return {
|
|
98
103
|
anchor,
|
|
99
104
|
key: getKey(anchor),
|
|
100
105
|
element: el,
|
|
101
|
-
|
|
106
|
+
elementRect: elRect,
|
|
107
|
+
top: elRect ? elRect.top : Infinity
|
|
102
108
|
};
|
|
103
109
|
}).sort((a, b) => a.top - b.top);
|
|
104
110
|
|
|
105
|
-
anchorPositions.forEach(({ anchor, key, element }) => {
|
|
111
|
+
anchorPositions.forEach(({ anchor, key, element, elementRect }) => {
|
|
106
112
|
const groupEl = anchorGroupElements[key];
|
|
107
113
|
|
|
108
|
-
if (element && groupEl) {
|
|
109
|
-
//
|
|
110
|
-
|
|
114
|
+
if (element && elementRect && groupEl) {
|
|
115
|
+
// Calculate position relative to the gutter element's top
|
|
116
|
+
// This accounts for any content above the content-body (headers, etc.)
|
|
117
|
+
let desiredTop = elementRect.top - gutterRect.top;
|
|
111
118
|
|
|
112
119
|
// Get the height of this gutter group
|
|
113
120
|
const groupHeight = groupEl.offsetHeight;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autumnsgrove/groveengine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Multi-tenant blog engine for Grove Platform. Features gutter annotations, markdown editing, magic code auth, and Cloudflare Workers deployment.",
|
|
5
5
|
"author": "AutumnsGrove",
|
|
6
6
|
"license": "MIT",
|
|
@@ -129,28 +129,10 @@
|
|
|
129
129
|
"dist",
|
|
130
130
|
"!dist/**/*.test.*"
|
|
131
131
|
],
|
|
132
|
-
"scripts": {
|
|
133
|
-
"dev": "vite dev",
|
|
134
|
-
"dev:wrangler": "wrangler pages dev -- vite dev",
|
|
135
|
-
"build": "vite build",
|
|
136
|
-
"build:package": "svelte-kit sync && svelte-package -o dist",
|
|
137
|
-
"package": "svelte-kit sync && svelte-package -o dist",
|
|
138
|
-
"prepublishOnly": "npm run package",
|
|
139
|
-
"preview": "vite preview",
|
|
140
|
-
"audit": "npm audit --audit-level=moderate",
|
|
141
|
-
"audit:fix": "npm audit fix",
|
|
142
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
143
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
144
|
-
"test": "vitest",
|
|
145
|
-
"test:ui": "vitest --ui",
|
|
146
|
-
"test:run": "vitest run",
|
|
147
|
-
"test:security": "vitest run tests/security",
|
|
148
|
-
"test:coverage": "vitest run --coverage",
|
|
149
|
-
"test:watch": "vitest watch"
|
|
150
|
-
},
|
|
151
132
|
"peerDependencies": {
|
|
152
133
|
"@sveltejs/kit": "^2.0.0",
|
|
153
134
|
"svelte": "^5.0.0",
|
|
135
|
+
"svelte-sonner": "^1.0.0",
|
|
154
136
|
"tailwindcss": "^3.4.0"
|
|
155
137
|
},
|
|
156
138
|
"devDependencies": {
|
|
@@ -184,8 +166,24 @@
|
|
|
184
166
|
"gray-matter": "^4.0.3",
|
|
185
167
|
"lucide-svelte": "^0.554.0",
|
|
186
168
|
"marked": "^17.0.1",
|
|
187
|
-
"sonner": "^2.0.7",
|
|
188
|
-
"svelte-sonner": "^1.0.7",
|
|
189
169
|
"tailwind-merge": "^3.4.0"
|
|
170
|
+
},
|
|
171
|
+
"scripts": {
|
|
172
|
+
"dev": "vite dev",
|
|
173
|
+
"dev:wrangler": "wrangler pages dev -- vite dev",
|
|
174
|
+
"build": "vite build",
|
|
175
|
+
"build:package": "svelte-kit sync && svelte-package -o dist",
|
|
176
|
+
"package": "svelte-kit sync && svelte-package -o dist",
|
|
177
|
+
"preview": "vite preview",
|
|
178
|
+
"audit": "npm audit --audit-level=moderate",
|
|
179
|
+
"audit:fix": "npm audit fix",
|
|
180
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
181
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
182
|
+
"test": "vitest",
|
|
183
|
+
"test:ui": "vitest --ui",
|
|
184
|
+
"test:run": "vitest run",
|
|
185
|
+
"test:security": "vitest run tests/security",
|
|
186
|
+
"test:coverage": "vitest run --coverage",
|
|
187
|
+
"test:watch": "vitest watch"
|
|
190
188
|
}
|
|
191
|
-
}
|
|
189
|
+
}
|