Skip to content

Commit 132330b

Browse files
committed
docs
1 parent 69f695d commit 132330b

29 files changed

Lines changed: 861 additions & 856 deletions

packages/docs/src/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
}
250250
}
251251
.shiki {
252+
text-align: left;
252253
--shiki-bg: var(--color-neutral);
253254
--shiki-token: color-mix(
254255
in oklab,

packages/docs/src/lib/mdsvex/mdsvex.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ const remarkPlugins = [
146146
export const mdsvexExtensions = [".svx", ".md"]
147147

148148
const config = {
149+
smartypants: false,
149150
extensions: mdsvexExtensions,
150151
remarkPlugins: remarkPlugins,
151152
rehypePlugins: rehypePlugins, // Keep rehypePlugins after remarkPlugins

packages/docs/src/lib/scripts/addTranslations.js

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,6 @@ const extractTextFromNode = (node) => {
7373
return ""
7474
}
7575

76-
const isInsideCodeBlock = (node, parent) => {
77-
if (parent?.type === "code") return true
78-
let currentNode = node
79-
while (currentNode?.parent) {
80-
if (currentNode.parent.type === "code") return true
81-
if (isNodeInCodeBlockContext(currentNode)) return true
82-
currentNode = currentNode.parent
83-
}
84-
return false
85-
}
86-
87-
const isNodeInCodeBlockContext = (node) => {
88-
if (!node.parent?.type === "root") return false
89-
const nodeStart = node.position?.start?.offset
90-
const codeBlocks = node.parent.children.filter(
91-
(child) => child.type === "code" && ["html", "jsx"].includes(child.lang),
92-
)
93-
return codeBlocks.some(
94-
(block) =>
95-
nodeStart > block.position?.start?.offset && nodeStart < block.position?.end?.offset + 100,
96-
)
97-
}
98-
9976
// Text Filtering
10077
const shouldSkipText = (text) => {
10178
// Array of regex patterns with comments explaining each one
@@ -111,30 +88,30 @@ const shouldSkipText = (text) => {
11188
/^.*\|.*\n\|.*$/, // Skip table-like content with pipe characters
11289
/^.*\|.*\|.*$/, // Skip lines with multiple pipe characters (likely tables)
11390
/<[a-z][\s\S]*>/i, // Skip HTML-like content
114-
91+
11592
// HTML tags and attributes
11693
/^<\w+.*$/i, // Skip strings starting with HTML tags like "<input"
11794
/^\/>$/, // Skip closing tag fragments like "/>"
11895
/^class=["'].*["']>$/, // Skip class attributes
11996
/^min=["'].*["'].*\/>$/, // Skip HTML attribute combinations ending with "/>"
120-
97+
12198
// Special characters and keyboard keys
12299
/^(ctrl|shift|del)$/, // Skip keyboard key names
123100
/^[]$/, // Skip arrow symbols
124-
/^\.\.\.$/, // Skip ellipsis
125-
101+
/^\.\.\.$/, // Skip ellipsis
102+
126103
// Svelte specific tags
127104
/^\[svelte:.*\].*$/, // Skip svelte tag references like "[svelte:head]..."
128105
/^<\/svelte:.*>$/, // Skip closing svelte tags like "</svelte:head>"
129-
106+
130107
// Time formats and units
131108
/^\d+[hm]$/, // Skip time units like "10h", "24m"
132109
/^\d+:$/, // Skip time formats like "10:", "24:"
133-
110+
134111
// URLs and domains
135112
/^https:\/\/$/, // Skip URL protocol
136113
/^\.\w+$/, // Skip domain extensions like ".com"
137-
114+
138115
// HTML attributes
139116
/^(type|class|required|placeholder|min|max|title)=["'].*["']$/, // Skip HTML attributes
140117
]
@@ -146,34 +123,48 @@ const shouldSkipText = (text) => {
146123

147124
// Additional checks for specific strings that might not be caught by regex
148125
const specificStringsToSkip = [
149-
"...", "ctrl", "shift", "del", "◀︎", "▶︎", "↖︎", "↗︎", "↙︎", "↘︎",
150-
"https://", ".com", "10h", "24m", "10:", "24:"
151-
];
152-
153-
if (specificStringsToSkip.includes(text)) return true;
126+
"...",
127+
"ctrl",
128+
"shift",
129+
"del",
130+
"◀︎",
131+
"▶︎",
132+
"↖︎",
133+
"↗︎",
134+
"↙︎",
135+
"↘︎",
136+
"https://",
137+
".com",
138+
"10h",
139+
"24m",
140+
"10:",
141+
"24:",
142+
]
143+
144+
if (specificStringsToSkip.includes(text)) return true
154145

155146
// Additional check for code blocks using triple backticks
156147
if (text.includes("```")) return true
157148

158149
// Skip lines with HTML-like content
159150
if (text.startsWith("<") && (text.includes("/>") || text.includes(">"))) return true
160-
151+
161152
// Skip class attributes
162153
if (text.includes("class=")) return true
163-
154+
164155
return false
165156
}
166157

167158
// Additional function to detect if content is within a code block
168159
export const isWithinCodeBlock = (content, position) => {
169160
const codeBlockMatches = [...content.matchAll(/```[\s\S]*?```/g)]
170-
161+
171162
for (const match of codeBlockMatches) {
172163
if (position >= match.index && position < match.index + match[0].length) {
173164
return true
174165
}
175166
}
176-
167+
177168
return false
178169
}
179170

@@ -205,22 +196,6 @@ export const processTableCells = (node) => {
205196
return tableCellTexts
206197
}
207198

208-
const extractCellText = (cell) => {
209-
let text = ""
210-
cell.children?.forEach((child) => {
211-
if (["text", "inlineCode"].includes(child.type)) {
212-
text += child.value.trim()
213-
} else if (child.type === "paragraph") {
214-
child.children?.forEach((grandChild) => {
215-
if (grandChild.type === "text") {
216-
text += grandChild.value.trim()
217-
}
218-
})
219-
}
220-
})
221-
return text
222-
}
223-
224199
export const shouldSkipTableCell = (text) =>
225200
Boolean(text.match(/^[-:]+$/)) || Boolean(text.match(/^\s*$/)) || /{COLOR_NAME}/.test(text)
226201

@@ -255,7 +230,7 @@ export const processMarkdownFile = (filePath) => {
255230

256231
// Check for code blocks in the entire content
257232
const codeBlocks = [...processableContent.matchAll(/```[\s\S]*?```/g)]
258-
const codeBlockRanges = codeBlocks.map(match => [match.index, match.index + match[0].length])
233+
const codeBlockRanges = codeBlocks.map((match) => [match.index, match.index + match[0].length])
259234

260235
// Split the content by actual newlines in the source
261236
const lines = processableContent.split(/\r?\n/)
@@ -273,9 +248,9 @@ export const processMarkdownFile = (filePath) => {
273248

274249
// Skip processing if this line is within a code block
275250
const inCodeBlock = codeBlockRanges.some(
276-
([start, end]) => currentPosition >= start && currentPosition < end
251+
([start, end]) => currentPosition >= start && currentPosition < end,
277252
)
278-
253+
279254
if (!inCodeBlock) {
280255
// Process each line as separate markdown content
281256
const lineAst = unified().use(remarkParse).use(remarkGfm).parse(line)

packages/docs/src/lib/scripts/addTranslations.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { unified } from "unified"
22
import remarkParse from "remark-parse"
33
import remarkGfm from "remark-gfm"
4-
import { visit } from "unist-util-visit"
54
import { expect, test, beforeEach, afterEach } from "bun:test"
65
import { mkdirSync, writeFileSync, rmSync } from "fs"
76
import { join } from "path"

packages/docs/src/lib/scripts/cleanTranslations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const getTranslationsFromFile = (file) => {
3838
export const loadAllTranslations = (files) =>
3939
files.reduce((acc, file) => ({ ...acc, ...getTranslationsFromFile(file) }), {})
4040

41-
const isTranslationUsed = (content, key, value) => {
41+
const isTranslationUsed = (content, key) => {
4242
// Escape special regex characters in the key
4343
const escapeRegex = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
4444
const escapedKey = escapeRegex(key)
@@ -94,7 +94,7 @@ const removeUnusedTranslations = (content, unusedTranslations) => {
9494
const unusedNormalized = new Set(Array.from(unusedTranslations).map(normalizeForComparison))
9595

9696
return Object.fromEntries(
97-
Object.entries(content).filter(([key, value]) => {
97+
Object.entries(content).filter(([key]) => {
9898
const normalizedKey = normalizeForComparison(key)
9999
return !unusedNormalized.has(normalizedKey)
100100
}),

packages/docs/src/routes/(routes)/docs/editor/+page.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ Add daisyUI's llms.txt file to your repo so that Copilot can use it by default.
4444

4545
## <img src="https://img.daisyui.com/images/logos/zed.webp" alt="VSCode" width="40" height="40" class="inline-block me-2 -mt-1 not-prose"> Zed
4646

47-
1. In chat window type this and press <kbd class="kbd">Enter ↵</kbd>
47+
- In chat window type this and press <kbd class="kbd">Enter ↵</kbd>
4848
```sh
4949
/fetch https://daisyui.com/llms.txt
5050
```
51+
52+
## <img src="https://img.daisyui.com/images/logos/windsurf.webp" alt="VSCode" width="40" height="40" class="inline-block me-2 -mt-1 not-prose"> Windsurf
53+
54+
- In chat window type this and write your prompt
55+
```sh
56+
@web https://daisyui.com/llms.txt
57+
```

packages/docs/src/routes/(routes)/docs/intro/+page.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ daisyUI uses the Tailwind CSS plugin API to extend the available Tailwind CSS cl
4141
## What's the difference between daisyUI and Tailwind CSS?
4242

4343
Tailwind CSS provides low-level utility classes, which usually include only one CSS rule.
44-
daisyUI classes are a combination of multiple CSS rule that are named semantically for each part of the UI.
44+
daisyUI classes are a combination of multiple CSS rule that are named semantically for each part of the UI.
4545

46-
For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a "card", a "button", a "toggle", etc, just like what we would call them semantically in a design system.
46+
For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a `card`, a `button`, a `toggle`, etc, just like what we would call them semantically in a design system.
4747

48-
This makes it easier to design interfaces with less code and more consistency. For example if you want to make a card using Tailwind CSS you would have to write one or multiple utility class names for each single CSS rule. Doing this over and over again for each element, for each page, for each project is time consuming and hard to manage. It also makes it harder to maintain your code as you have to always figure out what part of the code is responsible for what part of the UI.
48+
This makes it easier to design interfaces with less code and more consistency. For example if you want to make a card using Tailwind CSS you would have to write one or multiple utility class names for each single CSS rule. Doing this over and over again for each element, for each page, for each project is time consuming and hard to manage. It also makes it harder to maintain your code as you have to always figure out what part of the code is responsible for what part of the UI.
4949

5050
daisyUI solves this problem by providing higher level class names that are named based on the UI parts. For example to make a card, we simply use the `card` class name and daisyUI gives you all the necessary CSS rules to make a card. Then if you need additional customization, you can add Tailwind CSS utility classes to the element to make it look the way you want.
5151

@@ -55,17 +55,17 @@ daisyUI is not a replacement for Tailwind CSS, it's a plugin that makes Tailwind
5555

5656
Yes! It's utility-first, not utility-only.
5757

58-
daisyUI is built on top of Tailwind CSS's component API. Tailwind CSS as a library provides utility classes and suggests using utility classes for maximum flexibility and customization. However that means slower development and more code to write.
59-
That's why many people find it hard to use Tailwind CSS for designing interfaces. It takes a professional designer to make design decisions for many details of the UI to make them look good. It also takes a lot of time to write all the utility class names for each part of the UI. Even copying and pasting those huge chunks of utility class names is not helpful, as it makes the codebase hard to read and maintain.
58+
daisyUI is built on top of Tailwind CSS's component API. Tailwind CSS as a library provides utility classes and suggests using utility classes for maximum flexibility and customization. However that's means slower development and more code to write.
59+
That's why many people find it hard to use Tailwind CSS for designing interfaces. It takes a professional designer to make design decisions for many details of the UI to make them look good. It also takes a lot of time to write all the utility class names for each part of the UI. Even copying and pasting those huge chunks of utility class names is not helpful, as it makes the codebase hard to read and maintain.
6060

6161
Imagine one side of the spectrum is maximum customization and flexibility and you should make design decisions for every single detail. On the other side of the spectrum is maximum development speed and less code to write, but you have no control over the design. daisyUI and Tailwind CSS together give you the best of both worlds.
6262
Use daisyUI class names to write less code and develop faster, and use Tailwind CSS utility classes to customize the design when you need to.
6363

6464
Is it full circle?
65-
If you've been using Bootstrap many years ago, you may think it doesn't make sense to go back to using components.
65+
If you've been using Bootstrap many years ago, you may think it doesn't make sense to go back to using components.
6666

6767
But here's the catch: The problem with Bootstrap was not class names! Bootstrap class names were actually really fast to work with. The problem was lack of customization and flexibility. At some point every Bootstrap website looked the same unless you open a CSS file and write tons of custom CSS.
68-
Tailwind CSS solves this problem of customization and flexibility but the cost is slower development and more code to write! You wanted customization and flexibility? Good luck making design decisions for every single pixel in your page! Not a practical approach, right?
68+
Tailwind CSS solves this problem of customization and flexibility but the cost is slower development and more code to write! You wanted customization and flexibility? Good luck making design decisions for every single pixel in your page! Not a practical approach, right?
6969

7070
We need customization development speed at the same time. daisyUI is here to make this possible.
7171

packages/docs/src/translation/ar.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@
485485
"Want to swim in the ocean of thousands of class names and never find your way out.": "Want to swim in the ocean of thousands of class names and never find your way out.",
486486
"Want to make your codebase a mess and spend hours figuring out what part of the code is responsible for what part of the UI.": "Want to make your codebase a mess and spend hours figuring out what part of the code is responsible for what part of the UI.",
487487
"Want to waste your time and money re-inventing the wheel instead of shipping your actual project.": "Want to waste your time and money re-inventing the wheel instead of shipping your actual project.",
488-
"For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a \"card\", a \"button\", a \"toggle\", etc, just like what we would call them semantically in a design system.": "For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a \"card\", a \"button\", a \"toggle\", etc, just like what we would call them semantically in a design system.",
488+
"For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a `card`, a `button`, a `toggle`, etc, just like what we would call them semantically in a design system.": "For example Tailwind CSS class names decide if padding should be 4px or 8px. daisyUI class names decide if a HTML element should look like a `card`, a `button`, a `toggle`, etc, just like what we would call them semantically in a design system.",
489489
"This makes it easier to design interfaces with less code and more consistency. For example if you want to make a card using Tailwind CSS you would have to write one or multiple utility class names for each single CSS rule. Doing this over and over again for each element, for each page, for each project is time consuming and hard to manage. It also makes it harder to maintain your code as you have to always figure out what part of the code is responsible for what part of the UI.": "This makes it easier to design interfaces with less code and more consistency. For example if you want to make a card using Tailwind CSS you would have to write one or multiple utility class names for each single CSS rule. Doing this over and over again for each element, for each page, for each project is time consuming and hard to manage. It also makes it harder to maintain your code as you have to always figure out what part of the code is responsible for what part of the UI.",
490490
"daisyUI is not a replacement for Tailwind CSS, it's a plugin that makes Tailwind CSS more powerful and easier to use.": "daisyUI is not a replacement for Tailwind CSS, it's a plugin that makes Tailwind CSS more powerful and easier to use.",
491491
"Yes! It's utility-first, not utility-only.": "Yes! It's utility-first, not utility-only.",
@@ -925,7 +925,6 @@
925925
"A hidden checkbox can control the state of modal and labels can toggle the checkbox so we can open/close the modal.": "A hidden checkbox can control the state of modal and labels can toggle the checkbox so we can open/close the modal.",
926926
"open modal": "open modal",
927927
"is required for responsivness of the dock in iOS.": "is required for responsivness of the dock in iOS.",
928-
"don't re-invent <br/>the wheel <br/>every time": "لا تعد اختراع <br/>العجلة كل مرة",
929928
"Put Tailwind CSS and daisyUI in your CSS file at `src/` (and remove old styles).": "Put Tailwind CSS and daisyUI in your CSS file at `src/` (and remove old styles).",
930929
"Install WordPress according to the [Official WordPress guide](https://wordpress.org/download/).": "Install WordPress according to the [Official WordPress guide](https://wordpress.org/download/).",
931930
"In this guide, we will use the [WindPress](https://wind.press) plugin to install Tailwind CSS and daisyUI in a WordPress project.": "In this guide, we will use the [WindPress](https://wind.press) plugin to install Tailwind CSS and daisyUI in a WordPress project.",
@@ -1156,5 +1155,7 @@
11561155
"When modal is closed, the page will scroll to the top because of the anchor link.": "When modal is closed, the page will scroll to the top because of the anchor link.",
11571156
"Anchor links might not work well on some SPA frameworks. If there are problems, use the other methods": "Anchor links might not work well on some SPA frameworks. If there are problems, use the other methods",
11581157
"The `hr` tag at the beginning or end of each item, displays a line to connect items.": "The `hr` tag at the beginning or end of each item, displays a line to connect items.",
1159-
"Inbox": "Inbox"
1158+
"Inbox": "Inbox",
1159+
"In chat window type this and write your prompt": "In chat window type this and write your prompt",
1160+
"don't re-invent <br/>the wheel <br/>every time": "لا تعد اختراع <br/>العجلة كل مرة"
11601161
}

0 commit comments

Comments
 (0)