Skip to content

Commit 079e228

Browse files
committed
2 parents 293ab96 + bacd19c commit 079e228

File tree

15 files changed

+705
-399
lines changed

15 files changed

+705
-399
lines changed

.github/workflows/build-preview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
name: Build Preview
1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
permissions:
2020
contents: write
2121
steps:
22-
- uses: actions/checkout@v5
22+
- uses: actions/checkout@v6
2323
with:
2424
fetch-depth: 0
2525

@@ -53,7 +53,7 @@ jobs:
5353
permissions:
5454
contents: write
5555
steps:
56-
- uses: actions/checkout@v5
56+
- uses: actions/checkout@v6
5757
with:
5858
fetch-depth: 0
5959
- name: Setup Node

.github/workflows/docker-build-push.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
echo "OWNER_LOWERCASE=${OWNER,,}" >> ${GITHUB_ENV}
2222
env:
2323
OWNER: "${{ github.repository_owner }}"
24-
- uses: actions/checkout@v5
24+
- uses: actions/checkout@v6
2525
with:
2626
fetch-depth: 1
2727
- name: Inject slug/short variables
28-
uses: rlespinasse/github-slug-action@v5.3.0
28+
uses: rlespinasse/github-slug-action@v5.4.0
2929
- name: Set up QEMU
3030
uses: docker/setup-qemu-action@v3
3131
- name: Set up Docker Buildx

package-lock.json

Lines changed: 371 additions & 321 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@
4242
"@tweenjs/tween.js": "^25.0.0",
4343
"ansi-truncate": "^1.4.0",
4444
"async-mutex": "^0.5.0",
45-
"chokidar": "^4.0.3",
45+
"chokidar": "^5.0.0",
4646
"cli-spinner": "^0.2.10",
4747
"d3": "^7.9.0",
4848
"esbuild-sass-plugin": "^3.3.1",
4949
"flexsearch": "^0.8.205",
5050
"github-slugger": "^2.0.0",
51-
"globby": "^15.0.0",
51+
"globby": "^16.0.0",
5252
"gray-matter": "^4.0.3",
5353
"hast-util-to-html": "^9.0.5",
5454
"hast-util-to-jsx-runtime": "^2.3.6",
5555
"hast-util-to-string": "^3.0.1",
5656
"is-absolute-url": "^5.0.0",
57-
"js-yaml": "^4.1.0",
57+
"js-yaml": "^4.1.1",
5858
"lightningcss": "^1.30.2",
5959
"mdast-util-find-and-replace": "^3.0.2",
60-
"mdast-util-to-hast": "^13.2.0",
60+
"mdast-util-to-hast": "^13.2.1",
6161
"mdast-util-to-string": "^4.0.0",
6262
"micromorph": "^0.4.5",
6363
"minimatch": "^10.1.1",
64-
"pixi.js": "^8.14.0",
65-
"preact": "^10.27.2",
64+
"pixi.js": "^8.14.3",
65+
"preact": "^10.28.0",
6666
"preact-render-to-string": "^6.6.3",
6767
"pretty-bytes": "^7.1.0",
6868
"pretty-time": "^1.1.0",
@@ -85,30 +85,30 @@
8585
"rfdc": "^1.4.1",
8686
"satori": "^0.18.3",
8787
"serve-handler": "^6.1.6",
88-
"sharp": "^0.34.4",
88+
"sharp": "^0.34.5",
8989
"shiki": "^1.26.2",
9090
"source-map-support": "^0.5.21",
9191
"to-vfile": "^8.0.0",
9292
"toml": "^3.0.0",
9393
"unified": "^11.0.5",
9494
"unist-util-visit": "^5.0.0",
9595
"vfile": "^6.0.3",
96-
"workerpool": "^10.0.0",
96+
"workerpool": "^10.0.1",
9797
"ws": "^8.18.3",
9898
"yargs": "^18.0.0"
9999
},
100100
"devDependencies": {
101101
"@types/d3": "^7.4.3",
102102
"@types/hast": "^3.0.4",
103103
"@types/js-yaml": "^4.0.9",
104-
"@types/node": "^24.10.0",
104+
"@types/node": "^24.10.1",
105105
"@types/pretty-time": "^1.1.5",
106106
"@types/source-map-support": "^0.5.10",
107107
"@types/ws": "^8.18.1",
108-
"@types/yargs": "^17.0.34",
109-
"esbuild": "^0.25.12",
110-
"prettier": "^3.6.2",
111-
"tsx": "^4.20.6",
108+
"@types/yargs": "^17.0.35",
109+
"esbuild": "^0.27.1",
110+
"prettier": "^3.7.4",
111+
"tsx": "^4.21.0",
112112
"typescript": "^5.9.3"
113113
}
114114
}

quartz/components/renderPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function renderPage(
294294
</body>
295295
{pageResources.js
296296
.filter((resource) => resource.loadTime === "afterDOMReady")
297-
.map((res) => JSResourceToScriptElement(res))}
297+
.map((res) => JSResourceToScriptElement(res, true))}
298298
</html>
299299
)
300300

