-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support different icon sources (#8)
Bigger refactoring: Now generates a treeview.css instead of creating image tags Uses roles on an tag to define the icons. Supports antora, embedded, jsdelivr and custom url Closes #4
- Loading branch information
Showing
17 changed files
with
677 additions
and
238 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
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,59 @@ | ||
.listingblock.treeview.dark { | ||
--treeview-background-color: #222; | ||
--treeview-font-color: #d8dee9; | ||
--treeview-line-height: 1; | ||
} | ||
|
||
.listingblock.treeview.light { | ||
--treeview-background-color: #f7f7f8; | ||
--treeview-font-color: #222; | ||
--treeview-line-height: 1; | ||
} | ||
|
||
.listingblock.treeview > .content > pre { | ||
background-color: var(--treeview-background-color, #222); | ||
color: var(--treeview-font-color, #d8dee9); | ||
line-height: var(--treeview-line-height, 1); | ||
padding: 0.5em; | ||
border-radius: 4px; | ||
} | ||
|
||
.tv-line { | ||
display: inline-flex; | ||
align-items: center; | ||
} | ||
|
||
.tv-line-element { | ||
display: contents; | ||
} | ||
|
||
.tv-line-element > img { | ||
height: var(--treeview-icon-height, 18px); | ||
width: var(--treeview-icon-width, 18px); | ||
} | ||
|
||
.tv-line-element > .tv-item-name { | ||
margin-left: var(--treeview-item-name-offset, 5px); | ||
} | ||
|
||
.tv-icon { | ||
height: var(--treeview-icon-height, 18px); | ||
width: var(--treeview-icon-width, 18px); | ||
} | ||
|
||
.tv-icon::before { | ||
content: ""; | ||
width: var(--treeview-icon-width, 18px); | ||
height: var(--treeview-icon-height, 18px); | ||
/* margin-top: 0px; */ | ||
position: relative; | ||
display: inline-flex; | ||
/* background-size: var(--treeview-icon-height, 18px); */ | ||
background-repeat: no-repeat; | ||
} | ||
|
||
{{#each iconRules}} | ||
.tv-icon.{{this.baseName}}::before { | ||
background-image: url('{{{this.url}}}'); | ||
} | ||
{{/each}} |
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,22 @@ | ||
const defaultIconSource = 'antora' // jsdelivr, embedded | ||
|
||
function validateConfig (config, packageName, logger) { | ||
const { iconSource = defaultIconSource, ...unknownOptions } = config | ||
|
||
if (Object.keys(unknownOptions).length) { | ||
throw new Error(`Unrecognized options specified for ${packageName}: ${Object.keys(unknownOptions).join(', ')}`) | ||
} | ||
|
||
if (![defaultIconSource, 'jsdelivr', 'embedded'].includes(iconSource)) { | ||
throw new Error(`Invalid icon path specified for ${packageName}: ${iconSource}`) | ||
} | ||
|
||
const validatedConfig = { iconSource } | ||
|
||
logger.info(`Registering ${packageName} with config`) | ||
logger.info(` > Icon Path: ${validatedConfig.iconPath}`) | ||
|
||
return validatedConfig | ||
} | ||
|
||
module.exports = validateConfig |
Oops, something went wrong.