Skip to content

Commit 63566ce

Browse files
committed
Feat: New modifier menu-paged for navigating inside and outside of nested menus
1 parent 346edb2 commit 63566ce

209 files changed

Lines changed: 14633 additions & 8645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy-docs.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
- "packages/docs/**"
2121
- "CHANGELOG.md"
2222

23+
concurrency:
24+
group: deploy-docs-${{ inputs.publish_branch || 'gh-pages' }}
25+
cancel-in-progress: false
26+
2327
jobs:
2428
deploy-docs:
2529
timeout-minutes: 10
@@ -41,19 +45,29 @@ jobs:
4145

4246
- name: Setup Bun
4347
uses: oven-sh/setup-bun@v2
48+
with:
49+
bun-version: "1.3.14"
4450

4551
- name: Install dependencies
46-
run: bun i
52+
run: bun install --frozen-lockfile
4753

4854
- name: Add robots.txt if not main repo
4955
if: github.repository != 'saadeghi/daisyui'
5056
run: |
5157
echo 'User-agent: *
5258
Disallow: /' > packages/docs/static/robots.txt
5359
60+
- name: Verify docs source
61+
working-directory: packages/docs
62+
run: bun run verify
63+
5464
- name: Build docs
5565
run: bun run --bun build:docs
5666

67+
- name: Verify docs build
68+
working-directory: packages/docs
69+
run: bun run verify:build
70+
5771
- name: Deploy docs to github pages
5872
uses: peaceiris/actions-gh-pages@v4
5973
with:

‎.github/workflows/run-tests.yml‎

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,66 @@ on:
1111
inputs:
1212
filter:
1313
type: string
14-
# push:
15-
# branches:
16-
# - master
17-
# paths:
18-
# - "packages/daisyui/functions/**"
19-
# - "packages/daisyui/src/**"
20-
# - "packages/docs/src/**"
14+
default: ""
15+
pull_request:
16+
paths:
17+
- "packages/daisyui/**"
18+
- "packages/docs/**"
19+
- "package.json"
20+
- "bun.lock"
21+
- ".github/workflows/run-tests.yml"
22+
push:
23+
branches:
24+
- master
25+
paths:
26+
- "packages/daisyui/**"
27+
- "packages/docs/**"
28+
- "package.json"
29+
- "bun.lock"
30+
- ".github/workflows/run-tests.yml"
2131
jobs:
2232
tests:
2333
timeout-minutes: 10
2434
env:
25-
filter: ${{ inputs.filter }}
35+
TEST_FILTER: ${{ inputs.filter }}
2636
name: "Tests"
2737
runs-on: ubuntu-latest
2838
steps:
2939
- name: Checkout
3040
uses: actions/checkout@v6
3141
with:
3242
fetch-depth: 1
33-
clean: false
34-
ref: master
3543

3644
- name: Setup bun
3745
uses: oven-sh/setup-bun@v2
46+
with:
47+
bun-version: "1.3.14"
3848

3949
- name: Install dependencies
40-
run: bun i
50+
run: bun install --frozen-lockfile
4151

4252
- name: build package
4353
run: bun run --bun build
4454

4555
- name: Run tests
4656
run: |
47-
if [ -z "${{ env.filter }}" ]; then
57+
if [ -z "$TEST_FILTER" ]; then
4858
bun test
4959
else
50-
bun test -t ${{ env.filter }}
60+
bun test -t "$TEST_FILTER"
5161
fi
62+
63+
- name: Validate docs translations
64+
if: env.TEST_FILTER == ''
65+
working-directory: packages/docs
66+
run: bun run lang:validate
67+
68+
- name: Build docs
69+
if: env.TEST_FILTER == ''
70+
working-directory: packages/docs
71+
run: bun run --bun build
72+
73+
- name: Verify docs build
74+
if: env.TEST_FILTER == ''
75+
working-directory: packages/docs
76+
run: bun run verify:build

