UNPKG

@wordpress/components

Version:
1 lines • 22.1 kB
{"version":3,"file":"component.cjs","names":["extend","namesPlugin","useContextSystem","useControlledValue","useMemo","useState","useRef","useCallback","getFormat","PolymorphicElement","styles","Picker","HStack","Select","__","ColorCopyButton","Flex","ColorInput","contextConnect"],"sources":["../../../style-runtime/src/index.ts","../../src/color-picker/style.module.scss","../../src/color-picker/component.tsx"],"sourcesContent":["type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"7c9da4804d\", \".fc84b54ab7eadaac__prefix{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._0931450c28ea78af__number-control{width:96px}.d5340e8c9e22c868__select{margin-left:-8px}._96be3f8f4bf140d7__range{flex:1;margin-right:8px}.ba153a3ef3adbfdc__auxiliary{padding:8px 0 0}._8b76d21b029c2e21__header{padding-inline:16px}._10f48d0e75fe17ef__color-input{padding-block:16px 20px;padding-left:16px;padding-right:12px}.a2ba900a769046e5__colorful{box-sizing:border-box}.a2ba900a769046e5__colorful *,.a2ba900a769046e5__colorful :after,.a2ba900a769046e5__colorful :before{box-sizing:inherit}.a2ba900a769046e5__colorful{width:216px}.a2ba900a769046e5__colorful .react-colorful{align-items:center;display:flex;flex-direction:column;height:auto;width:216px}.a2ba900a769046e5__colorful .react-colorful__saturation{border-bottom:none;border-radius:0;height:216px;margin-bottom:16px;width:100%}.a2ba900a769046e5__colorful .react-colorful__alpha,.a2ba900a769046e5__colorful .react-colorful__hue{border-radius:9999px;height:16px;margin-bottom:8px;width:184px}.a2ba900a769046e5__colorful .react-colorful__pointer{border:none;box-shadow:0 0 2px 0 rgba(0,0,0,.25);height:16px;outline:2px solid transparent;width:16px}@media not (prefers-reduced-motion){.a2ba900a769046e5__colorful .react-colorful__pointer{transition:transform .16s ease-in-out}}.a2ba900a769046e5__colorful .react-colorful__interactive:focus .react-colorful__pointer{border:1.5px solid #000;box-shadow:0 0 0 1.5px #fff;transform:translate(-50%,-50%) scale(1.5)}.a2ba900a769046e5__colorful .react-colorful__pointer-fill{box-shadow:inset 0 0 0 1.5px #fff}.a2ba900a769046e5__colorful .react-colorful__interactive{margin-left:4px;width:calc(100% - 8px)}\");\n}\nexport default {\"prefix\":\"fc84b54ab7eadaac__prefix\",\"number-control\":\"_0931450c28ea78af__number-control\",\"select\":\"d5340e8c9e22c868__select\",\"range\":\"_96be3f8f4bf140d7__range\",\"auxiliary\":\"ba153a3ef3adbfdc__auxiliary\",\"header\":\"_8b76d21b029c2e21__header\",\"color-input\":\"_10f48d0e75fe17ef__color-input\",\"colorful\":\"a2ba900a769046e5__colorful\"};\n","import clsx from 'clsx';\nimport type { ClipboardEvent, ForwardedRef } from 'react';\nimport type { Colord } from 'colord';\nimport { colord, extend, getFormat } from 'colord';\nimport type { HslaColor } from 'react-colorful';\nimport namesPlugin from 'colord/plugins/names';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Select, useEnableWpCompatOverlaySlot } from '@wordpress/ui';\nimport { useContextSystem, contextConnect } from '../context';\nimport { HStack } from '../h-stack';\nimport { Flex } from '../flex';\nimport { PolymorphicElement } from '../utils/polymorphic-element';\nimport styles from './style.module.scss';\nimport { ColorCopyButton } from './color-copy-button';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\nimport type { ColorPickerProps, ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\n/**\n * Merges incoming HSLA with previous state, preserving hue for achromatic\n * colors and saturation only at lightness extremes (black/white) where\n * it has no visual effect.\n */\nfunction mergeHSLA( nextHSLA: HslaColor, prevHSLA: HslaColor ): HslaColor {\n\tif ( nextHSLA.s === 0 ) {\n\t\tif ( nextHSLA.l === 0 || nextHSLA.l === 100 ) {\n\t\t\treturn { ...nextHSLA, h: prevHSLA.h, s: prevHSLA.s };\n\t\t}\n\t\treturn { ...nextHSLA, h: prevHSLA.h };\n\t}\n\treturn nextHSLA;\n}\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\nconst UnconnectedColorPicker = (\n\tprops: ColorPickerProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tuseEnableWpCompatOverlaySlot();\n\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\tclassName,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\t// Internal HSLA state preserves hue and saturation values that\n\t// would otherwise be lost when converting to/from hex at achromatic\n\t// colors (e.g. pure black or white where any H/S maps to the same hex).\n\tconst [ internalHSLA, setInternalHSLA ] = useState< HslaColor >( () => ( {\n\t\t...safeColordColor.toHsl(),\n\t} ) );\n\n\t// Track the last hex we produced so the sync effect can\n\t// distinguish our own updates from external prop changes.\n\tconst lastProducedHexRef = useRef( safeColordColor.toHex() );\n\n\t// While the user is dragging the visual picker, ignore color-prop sync\n\t// so delayed/stale controlled echoes cannot overwrite internalHSLA mid-drag.\n\tconst isPickerInteractingRef = useRef( false );\n\n\t// Sync internalHSLA when the color prop changes externally (e.g.\n\t// parent passes a new color that wasn't produced by our onChange).\n\tuseEffect( () => {\n\t\tif ( isPickerInteractingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Compare by color equality, not hex string — rgb()/rgba()\n\t\t// round-trips can differ in string form for the same color.\n\t\tif ( safeColordColor.isEqual( lastProducedHexRef.current ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Genuinely external change — sync internalHSLA.\n\t\tlastProducedHexRef.current = safeColordColor.toHex();\n\t\tconst externalHSLA = safeColordColor.toHsl();\n\t\tsetInternalHSLA( ( prev ) => mergeHSLA( externalHSLA, prev ) );\n\t}, [ safeColordColor ] );\n\n\t// Handler for HSL inputs (and the HSVA picker after it converts to HSLA).\n\t// Apply the user's HSLA, then notify the parent only when the color\n\t// actually changes. setColor must not run inside setInternalHSLA\n\t// (state updaters must be pure).\n\tconst handleHSLAChange = useCallback(\n\t\t( nextHSLA: HslaColor ) => {\n\t\t\tconst previousHex = lastProducedHexRef.current;\n\t\t\t// An alpha-only change keeps the previous RGB values. Converting\n\t\t\t// the rounded HSLA channels back to RGB would shift them.\n\t\t\tconst isAlphaOnlyChange =\n\t\t\t\tnextHSLA.h === internalHSLA.h &&\n\t\t\t\tnextHSLA.s === internalHSLA.s &&\n\t\t\t\tnextHSLA.l === internalHSLA.l;\n\t\t\tsetInternalHSLA( nextHSLA );\n\t\t\tconst nextHex = isAlphaOnlyChange\n\t\t\t\t? colord( previousHex ).alpha( nextHSLA.a ).toHex()\n\t\t\t\t: colord( nextHSLA ).toHex();\n\t\t\tif ( ! colord( nextHex ).isEqual( previousHex ) ) {\n\t\t\t\tlastProducedHexRef.current = nextHex;\n\t\t\t\tsetColor( nextHex );\n\t\t\t}\n\t\t},\n\t\t[ internalHSLA, setColor ]\n\t);\n\n\t// Handler for components that provide Colord values (RGB, Hex inputs).\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tconst nextHSLA = nextValue.toHsl();\n\t\t\tsetInternalHSLA( ( prev ) => mergeHSLA( nextHSLA, prev ) );\n\t\t\tconst nextHex = nextValue.toHex();\n\t\t\tlastProducedHexRef.current = nextHex;\n\t\t\tsetColor( nextHex );\n\t\t},\n\t\t[ setColor ]\n\t);\n\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\t/*\n\t * ! Listener intended for the CAPTURE phase\n\t *\n\t * Capture paste events over the entire color picker, looking for clipboard\n\t * data that could be parsed as a color. If not, let the paste event\n\t * propagate normally, so that individual input controls within the\n\t * component have a chance to handle it.\n\t */\n\tconst maybeHandlePaste = useCallback(\n\t\t( event: ClipboardEvent ) => {\n\t\t\tconst pastedText = event.clipboardData?.getData( 'text' )?.trim();\n\t\t\tif ( ! pastedText ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst parsedColor = colord( pastedText );\n\t\t\tif ( ! parsedColor.isValid() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Apply all valid colors, even if the format isn't supported in\n\t\t\t// the UI (e.g. names like \"cyan\" or, in the future color spaces\n\t\t\t// like \"lch\" if we add the right colord plugins)\n\t\t\thandleChange( parsedColor );\n\n\t\t\t// This redundancy helps TypeScript and is safer than assertions\n\t\t\tconst supportedFormats: Record< string, ColorType | undefined > = {\n\t\t\t\thex: 'hex',\n\t\t\t\trgb: 'rgb',\n\t\t\t\thsl: 'hsl',\n\t\t\t};\n\n\t\t\tconst detectedFormat = String( getFormat( pastedText ) );\n\t\t\tconst newColorType = supportedFormats[ detectedFormat ];\n\t\t\tif ( newColorType ) {\n\t\t\t\tsetColorType( newColorType );\n\t\t\t}\n\n\t\t\t// Stop at capture phase; no bubbling\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ handleChange, setColorType ]\n\t);\n\n\treturn (\n\t\t<PolymorphicElement\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...divProps }\n\t\t\tclassName={ clsx( styles.colorful, className ) }\n\t\t\tonPasteCapture={ maybeHandlePaste }\n\t\t>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleHSLAChange }\n\t\t\t\thsla={ internalHSLA }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\tonInteractionStart={ () => {\n\t\t\t\t\tisPickerInteractingRef.current = true;\n\t\t\t\t} }\n\t\t\t\tonInteractionEnd={ () => {\n\t\t\t\t\tisPickerInteractingRef.current = false;\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<div className={ styles.auxiliary }>\n\t\t\t\t<HStack className={ styles.header } justify=\"space-between\">\n\t\t\t\t\t<Select.Root\n\t\t\t\t\t\titems={ options }\n\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\tonValueChange={ ( nextColorType ) => {\n\t\t\t\t\t\t\tif ( nextColorType !== null ) {\n\t\t\t\t\t\t\t\tsetColorType( nextColorType );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Select.Trigger\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\taria-label={ __( 'Color format' ) }\n\t\t\t\t\t\t\tclassName={ styles.select }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Select.Popup width=\"content\">\n\t\t\t\t\t\t\t{ options.map( ( option ) => (\n\t\t\t\t\t\t\t\t<Select.Item\n\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Select.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t\t\t\t</Select.ItemLabel>\n\t\t\t\t\t\t\t\t</Select.Item>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</Select.Popup>\n\t\t\t\t\t</Select.Root>\n\t\t\t\t\t<ColorCopyButton\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName={ styles[ 'color-input' ] }\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap={ 2 }\n\t\t\t\t>\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\thsla={ internalHSLA }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tonHSLChange={ handleHSLAChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t</Flex>\n\t\t\t</div>\n\t\t</PolymorphicElement>\n\t);\n};\n\n/**\n * `ColorPicker` lets users select a color from a visual color surface, or by\n * editing its hex, RGB, or HSL values.\n */\nexport const ColorPicker = contextConnect(\n\tUnconnectedColorPicker,\n\t'ColorPicker'\n);\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBAAmB;EAC9B,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,gCAAgB,IAAI,QAAQ;CAC7B;CAEA,IAAK,OAAO,aAAa,aACxB,iBAAkB,QAAS;CAG5B,OAAO,YAAY;AACpB;;;;;;;;;AAUA,SAAS,0BACR,gBACA,MACU;CACV,IAAK,CAAE,eAAe,MACrB,OAAO;CAGR,KAAM,MAAM,SAAS,eAAe,KAAK,iBACxC,SAAU,qBAAsB,EACjC,GACC,IAAK,MAAM,aAAc,oBAAqB,MAAM,MACnD,OAAO;CAIT,OAAO;AACR;;;;;;;;;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;CAC3E,IAAK,CAAE,eAAe,MACrB;CAGD,MAAM,UAAU,WAAW;CAC3B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