Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7c89fd2
Refator t function
brianjhanson Dec 15, 2025
6b0a6c4
Missed one
brianjhanson Dec 15, 2025
035a37c
Merge branch 'feature/inertia-settings' of github.com:craftcms/cms in…
brianjhanson Dec 15, 2025
836a91e
Build
brianjhanson Dec 15, 2025
bf2cb01
Merge branch 'feature/inertia-settings' of github.com:craftcms/cms in…
brianjhanson Dec 16, 2025
7e3c2fa
Merge branch 'feature/cms-1677-refactor-t-function' of github.com:cra…
brianjhanson Dec 16, 2025
51f5bf3
Merge branch '6.x' of github.com:craftcms/cms into feature/cms-1677-r…
brianjhanson Dec 17, 2025
c3de530
Merge branch '6.x' of github.com:craftcms/cms into feature/inertia-se…
brianjhanson Dec 17, 2025
e3e0aa6
Settings index page
brianjhanson Dec 17, 2025
8c66c31
Merge branch 'feature/cms-1677-refactor-t-function' of github.com:cra…
brianjhanson Dec 17, 2025
b46f789
Build
brianjhanson Dec 17, 2025
968575c
Fix default path
brianjhanson Dec 17, 2025
1b2b208
Use the container
brianjhanson Dec 17, 2025
9eb2e31
Remove settings twig template
brianjhanson Dec 17, 2025
e217f28
Legacy event handler
riasvdv Dec 18, 2025
e911779
Fix duplicate use
riasvdv Dec 18, 2025
7e49e44
Merge branch '6.x' of github.com:craftcms/cms into feature/inertia-se…
brianjhanson Jan 6, 2026
8ad0f43
Merge branch 'feature/inertia-settings-index' of github.com:craftcms/…
brianjhanson Jan 6, 2026
1e3fe98
Merge branch 'feature/cms-1677-refactor-t-function' of github.com:cra…
brianjhanson Jan 9, 2026
4c2f348
Fix git conflict
brianjhanson Jan 14, 2026
67adb64
Merge branch 'feature/cms-1677-refactor-t-function' of github.com:cra…
brianjhanson Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ composer.lock
vendor/*
.ddev/*
resources/build/*
resources/icons/*
resources/js/actions/*
resources/js/routes/*
resources/js/wayfinder/*
Expand Down
3 changes: 3 additions & 0 deletions packages/craftcms-cp/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@github/relative-time-element';
import {configureIcons} from '@/utilities/icons';

export {default as CraftDisclosure} from './components/disclosure/disclosure.js';
export {default as CraftSpinner} from './components/spinner/spinner.js';
Expand Down Expand Up @@ -46,3 +47,5 @@ export {t, formatMessage} from './utilities/translate.js';
export {formatNumber} from './utilities/format.js';
export * from './utilities/api/actionClient.js';
export * from './utilities/api/apiClient.js';

configureIcons();
14 changes: 14 additions & 0 deletions packages/craftcms-cp/src/utilities/icons.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {describe, test, expect} from 'vitest';
import {getIconUrl} from './icons.js';

describe('getIconUrl', () => {
test.for([
['custom-icons/graphql', '/vendor/craft/icons/custom-icons/graphql.svg'],
['light/sliders', '/vendor/craft/icons/light/sliders.svg'],
['x', '/vendor/craft/icons/regular/x.svg'],
['newstamp', '/vendor/craft/icons/regular/certificate.svg'],
])('%s', ([name, expected]) => {
// console.log(args);
expect(getIconUrl(name as string)).toBe(expected as string);
});
});
119 changes: 119 additions & 0 deletions packages/craftcms-cp/src/utilities/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import {registerIconLibrary} from '@awesome.me/webawesome/dist/webawesome.js';

const LEGACY_NAMES: Record<string, string> = {
alert: 'triangle-exclamation',
asc: 'arrow-down-short-wide',
asset: 'image',
assets: 'image',
circleuarr: 'circle-arrow-up',
collapse: 'down-left-and-up-right-to-center',
condition: 'diamond',
darr: 'arrow-down',
date: 'calendar',
desc: 'arrow-down-wide-short',
disabled: 'circle-dashed',
done: 'circle-check',
downangle: 'angle-down',
draft: 'scribble',
edit: 'pencil',
enabled: 'circle',
expand: 'up-right-and-down-left-from-center',
external: 'arrow-up-right-from-square',
field: 'pen-to-square',
help: 'circle-question',
home: 'house',
info: 'circle-info',
insecure: 'unlock',
larr: 'arrow-left',
layout: 'table-layout',
leftangle: 'angle-left',
listrtl: 'list-flip',
location: 'location-dot',
mail: 'envelope',
menu: 'bars',
move: 'grip-dots',
newstamp: 'certificate',
paperplane: 'paper-plane',
plugin: 'plug',
rarr: 'arrow-right',
refresh: 'arrows-rotate',
remove: 'xmark',
rightangle: 'angle-right',
rotate: 'rotate-left',
routes: 'signs-post',
search: 'magnifying-glass',
secure: 'lock',
settings: 'gear',
shareleft: 'share-flip',
shuteye: 'eye-slash',
'sidebar-left': 'sidebar',
'sidebar-right': 'sidebar-flip',
'sidebar-start': 'sidebar', // Note: Was conditional based on $orientation (ltr: 'sidebar', rtl: 'sidebar-flip')
'sidebar-end': 'sidebar-flip', // Note: Was conditional based on $orientation (ltr: 'sidebar-flip', rtl: 'sidebar')
structure: 'list-tree',
structurertl: 'list-tree-flip',
template: 'file-code',
time: 'clock',
tool: 'wrench',
uarr: 'arrow-up',
upangle: 'angle-up',
view: 'eye',
wand: 'wand-magic-sparkles',
};

/**
* This is mostly copied from font awesome directly because they don't seem to
* give you a way to access the default library settings and extend them, only
* overwrite them entirely.
*
* https://github.com/shoelace-style/webawesome/blob/da206a87873e3ab43ded7466a05005225aa50e69/packages/webawesome/src/components/icon/library.default.ts
*/
export function getIconUrl(
name: string,
family: string = 'classic',
variant: string = 'regular'
) {
let folder = 'solid';
let resolvedVariant = variant;
let resolvedName = name.endsWith('.svg') ? name.split('.svg')[0]! : name;

if (name.includes('/')) {
const [tmpVariant, ...tmpName] = name.split('/');

resolvedVariant = tmpVariant ?? resolvedVariant;
resolvedName = tmpName.join('/');
}

if (resolvedVariant === 'thin') {
folder = 'thin';
} else if (resolvedVariant === 'light') {
folder = 'light';
} else if (resolvedVariant === 'regular') {
folder = 'regular';
} else if (resolvedVariant === 'solid') {
folder = 'solid';
}

// Brands
if (family === 'brands') {
folder = 'brands';
}

if (resolvedVariant === 'custom-icons') {
folder = 'custom-icons';
}

resolvedName = LEGACY_NAMES[resolvedName] ?? resolvedName;

// Use the default CDN
return `/vendor/craft/icons/${folder}/${resolvedName}.svg`;
}

export function configureIcons() {
registerIconLibrary('default', {
resolver: (name: string, family = 'classic', variant = 'solid') => {
return getIconUrl(name, family, variant);
},
mutator: (svg) => svg.setAttribute('fill', 'currentColor'),
});
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion resources/build/Install.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/build/SettingsGeneralPage.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/build/SettingsIndexPage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading