@wordpress/theme 0.4.0 → 0.4.1-next.76cff8c98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE.md +1 -1
- package/README.md +97 -33
- package/build/color-ramps/{index.js → index.cjs} +9 -9
- package/build/color-ramps/index.cjs.map +7 -0
- package/build/color-ramps/lib/{color-utils.js → color-utils.cjs} +3 -3
- package/build/color-ramps/lib/color-utils.cjs.map +7 -0
- package/build/color-ramps/lib/{constants.js → constants.cjs} +2 -2
- package/build/color-ramps/lib/{default-ramps.js → default-ramps.cjs} +1 -1
- package/build/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.cjs} +6 -6
- package/build/color-ramps/lib/{index.js → index.cjs} +7 -7
- package/build/color-ramps/lib/index.cjs.map +7 -0
- package/build/color-ramps/lib/{ramp-configs.js → ramp-configs.cjs} +1 -1
- package/build/color-ramps/lib/{register-color-spaces.js → register-color-spaces.cjs} +1 -1
- package/build/color-ramps/lib/{taper-chroma.js → taper-chroma.cjs} +4 -4
- package/build/color-ramps/lib/{taper-chroma.js.map → taper-chroma.cjs.map} +2 -2
- package/build/color-ramps/lib/{types.js → types.cjs} +1 -1
- package/build/color-ramps/lib/{utils.js → utils.cjs} +4 -4
- package/build/{context.js → context.cjs} +1 -1
- package/build/{index.js → index.cjs} +2 -2
- package/build/index.cjs.map +7 -0
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/prebuilt/js/{design-tokens.js → design-tokens.cjs} +16 -14
- package/build/prebuilt/js/design-tokens.cjs.map +7 -0
- package/build/prebuilt/ts/{color-tokens.js → color-tokens.cjs} +1 -1
- package/build/prebuilt/ts/color-tokens.cjs.map +7 -0
- package/build/prebuilt/ts/token-types.cjs +18 -0
- package/build/prebuilt/ts/token-types.cjs.map +7 -0
- package/build/{private-apis.js → private-apis.cjs} +4 -4
- package/build/stylelint-plugins/no-setting-wpds-custom-properties.cjs +69 -0
- package/build/stylelint-plugins/no-setting-wpds-custom-properties.cjs.map +7 -0
- package/build/stylelint-plugins/no-unknown-ds-tokens.cjs +98 -0
- package/build/stylelint-plugins/no-unknown-ds-tokens.cjs.map +7 -0
- package/build/{theme-provider.js → theme-provider.cjs} +3 -3
- package/build/{types.js → types.cjs} +1 -1
- package/build/{use-theme-provider-styles.js → use-theme-provider-styles.cjs} +19 -35
- package/build/use-theme-provider-styles.cjs.map +7 -0
- package/build-module/color-ramps/{index.js → index.mjs} +10 -10
- package/build-module/color-ramps/index.mjs.map +7 -0
- package/build-module/color-ramps/lib/{color-utils.js → color-utils.mjs} +3 -3
- package/build-module/color-ramps/lib/color-utils.mjs.map +7 -0
- package/build-module/color-ramps/lib/{constants.js → constants.mjs} +2 -2
- package/build-module/color-ramps/lib/{default-ramps.js → default-ramps.mjs} +1 -1
- package/build-module/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.mjs} +6 -6
- package/build-module/color-ramps/lib/{index.js → index.mjs} +7 -8
- package/build-module/color-ramps/lib/index.mjs.map +7 -0
- package/build-module/color-ramps/lib/{ramp-configs.js → ramp-configs.mjs} +1 -1
- package/build-module/color-ramps/lib/{register-color-spaces.js → register-color-spaces.mjs} +1 -1
- package/build-module/color-ramps/lib/{taper-chroma.js → taper-chroma.mjs} +4 -4
- package/build-module/color-ramps/lib/{taper-chroma.js.map → taper-chroma.mjs.map} +2 -2
- package/build-module/color-ramps/lib/types.mjs +1 -0
- package/build-module/color-ramps/lib/{utils.js → utils.mjs} +4 -4
- package/build-module/{context.js → context.mjs} +1 -1
- package/build-module/index.mjs +6 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/prebuilt/js/{design-tokens.js → design-tokens.mjs} +16 -14
- package/build-module/prebuilt/js/design-tokens.mjs.map +7 -0
- package/build-module/prebuilt/ts/{color-tokens.js → color-tokens.mjs} +1 -1
- package/build-module/prebuilt/ts/color-tokens.mjs.map +7 -0
- package/build-module/prebuilt/ts/token-types.mjs +1 -0
- package/build-module/{private-apis.js → private-apis.mjs} +4 -4
- package/build-module/stylelint-plugins/no-setting-wpds-custom-properties.mjs +39 -0
- package/build-module/stylelint-plugins/no-setting-wpds-custom-properties.mjs.map +7 -0
- package/build-module/stylelint-plugins/no-unknown-ds-tokens.mjs +68 -0
- package/build-module/stylelint-plugins/no-unknown-ds-tokens.mjs.map +7 -0
- package/build-module/{theme-provider.js → theme-provider.mjs} +3 -3
- package/build-module/types.mjs +1 -0
- package/build-module/types.mjs.map +7 -0
- package/build-module/{use-theme-provider-styles.js → use-theme-provider-styles.mjs} +21 -37
- package/build-module/use-theme-provider-styles.mjs.map +7 -0
- package/build-types/color-ramps/lib/color-utils.d.ts +1 -1
- package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -1
- package/build-types/color-ramps/lib/constants.d.ts +2 -2
- package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/prebuilt/js/{design-tokens.d.ts → design-tokens.d.mts} +1 -1
- package/build-types/prebuilt/js/design-tokens.d.mts.map +1 -0
- package/build-types/prebuilt/ts/color-tokens.d.ts +0 -4
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -1
- package/build-types/prebuilt/ts/token-types.d.ts +65 -0
- package/build-types/prebuilt/ts/token-types.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts +1 -1
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.mts +4 -0
- package/build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.mts.map +1 -0
- package/build-types/stylelint-plugins/no-unknown-ds-tokens.d.mts +4 -0
- package/build-types/stylelint-plugins/no-unknown-ds-tokens.d.mts.map +1 -0
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/package.json +42 -12
- package/src/color-ramps/index.ts +2 -2
- package/src/color-ramps/lib/color-utils.ts +1 -1
- package/src/color-ramps/lib/index.ts +1 -2
- package/src/color-ramps/lib/taper-chroma.ts +2 -2
- package/src/color-ramps/stories/index.story.tsx +1 -1
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +7060 -7041
- package/src/color-ramps/test/index.test.ts +14 -23
- package/src/index.ts +2 -1
- package/src/prebuilt/css/design-tokens.css +14 -12
- package/src/prebuilt/js/{design-tokens.js → design-tokens.mjs} +16 -14
- package/src/prebuilt/ts/color-tokens.ts +1 -1
- package/src/prebuilt/ts/token-types.ts +179 -0
- package/src/stories/index.story.tsx +1 -1
- package/src/stylelint-plugins/no-setting-wpds-custom-properties.mjs +45 -0
- package/src/stylelint-plugins/no-unknown-ds-tokens.mjs +101 -0
- package/src/stylelint-plugins/test/.stylelintignore +1 -0
- package/src/stylelint-plugins/test/.stylelintrc.json +10 -0
- package/src/stylelint-plugins/test/__snapshots__/no-setting-wpds-custom-properties.test.ts.snap +24 -0
- package/src/stylelint-plugins/test/__snapshots__/no-unknown-ds-tokens.test.ts.snap +24 -0
- package/src/stylelint-plugins/test/fixtures/no-setting-wpds-custom-properties-invalid.css +9 -0
- package/src/stylelint-plugins/test/fixtures/no-setting-wpds-custom-properties-valid.css +12 -0
- package/src/stylelint-plugins/test/fixtures/no-unknown-ds-tokens-invalid.css +9 -0
- package/src/stylelint-plugins/test/fixtures/no-unknown-ds-tokens-valid.css +19 -0
- package/src/stylelint-plugins/test/no-setting-wpds-custom-properties.test.ts +47 -0
- package/src/stylelint-plugins/test/no-unknown-ds-tokens.test.ts +47 -0
- package/src/stylelint-plugins/test/utils/index.ts +29 -0
- package/src/use-theme-provider-styles.ts +19 -30
- package/bin/generate-default-ramps/index.ts +0 -49
- package/bin/generate-primitive-tokens/index.ts +0 -113
- package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +0 -84
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +0 -113
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +0 -52
- package/bin/terrazzo-plugin-mode-overrides/index.ts +0 -208
- package/build/color-ramps/index.js.map +0 -7
- package/build/color-ramps/lib/color-utils.js.map +0 -7
- package/build/color-ramps/lib/index.js.map +0 -7
- package/build/index.js.map +0 -7
- package/build/prebuilt/js/design-tokens.js.map +0 -7
- package/build/prebuilt/ts/color-tokens.js.map +0 -7
- package/build/use-theme-provider-styles.js.map +0 -7
- package/build-module/color-ramps/index.js.map +0 -7
- package/build-module/color-ramps/lib/color-utils.js.map +0 -7
- package/build-module/color-ramps/lib/index.js.map +0 -7
- package/build-module/color-ramps/lib/types.js +0 -1
- package/build-module/index.js +0 -6
- package/build-module/index.js.map +0 -7
- package/build-module/prebuilt/js/design-tokens.js.map +0 -7
- package/build-module/prebuilt/ts/color-tokens.js.map +0 -7
- package/build-module/types.js +0 -1
- package/build-module/use-theme-provider-styles.js.map +0 -7
- package/build-types/prebuilt/js/design-tokens.d.ts.map +0 -1
- package/docs/ds-tokens.md +0 -176
- package/terrazzo.config.ts +0 -123
- package/tokens/border.json +0 -56
- package/tokens/color.json +0 -1559
- package/tokens/dimension.json +0 -169
- package/tokens/elevation.json +0 -201
- package/tokens/modes/border.high-dpi.json +0 -15
- package/tokens/modes/dimension.comfortable.json +0 -54
- package/tokens/modes/dimension.compact.json +0 -54
- package/tokens/typography.json +0 -93
- package/tsconfig.bin.json +0 -13
- package/tsconfig.bin.tsbuildinfo +0 -1
- package/tsconfig.json +0 -11
- package/tsconfig.src.json +0 -9
- package/tsconfig.src.tsbuildinfo +0 -1
- /package/build/color-ramps/lib/{constants.js.map → constants.cjs.map} +0 -0
- /package/build/color-ramps/lib/{default-ramps.js.map → default-ramps.cjs.map} +0 -0
- /package/build/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.cjs.map} +0 -0
- /package/build/color-ramps/lib/{ramp-configs.js.map → ramp-configs.cjs.map} +0 -0
- /package/build/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.cjs.map} +0 -0
- /package/build/color-ramps/lib/{types.js.map → types.cjs.map} +0 -0
- /package/build/color-ramps/lib/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/{context.js.map → context.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
- /package/build/{theme-provider.js.map → theme-provider.cjs.map} +0 -0
- /package/build/{types.js.map → types.cjs.map} +0 -0
- /package/build-module/color-ramps/lib/{constants.js.map → constants.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{default-ramps.js.map → default-ramps.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{ramp-configs.js.map → ramp-configs.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{types.js.map → types.mjs.map} +0 -0
- /package/build-module/color-ramps/lib/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/{context.js.map → context.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/{types.js.map → prebuilt/ts/token-types.mjs.map} +0 -0
- /package/build-module/{private-apis.js.map → private-apis.mjs.map} +0 -0
- /package/build-module/{theme-provider.js.map → theme-provider.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/color-ramps/lib/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tclone,\n\tget,\n\tOKLCH,\n\tset,\n\ttype ColorTypes,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { clampToGamut, getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: PlainColorObject;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record< keyof Ramp, string >;\n\tlet warnings: string[] | undefined;\n\tlet maxDeficit = -Infinity;\n\tlet maxDeficitDirection: RampDirection = 'lighter';\n\tlet maxDeficitStep;\n\n\t// Keep track of the calculated colors, as they are going to be useful\n\t// when other colors reference them.\n\tconst calculatedColors = new Map< keyof Ramp | 'seed', PlainColorObject >();\n\tcalculatedColors.set( 'seed', seed );\n\n\tfor ( const stepName of sortedSteps ) {\n\t\tconst {\n\t\t\tcontrast,\n\t\t\tlightness: stepLightnessConstraint,\n\t\t\ttaperChromaOptions,\n\t\t\tsameAsIfPossible,\n\t\t} = config[ stepName ];\n\n\t\tconst referenceColor = calculatedColors.get( contrast.reference );\n\t\tif ( ! referenceColor ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Reference color for step ${ stepName } not found: ${ contrast.reference }`\n\t\t\t);\n\t\t}\n\n\t\t// Check if we can reuse color from the `sameAsIfPossible` config option\n\t\tif ( sameAsIfPossible ) {\n\t\t\tconst candidateColor = calculatedColors.get( sameAsIfPossible );\n\t\t\tif ( ! candidateColor ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Same-as color for step ${ stepName } not found: ${ sameAsIfPossible }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst candidateContrast = getContrast(\n\t\t\t\treferenceColor,\n\t\t\t\tcandidateColor\n\t\t\t);\n\t\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\t\t\t// If the candidate meets the contrast requirement, use it\n\t\t\tif ( candidateContrast >= adjustedTarget ) {\n\t\t\t\t// Store the reused color\n\t\t\t\tcalculatedColors.set( stepName, candidateColor );\n\t\t\t\trampResults[ stepName ] = getColorString( candidateColor );\n\n\t\t\t\tcontinue; // Skip to next step\n\t\t\t}\n\t\t}\n\n\t\tfunction computeDirection(\n\t\t\tcolor: ColorTypes,\n\t\t\tfollowDirection: FollowDirection\n\t\t): RampDirection {\n\t\t\tif ( followDirection === 'main' ) {\n\t\t\t\treturn mainDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'opposite' ) {\n\t\t\t\treturn oppDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'best' ) {\n\t\t\t\treturn computeBetterFgColorDirection(\n\t\t\t\t\tcolor,\n\t\t\t\t\tcontrast.preferLighter\n\t\t\t\t).better;\n\t\t\t}\n\n\t\t\treturn followDirection;\n\t\t}\n\n\t\tconst computedDir = computeDirection(\n\t\t\treferenceColor,\n\t\t\tcontrast.followDirection\n\t\t);\n\n\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\n\t\t// Define the lightness constraint, if needed.\n\t\tlet lightnessConstraint;\n\t\tif ( pinLightness?.stepName === stepName ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: pinLightness.value,\n\t\t\t\ttype: 'force',\n\t\t\t} as const;\n\t\t} else if ( stepLightnessConstraint ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: stepLightnessConstraint( computedDir ),\n\t\t\t\ttype: 'onlyIfSucceeds',\n\t\t\t} as const;\n\t\t}\n\n\t\t// Calculate the color meeting the requirements\n\t\tconst searchResults = findColorMeetingRequirements(\n\t\t\treferenceColor,\n\t\t\tseed,\n\t\t\tadjustedTarget,\n\t\t\tcomputedDir,\n\t\t\t{\n\t\t\t\tlightnessConstraint,\n\t\t\t\ttaperChromaOptions,\n\t\t\t}\n\t\t);\n\n\t\t// When the target contrast is not met, take note of it and use\n\t\t// that information to guide the ramp calculation bisection.\n\t\tif (\n\t\t\t! contrast.ignoreWhenAdjustingSeed &&\n\t\t\tsearchResults.deficit &&\n\t\t\tsearchResults.deficit > maxDeficit\n\t\t) {\n\t\t\tmaxDeficit = searchResults.deficit;\n\t\t\tmaxDeficitDirection = computedDir;\n\t\t\tmaxDeficitStep = stepName;\n\t\t}\n\n\t\t// Store calculated color for future dependencies\n\t\tcalculatedColors.set( stepName, searchResults.color );\n\n\t\t// Add to results\n\t\trampResults[ stepName ] = getColorString( searchResults.color );\n\n\t\tif ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {\n\t\t\twarnings ??= [];\n\t\t\twarnings.push( stepName );\n\t\t}\n\t}\n\n\treturn {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t};\n}\n\nexport function buildRamp(\n\tseedArg: string,\n\tconfig: RampConfig,\n\t{\n\t\tmainDirection,\n\t\tpinLightness,\n\t\trescaleToFitContrastTargets = true,\n\t}: {\n\t\tmainDirection?: RampDirection;\n\t\tpinLightness?: {\n\t\t\tstepName: keyof Ramp;\n\t\t\tvalue: number;\n\t\t};\n\t\trescaleToFitContrastTargets?: boolean;\n\t} = {}\n): RampResult {\n\tlet seed: PlainColorObject;\n\ttry {\n\t\tseed = clampToGamut( seedArg );\n\t} catch ( error ) {\n\t\tthrow new Error(\n\t\t\t`Invalid seed color \"${ seedArg }\": ${\n\t\t\t\terror instanceof Error ? error.message : 'Unknown error'\n\t\t\t}`\n\t\t);\n\t}\n\n\tlet mainDir: RampDirection = 'lighter';\n\tlet oppDir: RampDirection = 'darker';\n\n\tif ( mainDirection ) {\n\t\tmainDir = mainDirection;\n\t\toppDir = mainDirection === 'darker' ? 'lighter' : 'darker';\n\t} else {\n\t\tconst { better, worse } = computeBetterFgColorDirection( seed );\n\t\tmainDir = better;\n\t\toppDir = worse;\n\t}\n\n\t// Get the correct calculation order based on dependencies\n\tconst sortedSteps = sortByDependency( config );\n\n\t// Calculate the ramp with the initial seed.\n\tconst {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t} = calculateRamp( {\n\t\tseed,\n\t\tsortedSteps,\n\t\tconfig,\n\t\tmainDir,\n\t\toppDir,\n\t\tpinLightness,\n\t} );\n\n\tlet bestRamp = rampResults;\n\n\tif ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {\n\t\tconst iterSteps = stepsForStep( maxDeficitStep!, config );\n\n\t\tfunction getSeedForL( l: number ): PlainColorObject {\n\t\t\treturn clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );\n\t\t}\n\n\t\tfunction getDeficitForSeed( s: PlainColorObject ): number {\n\t\t\tconst iterationResults = calculateRamp( {\n\t\t\t\tseed: s,\n\t\t\t\tsortedSteps: iterSteps,\n\t\t\t\tconfig,\n\t\t\t\tmainDir,\n\t\t\t\toppDir,\n\t\t\t\tpinLightness,\n\t\t\t} );\n\n\t\t\t// If the constraints start failing in the opposite direction to the original\n\t\t\t// iteration's direction, that means we've moved too far away from the target.\n\t\t\t// Don't use the `maxDeficit` value because it's not related to our search,\n\t\t\t// and might even be positive, which would confuse the bisection algorithm.\n\t\t\treturn iterationResults.maxDeficitDirection === maxDeficitDirection\n\t\t\t\t? iterationResults.maxDeficit\n\t\t\t\t: -maxDeficit;\n\t\t}\n\n\t\t// For a scale with the \"lighter\" direction, the contrast can be improved\n\t\t// by darkening the seed. For \"darker\" direction, by lightening the seed.\n\t\tconst lowerSeedL = maxDeficitDirection === 'lighter' ? 0 : 1;\n\t\tconst lowerDeficit = -maxDeficit;\n\t\tconst upperSeedL = get( seed, [ OKLCH, 'l' ] );\n\t\tconst upperDeficit = maxDeficit;\n\n\t\tconst bestSeed = solveWithBisect(\n\t\t\tgetSeedForL,\n\t\t\tgetDeficitForSeed,\n\t\t\tlowerSeedL,\n\t\t\tlowerDeficit,\n\t\t\tupperSeedL,\n\t\t\tupperDeficit\n\t\t);\n\n\t\t// Calculate the final ramp with adjusted seed.\n\t\tbestRamp = calculateRamp( {\n\t\t\tseed: bestSeed,\n\t\t\tsortedSteps,\n\t\t\tconfig,\n\t\t\tmainDir,\n\t\t\toppDir,\n\t\t\tpinLightness,\n\t\t} ).rampResults;\n\t}\n\n\t// Swap surface1 and surface3 for darker ramps to maintain visual elevation hierarchy.\n\t// This ensures surface1 appears \"behind\" surface2, and surface3 appears \"in front\",\n\t// regardless of the ramp's main direction.\n\tif ( mainDir === 'darker' ) {\n\t\tconst tmpSurface1 = bestRamp.surface1;\n\t\tbestRamp.surface1 = bestRamp.surface3;\n\t\tbestRamp.surface3 = tmpSurface1;\n\t}\n\n\treturn {\n\t\tramp: bestRamp,\n\t\twarnings,\n\t\tdirection: mainDir,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAKP,OAAO;AACP,SAAS,cAAc,aAAa,sBAAsB;AAC1D,SAAS,oCAAoC;AAC7C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AA,IACA,WAAW;AAAA,EACZ;AACD;",
|
|
6
|
+
"names": ["adjustedTarget"]
|
|
7
|
+
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
OKLCH,
|
|
6
6
|
sRGB
|
|
7
7
|
} from "colorjs.io/fn";
|
|
8
|
-
import "./register-color-spaces";
|
|
8
|
+
import "./register-color-spaces.mjs";
|
|
9
9
|
function taperChroma(seed, lTarget, options = {}) {
|
|
10
10
|
const gamut = options.gamut ?? sRGB;
|
|
11
11
|
const alpha = options.alpha ?? 0.65;
|
|
@@ -17,9 +17,9 @@ function taperChroma(seed, lTarget, options = {}) {
|
|
|
17
17
|
const kDark = options.kDark ?? 0.85;
|
|
18
18
|
const achromaEpsilon = options.achromaEpsilon ?? 5e-3;
|
|
19
19
|
const cSeed = Math.max(0, get(seed, [OKLCH, "c"]));
|
|
20
|
-
let hSeed =
|
|
20
|
+
let hSeed = get(seed, [OKLCH, "h"]);
|
|
21
21
|
const chromaIsTiny = cSeed < achromaEpsilon;
|
|
22
|
-
const hueIsInvalid = !Number.isFinite(hSeed);
|
|
22
|
+
const hueIsInvalid = hSeed === null || !Number.isFinite(hSeed);
|
|
23
23
|
if (chromaIsTiny || hueIsInvalid) {
|
|
24
24
|
if (typeof options.hueFallback === "number") {
|
|
25
25
|
hSeed = normalizeHue(options.hueFallback);
|
|
@@ -119,4 +119,4 @@ function maxInGamutChromaAtLH(l, h, gamutSpace, cap) {
|
|
|
119
119
|
export {
|
|
120
120
|
taperChroma
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=taper-chroma.
|
|
122
|
+
//# sourceMappingURL=taper-chroma.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/taper-chroma.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tget,\n\ttoGamut,\n\tOKLCH,\n\tsRGB,\n\ttype PlainColorObject,\n\ttype ColorSpace,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\nexport interface TaperChromaOptions {\n\tgamut?: ColorSpace; // target gamut (default `sRGB`)\n\talpha?: number; // base fraction of Cmax at target (default 0.62)\n\tcarry?: number; // seed vividness carry exponent \u03B2 in [0..1] (default 0.5)\n\tcUpperBound?: number; // hard search cap for C (default 0.45)\n\t// Continuous taper around the seed (desaturate both sides slightly)\n\tradiusLight?: number; // distance in L where kLight is reached (default 0.20)\n\tradiusDark?: number; // distance in L where kDark is reached (default 0.20)\n\tkLight?: number; // floor multiplier near lighter side (default 0.85)\n\tkDark?: number; // floor multiplier near darker side (default 0.85)\n\t// Achromatic handling\n\thueFallback?: number; // degrees: if seed is achromatic and you still want color\n\tachromaEpsilon?: number; // \u2264 this chroma \u2192 treat as achromatic (default 0.005)\n}\n\n/**\n * Given the seed and the target lightness, tapers the chroma smoothly.\n * - C_intended = Cmax(Lt,H0) * alpha * (seedRelative^carry)\n * - Continuous taper vs |Lt - Ls| to softly reduce chroma for neighbors\n * - Downward-only clamp on C (preserve L & H)\n * @param seed\n * @param lTarget\n * @param options\n */\nexport function taperChroma(\n\tseed: PlainColorObject, // already OKLCH\n\tlTarget: number, // [0..1]\n\toptions: TaperChromaOptions = {}\n): { l: number; c: number } | PlainColorObject {\n\tconst gamut = options.gamut ?? sRGB;\n\tconst alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface\n\tconst carry = options.carry ?? 0.5;\n\tconst cUpperBound = options.cUpperBound ?? 0.45;\n\tconst radiusLight = options.radiusLight ?? 0.2;\n\tconst radiusDark = options.radiusDark ?? 0.2;\n\tconst kLight = options.kLight ?? 0.85;\n\tconst kDark = options.kDark ?? 0.85;\n\tconst achromaEpsilon = options.achromaEpsilon ?? 0.005;\n\n\tconst cSeed = Math.max( 0, get( seed, [ OKLCH, 'c' ] ) );\n\tlet hSeed =
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAKP,OAAO;AA0BA,SAAS,YACf,MACA,SACA,UAA8B,CAAC,GACe;AAC9C,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,iBAAiB,QAAQ,kBAAkB;AAEjD,QAAM,QAAQ,KAAK,IAAK,GAAG,IAAK,MAAM,CAAE,OAAO,GAAI,CAAE,CAAE;AACvD,MAAI,QAAQ,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tget,\n\ttoGamut,\n\tOKLCH,\n\tsRGB,\n\ttype PlainColorObject,\n\ttype ColorSpace,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\nexport interface TaperChromaOptions {\n\tgamut?: ColorSpace; // target gamut (default `sRGB`)\n\talpha?: number; // base fraction of Cmax at target (default 0.62)\n\tcarry?: number; // seed vividness carry exponent \u03B2 in [0..1] (default 0.5)\n\tcUpperBound?: number; // hard search cap for C (default 0.45)\n\t// Continuous taper around the seed (desaturate both sides slightly)\n\tradiusLight?: number; // distance in L where kLight is reached (default 0.20)\n\tradiusDark?: number; // distance in L where kDark is reached (default 0.20)\n\tkLight?: number; // floor multiplier near lighter side (default 0.85)\n\tkDark?: number; // floor multiplier near darker side (default 0.85)\n\t// Achromatic handling\n\thueFallback?: number; // degrees: if seed is achromatic and you still want color\n\tachromaEpsilon?: number; // \u2264 this chroma \u2192 treat as achromatic (default 0.005)\n}\n\n/**\n * Given the seed and the target lightness, tapers the chroma smoothly.\n * - C_intended = Cmax(Lt,H0) * alpha * (seedRelative^carry)\n * - Continuous taper vs |Lt - Ls| to softly reduce chroma for neighbors\n * - Downward-only clamp on C (preserve L & H)\n * @param seed\n * @param lTarget\n * @param options\n */\nexport function taperChroma(\n\tseed: PlainColorObject, // already OKLCH\n\tlTarget: number, // [0..1]\n\toptions: TaperChromaOptions = {}\n): { l: number; c: number } | PlainColorObject {\n\tconst gamut = options.gamut ?? sRGB;\n\tconst alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface\n\tconst carry = options.carry ?? 0.5;\n\tconst cUpperBound = options.cUpperBound ?? 0.45;\n\tconst radiusLight = options.radiusLight ?? 0.2;\n\tconst radiusDark = options.radiusDark ?? 0.2;\n\tconst kLight = options.kLight ?? 0.85;\n\tconst kDark = options.kDark ?? 0.85;\n\tconst achromaEpsilon = options.achromaEpsilon ?? 0.005;\n\n\tconst cSeed = Math.max( 0, get( seed, [ OKLCH, 'c' ] ) );\n\tlet hSeed = get( seed, [ OKLCH, 'h' ] );\n\n\tconst chromaIsTiny = cSeed < achromaEpsilon;\n\tconst hueIsInvalid = hSeed === null || ! Number.isFinite( hSeed );\n\n\tif ( chromaIsTiny || hueIsInvalid ) {\n\t\tif ( typeof options.hueFallback === 'number' ) {\n\t\t\thSeed = normalizeHue( options.hueFallback );\n\t\t} else {\n\t\t\t// Respect achromatic intent: grayscale at target L\n\t\t\treturn {\n\t\t\t\tspace: OKLCH,\n\t\t\t\tcoords: [ clamp01( lTarget ), 0, 0 ],\n\t\t\t\talpha: 1,\n\t\t\t};\n\t\t}\n\t}\n\n\t// Capacity at seed and target\n\tconst lSeed = clamp01( get( seed, [ OKLCH, 'l' ] ) );\n\tconst cmaxSeed = getCachedMaxChromaAtLH( lSeed, hSeed, gamut, cUpperBound );\n\tconst cmaxTarget = getCachedMaxChromaAtLH(\n\t\tclamp01( lTarget ),\n\t\thSeed,\n\t\tgamut,\n\t\tcUpperBound\n\t);\n\n\t// Seed vividness ratio (hue-fair normalization)\n\tlet seedRelative = 0;\n\tconst denom = cmaxSeed > 0 ? cmaxSeed : 1e-6;\n\tseedRelative = clamp01( cSeed / denom );\n\n\t// Intended chroma from local capacity, tempered by seed vividness\n\tconst cIntendedBase = alpha * cmaxTarget;\n\tconst cWithCarry =\n\t\tcIntendedBase * Math.pow( seedRelative, clamp01( carry ) );\n\n\t// Gentle, symmetric desaturation vs distance in L\n\tconst t = continuousTaper( lSeed, lTarget, {\n\t\tradiusLight,\n\t\tradiusDark,\n\t\tkLight,\n\t\tkDark,\n\t} );\n\tconst cPlanned = cWithCarry * t;\n\n\t// Downward-only clamp (preserve L & H)\n\tconst lOut = clamp01( lTarget );\n\n\treturn { l: lOut, c: cPlanned };\n}\n\n/* ---------------- helpers & caches ---------------- */\n\nfunction clamp01( x: number ): number {\n\tif ( x < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( x > 1 ) {\n\t\treturn 1;\n\t}\n\treturn x;\n}\nfunction normalizeHue( h: number ): number {\n\tlet hue = h % 360;\n\tif ( hue < 0 ) {\n\t\thue += 360;\n\t}\n\treturn hue;\n}\nfunction raisedCosine( u: number ): number {\n\tconst x = clamp01( u );\n\treturn 0.5 - 0.5 * Math.cos( Math.PI * x );\n}\n\n/**\n * smooth, distance-from-seed chroma taper (raised-cosine per side)\n * @param seedL\n * @param targetL\n * @param opts\n * @param opts.radiusLight\n * @param opts.radiusDark\n * @param opts.kLight\n * @param opts.kDark\n */\nfunction continuousTaper(\n\tseedL: number,\n\ttargetL: number,\n\topts: {\n\t\tradiusLight: number;\n\t\tradiusDark: number;\n\t\tkLight: number;\n\t\tkDark: number;\n\t}\n): number {\n\tconst d = targetL - seedL;\n\tif ( d >= 0 ) {\n\t\tconst u = opts.radiusLight > 0 ? Math.abs( d ) / opts.radiusLight : 1;\n\t\tconst w = raisedCosine( u > 1 ? 1 : u );\n\t\treturn 1 - ( 1 - opts.kLight ) * w;\n\t}\n\tconst u = opts.radiusDark > 0 ? Math.abs( d ) / opts.radiusDark : 1;\n\tconst w = raisedCosine( u > 1 ? 1 : u );\n\treturn 1 - ( 1 - opts.kDark ) * w;\n}\n\n/* ---- chroma-capacity queries with small caches ---- */\n\nconst maxChromaCache = new Map< string, number >();\nfunction keyMax( l: number, h: number, gamut: string, cap: number ): string {\n\t// Quantize to keep cache compact\n\tconst lq = quantize( l, 0.05 );\n\tconst hq = quantize( normalizeHue( h ), 10 );\n\tconst cq = quantize( cap, 0.05 );\n\treturn `${ gamut }|L:${ lq }|H:${ hq }|cap:${ cq }`;\n}\n\nfunction quantize( x: number, step: number ): number {\n\tconst k = Math.round( x / step );\n\treturn k * step;\n}\n\nfunction getCachedMaxChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\tconst gamut = gamutSpace.id;\n\tconst key = keyMax( l, h, gamut, cap );\n\tconst hit = maxChromaCache.get( key );\n\tif ( typeof hit === 'number' ) {\n\t\treturn hit;\n\t}\n\n\tconst computed = maxInGamutChromaAtLH( l, h, gamutSpace, cap );\n\tmaxChromaCache.set( key, computed );\n\treturn computed;\n}\n\n/**\n * Find the max in-gamut chroma at fixed (L,H) in the target gamut\n * @param l\n * @param h\n * @param gamutSpace\n * @param cap\n */\nfunction maxInGamutChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: ColorSpace,\n\tcap: number\n): number {\n\t// Construct a color with maximum chroma.\n\tconst probe: PlainColorObject = {\n\t\tspace: OKLCH,\n\t\tcoords: [ l, cap, h ],\n\t\talpha: 1,\n\t};\n\n\t// Let `toGamut` reduce the chroma to the gamut maximum.\n\tconst clamped = toGamut( probe, { space: gamutSpace, method: 'css' } );\n\n\treturn get( clamped, [ OKLCH, 'c' ] );\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAKP,OAAO;AA0BA,SAAS,YACf,MACA,SACA,UAA8B,CAAC,GACe;AAC9C,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,QAAQ,QAAQ,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BACR,GACA,GACA,YACA,KACS;AACT,QAAM,QAAQ,WAAW;AACzB,QAAM,MAAM,OAAQ,GAAG,GAAG,OAAO,GAAI;AACrC,QAAM,MAAM,eAAe,IAAK,GAAI;AACpC,MAAK,OAAO,QAAQ,UAAW;AAC9B,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,qBAAsB,GAAG,GAAG,YAAY,GAAI;AAC7D,iBAAe,IAAK,KAAK,QAAS;AAClC,SAAO;AACR;AASA,SAAS,qBACR,GACA,GACA,YACA,KACS;AAET,QAAM,QAA0B;AAAA,IAC/B,OAAO;AAAA,IACP,QAAQ,CAAE,GAAG,KAAK,CAAE;AAAA,IACpB,OAAO;AAAA,EACR;AAGA,QAAM,UAAU,QAAS,OAAO,EAAE,OAAO,YAAY,QAAQ,MAAM,CAAE;AAErE,SAAO,IAAK,SAAS,CAAE,OAAO,GAAI,CAAE;AACrC;",
|
|
6
6
|
"names": ["u", "w"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/theme/src/color-ramps/lib/utils.ts
|
|
2
|
-
import "./register-color-spaces";
|
|
2
|
+
import "./register-color-spaces.mjs";
|
|
3
3
|
import {
|
|
4
4
|
WHITE,
|
|
5
5
|
BLACK,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS,
|
|
9
9
|
MAX_BISECTION_ITERATIONS,
|
|
10
10
|
CONTRAST_EPSILON
|
|
11
|
-
} from "./constants";
|
|
12
|
-
import { getContrast } from "./color-utils";
|
|
11
|
+
} from "./constants.mjs";
|
|
12
|
+
import { getContrast } from "./color-utils.mjs";
|
|
13
13
|
function buildDependencyGraph(config) {
|
|
14
14
|
const dependencies = /* @__PURE__ */ new Map();
|
|
15
15
|
const dependents = /* @__PURE__ */ new Map();
|
|
@@ -142,4 +142,4 @@ export {
|
|
|
142
142
|
sortByDependency,
|
|
143
143
|
stepsForStep
|
|
144
144
|
};
|
|
145
|
-
//# sourceMappingURL=utils.
|
|
145
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { privateApis } from './private-apis';\nexport type * from './prebuilt/ts/token-types';\nexport { type ThemeProvider } from './theme-provider';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,mBAAmB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/theme/src/prebuilt/js/design-tokens.
|
|
1
|
+
// packages/theme/src/prebuilt/js/design-tokens.mjs
|
|
2
2
|
var design_tokens_default = [
|
|
3
3
|
"--wpds-border-radius-surface-xs",
|
|
4
4
|
"--wpds-border-radius-surface-sm",
|
|
@@ -131,20 +131,22 @@ var design_tokens_default = [
|
|
|
131
131
|
"--wpds-font-family-heading",
|
|
132
132
|
"--wpds-font-family-body",
|
|
133
133
|
"--wpds-font-family-mono",
|
|
134
|
-
"--wpds-font-size-
|
|
135
|
-
"--wpds-font-size-
|
|
136
|
-
"--wpds-font-size-
|
|
137
|
-
"--wpds-font-size-
|
|
138
|
-
"--wpds-font-size-
|
|
139
|
-
"--wpds-font-size-
|
|
140
|
-
"--wpds-font-line-height-
|
|
141
|
-
"--wpds-font-line-height-
|
|
142
|
-
"--wpds-font-line-height-
|
|
143
|
-
"--wpds-font-line-height-
|
|
144
|
-
"--wpds-font-line-height-
|
|
145
|
-
"--wpds-font-line-height-
|
|
134
|
+
"--wpds-font-size-xs",
|
|
135
|
+
"--wpds-font-size-sm",
|
|
136
|
+
"--wpds-font-size-md",
|
|
137
|
+
"--wpds-font-size-lg",
|
|
138
|
+
"--wpds-font-size-xl",
|
|
139
|
+
"--wpds-font-size-2xl",
|
|
140
|
+
"--wpds-font-line-height-xs",
|
|
141
|
+
"--wpds-font-line-height-sm",
|
|
142
|
+
"--wpds-font-line-height-md",
|
|
143
|
+
"--wpds-font-line-height-lg",
|
|
144
|
+
"--wpds-font-line-height-xl",
|
|
145
|
+
"--wpds-font-line-height-2xl",
|
|
146
|
+
"--wpds-font-weight-regular",
|
|
147
|
+
"--wpds-font-weight-medium"
|
|
146
148
|
];
|
|
147
149
|
export {
|
|
148
150
|
design_tokens_default as default
|
|
149
151
|
};
|
|
150
|
-
//# sourceMappingURL=design-tokens.
|
|
152
|
+
//# sourceMappingURL=design-tokens.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/prebuilt/js/design-tokens.mjs"],
|
|
4
|
+
"sourcesContent": ["/*\n * This file is generated by the @wordpress/terrazzo-plugin-known-wpds-css-variables plugin.\n * Do not edit this file directly.\n */\n\nexport default [\n\t'--wpds-border-radius-surface-xs',\n\t'--wpds-border-radius-surface-sm',\n\t'--wpds-border-radius-surface-md',\n\t'--wpds-border-radius-surface-lg',\n\t'--wpds-border-width-surface-xs',\n\t'--wpds-border-width-surface-sm',\n\t'--wpds-border-width-surface-md',\n\t'--wpds-border-width-surface-lg',\n\t'--wpds-border-width-interactive-focus',\n\t'--wpds-color-bg-surface-neutral',\n\t'--wpds-color-bg-surface-neutral-strong',\n\t'--wpds-color-bg-surface-neutral-weak',\n\t'--wpds-color-bg-surface-brand',\n\t'--wpds-color-bg-surface-success',\n\t'--wpds-color-bg-surface-success-weak',\n\t'--wpds-color-bg-surface-info',\n\t'--wpds-color-bg-surface-info-weak',\n\t'--wpds-color-bg-surface-warning',\n\t'--wpds-color-bg-surface-warning-weak',\n\t'--wpds-color-bg-surface-caution',\n\t'--wpds-color-bg-surface-caution-weak',\n\t'--wpds-color-bg-surface-error',\n\t'--wpds-color-bg-surface-error-weak',\n\t'--wpds-color-bg-interactive-neutral',\n\t'--wpds-color-bg-interactive-neutral-active',\n\t'--wpds-color-bg-interactive-neutral-disabled',\n\t'--wpds-color-bg-interactive-neutral-strong',\n\t'--wpds-color-bg-interactive-neutral-strong-active',\n\t'--wpds-color-bg-interactive-neutral-strong-disabled',\n\t'--wpds-color-bg-interactive-neutral-weak',\n\t'--wpds-color-bg-interactive-neutral-weak-active',\n\t'--wpds-color-bg-interactive-neutral-weak-disabled',\n\t'--wpds-color-bg-interactive-brand',\n\t'--wpds-color-bg-interactive-brand-active',\n\t'--wpds-color-bg-interactive-brand-disabled',\n\t'--wpds-color-bg-interactive-brand-strong',\n\t'--wpds-color-bg-interactive-brand-strong-active',\n\t'--wpds-color-bg-interactive-brand-strong-disabled',\n\t'--wpds-color-bg-interactive-brand-weak',\n\t'--wpds-color-bg-interactive-brand-weak-active',\n\t'--wpds-color-bg-interactive-brand-weak-disabled',\n\t'--wpds-color-bg-interactive-error',\n\t'--wpds-color-bg-interactive-error-active',\n\t'--wpds-color-bg-interactive-error-disabled',\n\t'--wpds-color-bg-interactive-error-strong',\n\t'--wpds-color-bg-interactive-error-strong-active',\n\t'--wpds-color-bg-interactive-error-strong-disabled',\n\t'--wpds-color-bg-interactive-error-weak',\n\t'--wpds-color-bg-interactive-error-weak-active',\n\t'--wpds-color-bg-interactive-error-weak-disabled',\n\t'--wpds-color-bg-track-neutral-weak',\n\t'--wpds-color-bg-track-neutral',\n\t'--wpds-color-bg-thumb-neutral-weak',\n\t'--wpds-color-bg-thumb-neutral-weak-active',\n\t'--wpds-color-bg-thumb-brand',\n\t'--wpds-color-bg-thumb-brand-active',\n\t'--wpds-color-bg-thumb-brand-disabled',\n\t'--wpds-color-fg-content-neutral',\n\t'--wpds-color-fg-content-neutral-weak',\n\t'--wpds-color-fg-content-success',\n\t'--wpds-color-fg-content-success-weak',\n\t'--wpds-color-fg-content-info',\n\t'--wpds-color-fg-content-info-weak',\n\t'--wpds-color-fg-content-warning',\n\t'--wpds-color-fg-content-warning-weak',\n\t'--wpds-color-fg-content-caution',\n\t'--wpds-color-fg-content-caution-weak',\n\t'--wpds-color-fg-content-error',\n\t'--wpds-color-fg-content-error-weak',\n\t'--wpds-color-fg-interactive-neutral',\n\t'--wpds-color-fg-interactive-neutral-active',\n\t'--wpds-color-fg-interactive-neutral-disabled',\n\t'--wpds-color-fg-interactive-neutral-strong',\n\t'--wpds-color-fg-interactive-neutral-strong-active',\n\t'--wpds-color-fg-interactive-neutral-strong-disabled',\n\t'--wpds-color-fg-interactive-neutral-weak',\n\t'--wpds-color-fg-interactive-neutral-weak-disabled',\n\t'--wpds-color-fg-interactive-brand',\n\t'--wpds-color-fg-interactive-brand-active',\n\t'--wpds-color-fg-interactive-brand-disabled',\n\t'--wpds-color-fg-interactive-brand-strong',\n\t'--wpds-color-fg-interactive-brand-strong-active',\n\t'--wpds-color-fg-interactive-brand-strong-disabled',\n\t'--wpds-color-fg-interactive-error',\n\t'--wpds-color-fg-interactive-error-active',\n\t'--wpds-color-fg-interactive-error-disabled',\n\t'--wpds-color-fg-interactive-error-strong',\n\t'--wpds-color-fg-interactive-error-strong-active',\n\t'--wpds-color-fg-interactive-error-strong-disabled',\n\t'--wpds-color-stroke-surface-neutral',\n\t'--wpds-color-stroke-surface-neutral-weak',\n\t'--wpds-color-stroke-surface-neutral-strong',\n\t'--wpds-color-stroke-surface-brand',\n\t'--wpds-color-stroke-surface-brand-strong',\n\t'--wpds-color-stroke-surface-success',\n\t'--wpds-color-stroke-surface-success-strong',\n\t'--wpds-color-stroke-surface-info',\n\t'--wpds-color-stroke-surface-info-strong',\n\t'--wpds-color-stroke-surface-warning',\n\t'--wpds-color-stroke-surface-warning-strong',\n\t'--wpds-color-stroke-surface-error',\n\t'--wpds-color-stroke-surface-error-strong',\n\t'--wpds-color-stroke-interactive-neutral',\n\t'--wpds-color-stroke-interactive-neutral-active',\n\t'--wpds-color-stroke-interactive-neutral-disabled',\n\t'--wpds-color-stroke-interactive-neutral-strong',\n\t'--wpds-color-stroke-interactive-brand',\n\t'--wpds-color-stroke-interactive-brand-active',\n\t'--wpds-color-stroke-interactive-error',\n\t'--wpds-color-stroke-interactive-error-active',\n\t'--wpds-color-stroke-interactive-error-strong',\n\t'--wpds-color-stroke-focus-brand',\n\t'--wpds-dimension-base',\n\t'--wpds-dimension-padding-surface-2xs',\n\t'--wpds-dimension-padding-surface-xs',\n\t'--wpds-dimension-padding-surface-sm',\n\t'--wpds-dimension-padding-surface-md',\n\t'--wpds-dimension-padding-surface-lg',\n\t'--wpds-dimension-gap-2xs',\n\t'--wpds-dimension-gap-xs',\n\t'--wpds-dimension-gap-sm',\n\t'--wpds-dimension-gap-md',\n\t'--wpds-dimension-gap-lg',\n\t'--wpds-dimension-gap-xl',\n\t'--wpds-elevation-x-small',\n\t'--wpds-elevation-small',\n\t'--wpds-elevation-medium',\n\t'--wpds-elevation-large',\n\t'--wpds-font-family-heading',\n\t'--wpds-font-family-body',\n\t'--wpds-font-family-mono',\n\t'--wpds-font-size-xs',\n\t'--wpds-font-size-sm',\n\t'--wpds-font-size-md',\n\t'--wpds-font-size-lg',\n\t'--wpds-font-size-xl',\n\t'--wpds-font-size-2xl',\n\t'--wpds-font-line-height-xs',\n\t'--wpds-font-line-height-sm',\n\t'--wpds-font-line-height-md',\n\t'--wpds-font-line-height-lg',\n\t'--wpds-font-line-height-xl',\n\t'--wpds-font-line-height-2xl',\n\t'--wpds-font-weight-regular',\n\t'--wpds-font-weight-medium',\n];\n"],
|
|
5
|
+
"mappings": ";AAKA,IAAO,wBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/prebuilt/ts/color-tokens.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * This file is generated by the @wordpress/terrazzo-plugin-inline-alias-values plugin.\n * Do not edit this file directly.\n */\n\nexport default {\n\t'primary-bgFill1': [ 'bg-interactive-brand-strong' ],\n\t'primary-fgFill': [\n\t\t'fg-interactive-brand-strong',\n\t\t'fg-interactive-brand-strong-active',\n\t],\n\t'primary-bgFill2': [ 'bg-interactive-brand-strong-active' ],\n\t'primary-surface2': [ 'bg-interactive-brand-active' ],\n\t'primary-surface4': [ 'bg-interactive-brand-weak-active' ],\n\t'primary-fgSurface3': [\n\t\t'fg-interactive-brand',\n\t\t'fg-interactive-brand-active',\n\t],\n\t'primary-stroke3': [\n\t\t'bg-thumb-brand',\n\t\t'bg-thumb-brand-active',\n\t\t'stroke-focus-brand',\n\t\t'stroke-interactive-brand',\n\t\t'stroke-surface-brand-strong',\n\t],\n\t'primary-stroke4': [ 'stroke-interactive-brand-active' ],\n\t'primary-stroke1': [ 'stroke-surface-brand' ],\n\t'primary-surface1': [ 'bg-surface-brand' ],\n\t'info-surface2': [ 'bg-surface-info-weak' ],\n\t'info-surface4': [ 'bg-surface-info' ],\n\t'info-fgSurface4': [ 'fg-content-info' ],\n\t'info-fgSurface3': [ 'fg-content-info-weak' ],\n\t'info-stroke3': [ 'stroke-surface-info-strong' ],\n\t'info-stroke1': [ 'stroke-surface-info' ],\n\t'success-surface2': [ 'bg-surface-success-weak' ],\n\t'success-surface4': [ 'bg-surface-success' ],\n\t'success-fgSurface4': [ 'fg-content-success' ],\n\t'success-fgSurface3': [ 'fg-content-success-weak' ],\n\t'success-stroke3': [ 'stroke-surface-success-strong' ],\n\t'success-stroke1': [ 'stroke-surface-success' ],\n\t'warning-surface2': [ 'bg-surface-warning-weak' ],\n\t'warning-surface4': [ 'bg-surface-warning' ],\n\t'warning-fgSurface4': [ 'fg-content-warning' ],\n\t'warning-fgSurface3': [ 'fg-content-warning-weak' ],\n\t'warning-stroke3': [ 'stroke-surface-warning-strong' ],\n\t'warning-stroke1': [ 'stroke-surface-warning' ],\n\t'error-bgFill1': [ 'bg-interactive-error-strong' ],\n\t'error-fgFill': [\n\t\t'fg-interactive-error-strong',\n\t\t'fg-interactive-error-strong-active',\n\t],\n\t'error-bgFill2': [ 'bg-interactive-error-strong-active' ],\n\t'error-surface2': [\n\t\t'bg-interactive-error-active',\n\t\t'bg-surface-error-weak',\n\t],\n\t'error-surface4': [\n\t\t'bg-interactive-error-weak-active',\n\t\t'bg-surface-error',\n\t],\n\t'error-fgSurface4': [ 'fg-content-error' ],\n\t'error-fgSurface3': [\n\t\t'fg-content-error-weak',\n\t\t'fg-interactive-error',\n\t\t'fg-interactive-error-active',\n\t],\n\t'error-stroke3': [\n\t\t'stroke-interactive-error',\n\t\t'stroke-interactive-error-strong',\n\t\t'stroke-surface-error-strong',\n\t],\n\t'error-stroke4': [ 'stroke-interactive-error-active' ],\n\t'error-stroke1': [ 'stroke-surface-error' ],\n\t'bg-surface2': [ 'bg-surface-neutral' ],\n\t'bg-surface6': [\n\t\t'bg-interactive-brand-strong-disabled',\n\t\t'bg-interactive-error-strong-disabled',\n\t\t'bg-interactive-neutral-strong-disabled',\n\t],\n\t'bg-surface5': [\n\t\t'bg-interactive-brand-disabled',\n\t\t'bg-interactive-brand-weak-disabled',\n\t\t'bg-interactive-error-disabled',\n\t\t'bg-interactive-error-weak-disabled',\n\t\t'bg-interactive-neutral-disabled',\n\t\t'bg-interactive-neutral-weak-disabled',\n\t],\n\t'bg-surface4': [\n\t\t'bg-interactive-neutral-active',\n\t\t'bg-interactive-neutral-weak-active',\n\t],\n\t'bg-surface3': [ 'bg-surface-neutral-strong' ],\n\t'bg-fgSurface4': [\n\t\t'fg-content-neutral',\n\t\t'fg-interactive-neutral',\n\t\t'fg-interactive-neutral-active',\n\t],\n\t'bg-fgSurface3': [\n\t\t'fg-content-neutral-weak',\n\t\t'fg-interactive-brand-strong-disabled',\n\t\t'fg-interactive-error-strong-disabled',\n\t\t'fg-interactive-neutral-strong-disabled',\n\t\t'fg-interactive-neutral-weak',\n\t],\n\t'bg-fgSurface2': [\n\t\t'fg-interactive-brand-disabled',\n\t\t'fg-interactive-error-disabled',\n\t\t'fg-interactive-neutral-disabled',\n\t\t'fg-interactive-neutral-weak-disabled',\n\t],\n\t'bg-stroke3': [\n\t\t'bg-thumb-neutral-weak',\n\t\t'stroke-interactive-neutral',\n\t\t'stroke-surface-neutral-strong',\n\t],\n\t'bg-stroke4': [\n\t\t'bg-thumb-neutral-weak-active',\n\t\t'stroke-interactive-neutral-active',\n\t\t'stroke-interactive-neutral-strong',\n\t],\n\t'bg-stroke2': [\n\t\t'bg-thumb-brand-disabled',\n\t\t'bg-track-neutral',\n\t\t'stroke-interactive-neutral-disabled',\n\t\t'stroke-surface-neutral',\n\t],\n\t'bg-stroke1': [ 'bg-track-neutral-weak', 'stroke-surface-neutral-weak' ],\n\t'bg-bgFillInverted2': [ 'bg-interactive-neutral-strong-active' ],\n\t'bg-bgFillInverted1': [ 'bg-interactive-neutral-strong' ],\n\t'bg-fgFillInverted': [\n\t\t'fg-interactive-neutral-strong',\n\t\t'fg-interactive-neutral-strong-active',\n\t],\n\t'bg-surface1': [ 'bg-surface-neutral-weak' ],\n\t'caution-surface2': [ 'bg-surface-caution-weak' ],\n\t'caution-surface4': [ 'bg-surface-caution' ],\n\t'caution-fgSurface4': [ 'fg-content-caution' ],\n\t'caution-fgSurface3': [ 'fg-content-caution-weak' ],\n} as Record< string, string[] >;\n"],
|
|
5
|
+
"mappings": ";AAKA,IAAO,uBAAQ;AAAA,EACd,mBAAmB,CAAE,6BAA8B;AAAA,EACnD,kBAAkB;AAAA,IACjB;AAAA,IACA;AAAA,EACD;AAAA,EACA,mBAAmB,CAAE,o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+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=token-types.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/theme/src/private-apis.ts
|
|
2
|
-
import { lock } from "./lock-unlock";
|
|
3
|
-
import { ThemeProvider } from "./theme-provider";
|
|
4
|
-
import { useThemeProviderStyles } from "./use-theme-provider-styles";
|
|
2
|
+
import { lock } from "./lock-unlock.mjs";
|
|
3
|
+
import { ThemeProvider } from "./theme-provider.mjs";
|
|
4
|
+
import { useThemeProviderStyles } from "./use-theme-provider-styles.mjs";
|
|
5
5
|
var privateApis = {};
|
|
6
6
|
lock(privateApis, {
|
|
7
7
|
ThemeProvider,
|
|
@@ -10,4 +10,4 @@ lock(privateApis, {
|
|
|
10
10
|
export {
|
|
11
11
|
privateApis
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=private-apis.
|
|
13
|
+
//# sourceMappingURL=private-apis.mjs.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// packages/theme/src/stylelint-plugins/no-setting-wpds-custom-properties.mjs
|
|
2
|
+
import stylelint from "stylelint";
|
|
3
|
+
var {
|
|
4
|
+
createPlugin,
|
|
5
|
+
utils: { report, ruleMessages, validateOptions }
|
|
6
|
+
} = stylelint;
|
|
7
|
+
var ruleName = "plugin-wpds/no-setting-wpds-custom-properties";
|
|
8
|
+
var messages = ruleMessages(ruleName, {
|
|
9
|
+
rejected: () => `Do not set CSS custom properties using the Design System tokens namespace (i.e. beginning with --wpds-*).`
|
|
10
|
+
});
|
|
11
|
+
var ruleFunction = (primary) => {
|
|
12
|
+
return (root, result) => {
|
|
13
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
14
|
+
actual: primary,
|
|
15
|
+
possible: [true]
|
|
16
|
+
});
|
|
17
|
+
if (!validOptions) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
root.walkDecls((ruleNode) => {
|
|
21
|
+
const { prop } = ruleNode;
|
|
22
|
+
if (prop.startsWith("--wpds-")) {
|
|
23
|
+
report({
|
|
24
|
+
message: messages.rejected(),
|
|
25
|
+
node: ruleNode,
|
|
26
|
+
result,
|
|
27
|
+
ruleName
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
ruleFunction.ruleName = ruleName;
|
|
34
|
+
ruleFunction.messages = messages;
|
|
35
|
+
var no_setting_wpds_custom_properties_default = createPlugin(ruleName, ruleFunction);
|
|
36
|
+
export {
|
|
37
|
+
no_setting_wpds_custom_properties_default as default
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=no-setting-wpds-custom-properties.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/stylelint-plugins/no-setting-wpds-custom-properties.mjs"],
|
|
4
|
+
"sourcesContent": ["import stylelint from 'stylelint';\n\nconst {\n\tcreatePlugin,\n\tutils: { report, ruleMessages, validateOptions },\n} = stylelint;\n\nconst ruleName = 'plugin-wpds/no-setting-wpds-custom-properties';\n\nconst messages = ruleMessages( ruleName, {\n\trejected: () =>\n\t\t`Do not set CSS custom properties using the Design System tokens namespace (i.e. beginning with --wpds-*).`,\n} );\n\n/** @type {import('stylelint').Rule} */\nconst ruleFunction = ( primary ) => {\n\treturn ( root, result ) => {\n\t\tconst validOptions = validateOptions( result, ruleName, {\n\t\t\tactual: primary,\n\t\t\tpossible: [ true ],\n\t\t} );\n\n\t\tif ( ! validOptions ) {\n\t\t\treturn;\n\t\t}\n\n\t\troot.walkDecls( ( ruleNode ) => {\n\t\t\tconst { prop } = ruleNode;\n\t\t\tif ( prop.startsWith( '--wpds-' ) ) {\n\t\t\t\treport( {\n\t\t\t\t\tmessage: messages.rejected(),\n\t\t\t\t\tnode: ruleNode,\n\t\t\t\t\tresult,\n\t\t\t\t\truleName,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n};\n\nruleFunction.ruleName = ruleName;\nruleFunction.messages = messages;\n\n/** @type {import('stylelint').Plugin} */\nexport default createPlugin( ruleName, ruleFunction );\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,eAAe;AAEtB,IAAM;AAAA,EACL;AAAA,EACA,OAAO,EAAE,QAAQ,cAAc,gBAAgB;AAChD,IAAI;AAEJ,IAAM,WAAW;AAEjB,IAAM,WAAW,aAAc,UAAU;AAAA,EACxC,UAAU,MACT;AACF,CAAE;AAGF,IAAM,eAAe,CAAE,YAAa;AACnC,SAAO,CAAE,MAAM,WAAY;AAC1B,UAAM,eAAe,gBAAiB,QAAQ,UAAU;AAAA,MACvD,QAAQ;AAAA,MACR,UAAU,CAAE,IAAK;AAAA,IAClB,CAAE;AAEF,QAAK,CAAE,cAAe;AACrB;AAAA,IACD;AAEA,SAAK,UAAW,CAAE,aAAc;AAC/B,YAAM,EAAE,KAAK,IAAI;AACjB,UAAK,KAAK,WAAY,SAAU,GAAI;AACnC,eAAQ;AAAA,UACP,SAAS,SAAS,SAAS;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,aAAa,WAAW;AACxB,aAAa,WAAW;AAGxB,IAAO,4CAAQ,aAAc,UAAU,YAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// packages/theme/src/stylelint-plugins/no-unknown-ds-tokens.mjs
|
|
2
|
+
import stylelint from "stylelint";
|
|
3
|
+
import tokenList from "../prebuilt/js/design-tokens.mjs";
|
|
4
|
+
var DS_TOKEN_PREFIX = "wpds-";
|
|
5
|
+
function extractCSSVariables(value, prefix = "") {
|
|
6
|
+
const regex = /--[\w-]+/g;
|
|
7
|
+
const variables = /* @__PURE__ */ new Set();
|
|
8
|
+
let match;
|
|
9
|
+
while ((match = regex.exec(value)) !== null) {
|
|
10
|
+
const variableName = match[0];
|
|
11
|
+
if (variableName.startsWith(`--${prefix}`)) {
|
|
12
|
+
variables.add(variableName);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return variables;
|
|
16
|
+
}
|
|
17
|
+
var knownTokens = new Set(tokenList);
|
|
18
|
+
var wpdsTokensRegex = new RegExp(`[^\\w]--${DS_TOKEN_PREFIX}`, "i");
|
|
19
|
+
var {
|
|
20
|
+
createPlugin,
|
|
21
|
+
utils: { report, ruleMessages, validateOptions }
|
|
22
|
+
} = stylelint;
|
|
23
|
+
var ruleName = "plugin-wpds/no-unknown-ds-tokens";
|
|
24
|
+
var messages = ruleMessages(ruleName, {
|
|
25
|
+
rejected: (tokenNames) => `The following CSS variables are not valid Design System tokens: ${tokenNames}`
|
|
26
|
+
});
|
|
27
|
+
var ruleFunction = (primary) => {
|
|
28
|
+
return (root, result) => {
|
|
29
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
30
|
+
actual: primary,
|
|
31
|
+
possible: [true]
|
|
32
|
+
});
|
|
33
|
+
if (!validOptions) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
root.walkDecls((ruleNode) => {
|
|
37
|
+
const { value } = ruleNode;
|
|
38
|
+
if (wpdsTokensRegex.test(value)) {
|
|
39
|
+
const usedTokens = extractCSSVariables(
|
|
40
|
+
value,
|
|
41
|
+
DS_TOKEN_PREFIX
|
|
42
|
+
);
|
|
43
|
+
const unknownTokens = new Set(
|
|
44
|
+
[...usedTokens].filter(
|
|
45
|
+
(token) => !knownTokens.has(token)
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
if (unknownTokens.size > 0) {
|
|
49
|
+
report({
|
|
50
|
+
message: messages.rejected(
|
|
51
|
+
Array.from(unknownTokens).map((token) => `'${token}'`).join(", ")
|
|
52
|
+
),
|
|
53
|
+
node: ruleNode,
|
|
54
|
+
result,
|
|
55
|
+
ruleName
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
ruleFunction.ruleName = ruleName;
|
|
63
|
+
ruleFunction.messages = messages;
|
|
64
|
+
var no_unknown_ds_tokens_default = createPlugin(ruleName, ruleFunction);
|
|
65
|
+
export {
|
|
66
|
+
no_unknown_ds_tokens_default as default
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=no-unknown-ds-tokens.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/stylelint-plugins/no-unknown-ds-tokens.mjs"],
|
|
4
|
+
"sourcesContent": ["import stylelint from 'stylelint';\nimport tokenList from '../prebuilt/js/design-tokens.mjs';\n\nconst DS_TOKEN_PREFIX = 'wpds-';\n\n/**\n * Extracts all unique CSS custom properties (variables) from a given CSS value string,\n * including those in fallback positions, optionally filtering by a specific prefix.\n *\n * @param {string} value - The CSS value string to search for variables.\n * @param {string} [prefix=''] - Optional prefix to filter variables (e.g., 'wpds-').\n * @return {Set<string>} A Set of unique matched CSS variable names (e.g., Set { '--wpds-token' }).\n *\n * @example\n * extractCSSVariables(\n * 'border: 1px solid var(--wpds-border-color, var(--wpds-border-fallback)); ' +\n * 'color: var(--wpds-color-fg, black); ' +\n * 'background: var(--unrelated-bg);',\n * 'wpds'\n * );\n * // \u2192 Set { '--wpds-border-color', '--wpds-border-fallback', '--wpds-color-fg' }\n */\nfunction extractCSSVariables( value, prefix = '' ) {\n\tconst regex = /--[\\w-]+/g;\n\t/** @type {Set<string>} */\n\tconst variables = new Set();\n\n\tlet match;\n\twhile ( ( match = regex.exec( value ) ) !== null ) {\n\t\tconst variableName = match[ 0 ];\n\t\tif ( variableName.startsWith( `--${ prefix }` ) ) {\n\t\t\tvariables.add( variableName );\n\t\t}\n\t}\n\n\treturn variables;\n}\n\nconst knownTokens = new Set( tokenList );\nconst wpdsTokensRegex = new RegExp( `[^\\\\w]--${ DS_TOKEN_PREFIX }`, 'i' );\n\nconst {\n\tcreatePlugin,\n\tutils: { report, ruleMessages, validateOptions },\n} = stylelint;\n\nconst ruleName = 'plugin-wpds/no-unknown-ds-tokens';\n\nconst messages = ruleMessages( ruleName, {\n\trejected: ( tokenNames ) =>\n\t\t`The following CSS variables are not valid Design System tokens: ${ tokenNames }`,\n} );\n\n/** @type {import('stylelint').Rule} */\nconst ruleFunction = ( primary ) => {\n\treturn ( root, result ) => {\n\t\tconst validOptions = validateOptions( result, ruleName, {\n\t\t\tactual: primary,\n\t\t\tpossible: [ true ],\n\t\t} );\n\n\t\tif ( ! validOptions ) {\n\t\t\treturn;\n\t\t}\n\n\t\troot.walkDecls( ( ruleNode ) => {\n\t\t\tconst { value } = ruleNode;\n\t\t\t// Early match for WPDS tokens to avoid unnecessary processing.\n\t\t\tif ( wpdsTokensRegex.test( value ) ) {\n\t\t\t\tconst usedTokens = extractCSSVariables(\n\t\t\t\t\tvalue,\n\t\t\t\t\tDS_TOKEN_PREFIX\n\t\t\t\t);\n\t\t\t\tconst unknownTokens = new Set(\n\t\t\t\t\t[ ...usedTokens ].filter(\n\t\t\t\t\t\t( token ) => ! knownTokens.has( token )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\tif ( unknownTokens.size > 0 ) {\n\t\t\t\t\treport( {\n\t\t\t\t\t\tmessage: messages.rejected(\n\t\t\t\t\t\t\tArray.from( unknownTokens )\n\t\t\t\t\t\t\t\t.map( ( token ) => `'${ token }'` )\n\t\t\t\t\t\t\t\t.join( ', ' )\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnode: ruleNode,\n\t\t\t\t\t\tresult,\n\t\t\t\t\t\truleName,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t};\n};\n\nruleFunction.ruleName = ruleName;\nruleFunction.messages = messages;\n\n/** @type {import('stylelint').Plugin} */\nexport default createPlugin( ruleName, ruleFunction );\n"],
|
|
5
|
+
"mappings": ";AAAA,OAA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CAAE,UAAW,IAAK,KAAM,GAAI,EACjC,KAAM,IAAK;AAAA,YACd;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,UACD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,aAAa,WAAW;AACxB,aAAa,WAAW;AAGxB,IAAO,+BAAQ,aAAc,UAAU,YAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/theme/src/theme-provider.tsx
|
|
2
2
|
import { useMemo, useId } from "@wordpress/element";
|
|
3
|
-
import { ThemeContext } from "./context";
|
|
4
|
-
import { useThemeProviderStyles } from "./use-theme-provider-styles";
|
|
3
|
+
import { ThemeContext } from "./context.mjs";
|
|
4
|
+
import { useThemeProviderStyles } from "./use-theme-provider-styles.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/theme/src/style.module.css
|
|
7
7
|
var css = `.style-module__root__26kw6 {
|
|
@@ -69,4 +69,4 @@ var ThemeProvider = ({
|
|
|
69
69
|
export {
|
|
70
70
|
ThemeProvider
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=theme-provider.
|
|
72
|
+
//# sourceMappingURL=theme-provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// packages/theme/src/use-theme-provider-styles.ts
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
clone,
|
|
4
|
+
set,
|
|
4
5
|
to,
|
|
5
|
-
get,
|
|
6
6
|
serialize,
|
|
7
7
|
sRGB,
|
|
8
8
|
HSL
|
|
9
9
|
} from "colorjs.io/fn";
|
|
10
10
|
import memoize from "memize";
|
|
11
11
|
import { useMemo, useContext } from "@wordpress/element";
|
|
12
|
-
import "./color-ramps/lib/register-color-spaces";
|
|
13
|
-
import { ThemeContext } from "./context";
|
|
14
|
-
import colorTokens from "./prebuilt/ts/color-tokens";
|
|
12
|
+
import "./color-ramps/lib/register-color-spaces.mjs";
|
|
13
|
+
import { ThemeContext } from "./context.mjs";
|
|
14
|
+
import colorTokens from "./prebuilt/ts/color-tokens.mjs";
|
|
15
15
|
import {
|
|
16
16
|
buildBgRamp,
|
|
17
17
|
buildAccentRamp,
|
|
18
18
|
DEFAULT_SEED_COLORS
|
|
19
|
-
} from "./color-ramps";
|
|
19
|
+
} from "./color-ramps/index.mjs";
|
|
20
20
|
var getCachedBgRamp = memoize(buildBgRamp, { maxSize: 10 });
|
|
21
21
|
var getCachedAccentRamp = memoize(buildAccentRamp, { maxSize: 10 });
|
|
22
22
|
var legacyWpComponentsOverridesCSS = [
|
|
@@ -76,43 +76,27 @@ var legacyWpComponentsOverridesCSS = [
|
|
|
76
76
|
];
|
|
77
77
|
function customRgbFormat(color) {
|
|
78
78
|
const rgb = to(color, sRGB);
|
|
79
|
-
return
|
|
79
|
+
return rgb.coords.map((n) => Math.round((n ?? 0) * 255)).join(", ");
|
|
80
80
|
}
|
|
81
81
|
function legacyWpAdminThemeOverridesCSS(accent) {
|
|
82
|
-
const parsedAccent = to(
|
|
83
|
-
const
|
|
84
|
-
const darker10 =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// h
|
|
90
|
-
coords[1],
|
|
91
|
-
// s
|
|
92
|
-
Math.max(0, Math.min(100, coords[2] - 5))
|
|
93
|
-
// l (reduced by 5%)
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
sRGB
|
|
82
|
+
const parsedAccent = to(accent, HSL);
|
|
83
|
+
const parsedL = parsedAccent.coords[2] ?? 0;
|
|
84
|
+
const darker10 = set(
|
|
85
|
+
clone(parsedAccent),
|
|
86
|
+
[HSL, "l"],
|
|
87
|
+
Math.max(0, parsedL - 5)
|
|
88
|
+
// L reduced by 5%
|
|
97
89
|
);
|
|
98
|
-
const darker20 =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// h
|
|
104
|
-
coords[1],
|
|
105
|
-
// s
|
|
106
|
-
Math.max(0, Math.min(100, coords[2] - 10))
|
|
107
|
-
// l (reduced by 10%)
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
sRGB
|
|
90
|
+
const darker20 = set(
|
|
91
|
+
clone(parsedAccent),
|
|
92
|
+
[HSL, "l"],
|
|
93
|
+
Math.max(0, parsedL - 10)
|
|
94
|
+
// L reduced by 10%
|
|
111
95
|
);
|
|
112
96
|
return [
|
|
113
97
|
[
|
|
114
98
|
"--wp-admin-theme-color",
|
|
115
|
-
serialize(
|
|
99
|
+
serialize(parsedAccent, { format: "hex" })
|
|
116
100
|
],
|
|
117
101
|
["--wp-admin-theme-color--rgb", customRgbFormat(parsedAccent)],
|
|
118
102
|
[
|
|
@@ -206,4 +190,4 @@ function useThemeProviderStyles({
|
|
|
206
190
|
export {
|
|
207
191
|
useThemeProviderStyles
|
|
208
192
|
};
|
|
209
|
-
//# sourceMappingURL=use-theme-provider-styles.
|
|
193
|
+
//# sourceMappingURL=use-theme-provider-styles.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/use-theme-provider-styles.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tclone,\n\tset,\n\tto,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport colorTokens from './prebuilt/ts/color-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );\nconst getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: PlainColorObject ): string {\n\tconst rgb = to( color, sRGB );\n\treturn rgb.coords\n\t\t.map( ( n ) => Math.round( ( n ?? 0 ) * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = to( accent, HSL );\n\tconst parsedL = parsedAccent.coords[ 2 ] ?? 0;\n\n\t// Create darker version of accent \u2014\n\tconst darker10 = set(\n\t\tclone( parsedAccent ),\n\t\t[ HSL, 'l' ],\n\t\tMath.max( 0, parsedL - 5 ) // L reduced by 5%\n\t);\n\tconst darker20 = set(\n\t\tclone( parsedAccent ),\n\t\t[ HSL, 'l' ],\n\t\tMath.max( 0, parsedL - 10 ) // L reduced by 10%\n\t);\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tserialize( parsedAccent, { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tserialize( darker10, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tserialize( darker20, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction colorTokensCSS(\n\tcomputedColorRamps: Map< string, RampResult >\n): Entry[] {\n\tconst entries: Entry[] = [];\n\n\tfor ( const [ rampName, { ramp } ] of computedColorRamps ) {\n\t\tfor ( const [ tokenName, tokenValue ] of Object.entries( ramp ) ) {\n\t\t\tconst key = `${ rampName }-${ tokenName }`;\n\t\t\tconst aliasedBy = colorTokens[ key ] ?? [];\n\t\t\tfor ( const aliasedId of aliasedBy ) {\n\t\t\t\tentries.push( [ `--wpds-color-${ aliasedId }`, tokenValue ] );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn entries;\n}\n\nfunction generateStyles( {\n\tprimary,\n\tcomputedColorRamps,\n}: {\n\tprimary: string;\n\tcomputedColorRamps: Map< string, RampResult >;\n} ): CSSProperties {\n\treturn Object.fromEntries(\n\t\t[\n\t\t\t// Semantic color tokens\n\t\t\tcolorTokensCSS( computedColorRamps ),\n\t\t\t// Legacy overrides\n\t\t\tlegacyWpAdminThemeOverridesCSS( primary ),\n\t\t\tlegacyWpComponentsOverridesCSS,\n\t\t].flat()\n\t);\n}\n\nexport function useThemeProviderStyles( {\n\tcolor = {},\n}: {\n\tcolor?: ThemeProviderProps[ 'color' ];\n} = {} ) {\n\tconst { resolvedSettings: inheritedSettings } = useContext( ThemeContext );\n\n\t// Compute settings:\n\t// - used provided prop value;\n\t// - otherwise, use inherited value from parent instance;\n\t// - otherwise, use fallback value (where applicable).\n\tconst primary =\n\t\tcolor.primary ??\n\t\tinheritedSettings.color?.primary ??\n\t\tDEFAULT_SEED_COLORS.primary;\n\tconst bg =\n\t\tcolor.bg ?? inheritedSettings.color?.bg ?? DEFAULT_SEED_COLORS.bg;\n\n\tconst resolvedSettings = useMemo(\n\t\t() => ( {\n\t\t\tcolor: {\n\t\t\t\tprimary,\n\t\t\t\tbg,\n\t\t\t},\n\t\t} ),\n\t\t[ primary, bg ]\n\t);\n\n\tconst themeProviderStyles = useMemo( () => {\n\t\t// Determine which seeds are needed for generating ramps.\n\t\tconst seeds = {\n\t\t\t...DEFAULT_SEED_COLORS,\n\t\t\tbg,\n\t\t\tprimary,\n\t\t};\n\n\t\t// Generate ramps.\n\t\tconst computedColorRamps = new Map< string, RampResult >();\n\t\tconst bgRamp = getCachedBgRamp( seeds.bg );\n\t\tObject.entries( seeds ).forEach( ( [ rampName, seed ] ) => {\n\t\t\tif ( rampName === 'bg' ) {\n\t\t\t\tcomputedColorRamps.set( rampName, bgRamp );\n\t\t\t} else {\n\t\t\t\tcomputedColorRamps.set(\n\t\t\t\t\trampName,\n\t\t\t\t\tgetCachedAccentRamp( seed, bgRamp )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn generateStyles( {\n\t\t\tprimary: seeds.primary,\n\t\t\tcomputedColorRamps,\n\t\t} );\n\t}, [ primary, bg ] );\n\n\treturn {\n\t\tresolvedSettings,\n\t\tthemeProviderStyles,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAIA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,OAAO,aAAa;AAKpB,SAAS,SAAS,kBAAkB;AAKpC,OAAO;AACP,SAAS,oBAAoB;AAC7B,OAAO,iBAAiB;AACxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAKP,IAAM,kBAAkB,QAAS,aAAa,EAAE,SAAS,GAAG,CAAE;AAC9D,IAAM,sBAAsB,QAAS,iBAAiB,EAAE,SAAS,GAAG,CAAE;AAEtE,IAAM,iCAA0C;AAAA,EAC/C,CAAE,gCAAgC,6BAA8B;AAAA,EAChE;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AACD;AAEA,SAAS,gBAAiB,OAAkC;AAC3D,QAAM,MAAM,GAAI,OAAO,IAA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|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -23,5 +23,5 @@ export declare function getContrast(colorA: ColorTypes, colorB: ColorTypes): num
|
|
|
23
23
|
* Make sure that a color is valid in the sRGB gamut and convert it to OKLCH.
|
|
24
24
|
* @param c
|
|
25
25
|
*/
|
|
26
|
-
export declare function clampToGamut(c: ColorTypes): import("colorjs.io/
|
|
26
|
+
export declare function clampToGamut(c: ColorTypes): import("colorjs.io/src/color.js").PlainColorObject;
|
|
27
27
|
//# sourceMappingURL=color-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/color-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAON,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,UAAU,GAAI,MAAM,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAI,MAAM,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAE,CAAC,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/color-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAON,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,UAAU,GAAI,MAAM,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAI,MAAM,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAE,CAAC,EAAE,UAAU,sDAG1C"}
|