‎.grok-plugin/marketplace.json‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "daisyui",
3+
"description": "Official daisyUI plugins for Grok Build",
4+
"owner": {
5+
"name": "daisyUI"
6+
},
7+
"plugins": [
8+
{
9+
"name": "daisyui",
10+
"description": "Official daisyUI component library skill.",
11+
"category": "development",
12+
"source": {
13+
"type": "local",
14+
"path": "./skills"
15+
},
16+
"homepage": "https://daisyui.com",
17+
"keywords": ["daisyui", "tailwind css", "ui components"],
18+
"domains": ["daisyui.com"]
19+
},
20+
{
21+
"name": "daisyui-blueprint",
22+
"description": "Official daisyUI Blueprint MCP server. Requires a paid license.",
23+
"category": "development",
24+
"source": {
25+
"type": "local",
26+
"path": "./packages/blueprint"
27+
},
28+
"homepage": "https://daisyui.com/blueprint",
29+
"keywords": ["daisyui", "blueprint", "mcp", "figma"],
30+
"domains": ["daisyui.com"]
31+
}
32+
]
33+
}

‎packages/daisyui/functions/cssToJs.test.js‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,62 @@ test("cssToJs wraps read and parse errors with file context", async () => {
2626
"Error converting CSS to JS:",
2727
)
2828
})
29+
30+
test("menu-paged compiles its nested page and back-button states", async () => {
31+
const result = JSON.parse(await cssToJs(join(import.meta.dirname, "../src/components/menu.css")))
32+
const paged = result[".menu-paged"]["@layer daisyui.l1.l2"]
33+
34+
expect(paged).toMatchObject({
35+
"--menu-paged-arrow": "135deg",
36+
"--menu-paged-back-arrow": "-45deg",
37+
'[dir="rtl"] &': {
38+
"--menu-paged-arrow": "-45deg",
39+
"--menu-paged-back-arrow": "135deg",
40+
},
41+
":where(li ul, li menu):before": {
42+
"--tw-content": "none",
43+
content: "var(--tw-content)",
44+
},
45+
"details::details-content": { transition: "none" },
46+
":where(li > details > summary):after": {
47+
rotate: "var(--menu-paged-arrow)",
48+
translate: "0",
49+
transition: "none",
50+
},
51+
})
52+
expect(
53+
paged[
54+
"&:has(> li > details[open]) > li:not(:has(> details[open])), :where(:is(ul, menu):has(> li > details[open]) > li:not(:has(> details[open])))"
55+
],
56+
).toEqual({ display: "none" })
57+
expect(
58+
paged[
59+
":where(li:has(> details[open]), details[open], details[open] > :is(ul, menu)), :where(details[open])::details-content"
60+
],
61+
).toEqual({ display: "contents" })
62+
expect(
63+
paged[":where(details[open]:has(> :is(ul, menu) > li > details[open]) > summary)"],
64+
).toEqual({ display: "none" })
65+
expect(paged[":where(li > details[open] > summary):after"]).toEqual({
66+
order: -1,
67+
"justify-self": "flex-start",
68+
rotate: "var(--menu-paged-back-arrow)",
69+
})
70+
71+
expect(result[".menu-horizontal"]["@layer daisyui.l1.l2"]["&.menu-paged"]).toEqual({
72+
"--menu-paged-arrow": "-135deg",
73+
"--menu-paged-back-arrow": "45deg",
74+
"& > li:not(.menu-title) > details > :is(ul, menu)": {
75+
animation: "none",
76+
transition: "none",
77+
},
78+
})
79+
expect(result[".menu-vertical"]["@layer daisyui.l1.l2"]["&.menu-paged"]).toEqual({
80+
"--menu-paged-arrow": "135deg",
81+
"--menu-paged-back-arrow": "-45deg",
82+
'[dir="rtl"] &': {
83+
"--menu-paged-arrow": "-45deg",
84+
"--menu-paged-back-arrow": "135deg",
85+
},
86+
})
87+
})

‎packages/daisyui/src/components/menu.css‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,77 @@
210210
}
211211
}
212212

