@iconify/react
Advanced tools
Comparing version 3.1.0-beta.5 to 3.1.0
@@ -84,3 +84,3 @@ import { default as React_2 } from 'react'; | ||
*/ | ||
export declare const Icon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
export declare const Icon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
@@ -399,3 +399,3 @@ /** | ||
// Array of icons that should be used for samples in icon sets list. | ||
samples: string[]; | ||
samples?: string[]; | ||
@@ -412,4 +412,4 @@ // Icon grid: number or array of numbers. | ||
// Palette status. True if icons have predefined color scheme, false if icons use currentColor. | ||
// Icon set should not mix icons with and without palette to simplify search. | ||
palette: boolean; | ||
// Ideally, icon set should not mix icons with and without palette to simplify search. | ||
palette?: boolean; | ||
} | ||
@@ -547,3 +547,3 @@ | ||
*/ | ||
export declare const InlineIcon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
export declare const InlineIcon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
@@ -681,5 +681,4 @@ /** | ||
* Replace IDs in SVG output with unique IDs | ||
* Fast replacement without parsing XML, assuming commonly used patterns and clean XML (icon should have been cleaned up with Iconify Tools or SVGO). | ||
*/ | ||
export declare function replaceIDs(body: string, prefix?: string | (() => string)): string; | ||
export declare function replaceIDs(body: string, prefix?: string | ((id: string) => string)): string; | ||
@@ -686,0 +685,0 @@ /** |
@@ -102,62 +102,299 @@ 'use strict'; | ||
// src/icon-set/parse.ts | ||
var defaultsKeys = Object.keys(iconDefaults); | ||
function resolveAlias(alias, icons, aliases, level = 0) { | ||
const parent = alias.parent; | ||
if (icons[parent] !== void 0) { | ||
return mergeIconData(icons[parent], alias); | ||
} | ||
if (aliases[parent] !== void 0) { | ||
if (level > 2) { | ||
// src/icon-set/get-icon.ts | ||
function getIconData$1(data, name, full = false) { | ||
function getIcon(name2, iteration) { | ||
var _a, _b, _c, _d; | ||
if (data.icons[name2] !== void 0) { | ||
return Object.assign({}, data.icons[name2]); | ||
} | ||
if (iteration > 5) { | ||
return null; | ||
} | ||
const icon = resolveAlias(aliases[parent], icons, aliases, level + 1); | ||
if (icon) { | ||
return mergeIconData(icon, alias); | ||
if (((_a = data.aliases) == null ? void 0 : _a[name2]) !== void 0) { | ||
const item = (_b = data.aliases) == null ? void 0 : _b[name2]; | ||
const result2 = getIcon(item.parent, iteration + 1); | ||
if (result2) { | ||
return mergeIconData(result2, item); | ||
} | ||
return result2; | ||
} | ||
if (iteration === 0 && ((_c = data.chars) == null ? void 0 : _c[name2]) !== void 0) { | ||
return getIcon((_d = data.chars) == null ? void 0 : _d[name2], iteration + 1); | ||
} | ||
return null; | ||
} | ||
const result = getIcon(name, 0); | ||
if (result) { | ||
for (const key in iconDefaults) { | ||
if (result[key] === void 0 && data[key] !== void 0) { | ||
result[key] = data[key]; | ||
} | ||
} | ||
} | ||
return result && full ? fullIcon(result) : result; | ||
} | ||
// src/icon-set/validate.ts | ||
var matchChar = /^[a-f0-9]+(-[a-f0-9]+)*$/; | ||
function validateIconProps(item, fix) { | ||
for (const key in item) { | ||
const attr = key; | ||
const value = item[attr]; | ||
const type = typeof value; | ||
if (type === "undefined") { | ||
delete item[attr]; | ||
continue; | ||
} | ||
switch (key) { | ||
case "body": | ||
case "parent": | ||
if (type !== "string") { | ||
return key; | ||
} | ||
break; | ||
case "hFlip": | ||
case "vFlip": | ||
case "hidden": | ||
if (type !== "boolean") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
case "width": | ||
case "height": | ||
case "left": | ||
case "top": | ||
case "rotate": | ||
case "inlineHeight": | ||
case "inlineTop": | ||
case "verticalAlign": | ||
if (type !== "number") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
default: | ||
if (type === "object") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
function parseIconSet(data, callback, list = "none") { | ||
const added = []; | ||
if (typeof data !== "object") { | ||
return list === "none" ? false : added; | ||
function validateIconSet(obj, options) { | ||
const fix = !!(options == null ? void 0 : options.fix); | ||
if (typeof obj !== "object" || obj === null || typeof obj.icons !== "object" || !obj.icons) { | ||
throw new Error("Bad icon set"); | ||
} | ||
const data = obj; | ||
if (typeof (options == null ? void 0 : options.prefix) === "string") { | ||
data.prefix = options.prefix; | ||
} else if (typeof data.prefix !== "string" || !data.prefix.match(matchName)) { | ||
throw new Error("Invalid prefix"); | ||
} | ||
if (typeof (options == null ? void 0 : options.provider) === "string") { | ||
data.provider = options.provider; | ||
} else if (data.provider !== void 0) { | ||
const value = data.provider; | ||
if (typeof value !== "string" || value !== "" && !value.match(matchName)) { | ||
if (fix) { | ||
delete data.provider; | ||
} else { | ||
throw new Error("Invalid provider"); | ||
} | ||
} | ||
} | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
if (!name.match(matchName)) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon name: "${name}"`); | ||
} | ||
const item = icons[name]; | ||
if (typeof item !== "object" || item === null || typeof item.body !== "string") { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon: "${name}"`); | ||
} | ||
const key = typeof item.parent === "string" ? "parent" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid property "${key}" in icon "${name}"`); | ||
} | ||
}); | ||
if (!Object.keys(data.icons).length) { | ||
throw new Error("Icon set is empty"); | ||
} | ||
if (data.aliases !== void 0) { | ||
if (typeof data.aliases !== "object" || data.aliases === null) { | ||
if (fix) { | ||
delete data.aliases; | ||
} else { | ||
throw new Error("Invalid aliases list"); | ||
} | ||
} | ||
} | ||
if (typeof data.aliases === "object") { | ||
let validateAlias = function(name, iteration) { | ||
if (validatedAliases.has(name)) { | ||
return !failedAliases.has(name); | ||
} | ||
const item = aliases[name]; | ||
if (iteration > 5 || typeof item !== "object" || item === null || typeof item.parent !== "string" || !name.match(matchName)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid icon alias: "${name}"`); | ||
} | ||
const parent = item.parent; | ||
if (data.icons[parent] === void 0) { | ||
if (aliases[parent] === void 0 || !validateAlias(parent, iteration + 1)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Missing parent icon for alias "${name}`); | ||
} | ||
} | ||
if (fix && item.body !== void 0) { | ||
delete item.body; | ||
} | ||
const key = item.body !== void 0 ? "body" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid property "${key}" in alias "${name}"`); | ||
} | ||
validatedAliases.add(name); | ||
return true; | ||
}; | ||
const aliases = data.aliases; | ||
const validatedAliases = new Set(); | ||
const failedAliases = new Set(); | ||
Object.keys(aliases).forEach((name) => { | ||
validateAlias(name, 0); | ||
}); | ||
if (fix && !Object.keys(data.aliases).length) { | ||
delete data.aliases; | ||
} | ||
} | ||
Object.keys(iconDefaults).forEach((prop) => { | ||
const expectedType = typeof iconDefaults[prop]; | ||
const actualType = typeof data[prop]; | ||
if (actualType !== "undefined" && actualType !== expectedType) { | ||
throw new Error(`Invalid value type for "${prop}"`); | ||
} | ||
}); | ||
if (data.chars !== void 0) { | ||
if (typeof data.chars !== "object" || data.chars === null) { | ||
if (fix) { | ||
delete data.chars; | ||
} else { | ||
throw new Error("Invalid characters map"); | ||
} | ||
} | ||
} | ||
if (typeof data.chars === "object") { | ||
const chars = data.chars; | ||
Object.keys(chars).forEach((char) => { | ||
var _a; | ||
if (!char.match(matchChar) || typeof chars[char] !== "string") { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Invalid character "${char}"`); | ||
} | ||
const target = chars[char]; | ||
if (data.icons[target] === void 0 && ((_a = data.aliases) == null ? void 0 : _a[target]) === void 0) { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Character "${char}" points to missing icon "${target}"`); | ||
} | ||
}); | ||
if (fix && !Object.keys(data.chars).length) { | ||
delete data.chars; | ||
} | ||
} | ||
return data; | ||
} | ||
// src/icon-set/parse.ts | ||
function isVariation(item) { | ||
for (const key in iconDefaults) { | ||
if (item[key] !== void 0) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function parseIconSet(data, callback, options) { | ||
options = options || {}; | ||
const names = []; | ||
if (typeof data !== "object" || typeof data.icons !== "object") { | ||
return names; | ||
} | ||
const validate = options.validate; | ||
if (validate !== false) { | ||
try { | ||
validateIconSet(data, typeof validate === "object" ? validate : { fix: true }); | ||
} catch (err) { | ||
return names; | ||
} | ||
} | ||
if (data.not_found instanceof Array) { | ||
data.not_found.forEach((name) => { | ||
callback(name, null); | ||
if (list === "all") { | ||
added.push(name); | ||
} | ||
names.push(name); | ||
}); | ||
} | ||
if (typeof data.icons !== "object") { | ||
return list === "none" ? false : added; | ||
} | ||
const defaults = Object.create(null); | ||
defaultsKeys.forEach((key) => { | ||
if (data[key] !== void 0 && typeof data[key] !== "object") { | ||
defaults[key] = data[key]; | ||
} | ||
}); | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
const icon = icons[name]; | ||
if (typeof icon.body !== "string") { | ||
return; | ||
const iconData = getIconData$1(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
callback(name, Object.freeze({ ...iconDefaults, ...defaults, ...icon })); | ||
added.push(name); | ||
}); | ||
if (typeof data.aliases === "object") { | ||
const parseAliases = options.aliases || "all"; | ||
if (parseAliases !== "none" && typeof data.aliases === "object") { | ||
const aliases = data.aliases; | ||
Object.keys(aliases).forEach((name) => { | ||
const icon = resolveAlias(aliases[name], icons, aliases, 1); | ||
if (icon) { | ||
callback(name, Object.freeze({ ...iconDefaults, ...defaults, ...icon })); | ||
added.push(name); | ||
if (parseAliases === "variations" && isVariation(aliases[name])) { | ||
return; | ||
} | ||
const iconData = getIconData$1(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
}); | ||
} | ||
return list === "none" ? added.length > 0 : added; | ||
return names; | ||
} | ||
@@ -185,11 +422,11 @@ | ||
} | ||
function addIconSet(storage2, data, list = "none") { | ||
function addIconSet(storage2, data) { | ||
const t = Date.now(); | ||
return parseIconSet(data, (name, icon) => { | ||
if (icon === null) { | ||
if (icon) { | ||
storage2.icons[name] = icon; | ||
} else { | ||
storage2.missing[name] = t; | ||
} else { | ||
storage2.icons[name] = icon; | ||
} | ||
}, list); | ||
}); | ||
} | ||
@@ -264,5 +501,10 @@ function addIconToStorage(storage2, name, icon) { | ||
parseIconSet(data, (name, icon) => { | ||
if (icon !== null && addIcon(name, icon)) { | ||
if (icon && addIcon(name, icon)) { | ||
added = true; | ||
} | ||
}, { | ||
validate: { | ||
fix: true, | ||
prefix: "" | ||
} | ||
}); | ||
@@ -517,5 +759,2 @@ return added; | ||
var counter = 0; | ||
function isQuote(char) { | ||
return char === '"' || char === "'"; | ||
} | ||
function replaceIDs(body, prefix = randomPrefix) { | ||
@@ -530,30 +769,6 @@ const ids = []; | ||
} | ||
ids.sort((a, b) => b.length - a.length); | ||
ids.forEach((id) => { | ||
const newID = typeof prefix === "function" ? prefix() : prefix + counter++; | ||
const parts = body.split(id); | ||
let lastPart = parts.shift(); | ||
body = lastPart; | ||
parts.forEach((part) => { | ||
if (!part.length) { | ||
body += id + part; | ||
lastPart += id + part; | ||
return; | ||
} | ||
const lastChar = lastPart.slice(lastPart.length - 1); | ||
const nextChar = part.slice(0, 1); | ||
function test() { | ||
if (lastChar === "#") { | ||
return isQuote(nextChar) || nextChar === ")"; | ||
} | ||
const isAnimationDot = nextChar === "." && !!part.slice(1, 2).match(/\w/); | ||
if (isQuote(lastChar) || lastChar === ";") { | ||
return isQuote(nextChar) || isAnimationDot; | ||
} | ||
return false; | ||
} | ||
const success = test(); | ||
body += (success ? newID : id) + part; | ||
lastPart = part; | ||
}); | ||
const newID = typeof prefix === "function" ? prefix(id) : prefix + counter++; | ||
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3"); | ||
}); | ||
@@ -1336,8 +1551,8 @@ return body; | ||
try { | ||
const added = addIconSet(storage, data, "all"); | ||
if (typeof added === "boolean") { | ||
const parsed = addIconSet(storage, data); | ||
if (!parsed.length) { | ||
return; | ||
} | ||
const pending = providerPendingIcons[prefix]; | ||
added.forEach((name) => { | ||
parsed.forEach((name) => { | ||
delete pending[name]; | ||
@@ -1516,3 +1731,3 @@ }); | ||
const storage = getStorage(provider, prefix); | ||
valid = addIconSet(storage, data.data); | ||
valid = addIconSet(storage, data.data).length > 0; | ||
} | ||
@@ -1645,3 +1860,3 @@ } catch (err) { | ||
// src/customisations/rotate.ts | ||
function rotateFromString(value) { | ||
function rotateFromString(value, defaultValue = 0) { | ||
const units = value.replace(/^-?[0-9.]*/, ""); | ||
@@ -1675,3 +1890,3 @@ function cleanup(value2) { | ||
} | ||
return 0; | ||
return defaultValue; | ||
} | ||
@@ -1678,0 +1893,0 @@ |
@@ -40,3 +40,3 @@ import { default as React_2 } from 'react'; | ||
*/ | ||
export declare const Icon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
export declare const Icon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
@@ -216,3 +216,3 @@ /** | ||
// Array of icons that should be used for samples in icon sets list. | ||
samples: string[]; | ||
samples?: string[]; | ||
@@ -229,4 +229,4 @@ // Icon grid: number or array of numbers. | ||
// Palette status. True if icons have predefined color scheme, false if icons use currentColor. | ||
// Icon set should not mix icons with and without palette to simplify search. | ||
palette: boolean; | ||
// Ideally, icon set should not mix icons with and without palette to simplify search. | ||
palette?: boolean; | ||
} | ||
@@ -333,3 +333,3 @@ | ||
*/ | ||
export declare const InlineIcon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
export declare const InlineIcon: React_2.ForwardRefExoticComponent<Pick<IconProps, "string" | "slice" | "end" | "local" | "color" | "clip" | "style" | "inline" | "flip" | "fill" | "stroke" | "x" | "y" | "icon" | "clipPath" | "cursor" | "direction" | "display" | "filter" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "additive" | "values" | "path" | "children" | "key" | "crossOrigin" | "href" | "max" | "media" | "method" | "min" | "name" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "target" | "type" | "accentHeight" | "accumulate" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "hFlip" | "vFlip" | "hAlign" | "vAlign"> & React_2.RefAttributes<IconRef>>; | ||
@@ -336,0 +336,0 @@ /** |
@@ -12,2 +12,3 @@ 'use strict'; | ||
// src/icon/index.ts | ||
var matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/; | ||
var iconDefaults = Object.freeze({ | ||
@@ -53,62 +54,299 @@ left: 0, | ||
// src/icon-set/parse.ts | ||
var defaultsKeys = Object.keys(iconDefaults); | ||
function resolveAlias(alias, icons, aliases, level = 0) { | ||
const parent = alias.parent; | ||
if (icons[parent] !== void 0) { | ||
return mergeIconData(icons[parent], alias); | ||
} | ||
if (aliases[parent] !== void 0) { | ||
if (level > 2) { | ||
// src/icon-set/get-icon.ts | ||
function getIconData(data, name, full = false) { | ||
function getIcon(name2, iteration) { | ||
var _a, _b, _c, _d; | ||
if (data.icons[name2] !== void 0) { | ||
return Object.assign({}, data.icons[name2]); | ||
} | ||
if (iteration > 5) { | ||
return null; | ||
} | ||
const icon = resolveAlias(aliases[parent], icons, aliases, level + 1); | ||
if (icon) { | ||
return mergeIconData(icon, alias); | ||
if (((_a = data.aliases) == null ? void 0 : _a[name2]) !== void 0) { | ||
const item = (_b = data.aliases) == null ? void 0 : _b[name2]; | ||
const result2 = getIcon(item.parent, iteration + 1); | ||
if (result2) { | ||
return mergeIconData(result2, item); | ||
} | ||
return result2; | ||
} | ||
if (iteration === 0 && ((_c = data.chars) == null ? void 0 : _c[name2]) !== void 0) { | ||
return getIcon((_d = data.chars) == null ? void 0 : _d[name2], iteration + 1); | ||
} | ||
return null; | ||
} | ||
const result = getIcon(name, 0); | ||
if (result) { | ||
for (const key in iconDefaults) { | ||
if (result[key] === void 0 && data[key] !== void 0) { | ||
result[key] = data[key]; | ||
} | ||
} | ||
} | ||
return result && full ? fullIcon(result) : result; | ||
} | ||
// src/icon-set/validate.ts | ||
var matchChar = /^[a-f0-9]+(-[a-f0-9]+)*$/; | ||
function validateIconProps(item, fix) { | ||
for (const key in item) { | ||
const attr = key; | ||
const value = item[attr]; | ||
const type = typeof value; | ||
if (type === "undefined") { | ||
delete item[attr]; | ||
continue; | ||
} | ||
switch (key) { | ||
case "body": | ||
case "parent": | ||
if (type !== "string") { | ||
return key; | ||
} | ||
break; | ||
case "hFlip": | ||
case "vFlip": | ||
case "hidden": | ||
if (type !== "boolean") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
case "width": | ||
case "height": | ||
case "left": | ||
case "top": | ||
case "rotate": | ||
case "inlineHeight": | ||
case "inlineTop": | ||
case "verticalAlign": | ||
if (type !== "number") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
default: | ||
if (type === "object") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
function parseIconSet(data, callback, list = "none") { | ||
const added = []; | ||
if (typeof data !== "object") { | ||
return list === "none" ? false : added; | ||
function validateIconSet(obj, options) { | ||
const fix = !!(options == null ? void 0 : options.fix); | ||
if (typeof obj !== "object" || obj === null || typeof obj.icons !== "object" || !obj.icons) { | ||
throw new Error("Bad icon set"); | ||
} | ||
const data = obj; | ||
if (typeof (options == null ? void 0 : options.prefix) === "string") { | ||
data.prefix = options.prefix; | ||
} else if (typeof data.prefix !== "string" || !data.prefix.match(matchName)) { | ||
throw new Error("Invalid prefix"); | ||
} | ||
if (typeof (options == null ? void 0 : options.provider) === "string") { | ||
data.provider = options.provider; | ||
} else if (data.provider !== void 0) { | ||
const value = data.provider; | ||
if (typeof value !== "string" || value !== "" && !value.match(matchName)) { | ||
if (fix) { | ||
delete data.provider; | ||
} else { | ||
throw new Error("Invalid provider"); | ||
} | ||
} | ||
} | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
if (!name.match(matchName)) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon name: "${name}"`); | ||
} | ||
const item = icons[name]; | ||
if (typeof item !== "object" || item === null || typeof item.body !== "string") { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon: "${name}"`); | ||
} | ||
const key = typeof item.parent === "string" ? "parent" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid property "${key}" in icon "${name}"`); | ||
} | ||
}); | ||
if (!Object.keys(data.icons).length) { | ||
throw new Error("Icon set is empty"); | ||
} | ||
if (data.aliases !== void 0) { | ||
if (typeof data.aliases !== "object" || data.aliases === null) { | ||
if (fix) { | ||
delete data.aliases; | ||
} else { | ||
throw new Error("Invalid aliases list"); | ||
} | ||
} | ||
} | ||
if (typeof data.aliases === "object") { | ||
let validateAlias = function(name, iteration) { | ||
if (validatedAliases.has(name)) { | ||
return !failedAliases.has(name); | ||
} | ||
const item = aliases[name]; | ||
if (iteration > 5 || typeof item !== "object" || item === null || typeof item.parent !== "string" || !name.match(matchName)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid icon alias: "${name}"`); | ||
} | ||
const parent = item.parent; | ||
if (data.icons[parent] === void 0) { | ||
if (aliases[parent] === void 0 || !validateAlias(parent, iteration + 1)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Missing parent icon for alias "${name}`); | ||
} | ||
} | ||
if (fix && item.body !== void 0) { | ||
delete item.body; | ||
} | ||
const key = item.body !== void 0 ? "body" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid property "${key}" in alias "${name}"`); | ||
} | ||
validatedAliases.add(name); | ||
return true; | ||
}; | ||
const aliases = data.aliases; | ||
const validatedAliases = new Set(); | ||
const failedAliases = new Set(); | ||
Object.keys(aliases).forEach((name) => { | ||
validateAlias(name, 0); | ||
}); | ||
if (fix && !Object.keys(data.aliases).length) { | ||
delete data.aliases; | ||
} | ||
} | ||
Object.keys(iconDefaults).forEach((prop) => { | ||
const expectedType = typeof iconDefaults[prop]; | ||
const actualType = typeof data[prop]; | ||
if (actualType !== "undefined" && actualType !== expectedType) { | ||
throw new Error(`Invalid value type for "${prop}"`); | ||
} | ||
}); | ||
if (data.chars !== void 0) { | ||
if (typeof data.chars !== "object" || data.chars === null) { | ||
if (fix) { | ||
delete data.chars; | ||
} else { | ||
throw new Error("Invalid characters map"); | ||
} | ||
} | ||
} | ||
if (typeof data.chars === "object") { | ||
const chars = data.chars; | ||
Object.keys(chars).forEach((char) => { | ||
var _a; | ||
if (!char.match(matchChar) || typeof chars[char] !== "string") { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Invalid character "${char}"`); | ||
} | ||
const target = chars[char]; | ||
if (data.icons[target] === void 0 && ((_a = data.aliases) == null ? void 0 : _a[target]) === void 0) { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Character "${char}" points to missing icon "${target}"`); | ||
} | ||
}); | ||
if (fix && !Object.keys(data.chars).length) { | ||
delete data.chars; | ||
} | ||
} | ||
return data; | ||
} | ||
// src/icon-set/parse.ts | ||
function isVariation(item) { | ||
for (const key in iconDefaults) { | ||
if (item[key] !== void 0) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function parseIconSet(data, callback, options) { | ||
options = options || {}; | ||
const names = []; | ||
if (typeof data !== "object" || typeof data.icons !== "object") { | ||
return names; | ||
} | ||
const validate = options.validate; | ||
if (validate !== false) { | ||
try { | ||
validateIconSet(data, typeof validate === "object" ? validate : { fix: true }); | ||
} catch (err) { | ||
return names; | ||
} | ||
} | ||
if (data.not_found instanceof Array) { | ||
data.not_found.forEach((name) => { | ||
callback(name, null); | ||
if (list === "all") { | ||
added.push(name); | ||
} | ||
names.push(name); | ||
}); | ||
} | ||
if (typeof data.icons !== "object") { | ||
return list === "none" ? false : added; | ||
} | ||
const defaults = Object.create(null); | ||
defaultsKeys.forEach((key) => { | ||
if (data[key] !== void 0 && typeof data[key] !== "object") { | ||
defaults[key] = data[key]; | ||
} | ||
}); | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
const icon = icons[name]; | ||
if (typeof icon.body !== "string") { | ||
return; | ||
const iconData = getIconData(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
callback(name, Object.freeze({ ...iconDefaults, ...defaults, ...icon })); | ||
added.push(name); | ||
}); | ||
if (typeof data.aliases === "object") { | ||
const parseAliases = options.aliases || "all"; | ||
if (parseAliases !== "none" && typeof data.aliases === "object") { | ||
const aliases = data.aliases; | ||
Object.keys(aliases).forEach((name) => { | ||
const icon = resolveAlias(aliases[name], icons, aliases, 1); | ||
if (icon) { | ||
callback(name, Object.freeze({ ...iconDefaults, ...defaults, ...icon })); | ||
added.push(name); | ||
if (parseAliases === "variations" && isVariation(aliases[name])) { | ||
return; | ||
} | ||
const iconData = getIconData(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
}); | ||
} | ||
return list === "none" ? added.length > 0 : added; | ||
return names; | ||
} | ||
@@ -212,3 +450,3 @@ | ||
// src/customisations/rotate.ts | ||
function rotateFromString(value) { | ||
function rotateFromString(value, defaultValue = 0) { | ||
const units = value.replace(/^-?[0-9.]*/, ""); | ||
@@ -242,3 +480,3 @@ function cleanup(value2) { | ||
} | ||
return 0; | ||
return defaultValue; | ||
} | ||
@@ -413,5 +651,2 @@ | ||
var counter = 0; | ||
function isQuote(char) { | ||
return char === '"' || char === "'"; | ||
} | ||
function replaceIDs(body, prefix = randomPrefix) { | ||
@@ -426,30 +661,6 @@ const ids = []; | ||
} | ||
ids.sort((a, b) => b.length - a.length); | ||
ids.forEach((id) => { | ||
const newID = typeof prefix === "function" ? prefix() : prefix + counter++; | ||
const parts = body.split(id); | ||
let lastPart = parts.shift(); | ||
body = lastPart; | ||
parts.forEach((part) => { | ||
if (!part.length) { | ||
body += id + part; | ||
lastPart += id + part; | ||
return; | ||
} | ||
const lastChar = lastPart.slice(lastPart.length - 1); | ||
const nextChar = part.slice(0, 1); | ||
function test() { | ||
if (lastChar === "#") { | ||
return isQuote(nextChar) || nextChar === ")"; | ||
} | ||
const isAnimationDot = nextChar === "." && !!part.slice(1, 2).match(/\w/); | ||
if (isQuote(lastChar) || lastChar === ";") { | ||
return isQuote(nextChar) || isAnimationDot; | ||
} | ||
return false; | ||
} | ||
const success = test(); | ||
body += (success ? newID : id) + part; | ||
lastPart = part; | ||
}); | ||
const newID = typeof prefix === "function" ? prefix(id) : prefix + counter++; | ||
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3"); | ||
}); | ||
@@ -637,5 +848,11 @@ return body; | ||
parseIconSet(data, (name, icon) => { | ||
if (icon !== null) { | ||
if (icon) { | ||
storage[iconPrefix + name] = icon; | ||
} | ||
}, { | ||
// Allow empty prefix | ||
validate: { | ||
fix: true, | ||
prefix: iconPrefix, | ||
}, | ||
}); | ||
@@ -642,0 +859,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Vjacheslav Trushkin", | ||
"version": "3.1.0-beta.5", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -43,15 +43,15 @@ "bugs": "https://github.com/iconify/iconify/issues", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.14.2", | ||
"@babel/preset-react": "^7.13.13", | ||
"@iconify/core": "^1.2.0-beta.3", | ||
"@microsoft/api-extractor": "^7.13.5", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"@babel/preset-env": "^7.16.0", | ||
"@babel/preset-react": "^7.16.0", | ||
"@iconify/core": "^1.2.0", | ||
"@microsoft/api-extractor": "^7.18.19", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@types/react": "^17.0.3", | ||
"babel-jest": "^26.6.3", | ||
"jest": "^26.6.3", | ||
"babel-jest": "^27.3.1", | ||
"jest": "^27.3.1", | ||
"react": "^17.0.2", | ||
"react-test-renderer": "^17.0.2", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.50.0", | ||
"typescript": "^4.2.4" | ||
"rollup": "^2.59.0", | ||
"typescript": "^4.4.4" | ||
}, | ||
@@ -58,0 +58,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
244099
7152
0