-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): allow adding prefix to class names (#537)
* feat(src/index): postcss-js inject prefix for components & their associated utilities if specified * docs: add instruction for `prefix` at /docs/config * docs(prefix): add globlal prefix store for user to customize display of class names * refactor(docs.components): use prefix store & action for html display * fix: load prefix from daisyui user's config
- Loading branch information
1 parent
7d4ceb6
commit 49e05fa
Showing
13 changed files
with
175 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script> | ||
import debounce from "lodash.debounce" | ||
import { prefix } from "$lib/stores" | ||
const onPrefixInput = debounce((e) => { | ||
if (e.target.value !== $prefix) { | ||
prefix.set(e.target.value) | ||
} | ||
}, 500) | ||
</script> | ||
|
||
<label for="config-prefix" class="relative w-full tooltip tooltip-bottom" data-tip="Custom prefix"> | ||
<svg class="stroke-current fill-current h-3 absolute left-2 top-1/2 -translate-y-1/2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M318.4 16l-161 480h77.5l25.4-81.4h119.5L405 496h77.5L318.4 16zm-40.3 341.9l41.2-130.4h1.5l40.9 130.4h-83.6zM640 405l-10-31.4L462.1 358l19.4 56.5L640 405zm-462.1-47L10 373.7 0 405l158.5 9.4 19.4-56.4z"/></svg> | ||
<input class="input input-ghost pl-8 h-10 w-full" type="text" placeholder="Custom Prefix" id="config-prefix" on:input={onPrefixInput} value={$prefix}/> | ||
</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function replace(node, parameters = {}) { | ||
const originalContent = node.textContent ?? '' | ||
const defaultParameters = { | ||
search: '$$', | ||
to: '', | ||
} | ||
|
||
function update(p) { | ||
const { search, to } = { | ||
...defaultParameters, | ||
...p, | ||
} | ||
node.textContent = originalContent.replaceAll(search, to) | ||
} | ||
|
||
update(parameters) | ||
|
||
return { | ||
update, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { writable } from "svelte/store" | ||
|
||
// export let store = writable(); | ||
|
||
export const prefix = writable(""); |
Oops, something went wrong.