quartz/components/scripts/mermaid.inline.ts

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,31 @@ class DiagramPanZoom {
2929
const mouseDownHandler = this.onMouseDown.bind(this)
3030
const mouseMoveHandler = this.onMouseMove.bind(this)
3131
const mouseUpHandler = this.onMouseUp.bind(this)
32+
33+
// Touch drag events
34+
const touchStartHandler = this.onTouchStart.bind(this)
35+
const touchMoveHandler = this.onTouchMove.bind(this)
36+
const touchEndHandler = this.onTouchEnd.bind(this)
37+
3238
const resizeHandler = this.resetTransform.bind(this)
3339

3440
this.container.addEventListener("mousedown", mouseDownHandler)
3541
document.addEventListener("mousemove", mouseMoveHandler)
3642
document.addEventListener("mouseup", mouseUpHandler)
43+
44+
this.container.addEventListener("touchstart", touchStartHandler, { passive: false })
45+
document.addEventListener("touchmove", touchMoveHandler, { passive: false })
46+
document.addEventListener("touchend", touchEndHandler)
47+
3748
window.addEventListener("resize", resizeHandler)
3849

3950
this.cleanups.push(
4051
() => this.container.removeEventListener("mousedown", mouseDownHandler),
4152
() => document.removeEventListener("mousemove", mouseMoveHandler),
4253
() => document.removeEventListener("mouseup", mouseUpHandler),
54+
() => this.container.removeEventListener("touchstart", touchStartHandler),
55+
() => document.removeEventListener("touchmove", touchMoveHandler),
56+
() => document.removeEventListener("touchend", touchEndHandler),
4357
() => window.removeEventListener("resize", resizeHandler),
4458
)
4559
}
@@ -99,6 +113,30 @@ class DiagramPanZoom {
99113
this.container.style.cursor = "grab"
100114
}
101115

116+
private onTouchStart(e: TouchEvent) {
117+
if (e.touches.length !== 1) return
118+
this.isDragging = true
119+
const touch = e.touches[0]
120+
this.startPan = { x: touch.clientX - this.currentPan.x, y: touch.clientY - this.currentPan.y }
121+
}
122+
123+
private onTouchMove(e: TouchEvent) {
124+
if (!this.isDragging || e.touches.length !== 1) return
125+
e.preventDefault() // Prevent scrolling
126+
127+
const touch = e.touches[0]
128+
this.currentPan = {
129+
x: touch.clientX - this.startPan.x,
130+
y: touch.clientY - this.startPan.y,
131+
}
132+
133+
this.updateTransform()
134+
}
135+
136+
private onTouchEnd() {
137+
this.isDragging = false
138+
}
139+
102140
private zoom(delta: number) {
103141
const newScale = Math.min(Math.max(this.scale + delta, this.MIN_SCALE), this.MAX_SCALE)
104142

@@ -120,11 +158,15 @@ class DiagramPanZoom {
120158
}
121159

122160
private resetTransform() {
123-
this.scale = 1
124161
const svg = this.content.querySelector("svg")!
162+
const rect = svg.getBoundingClientRect()
163+
const width = rect.width / this.scale
164+
const height = rect.height / this.scale
165+
166+
this.scale = 1
125167
this.currentPan = {
126-
x: svg.getBoundingClientRect().width / 2,
127-
y: svg.getBoundingClientRect().height / 2,
168+
x: (this.container.clientWidth - width) / 2,
169+
y: (this.container.clientHeight - height) / 2,
128170
}
129171
this.updateTransform()
130172
}

quartz/components/scripts/search.inline.ts

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,49 @@ interface Item {
1616
type SearchType = "basic" | "tags"
1717
let searchType: SearchType = "basic"
1818
let currentSearchTerm: string = ""
19-
const encoder = (str: string) => {
20-
return str
21-
.toLowerCase()
22-
.split(/\s+/)
23-
.filter((token) => token.length > 0)
19+
const encoder = (str: string): string[] => {
20+
const tokens: string[] = []
21+
let bufferStart = -1
22+
let bufferEnd = -1
23+
const lower = str.toLowerCase()
24+
25+
let i = 0
26+
for (const char of lower) {
27+
const code = char.codePointAt(0)!
28+
29+
const isCJK =
30+
(code >= 0x3040 && code <= 0x309f) ||
31+
(code >= 0x30a0 && code <= 0x30ff) ||
32+
(code >= 0x4e00 && code <= 0x9fff) ||
33+
(code >= 0xac00 && code <= 0xd7af) ||
34+
(code >= 0x20000 && code <= 0x2a6df)
35+
36+
const isWhitespace = code === 32 || code === 9 || code === 10 || code === 13
37+
38+
if (isCJK) {
39+
if (bufferStart !== -1) {
40+
tokens.push(lower.slice(bufferStart, bufferEnd))
41+
bufferStart = -1
42+
}
43+
tokens.push(char)
44+
} else if (isWhitespace) {
45+
if (bufferStart !== -1) {
46+
tokens.push(lower.slice(bufferStart, bufferEnd))
47+
bufferStart = -1
48+
}
49+
} else {
50+
if (bufferStart === -1) bufferStart = i
51+
bufferEnd = i + char.length
52+
}
53+
54+
i += char.length
55+
}
56+
57+
if (bufferStart !== -1) {
58+
tokens.push(lower.slice(bufferStart))
59+
}
60+
61+
return tokens
2462
}
2563

2664
let index = new FlexSearch.Document<Item>({

0 commit comments

Comments
 (0)