Design Tokens
With $THIS being the folder that contains this SKILL.md:
Prerequisite
$THIS/node_modules/ exists and is not older than 7 days; if not: cd $THIS && npm ci
Context
Design Tokens are defined in LESS files of the theming-base-content, and consumed in LESS and CSS files of different frameworks (= UI technologies). In $THIS/node_modules/ you find the following:
- UI5: (with
$LIBRARYbeing e.g.sap.ui.core, and$THEMEbeing e.g.sap_horizon)$THIS/node_modules/@openui5/$LIBRARY/src/${LIBRARY/./\//}/**/themes/basecontains thebaseThemeof the different libraries$THIS/node_modules/@openui5/themelib_$THEME/src/${LIBRARY/./\//}/themes/contains the$THEMEof the different libraries
- UI5 Web Components: (with
$THEMEbeing e.g.sap_horizon, and$COMPONENTbeing e.g.Button)$THIS/node_modules/@ui5/*/src/themes/$COMPONENT.csscontains theme-independent component skeleton CSS, using parameters from theming-base-content as CSS custom properties, as well as CSS custom properties defined inbase/(see below)$THIS/node_modules/@ui5/*/src/themes/base/$COMPONENT-parameters.csscontains CSS custom property definitions for components; never report those UI5 Web Components-specific internal CSS custom properties.$THIS/node_modules/@ui5/*/src/themes/$THEME/$COMPONENT-parameters.csscontains theme-dependent values for the custom property definitions frombase/(see above)
- Fundamental Styles:
$THIS/node_modules/fundamental-styles/dist/*.csscontains theme-independent component skeleton CSS, using parameters from theming-base-content as CSS custom properties, as well as CSS custom properties defined intheming/(see below)$THIS/node_modules/fundamental-styles/dist/theming/$THEME.csscontains theme-dependent values for the custom property definitions used indist/*.css(see above); never report those Fundamental Styles-specific internal CSS custom properties$THIS/node_modules/@fundamental-styles/common-css/dist/*.csstheme-independent helper CSS, using parameters from theming-base-content as CSS custom properties
- Base: (with
$LIBRARYbeing e.g.baseLib, and$THEMEbeing e.g.sap_horizon)$THIS/node_modules/@sap-theming/theming-base-content/contentis a theme repository as described in https://raw.githubusercontent.com/SAP-docs/btp-ui-theme-designer/main/docs/cf/About-Themes/overview-of-sap-theming-content-91ebfe2.md, containingBase/; used by all frameworks$THIS/node_modules/@sap-theming/theming-base-content/content/Base/.themingcontains metadata about theBaseframework$THIS/node_modules/@sap-theming/theming-base-content/content/Base/$LIBRARY/.themingcontains metadata about libraries$THIS/node_modules/@sap-theming/theming-base-content/content/Base/$LIBRARY/$THEME/.themingcontains metadata about themes- Metadata includes
sEntity: "Framework", "Library" or "Theme"sType(for themes): "STANDARD" (= single theme) or "SET" (= no CSS, just references to different themes ofsType=STANDARD)aFiles: LESS source filesaBuildFiles: CSS files built fromaFiles*sBase{Library,Theme,File}Id: ID of the most important library/theme/fileoExtends: the$FRAMEWORK[.$LIBRARY[.$THEME[.$FILE]]]"object path" of the parent entitysSourcePathPattern: pattern to resolve object paths to file paths- (optional)
bIgnore=true: entity is ignored from theming
Procedure
- Determine the SAP theme the users question targets, present the available theme IDs from
$THIS/node_modules/@sap-theming/theming-base-content/content/Base/baseLibas select options if unclear, default tosap_horizon - Determine the framework the user's question targets. Present the frameworks from "Context" as select options if unclear, applying these defaults:
- framework stated: use that
- component stated, no framework:
- search UI5 Web Components for a CSS file for the component; if found use UI5 Web Components as primary source
- additionally search Base for parameters matching
sap$COMPONENT_*: report any such parameters not already referenced in UI5 Web Components as supplementary, labelled "defined in theming-base-content, not yet referenced in UI5 Web Components CSS"
- no component, no framework: use Base
- Read the
.themingfile of the framework the users question targets, determinesBaseLibraryIdandsSourcePathPattern - Read the
.themingfile of the theme of thesBaseLibraryof the framework the users question targets, based onsSourcePathPatternof the frameworks.themingfile - While there is an
oExtends:- Read the
.themingfile of the theme referenced byoExtends; if you haven't encountered the framework (the first section of the Object Path) before, read the framework.themingfirst to determine itssSourcePathPattern - Merge the
.themingJSON with what you already have from the theme.themingfiles: if a key already exists, leave it untouched; add key+value if the key does not yet exist
- Read the
- Read the
${sBaseFileId}.lessfile (sBaseFileIdcomes from the merged.themingfiles) of the theme of thesBaseLibraryof the framework the users question targets - For each LESS
@importstatement, recursively:- Read the referenced LESS file
- Replace the
@importstatement with the read content
- In the merged LESS file, map the lines
// [<Annotation> <required: Value> <optional: More Values>]that precede parameter definitions to that parameter:- If a parameter is defined multiple times, merge those annotations
- If an annotation already exists: append the value to the existing annotation values
- If an annotation has values for which it also has "anti-values" (the same value but starting with a
!, e.g. "Protected" and "!Protected"), remove both values from the values list - If an annotation values list is empty, remove the annotation
- If the user targets "UI5 Web Components", for each relevant component look up the three CSS sources:
- the theme-independent skeleton at
webcomponents/packages/*/src/themes/<component>.css, merged with - the always-used base parameters at
webcomponents/packages/*/src/themes/base/<component>-parameters.css, then with - the theme-specific delta at
webcomponents/packages/*/src/themes/<theme>/<component>-parameters.css
- the theme-independent skeleton at
- If the user targets "Fundamental Styles", scan
fundamental-styles/packages/*/src/**/*.scssfor the relevant component; theme-specific values come from the CSS custom properties intheming-base-content/content/Base/baseLib/<theme>/css_variables.css - Answer the users question based on the information collected