Switch to minified version of color.js

See this discussion https://github.com/TiddlyWiki/TiddlyWiki5/pull/8702#issuecomment-3158465038
This commit is contained in:
Jeremy Ruston committed 2025-08-06 10:29:04 +01:00
1 parent 38457a4667
commit 974904588c
3 files changed
+3 -7509

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,2 @@
var Color=function(){"use strict";function e(e,t){let r,a,n=e.length,o=!1,s=!1;Array.isArray(e[0])?r=e:(r=[e],n=r.length,o=!0),Array.isArray(t[0])?a=t:(a=t.length>0?t.map((e=>[e])):[[]],s=!0);let i=a[0].length,c=a[0].map(((e,t)=>a.map((e=>e[t])))),l=r.map((e=>c.map((t=>{let r=0;if(!Array.isArray(e)){for(let a of t)r+=e*a;return r}for(let a=0;a<e.length;a++)r+=e[a]*(t[a]||0);return r}))));return 1===n&&o&&(l=l[0]),1===i&&s?1===n&&o?l[0]:l.map((e=>e[0])):l}function t(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function r(e,r,a=[0,0,0]){const n=t(e,r[0]),o=t(e,r[1]),s=t(e,r[2]);return a[0]=n,a[1]=o,a[2]=s,a}function a(e){return"string"===n(e)}function n(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function o(e,{precision:t=16,unit:r}){return s(e)?"none":(e=+c(e,t))+(r??"")}function s(e){return null===e}function i(e){return s(e)?0:e}function c(e,t){if(0===e)return 0;let r=~~e,a=0;r&&t&&(a=1+~~Math.log10(Math.abs(r)));const n=10**(t-a);return Math.floor(e*n+.5)/n}function l(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function u(e,t,r){return(r-e)/(t-e)}function h(e,t,r){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(r)||null===r?r:l(t[0],t[1],u(e[0],e[1],r))}function p(e,t,r){return Math.max(Math.min(r,t),e)}function m(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function f(e,t){return m(Math.abs(e)**t,e)}function d(e,t){return 0===t?0:e/t}function g(e,t,r=0,a=e.length){for(;r<a;){const n=r+a>>1;e[n]<t?r=n+1:a=n}return r}function b(e,t){if(e instanceof t)return!0;const r=t.name;for(;e;){const t=Object.getPrototypeOf(e),a=t?.constructor?.name;if(a===r)return!0;if(!a||"Object"===a)return!1;e=t}return!1}var M=Object.freeze({__proto__:null,bisectLeft:g,clamp:p,copySign:m,interpolate:l,interpolateInv:u,isInstance:b,isNone:s,isString:a,mapRange:h,multiplyMatrices:e,multiply_v3_m3x3:r,serializeNumber:o,skipNone:i,spow:f,toPrecision:c,type:n,zdiv:d});const y=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};var w={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}};class v{type;coordMeta;coordRange;range;constructor(e,t){if("object"==typeof e&&(this.coordMeta=e),t&&(this.coordMeta=t,this.coordRange=t.range??t.refRange),"string"==typeof e){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw new TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:r,max:a}=t.groups;(r||a)&&(this.range=[+r,+a])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(e){if("<angle>"===this.type)return e;let t=this.computedRange,r=this.coordRange;return"<percentage>"===this.type&&(r??=this.percentageRange()),h(t,r,e)}serialize(e,t){let r="<percentage>"===this.type?this.percentageRange(100):this.computedRange,a=this.unit;return o(e=h(this.coordRange,r,e),{unit:a,precision:t})}toString(){let e=this.type;if(this.range){let[t="",r=""]=this.range;e+=`[${t},${r}]`}return e}percentageRange(e=1){let t;return t=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[t[0]*e,t[1]*e]}static get(e,...t){return b(e,this)?e:new this(e,...t)}}const C=Symbol("instance");class R{type;name;spaceCoords;coords;id;alpha;constructor(e,t=e.space){e[C]=this,this.type="function",this.name="color",Object.assign(this,e),this.space=t,"custom"!==this.type&&(this.spaceCoords=Object.values(t.coords),this.coords||(this.coords=this.spaceCoords.map((e=>{let t=["<number>","<percentage>"];return"angle"===e.type&&t.push("<angle>"),t}))),this.coords=this.coords.map(((e,t)=>{let r=this.spaceCoords[t];return"string"==typeof e&&(e=e.trim().split(/\s*\|\s*/)),e.map((e=>v.get(e,r)))})))}serializeCoords(e,t,r){return r=e.map(((e,t)=>v.get(r?.[t]??this.coords[t][0],this.spaceCoords[t]))),e.map(((e,a)=>r[a].serialize(e,t)))}coerceCoords(e,t){return Object.entries(this.space.coords).map((([r,a],n)=>{let o=e[n];if(s(o)||isNaN(o))return o;let i=t[n],c=this.coords[n].find((e=>e.type==i));if(!c){let e=a.name||r;throw new TypeError(`${i??o?.raw??o} not allowed for ${e} in ${this.name}()`)}return o=c.resolve(o),c.range&&(t[n]=c.toString()),o}))}canSerialize(){return"function"===this.type||this.serialize}parse(e){return null}static get(e,...t){return!e||b(e,this)?e:e[C]?e[C]:new R(e,...t)}}const B={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function _(e){return Array.isArray(e)?e:B[e]}function k(e,t,a,n={}){if(e=_(e),t=_(t),!e||!t)throw new TypeErLine truncated
//# sourceMappingURL=color.global.min.js.map
@@ -1,7 +1,7 @@
{
"tiddlers": [
{
"file": "color.global.0.5.2.js",
"file": "color.global.min.v0.5.2.js",
"fields": {
"type": "application/javascript",
"title": "$:/core/modules/utils/dom/color.js",