213+
.menu-paged {
214+
@layer daisyui.l1.l2 {
215+
--menu-paged-arrow: 135deg;
216+
--menu-paged-back-arrow: -45deg;
217+
[dir="rtl"] & {
218+
--menu-paged-arrow: -45deg;
219+
--menu-paged-back-arrow: 135deg;
220+
}
221+
222+
:where(li ul, li menu):before {
223+
--tw-content: none;
224+
content: var(--tw-content);
225+
}
226+
227+
details[open]>summary{
228+
font-size: 0;
229+
&:not(:active){
230+
transition-duration: 0s;
231+
}
232+
&:before {
233+
--tw-content: "Back";
234+
content: var(--tw-content);
235+
font-size: 0.875rem;
236+
}
237+
&[aria-label]:before {
238+
content: attr(aria-label);
239+
}
240+
}
241+
242+
details::details-content {
243+
transition: none;
244+
}
245+
246+
&:has(> li > details[open]) > li:not(:has(> details[open])),
247+
:where(:is(ul, menu):has(> li > details[open]) > li:not(:has(> details[open]))) {
248+
@apply hidden;
249+
}
250+
251+
:where(li:has(> details[open]), details[open], details[open] > :is(ul, menu)),
252+
:where(details[open])::details-content {
253+
display: contents;
254+
}
255+
256+
:where(details[open]:has(> :is(ul, menu) > li > details[open]) > summary) {
257+
@apply hidden;
258+
}
259+
260+
:where(li > details > summary):after {
261+
rotate: var(--menu-paged-arrow);
262+
translate: 0;
263+
transition: none;
264+
}
265+
266+
:where(li > details[open] > summary):after {
267+
order: -1;
268+
@apply justify-self-start;
269+
rotate: var(--menu-paged-back-arrow);
270+
}
271+
}
272+
}
273+
213274
.menu-xs {
214275
@layer daisyui.l1.l2 {
215276
:where(li:not(.menu-title) > *:not(ul, menu, details, .menu-title)),
216277
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
217278
@apply rounded-field px-2 py-1;
218279
font-size: 0.6875rem;
219280
}
281+
details[open]>summary:before{
282+
font-size: 0.6875rem;
283+
}
220284

221285
.menu-title {
222286
@apply px-2 py-1;
@@ -231,6 +295,9 @@
231295
@apply rounded-field px-2.5 py-1;
232296
font-size: 0.75rem;
233297
}
298+
details[open]>summary:before {
299+
font-size: 0.75rem;
300+
}
234301

235302
.menu-title {
236303
@apply px-3 py-2;
@@ -245,6 +312,9 @@
245312
@apply rounded-field px-3 py-1.5;
246313
font-size: 0.875rem;
247314
}
315+
details[open]>summary:before {
316+
font-size: 0.875rem;
317+
}
248318

249319
.menu-title {
250320
@apply px-3 py-2;
@@ -259,6 +329,9 @@
259329
@apply rounded-field px-4 py-1.5;
260330
font-size: 1.125rem;
261331
}
332+
details[open]>summary:before {
333+
font-size: 1.125rem;
334+
}
262335

263336
.menu-title {
264337
@apply px-6 py-3;
@@ -273,6 +346,9 @@
273346
@apply rounded-field px-5 py-1.5;
274347
font-size: 1.375rem;
275348
}
349+
details[open]>summary:before {
350+
font-size: 1.375rem;
351+
}
276352

277353
.menu-title {
278354
@apply px-6 py-3;

‎packages/docs/package.json‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77
},
88
"scripts": {
99
"dev": "vite dev --port 3000 --open",
10-
"build": "NODE_ENV=production vite build --logLevel error",
11-
"preview": "bun run --bun build && vite preview --port 3000 --open",
10+
"build": "NODE_ENV=production vite build",
11+
"analyze": "DOCS_ANALYZE=true bun run --bun build",
12+
"build:verify": "bun run --bun build && bun run verify:build",
13+
"preview": "vite preview --port 3000 --open",
14+
"build:preview": "bun run --bun build && bun run preview",
1215
"stats": "open build/stats.html",
16+
"test": "bun test src",
17+
"verify": "bun run test && bun run lang:validate",
18+
"verify:build": "bun src/lib/scripts/verifyBuild.js",
1319
"lang:add": "bun src/lib/scripts/addTranslations.js --write",
1420
"lang:prune": "bun src/lib/scripts/pruneTranslations.js",
1521
"lang:prune:write": "bun src/lib/scripts/pruneTranslations.js --write",

‎packages/docs/src/components/ComponentFooter.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
return items
2424
}
25-
let arrayOfPagesInOrder = extractPages(pages)
25+
const arrayOfPagesInOrder = $derived.by(() => extractPages(pages))
2626
2727
let currentPageIndex = $derived(
2828
arrayOfPagesInOrder.findIndex((item) => item.href === $page.url.pathname),

0 commit comments

Comments
 (0)