@johnfmorton/some-shade 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.d.ts +78 -0
- package/dist/some-shade.cjs.js +8 -8
- package/dist/some-shade.es.js +200 -200
- package/dist/some-shade.umd.js +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 - 2026-03-01
|
|
4
|
+
|
|
5
|
+
- Add `reference-width` attribute (default 1024) — normalizes `u_gridSize` and `u_dotRadius` by source image width so the dot pattern looks visually consistent regardless of image resolution
|
|
6
|
+
|
|
3
7
|
## 0.1.1-beta
|
|
4
8
|
|
|
5
9
|
- Fix halftone-duotone and halftone-cmyk shaders to sample at grid cell center — dots are now clean, uniform circles instead of splotchy per-pixel noise
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { PropertyValues } from 'lit';
|
|
4
|
+
import { TemplateResult } from 'lit';
|
|
5
|
+
|
|
6
|
+
export declare interface EffectDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
fragmentShader: string;
|
|
9
|
+
vertexShader: string;
|
|
10
|
+
uniforms: UniformDefinition[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare function get(name: string): EffectDefinition | undefined;
|
|
14
|
+
|
|
15
|
+
export declare function list(): string[];
|
|
16
|
+
|
|
17
|
+
export declare function register(effect: EffectDefinition): void;
|
|
18
|
+
|
|
19
|
+
export declare class SomeShadeImage extends LitElement {
|
|
20
|
+
static styles: CSSResult;
|
|
21
|
+
src: string;
|
|
22
|
+
effect: string;
|
|
23
|
+
dotRadius: number;
|
|
24
|
+
gridSize: number;
|
|
25
|
+
angleC: number;
|
|
26
|
+
angleM: number;
|
|
27
|
+
angleY: number;
|
|
28
|
+
angleK: number;
|
|
29
|
+
showC: number;
|
|
30
|
+
showM: number;
|
|
31
|
+
showY: number;
|
|
32
|
+
showK: number;
|
|
33
|
+
intensityK: number;
|
|
34
|
+
duotoneColor: string;
|
|
35
|
+
angle: number;
|
|
36
|
+
dotOffsetX: number;
|
|
37
|
+
dotOffsetY: number;
|
|
38
|
+
bgColor: string;
|
|
39
|
+
angleWarm: number;
|
|
40
|
+
angleCool: number;
|
|
41
|
+
showWarm: number;
|
|
42
|
+
showCool: number;
|
|
43
|
+
warmColor: string;
|
|
44
|
+
coolColor: string;
|
|
45
|
+
blendMode: number;
|
|
46
|
+
referenceWidth: number;
|
|
47
|
+
loadingBlur: number;
|
|
48
|
+
private _webglAvailable;
|
|
49
|
+
private _snapshotUrl;
|
|
50
|
+
private _snapshotLoaded;
|
|
51
|
+
private _image;
|
|
52
|
+
private _observer;
|
|
53
|
+
private _visible;
|
|
54
|
+
private _needsRender;
|
|
55
|
+
render(): TemplateResult<1>;
|
|
56
|
+
connectedCallback(): void;
|
|
57
|
+
updated(changed: PropertyValues): void;
|
|
58
|
+
disconnectedCallback(): void;
|
|
59
|
+
private _loadImage;
|
|
60
|
+
private _scheduleRender;
|
|
61
|
+
private _renderEffect;
|
|
62
|
+
private _onSnapshotLoad;
|
|
63
|
+
/** Hide the rendered snapshot momentarily, then fade it back in.
|
|
64
|
+
* Useful for previewing the loading-blur transition. */
|
|
65
|
+
replayTransition(delay?: number): void;
|
|
66
|
+
private _revokeSnapshot;
|
|
67
|
+
private _getUniformValues;
|
|
68
|
+
private _parseHexColor;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare interface UniformDefinition {
|
|
72
|
+
name: string;
|
|
73
|
+
type: 'float' | 'vec2' | 'vec3' | 'vec4';
|
|
74
|
+
default: number | number[];
|
|
75
|
+
attribute?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { }
|
package/dist/some-shade.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lit"),s=require("lit/decorators.js");function U(e){return e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0})}function S(e,o,a){const t=e.createShader(o);if(!t)throw new Error("Failed to create shader");if(e.shaderSource(t,a),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS)){const u=e.getShaderInfoLog(t);throw e.deleteShader(t),new Error(`Shader compile error: ${u}`)}return t}function K(e,o,a){const t=S(e,e.VERTEX_SHADER,o),u=S(e,e.FRAGMENT_SHADER,a),n=e.createProgram();if(!n)throw new Error("Failed to create program");if(e.attachShader(n,t),e.attachShader(n,u),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){const d=e.getProgramInfoLog(n);throw e.deleteProgram(n),new Error(`Program link error: ${d}`)}e.deleteShader(t),e.deleteShader(u);const r=new Map,g=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let d=0;d<g;d++){const f=e.getActiveAttrib(n,d);f&&r.set(f.name,e.getAttribLocation(n,f.name))}const c=new Map,m=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let d=0;d<m;d++){const f=e.getActiveUniform(n,d);if(f){const h=e.getUniformLocation(n,f.name);h&&c.set(f.name,h)}}return{program:n,attribLocations:r,uniformLocations:c}}function k(e,o,a){for(const[t,u]of Object.entries(a)){const n=o.uniformLocations.get(t);if(n){if(typeof u=="number")e.uniform1f(n,u);else if(Array.isArray(u))switch(u.length){case 2:e.uniform2fv(n,u);break;case 3:e.uniform3fv(n,u);break;case 4:e.uniform4fv(n,u);break}}}}function D(e,o){const a=e.createTexture();if(!a)throw new Error("Failed to create texture");return e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),{texture:a,width:o.naturalWidth,height:o.naturalHeight}}function L(e,o){const a=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),t=e.createBuffer();if(!t)throw new Error("Failed to create buffer");e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,a,e.STATIC_DRAW);const u=4*Float32Array.BYTES_PER_ELEMENT,n=o.attribLocations.get("a_position");n!==void 0&&n!==-1&&(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,u,0));const r=o.attribLocations.get("a_texCoord");return r!==void 0&&r!==-1&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,u,2*Float32Array.BYTES_PER_ELEMENT)),t}function M(e){e.drawArrays(e.TRIANGLE_STRIP,0,4)}const z=`precision mediump float;
|
|
2
2
|
|
|
3
3
|
varying vec2 v_texCoord;
|
|
4
4
|
|
|
@@ -92,7 +92,7 @@ void main() {
|
|
|
92
92
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
93
93
|
v_texCoord = a_texCoord;
|
|
94
94
|
}
|
|
95
|
-
`,
|
|
95
|
+
`,P={name:"halftone-cmyk",fragmentShader:z,vertexShader:y,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_angleC",type:"float",default:15,attribute:"angle-c"},{name:"u_angleM",type:"float",default:75,attribute:"angle-m"},{name:"u_angleY",type:"float",default:0,attribute:"angle-y"},{name:"u_angleK",type:"float",default:45,attribute:"angle-k"},{name:"u_showC",type:"float",default:1,attribute:"show-c"},{name:"u_showM",type:"float",default:1,attribute:"show-m"},{name:"u_showY",type:"float",default:1,attribute:"show-y"},{name:"u_showK",type:"float",default:1,attribute:"show-k"},{name:"u_intensityK",type:"float",default:1,attribute:"intensity-k"}]},I=`precision mediump float;
|
|
96
96
|
|
|
97
97
|
varying vec2 v_texCoord;
|
|
98
98
|
|
|
@@ -134,7 +134,7 @@ void main() {
|
|
|
134
134
|
|
|
135
135
|
gl_FragColor = vec4(result, color.a);
|
|
136
136
|
}
|
|
137
|
-
`,
|
|
137
|
+
`,V={name:"halftone-duotone",fragmentShader:I,vertexShader:y,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_duotoneColor",type:"vec3",default:[0,.6,.8],attribute:"duotone-color"},{name:"u_angle",type:"float",default:0,attribute:"angle"}]},N=`precision mediump float;
|
|
138
138
|
|
|
139
139
|
varying vec2 v_texCoord;
|
|
140
140
|
|
|
@@ -190,7 +190,7 @@ void main() {
|
|
|
190
190
|
|
|
191
191
|
gl_FragColor = vec4(result, 1.0);
|
|
192
192
|
}
|
|
193
|
-
`,
|
|
193
|
+
`,O={name:"dot-grid",fragmentShader:N,vertexShader:y,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_dotOffset",type:"vec2",default:[.5,.5],attribute:"dot-offset"},{name:"u_bgColor",type:"vec3",default:[1,1,1],attribute:"bg-color"},{name:"u_angle",type:"float",default:0,attribute:"angle"}]},F=`precision mediump float;
|
|
194
194
|
|
|
195
195
|
varying vec2 v_texCoord;
|
|
196
196
|
|
|
@@ -273,14 +273,14 @@ void main() {
|
|
|
273
273
|
|
|
274
274
|
gl_FragColor = vec4(clamp(result, 0.0, 1.0), color.a);
|
|
275
275
|
}
|
|
276
|
-
`,
|
|
276
|
+
`,W={name:"technicolor-2strip",fragmentShader:F,vertexShader:y,uniforms:[{name:"u_dotRadius",type:"float",default:7,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:10,attribute:"grid-size"},{name:"u_angleWarm",type:"float",default:15,attribute:"angle-warm"},{name:"u_angleCool",type:"float",default:75,attribute:"angle-cool"},{name:"u_angleK",type:"float",default:45,attribute:"angle-k"},{name:"u_showWarm",type:"float",default:1,attribute:"show-warm"},{name:"u_showCool",type:"float",default:1,attribute:"show-cool"},{name:"u_showK",type:"float",default:1,attribute:"show-k"},{name:"u_warmColor",type:"vec3",default:[.85,.25,.06],attribute:"warm-color"},{name:"u_coolColor",type:"vec3",default:[.05,.65,.6],attribute:"cool-color"},{name:"u_blendMode",type:"float",default:1,attribute:"blend-mode"},{name:"u_intensityK",type:"float",default:1,attribute:"intensity-k"}]},w=new Map;function _(e){w.set(e.name,e)}function T(e){return w.get(e)}function B(){return Array.from(w.keys())}_(P);_(V);_(O);_(W);var Y=Object.defineProperty,l=(e,o,a,t)=>{for(var u=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(u=r(o,a,u)||u);return u&&Y(o,a,u),u};const X=2;let E=Promise.resolve();function x(e){const o=E.then(e,e);return E=o,o}const $=new Set(["effect","dotRadius","gridSize","angleC","angleM","angleY","angleK","showC","showM","showY","showK","intensityK","duotoneColor","angle","dotOffsetX","dotOffsetY","bgColor","angleWarm","angleCool","showWarm","showCool","warmColor","coolColor","blendMode","referenceWidth"]),C=class C extends p.LitElement{constructor(){super(...arguments),this.src="",this.effect="halftone-cmyk",this.dotRadius=4,this.gridSize=8,this.angleC=15,this.angleM=75,this.angleY=0,this.angleK=45,this.showC=1,this.showM=1,this.showY=1,this.showK=1,this.intensityK=1,this.duotoneColor="#0099cc",this.angle=0,this.dotOffsetX=.5,this.dotOffsetY=.5,this.bgColor="#ffffff",this.angleWarm=15,this.angleCool=75,this.showWarm=1,this.showCool=1,this.warmColor="#d94010",this.coolColor="#0da699",this.blendMode=1,this.referenceWidth=1024,this.loadingBlur=0,this._webglAvailable=!0,this._snapshotUrl="",this._snapshotLoaded=!1,this._image=null,this._observer=null,this._visible=!1,this._needsRender=!1}render(){if(!this._webglAvailable)return p.html`<img src=${this.src} alt="" />`;const o=this.loadingBlur>0?`filter: blur(${this.loadingBlur}px)`:"";return p.html`
|
|
277
277
|
<img src=${this.src} alt="" style=${o} />
|
|
278
|
-
${this._snapshotUrl?
|
|
278
|
+
${this._snapshotUrl?p.html`<img
|
|
279
279
|
class="snapshot${this._snapshotLoaded?" loaded":""}"
|
|
280
280
|
src=${this._snapshotUrl}
|
|
281
281
|
@load=${this._onSnapshotLoad}
|
|
282
282
|
alt="" />`:""}
|
|
283
|
-
`}connectedCallback(){super.connectedCallback(),this._observer=new IntersectionObserver(o=>{var
|
|
283
|
+
`}connectedCallback(){super.connectedCallback(),this._observer=new IntersectionObserver(o=>{var t;const a=this._visible;this._visible=((t=o[0])==null?void 0:t.isIntersecting)??!1,this._visible&&!a&&this._needsRender&&(this._needsRender=!1,x(()=>this._renderEffect()))},{rootMargin:"200px"}),this._observer.observe(this)}updated(o){if(o.has("src")&&this.src){this._loadImage(this.src);return}if(!this._image)return;[...o.keys()].some(t=>$.has(t))&&this._scheduleRender()}disconnectedCallback(){var o;super.disconnectedCallback(),(o=this._observer)==null||o.disconnect(),this._revokeSnapshot()}_loadImage(o){const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{this._image=a,this._scheduleRender()},a.onerror=()=>{console.warn(`[some-shade] Failed to load image: ${o}`)},a.src=o}_scheduleRender(){this._visible?x(()=>this._renderEffect()):this._needsRender=!0}async _renderEffect(){var g;if(!this._image)return;const o=T(this.effect);if(!o){console.warn(`[some-shade] Unknown effect: ${this.effect}`);return}const a=Math.min(window.devicePixelRatio||1,X),t=this._image.naturalWidth,u=this._image.naturalHeight,n=document.createElement("canvas");n.width=t*a,n.height=u*a;const r=U(n);if(!r){this._webglAvailable=!1;return}try{const c=K(r,o.vertexShader,o.fragmentShader);r.useProgram(c.program);const m=D(r,this._image),d=L(r,c);r.viewport(0,0,n.width,n.height),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,m.texture);const f=c.uniformLocations.get("u_image");f&&r.uniform1i(f,0),k(r,c,this._getUniformValues(m,a)),r.bindBuffer(r.ARRAY_BUFFER,d);const h=4*Float32Array.BYTES_PER_ELEMENT,b=c.attribLocations.get("a_position");b!==void 0&&b!==-1&&(r.enableVertexAttribArray(b),r.vertexAttribPointer(b,2,r.FLOAT,!1,h,0));const v=c.attribLocations.get("a_texCoord");v!==void 0&&v!==-1&&(r.enableVertexAttribArray(v),r.vertexAttribPointer(v,2,r.FLOAT,!1,h,2*Float32Array.BYTES_PER_ELEMENT)),M(r);const R=await new Promise(A=>n.toBlob(A));r.deleteTexture(m.texture),r.deleteProgram(c.program),r.deleteBuffer(d),R&&(this._snapshotLoaded=!1,this._revokeSnapshot(),this._snapshotUrl=URL.createObjectURL(R))}finally{(g=r.getExtension("WEBGL_lose_context"))==null||g.loseContext()}}_onSnapshotLoad(){this._snapshotLoaded=!0}replayTransition(o=500){this._snapshotUrl&&(this._snapshotLoaded=!1,this.updateComplete.then(()=>{setTimeout(()=>{this._snapshotLoaded=!0},o)}))}_revokeSnapshot(){this._snapshotUrl&&(URL.revokeObjectURL(this._snapshotUrl),this._snapshotUrl="")}_getUniformValues(o,a){const t={};t.u_resolution=[o.width*a,o.height*a];const u=o.width/this.referenceWidth;return t.u_dotRadius=this.dotRadius*u,t.u_gridSize=this.gridSize*u,this.effect==="halftone-cmyk"?(t.u_angleC=this.angleC,t.u_angleM=this.angleM,t.u_angleY=this.angleY,t.u_angleK=this.angleK,t.u_showC=this.showC,t.u_showM=this.showM,t.u_showY=this.showY,t.u_showK=this.showK,t.u_intensityK=this.intensityK):this.effect==="halftone-duotone"?(t.u_duotoneColor=this._parseHexColor(this.duotoneColor),t.u_angle=this.angle):this.effect==="dot-grid"?(t.u_dotOffset=[this.dotOffsetX,this.dotOffsetY],t.u_bgColor=this._parseHexColor(this.bgColor),t.u_angle=this.angle):this.effect==="technicolor-2strip"&&(t.u_angleWarm=this.angleWarm,t.u_angleCool=this.angleCool,t.u_angleK=this.angleK,t.u_showWarm=this.showWarm,t.u_showCool=this.showCool,t.u_showK=this.showK,t.u_warmColor=this._parseHexColor(this.warmColor),t.u_coolColor=this._parseHexColor(this.coolColor),t.u_blendMode=this.blendMode,t.u_intensityK=this.intensityK),t}_parseHexColor(o){const a=o.replace("#",""),t=parseInt(a.substring(0,2),16)/255,u=parseInt(a.substring(2,4),16)/255,n=parseInt(a.substring(4,6),16)/255;return[t,u,n]}};C.styles=p.css`
|
|
284
284
|
:host {
|
|
285
285
|
display: block;
|
|
286
286
|
position: relative;
|
|
@@ -303,4 +303,4 @@ void main() {
|
|
|
303
303
|
img.snapshot.loaded {
|
|
304
304
|
opacity: 1;
|
|
305
305
|
}
|
|
306
|
-
`;let
|
|
306
|
+
`;let i=C;l([s.property()],i.prototype,"src");l([s.property()],i.prototype,"effect");l([s.property({type:Number,attribute:"dot-radius"})],i.prototype,"dotRadius");l([s.property({type:Number,attribute:"grid-size"})],i.prototype,"gridSize");l([s.property({type:Number,attribute:"angle-c"})],i.prototype,"angleC");l([s.property({type:Number,attribute:"angle-m"})],i.prototype,"angleM");l([s.property({type:Number,attribute:"angle-y"})],i.prototype,"angleY");l([s.property({type:Number,attribute:"angle-k"})],i.prototype,"angleK");l([s.property({type:Number,attribute:"show-c"})],i.prototype,"showC");l([s.property({type:Number,attribute:"show-m"})],i.prototype,"showM");l([s.property({type:Number,attribute:"show-y"})],i.prototype,"showY");l([s.property({type:Number,attribute:"show-k"})],i.prototype,"showK");l([s.property({type:Number,attribute:"intensity-k"})],i.prototype,"intensityK");l([s.property({attribute:"duotone-color"})],i.prototype,"duotoneColor");l([s.property({type:Number})],i.prototype,"angle");l([s.property({type:Number,attribute:"dot-offset-x"})],i.prototype,"dotOffsetX");l([s.property({type:Number,attribute:"dot-offset-y"})],i.prototype,"dotOffsetY");l([s.property({attribute:"bg-color"})],i.prototype,"bgColor");l([s.property({type:Number,attribute:"angle-warm"})],i.prototype,"angleWarm");l([s.property({type:Number,attribute:"angle-cool"})],i.prototype,"angleCool");l([s.property({type:Number,attribute:"show-warm"})],i.prototype,"showWarm");l([s.property({type:Number,attribute:"show-cool"})],i.prototype,"showCool");l([s.property({attribute:"warm-color"})],i.prototype,"warmColor");l([s.property({attribute:"cool-color"})],i.prototype,"coolColor");l([s.property({type:Number,attribute:"blend-mode"})],i.prototype,"blendMode");l([s.property({type:Number,attribute:"reference-width"})],i.prototype,"referenceWidth");l([s.property({type:Number,attribute:"loading-blur"})],i.prototype,"loadingBlur");l([s.state()],i.prototype,"_webglAvailable");l([s.state()],i.prototype,"_snapshotUrl");l([s.state()],i.prototype,"_snapshotLoaded");customElements.get("some-shade-image")||customElements.define("some-shade-image",i);exports.SomeShadeImage=i;exports.get=T;exports.list=B;exports.register=_;
|
package/dist/some-shade.es.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { LitElement as
|
|
1
|
+
import { LitElement as U, css as K, html as y } from "lit";
|
|
2
2
|
import { property as u, state as w } from "lit/decorators.js";
|
|
3
|
-
function
|
|
4
|
-
return
|
|
3
|
+
function k(e) {
|
|
4
|
+
return e.getContext("webgl", {
|
|
5
5
|
alpha: !0,
|
|
6
6
|
premultipliedAlpha: !1,
|
|
7
7
|
preserveDrawingBuffer: !0
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
throw
|
|
10
|
+
function x(e, o, a) {
|
|
11
|
+
const t = e.createShader(o);
|
|
12
|
+
if (!t) throw new Error("Failed to create shader");
|
|
13
|
+
if (e.shaderSource(t, a), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS)) {
|
|
14
|
+
const l = e.getShaderInfoLog(t);
|
|
15
|
+
throw e.deleteShader(t), new Error(`Shader compile error: ${l}`);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
19
|
+
function D(e, o, a) {
|
|
20
|
+
const t = x(e, e.VERTEX_SHADER, o), l = x(e, e.FRAGMENT_SHADER, a), r = e.createProgram();
|
|
21
21
|
if (!r) throw new Error("Failed to create program");
|
|
22
|
-
if (
|
|
23
|
-
const d =
|
|
24
|
-
throw
|
|
22
|
+
if (e.attachShader(r, t), e.attachShader(r, l), e.linkProgram(r), !e.getProgramParameter(r, e.LINK_STATUS)) {
|
|
23
|
+
const d = e.getProgramInfoLog(r);
|
|
24
|
+
throw e.deleteProgram(r), new Error(`Program link error: ${d}`);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
for (let d = 0; d < h; d++) {
|
|
29
|
-
const f = t.getActiveAttrib(r, d);
|
|
30
|
-
f && c.set(f.name, t.getAttribLocation(r, f.name));
|
|
31
|
-
}
|
|
32
|
-
const s = /* @__PURE__ */ new Map(), _ = t.getProgramParameter(r, t.ACTIVE_UNIFORMS);
|
|
26
|
+
e.deleteShader(t), e.deleteShader(l);
|
|
27
|
+
const n = /* @__PURE__ */ new Map(), _ = e.getProgramParameter(r, e.ACTIVE_ATTRIBUTES);
|
|
33
28
|
for (let d = 0; d < _; d++) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
const c = e.getActiveAttrib(r, d);
|
|
30
|
+
c && n.set(c.name, e.getAttribLocation(r, c.name));
|
|
31
|
+
}
|
|
32
|
+
const f = /* @__PURE__ */ new Map(), m = e.getProgramParameter(r, e.ACTIVE_UNIFORMS);
|
|
33
|
+
for (let d = 0; d < m; d++) {
|
|
34
|
+
const c = e.getActiveUniform(r, d);
|
|
35
|
+
if (c) {
|
|
36
|
+
const h = e.getUniformLocation(r, c.name);
|
|
37
|
+
h && f.set(c.name, h);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
return { program: r, attribLocations:
|
|
40
|
+
return { program: r, attribLocations: n, uniformLocations: f };
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
for (const [
|
|
44
|
-
const r = o.uniformLocations.get(
|
|
42
|
+
function L(e, o, a) {
|
|
43
|
+
for (const [t, l] of Object.entries(a)) {
|
|
44
|
+
const r = o.uniformLocations.get(t);
|
|
45
45
|
if (r) {
|
|
46
|
-
if (typeof
|
|
47
|
-
|
|
48
|
-
else if (Array.isArray(
|
|
49
|
-
switch (
|
|
46
|
+
if (typeof l == "number")
|
|
47
|
+
e.uniform1f(r, l);
|
|
48
|
+
else if (Array.isArray(l))
|
|
49
|
+
switch (l.length) {
|
|
50
50
|
case 2:
|
|
51
|
-
|
|
51
|
+
e.uniform2fv(r, l);
|
|
52
52
|
break;
|
|
53
53
|
case 3:
|
|
54
|
-
|
|
54
|
+
e.uniform3fv(r, l);
|
|
55
55
|
break;
|
|
56
56
|
case 4:
|
|
57
|
-
|
|
57
|
+
e.uniform4fv(r, l);
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
66
|
-
return
|
|
63
|
+
function M(e, o) {
|
|
64
|
+
const a = e.createTexture();
|
|
65
|
+
if (!a) throw new Error("Failed to create texture");
|
|
66
|
+
return e.bindTexture(e.TEXTURE_2D, a), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, o), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), { texture: a, width: o.naturalWidth, height: o.naturalHeight };
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
68
|
+
function z(e, o) {
|
|
69
|
+
const a = new Float32Array([
|
|
70
70
|
// pos.x pos.y tex.s tex.t
|
|
71
71
|
-1,
|
|
72
72
|
-1,
|
|
@@ -84,18 +84,18 @@ function O(t, o) {
|
|
|
84
84
|
1,
|
|
85
85
|
1,
|
|
86
86
|
0
|
|
87
|
-
]),
|
|
88
|
-
if (!
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
r !== void 0 && r !== -1 && (
|
|
92
|
-
const
|
|
93
|
-
return
|
|
87
|
+
]), t = e.createBuffer();
|
|
88
|
+
if (!t) throw new Error("Failed to create buffer");
|
|
89
|
+
e.bindBuffer(e.ARRAY_BUFFER, t), e.bufferData(e.ARRAY_BUFFER, a, e.STATIC_DRAW);
|
|
90
|
+
const l = 4 * Float32Array.BYTES_PER_ELEMENT, r = o.attribLocations.get("a_position");
|
|
91
|
+
r !== void 0 && r !== -1 && (e.enableVertexAttribArray(r), e.vertexAttribPointer(r, 2, e.FLOAT, !1, l, 0));
|
|
92
|
+
const n = o.attribLocations.get("a_texCoord");
|
|
93
|
+
return n !== void 0 && n !== -1 && (e.enableVertexAttribArray(n), e.vertexAttribPointer(n, 2, e.FLOAT, !1, l, 2 * Float32Array.BYTES_PER_ELEMENT)), t;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
95
|
+
function P(e) {
|
|
96
|
+
e.drawArrays(e.TRIANGLE_STRIP, 0, 4);
|
|
97
97
|
}
|
|
98
|
-
const
|
|
98
|
+
const I = `precision mediump float;
|
|
99
99
|
|
|
100
100
|
varying vec2 v_texCoord;
|
|
101
101
|
|
|
@@ -189,9 +189,9 @@ void main() {
|
|
|
189
189
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
190
190
|
v_texCoord = a_texCoord;
|
|
191
191
|
}
|
|
192
|
-
`,
|
|
192
|
+
`, V = {
|
|
193
193
|
name: "halftone-cmyk",
|
|
194
|
-
fragmentShader:
|
|
194
|
+
fragmentShader: I,
|
|
195
195
|
vertexShader: b,
|
|
196
196
|
uniforms: [
|
|
197
197
|
{ name: "u_dotRadius", type: "float", default: 4, attribute: "dot-radius" },
|
|
@@ -248,7 +248,7 @@ void main() {
|
|
|
248
248
|
|
|
249
249
|
gl_FragColor = vec4(result, color.a);
|
|
250
250
|
}
|
|
251
|
-
`,
|
|
251
|
+
`, O = {
|
|
252
252
|
name: "halftone-duotone",
|
|
253
253
|
fragmentShader: N,
|
|
254
254
|
vertexShader: b,
|
|
@@ -258,7 +258,7 @@ void main() {
|
|
|
258
258
|
{ name: "u_duotoneColor", type: "vec3", default: [0, 0.6, 0.8], attribute: "duotone-color" },
|
|
259
259
|
{ name: "u_angle", type: "float", default: 0, attribute: "angle" }
|
|
260
260
|
]
|
|
261
|
-
},
|
|
261
|
+
}, F = `precision mediump float;
|
|
262
262
|
|
|
263
263
|
varying vec2 v_texCoord;
|
|
264
264
|
|
|
@@ -314,9 +314,9 @@ void main() {
|
|
|
314
314
|
|
|
315
315
|
gl_FragColor = vec4(result, 1.0);
|
|
316
316
|
}
|
|
317
|
-
`,
|
|
317
|
+
`, W = {
|
|
318
318
|
name: "dot-grid",
|
|
319
|
-
fragmentShader:
|
|
319
|
+
fragmentShader: F,
|
|
320
320
|
vertexShader: b,
|
|
321
321
|
uniforms: [
|
|
322
322
|
{ name: "u_dotRadius", type: "float", default: 4, attribute: "dot-radius" },
|
|
@@ -325,7 +325,7 @@ void main() {
|
|
|
325
325
|
{ name: "u_bgColor", type: "vec3", default: [1, 1, 1], attribute: "bg-color" },
|
|
326
326
|
{ name: "u_angle", type: "float", default: 0, attribute: "angle" }
|
|
327
327
|
]
|
|
328
|
-
},
|
|
328
|
+
}, B = `precision mediump float;
|
|
329
329
|
|
|
330
330
|
varying vec2 v_texCoord;
|
|
331
331
|
|
|
@@ -408,9 +408,9 @@ void main() {
|
|
|
408
408
|
|
|
409
409
|
gl_FragColor = vec4(clamp(result, 0.0, 1.0), color.a);
|
|
410
410
|
}
|
|
411
|
-
`,
|
|
411
|
+
`, Y = {
|
|
412
412
|
name: "technicolor-2strip",
|
|
413
|
-
fragmentShader:
|
|
413
|
+
fragmentShader: B,
|
|
414
414
|
vertexShader: b,
|
|
415
415
|
uniforms: [
|
|
416
416
|
{ name: "u_dotRadius", type: "float", default: 7, attribute: "dot-radius" },
|
|
@@ -427,31 +427,31 @@ void main() {
|
|
|
427
427
|
{ name: "u_intensityK", type: "float", default: 1, attribute: "intensity-k" }
|
|
428
428
|
]
|
|
429
429
|
}, C = /* @__PURE__ */ new Map();
|
|
430
|
-
function v(
|
|
431
|
-
C.set(
|
|
430
|
+
function v(e) {
|
|
431
|
+
C.set(e.name, e);
|
|
432
432
|
}
|
|
433
|
-
function
|
|
434
|
-
return C.get(
|
|
433
|
+
function X(e) {
|
|
434
|
+
return C.get(e);
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function Q() {
|
|
437
437
|
return Array.from(C.keys());
|
|
438
438
|
}
|
|
439
|
+
v(V);
|
|
440
|
+
v(O);
|
|
439
441
|
v(W);
|
|
440
|
-
v(F);
|
|
441
442
|
v(Y);
|
|
442
|
-
|
|
443
|
-
var
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
return e && H(o, n, e), e;
|
|
443
|
+
var $ = Object.defineProperty, s = (e, o, a, t) => {
|
|
444
|
+
for (var l = void 0, r = e.length - 1, n; r >= 0; r--)
|
|
445
|
+
(n = e[r]) && (l = n(o, a, l) || l);
|
|
446
|
+
return l && $(o, a, l), l;
|
|
447
447
|
};
|
|
448
|
-
const
|
|
449
|
-
let
|
|
450
|
-
function
|
|
451
|
-
const o =
|
|
452
|
-
return
|
|
448
|
+
const G = 2;
|
|
449
|
+
let E = Promise.resolve();
|
|
450
|
+
function T(e) {
|
|
451
|
+
const o = E.then(e, e);
|
|
452
|
+
return E = o, o;
|
|
453
453
|
}
|
|
454
|
-
const
|
|
454
|
+
const H = /* @__PURE__ */ new Set([
|
|
455
455
|
"effect",
|
|
456
456
|
"dotRadius",
|
|
457
457
|
"gridSize",
|
|
@@ -475,10 +475,11 @@ const j = /* @__PURE__ */ new Set([
|
|
|
475
475
|
"showCool",
|
|
476
476
|
"warmColor",
|
|
477
477
|
"coolColor",
|
|
478
|
-
"blendMode"
|
|
479
|
-
|
|
478
|
+
"blendMode",
|
|
479
|
+
"referenceWidth"
|
|
480
|
+
]), R = class R extends U {
|
|
480
481
|
constructor() {
|
|
481
|
-
super(...arguments), this.src = "", this.effect = "halftone-cmyk", this.dotRadius = 4, this.gridSize = 8, this.angleC = 15, this.angleM = 75, this.angleY = 0, this.angleK = 45, this.showC = 1, this.showM = 1, this.showY = 1, this.showK = 1, this.intensityK = 1, this.duotoneColor = "#0099cc", this.angle = 0, this.dotOffsetX = 0.5, this.dotOffsetY = 0.5, this.bgColor = "#ffffff", this.angleWarm = 15, this.angleCool = 75, this.showWarm = 1, this.showCool = 1, this.warmColor = "#d94010", this.coolColor = "#0da699", this.blendMode = 1, this.loadingBlur = 0, this._webglAvailable = !0, this._snapshotUrl = "", this._snapshotLoaded = !1, this._image = null, this._observer = null, this.
|
|
482
|
+
super(...arguments), this.src = "", this.effect = "halftone-cmyk", this.dotRadius = 4, this.gridSize = 8, this.angleC = 15, this.angleM = 75, this.angleY = 0, this.angleK = 45, this.showC = 1, this.showM = 1, this.showY = 1, this.showK = 1, this.intensityK = 1, this.duotoneColor = "#0099cc", this.angle = 0, this.dotOffsetX = 0.5, this.dotOffsetY = 0.5, this.bgColor = "#ffffff", this.angleWarm = 15, this.angleCool = 75, this.showWarm = 1, this.showCool = 1, this.warmColor = "#d94010", this.coolColor = "#0da699", this.blendMode = 1, this.referenceWidth = 1024, this.loadingBlur = 0, this._webglAvailable = !0, this._snapshotUrl = "", this._snapshotLoaded = !1, this._image = null, this._observer = null, this._visible = !1, this._needsRender = !1;
|
|
482
483
|
}
|
|
483
484
|
render() {
|
|
484
485
|
if (!this._webglAvailable)
|
|
@@ -496,17 +497,13 @@ const j = /* @__PURE__ */ new Set([
|
|
|
496
497
|
connectedCallback() {
|
|
497
498
|
super.connectedCallback(), this._observer = new IntersectionObserver(
|
|
498
499
|
(o) => {
|
|
499
|
-
var
|
|
500
|
-
const
|
|
501
|
-
this._visible = ((
|
|
500
|
+
var t;
|
|
501
|
+
const a = this._visible;
|
|
502
|
+
this._visible = ((t = o[0]) == null ? void 0 : t.isIntersecting) ?? !1, this._visible && !a && this._needsRender && (this._needsRender = !1, T(() => this._renderEffect()));
|
|
502
503
|
},
|
|
503
504
|
// Start rendering slightly before the element scrolls into view.
|
|
504
505
|
{ rootMargin: "200px" }
|
|
505
|
-
), this._observer.observe(this)
|
|
506
|
-
if (!this._image) return;
|
|
507
|
-
const o = this.clientWidth;
|
|
508
|
-
o > 0 && o !== this._lastClientWidth && (this._lastClientWidth = o, this._scheduleRender());
|
|
509
|
-
}), this._resizeObserver.observe(this);
|
|
506
|
+
), this._observer.observe(this);
|
|
510
507
|
}
|
|
511
508
|
updated(o) {
|
|
512
509
|
if (o.has("src") && this.src) {
|
|
@@ -515,29 +512,29 @@ const j = /* @__PURE__ */ new Set([
|
|
|
515
512
|
}
|
|
516
513
|
if (!this._image) return;
|
|
517
514
|
[...o.keys()].some(
|
|
518
|
-
(
|
|
515
|
+
(t) => H.has(t)
|
|
519
516
|
) && this._scheduleRender();
|
|
520
517
|
}
|
|
521
518
|
disconnectedCallback() {
|
|
522
|
-
var o
|
|
523
|
-
super.disconnectedCallback(), (o = this._observer) == null || o.disconnect(),
|
|
519
|
+
var o;
|
|
520
|
+
super.disconnectedCallback(), (o = this._observer) == null || o.disconnect(), this._revokeSnapshot();
|
|
524
521
|
}
|
|
525
522
|
// ---------------------------------------------------------------------------
|
|
526
523
|
// Image loading
|
|
527
524
|
// ---------------------------------------------------------------------------
|
|
528
525
|
_loadImage(o) {
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
this._image =
|
|
532
|
-
},
|
|
526
|
+
const a = new Image();
|
|
527
|
+
a.crossOrigin = "anonymous", a.onload = () => {
|
|
528
|
+
this._image = a, this._scheduleRender();
|
|
529
|
+
}, a.onerror = () => {
|
|
533
530
|
console.warn(`[some-shade] Failed to load image: ${o}`);
|
|
534
|
-
},
|
|
531
|
+
}, a.src = o;
|
|
535
532
|
}
|
|
536
533
|
// ---------------------------------------------------------------------------
|
|
537
534
|
// Render scheduling
|
|
538
535
|
// ---------------------------------------------------------------------------
|
|
539
536
|
_scheduleRender() {
|
|
540
|
-
this._visible ?
|
|
537
|
+
this._visible ? T(() => this._renderEffect()) : this._needsRender = !0;
|
|
541
538
|
}
|
|
542
539
|
// ---------------------------------------------------------------------------
|
|
543
540
|
// WebGL render → snapshot → tear-down
|
|
@@ -545,52 +542,50 @@ const j = /* @__PURE__ */ new Set([
|
|
|
545
542
|
async _renderEffect() {
|
|
546
543
|
var _;
|
|
547
544
|
if (!this._image) return;
|
|
548
|
-
const o =
|
|
545
|
+
const o = X(this.effect);
|
|
549
546
|
if (!o) {
|
|
550
547
|
console.warn(`[some-shade] Unknown effect: ${this.effect}`);
|
|
551
548
|
return;
|
|
552
549
|
}
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
const s = L(h);
|
|
558
|
-
if (!s) {
|
|
550
|
+
const a = Math.min(window.devicePixelRatio || 1, G), t = this._image.naturalWidth, l = this._image.naturalHeight, r = document.createElement("canvas");
|
|
551
|
+
r.width = t * a, r.height = l * a;
|
|
552
|
+
const n = k(r);
|
|
553
|
+
if (!n) {
|
|
559
554
|
this._webglAvailable = !1;
|
|
560
555
|
return;
|
|
561
556
|
}
|
|
562
557
|
try {
|
|
563
|
-
const
|
|
564
|
-
|
|
558
|
+
const f = D(
|
|
559
|
+
n,
|
|
565
560
|
o.vertexShader,
|
|
566
561
|
o.fragmentShader
|
|
567
562
|
);
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this._getUniformValues(
|
|
576
|
-
),
|
|
577
|
-
const
|
|
578
|
-
g !== void 0 && g !== -1 && (
|
|
579
|
-
const p =
|
|
580
|
-
p !== void 0 && p !== -1 && (
|
|
563
|
+
n.useProgram(f.program);
|
|
564
|
+
const m = M(n, this._image), d = z(n, f);
|
|
565
|
+
n.viewport(0, 0, r.width, r.height), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.activeTexture(n.TEXTURE0), n.bindTexture(n.TEXTURE_2D, m.texture);
|
|
566
|
+
const c = f.uniformLocations.get("u_image");
|
|
567
|
+
c && n.uniform1i(c, 0), L(
|
|
568
|
+
n,
|
|
569
|
+
f,
|
|
570
|
+
this._getUniformValues(m, a)
|
|
571
|
+
), n.bindBuffer(n.ARRAY_BUFFER, d);
|
|
572
|
+
const h = 4 * Float32Array.BYTES_PER_ELEMENT, g = f.attribLocations.get("a_position");
|
|
573
|
+
g !== void 0 && g !== -1 && (n.enableVertexAttribArray(g), n.vertexAttribPointer(g, 2, n.FLOAT, !1, h, 0));
|
|
574
|
+
const p = f.attribLocations.get("a_texCoord");
|
|
575
|
+
p !== void 0 && p !== -1 && (n.enableVertexAttribArray(p), n.vertexAttribPointer(
|
|
581
576
|
p,
|
|
582
577
|
2,
|
|
583
|
-
|
|
578
|
+
n.FLOAT,
|
|
584
579
|
!1,
|
|
585
|
-
|
|
580
|
+
h,
|
|
586
581
|
2 * Float32Array.BYTES_PER_ELEMENT
|
|
587
|
-
)),
|
|
588
|
-
const
|
|
589
|
-
(
|
|
582
|
+
)), P(n);
|
|
583
|
+
const S = await new Promise(
|
|
584
|
+
(A) => r.toBlob(A)
|
|
590
585
|
);
|
|
591
|
-
|
|
586
|
+
n.deleteTexture(m.texture), n.deleteProgram(f.program), n.deleteBuffer(d), S && (this._snapshotLoaded = !1, this._revokeSnapshot(), this._snapshotUrl = URL.createObjectURL(S));
|
|
592
587
|
} finally {
|
|
593
|
-
(_ =
|
|
588
|
+
(_ = n.getExtension("WEBGL_lose_context")) == null || _.loseContext();
|
|
594
589
|
}
|
|
595
590
|
}
|
|
596
591
|
// ---------------------------------------------------------------------------
|
|
@@ -611,19 +606,21 @@ const j = /* @__PURE__ */ new Set([
|
|
|
611
606
|
_revokeSnapshot() {
|
|
612
607
|
this._snapshotUrl && (URL.revokeObjectURL(this._snapshotUrl), this._snapshotUrl = "");
|
|
613
608
|
}
|
|
614
|
-
_getUniformValues(o,
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
o.width *
|
|
618
|
-
o.height *
|
|
619
|
-
]
|
|
609
|
+
_getUniformValues(o, a) {
|
|
610
|
+
const t = {};
|
|
611
|
+
t.u_resolution = [
|
|
612
|
+
o.width * a,
|
|
613
|
+
o.height * a
|
|
614
|
+
];
|
|
615
|
+
const l = o.width / this.referenceWidth;
|
|
616
|
+
return t.u_dotRadius = this.dotRadius * l, t.u_gridSize = this.gridSize * l, this.effect === "halftone-cmyk" ? (t.u_angleC = this.angleC, t.u_angleM = this.angleM, t.u_angleY = this.angleY, t.u_angleK = this.angleK, t.u_showC = this.showC, t.u_showM = this.showM, t.u_showY = this.showY, t.u_showK = this.showK, t.u_intensityK = this.intensityK) : this.effect === "halftone-duotone" ? (t.u_duotoneColor = this._parseHexColor(this.duotoneColor), t.u_angle = this.angle) : this.effect === "dot-grid" ? (t.u_dotOffset = [this.dotOffsetX, this.dotOffsetY], t.u_bgColor = this._parseHexColor(this.bgColor), t.u_angle = this.angle) : this.effect === "technicolor-2strip" && (t.u_angleWarm = this.angleWarm, t.u_angleCool = this.angleCool, t.u_angleK = this.angleK, t.u_showWarm = this.showWarm, t.u_showCool = this.showCool, t.u_showK = this.showK, t.u_warmColor = this._parseHexColor(this.warmColor), t.u_coolColor = this._parseHexColor(this.coolColor), t.u_blendMode = this.blendMode, t.u_intensityK = this.intensityK), t;
|
|
620
617
|
}
|
|
621
618
|
_parseHexColor(o) {
|
|
622
|
-
const
|
|
623
|
-
return [
|
|
619
|
+
const a = o.replace("#", ""), t = parseInt(a.substring(0, 2), 16) / 255, l = parseInt(a.substring(2, 4), 16) / 255, r = parseInt(a.substring(4, 6), 16) / 255;
|
|
620
|
+
return [t, l, r];
|
|
624
621
|
}
|
|
625
622
|
};
|
|
626
|
-
R.styles =
|
|
623
|
+
R.styles = K`
|
|
627
624
|
:host {
|
|
628
625
|
display: block;
|
|
629
626
|
position: relative;
|
|
@@ -647,98 +644,101 @@ R.styles = D`
|
|
|
647
644
|
opacity: 1;
|
|
648
645
|
}
|
|
649
646
|
`;
|
|
650
|
-
let
|
|
651
|
-
|
|
647
|
+
let i = R;
|
|
648
|
+
s([
|
|
652
649
|
u()
|
|
653
|
-
],
|
|
654
|
-
|
|
650
|
+
], i.prototype, "src");
|
|
651
|
+
s([
|
|
655
652
|
u()
|
|
656
|
-
],
|
|
657
|
-
|
|
653
|
+
], i.prototype, "effect");
|
|
654
|
+
s([
|
|
658
655
|
u({ type: Number, attribute: "dot-radius" })
|
|
659
|
-
],
|
|
660
|
-
|
|
656
|
+
], i.prototype, "dotRadius");
|
|
657
|
+
s([
|
|
661
658
|
u({ type: Number, attribute: "grid-size" })
|
|
662
|
-
],
|
|
663
|
-
|
|
659
|
+
], i.prototype, "gridSize");
|
|
660
|
+
s([
|
|
664
661
|
u({ type: Number, attribute: "angle-c" })
|
|
665
|
-
],
|
|
666
|
-
|
|
662
|
+
], i.prototype, "angleC");
|
|
663
|
+
s([
|
|
667
664
|
u({ type: Number, attribute: "angle-m" })
|
|
668
|
-
],
|
|
669
|
-
|
|
665
|
+
], i.prototype, "angleM");
|
|
666
|
+
s([
|
|
670
667
|
u({ type: Number, attribute: "angle-y" })
|
|
671
|
-
],
|
|
672
|
-
|
|
668
|
+
], i.prototype, "angleY");
|
|
669
|
+
s([
|
|
673
670
|
u({ type: Number, attribute: "angle-k" })
|
|
674
|
-
],
|
|
675
|
-
|
|
671
|
+
], i.prototype, "angleK");
|
|
672
|
+
s([
|
|
676
673
|
u({ type: Number, attribute: "show-c" })
|
|
677
|
-
],
|
|
678
|
-
|
|
674
|
+
], i.prototype, "showC");
|
|
675
|
+
s([
|
|
679
676
|
u({ type: Number, attribute: "show-m" })
|
|
680
|
-
],
|
|
681
|
-
|
|
677
|
+
], i.prototype, "showM");
|
|
678
|
+
s([
|
|
682
679
|
u({ type: Number, attribute: "show-y" })
|
|
683
|
-
],
|
|
684
|
-
|
|
680
|
+
], i.prototype, "showY");
|
|
681
|
+
s([
|
|
685
682
|
u({ type: Number, attribute: "show-k" })
|
|
686
|
-
],
|
|
687
|
-
|
|
683
|
+
], i.prototype, "showK");
|
|
684
|
+
s([
|
|
688
685
|
u({ type: Number, attribute: "intensity-k" })
|
|
689
|
-
],
|
|
690
|
-
|
|
686
|
+
], i.prototype, "intensityK");
|
|
687
|
+
s([
|
|
691
688
|
u({ attribute: "duotone-color" })
|
|
692
|
-
],
|
|
693
|
-
|
|
689
|
+
], i.prototype, "duotoneColor");
|
|
690
|
+
s([
|
|
694
691
|
u({ type: Number })
|
|
695
|
-
],
|
|
696
|
-
|
|
692
|
+
], i.prototype, "angle");
|
|
693
|
+
s([
|
|
697
694
|
u({ type: Number, attribute: "dot-offset-x" })
|
|
698
|
-
],
|
|
699
|
-
|
|
695
|
+
], i.prototype, "dotOffsetX");
|
|
696
|
+
s([
|
|
700
697
|
u({ type: Number, attribute: "dot-offset-y" })
|
|
701
|
-
],
|
|
702
|
-
|
|
698
|
+
], i.prototype, "dotOffsetY");
|
|
699
|
+
s([
|
|
703
700
|
u({ attribute: "bg-color" })
|
|
704
|
-
],
|
|
705
|
-
|
|
701
|
+
], i.prototype, "bgColor");
|
|
702
|
+
s([
|
|
706
703
|
u({ type: Number, attribute: "angle-warm" })
|
|
707
|
-
],
|
|
708
|
-
|
|
704
|
+
], i.prototype, "angleWarm");
|
|
705
|
+
s([
|
|
709
706
|
u({ type: Number, attribute: "angle-cool" })
|
|
710
|
-
],
|
|
711
|
-
|
|
707
|
+
], i.prototype, "angleCool");
|
|
708
|
+
s([
|
|
712
709
|
u({ type: Number, attribute: "show-warm" })
|
|
713
|
-
],
|
|
714
|
-
|
|
710
|
+
], i.prototype, "showWarm");
|
|
711
|
+
s([
|
|
715
712
|
u({ type: Number, attribute: "show-cool" })
|
|
716
|
-
],
|
|
717
|
-
|
|
713
|
+
], i.prototype, "showCool");
|
|
714
|
+
s([
|
|
718
715
|
u({ attribute: "warm-color" })
|
|
719
|
-
],
|
|
720
|
-
|
|
716
|
+
], i.prototype, "warmColor");
|
|
717
|
+
s([
|
|
721
718
|
u({ attribute: "cool-color" })
|
|
722
|
-
],
|
|
723
|
-
|
|
719
|
+
], i.prototype, "coolColor");
|
|
720
|
+
s([
|
|
724
721
|
u({ type: Number, attribute: "blend-mode" })
|
|
725
|
-
],
|
|
726
|
-
|
|
722
|
+
], i.prototype, "blendMode");
|
|
723
|
+
s([
|
|
724
|
+
u({ type: Number, attribute: "reference-width" })
|
|
725
|
+
], i.prototype, "referenceWidth");
|
|
726
|
+
s([
|
|
727
727
|
u({ type: Number, attribute: "loading-blur" })
|
|
728
|
-
],
|
|
729
|
-
|
|
728
|
+
], i.prototype, "loadingBlur");
|
|
729
|
+
s([
|
|
730
730
|
w()
|
|
731
|
-
],
|
|
732
|
-
|
|
731
|
+
], i.prototype, "_webglAvailable");
|
|
732
|
+
s([
|
|
733
733
|
w()
|
|
734
|
-
],
|
|
735
|
-
|
|
734
|
+
], i.prototype, "_snapshotUrl");
|
|
735
|
+
s([
|
|
736
736
|
w()
|
|
737
|
-
],
|
|
738
|
-
customElements.get("some-shade-image") || customElements.define("some-shade-image",
|
|
737
|
+
], i.prototype, "_snapshotLoaded");
|
|
738
|
+
customElements.get("some-shade-image") || customElements.define("some-shade-image", i);
|
|
739
739
|
export {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
740
|
+
i as SomeShadeImage,
|
|
741
|
+
X as get,
|
|
742
|
+
Q as list,
|
|
743
743
|
v as register
|
|
744
744
|
};
|
package/dist/some-shade.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(f,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("lit"),require("lit/decorators.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js"],h):(f=typeof globalThis<"u"?globalThis:f||self,h(f.SomeShade={},f.Lit,f.LitDecorators))})(this,(function(f,h,l){"use strict";function U(e){return e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0})}function S(e,o,i){const t=e.createShader(o);if(!t)throw new Error("Failed to create shader");if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS)){const u=e.getShaderInfoLog(t);throw e.deleteShader(t),new Error(`Shader compile error: ${u}`)}return t}function K(e,o,i){const t=S(e,e.VERTEX_SHADER,o),u=S(e,e.FRAGMENT_SHADER,i),r=e.createProgram();if(!r)throw new Error("Failed to create program");if(e.attachShader(r,t),e.attachShader(r,u),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS)){const d=e.getProgramInfoLog(r);throw e.deleteProgram(r),new Error(`Program link error: ${d}`)}e.deleteShader(t),e.deleteShader(u);const n=new Map,v=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let d=0;d<v;d++){const m=e.getActiveAttrib(r,d);m&&n.set(m.name,e.getAttribLocation(r,m.name))}const c=new Map,g=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let d=0;d<g;d++){const m=e.getActiveUniform(r,d);if(m){const _=e.getUniformLocation(r,m.name);_&&c.set(m.name,_)}}return{program:r,attribLocations:n,uniformLocations:c}}function k(e,o,i){for(const[t,u]of Object.entries(i)){const r=o.uniformLocations.get(t);if(r){if(typeof u=="number")e.uniform1f(r,u);else if(Array.isArray(u))switch(u.length){case 2:e.uniform2fv(r,u);break;case 3:e.uniform3fv(r,u);break;case 4:e.uniform4fv(r,u);break}}}}function D(e,o){const i=e.createTexture();if(!i)throw new Error("Failed to create texture");return e.bindTexture(e.TEXTURE_2D,i),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),{texture:i,width:o.naturalWidth,height:o.naturalHeight}}function L(e,o){const i=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),t=e.createBuffer();if(!t)throw new Error("Failed to create buffer");e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW);const u=4*Float32Array.BYTES_PER_ELEMENT,r=o.attribLocations.get("a_position");r!==void 0&&r!==-1&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,u,0));const n=o.attribLocations.get("a_texCoord");return n!==void 0&&n!==-1&&(e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,u,2*Float32Array.BYTES_PER_ELEMENT)),t}function M(e){e.drawArrays(e.TRIANGLE_STRIP,0,4)}const z=`precision mediump float;
|
|
2
2
|
|
|
3
3
|
varying vec2 v_texCoord;
|
|
4
4
|
|
|
@@ -92,7 +92,7 @@ void main() {
|
|
|
92
92
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
93
93
|
v_texCoord = a_texCoord;
|
|
94
94
|
}
|
|
95
|
-
`,
|
|
95
|
+
`,P={name:"halftone-cmyk",fragmentShader:z,vertexShader:b,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_angleC",type:"float",default:15,attribute:"angle-c"},{name:"u_angleM",type:"float",default:75,attribute:"angle-m"},{name:"u_angleY",type:"float",default:0,attribute:"angle-y"},{name:"u_angleK",type:"float",default:45,attribute:"angle-k"},{name:"u_showC",type:"float",default:1,attribute:"show-c"},{name:"u_showM",type:"float",default:1,attribute:"show-m"},{name:"u_showY",type:"float",default:1,attribute:"show-y"},{name:"u_showK",type:"float",default:1,attribute:"show-k"},{name:"u_intensityK",type:"float",default:1,attribute:"intensity-k"}]},I={name:"halftone-duotone",fragmentShader:`precision mediump float;
|
|
96
96
|
|
|
97
97
|
varying vec2 v_texCoord;
|
|
98
98
|
|
|
@@ -134,7 +134,7 @@ void main() {
|
|
|
134
134
|
|
|
135
135
|
gl_FragColor = vec4(result, color.a);
|
|
136
136
|
}
|
|
137
|
-
`,vertexShader:b,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_duotoneColor",type:"vec3",default:[0,.6,.8],attribute:"duotone-color"},{name:"u_angle",type:"float",default:0,attribute:"angle"}]},
|
|
137
|
+
`,vertexShader:b,uniforms:[{name:"u_dotRadius",type:"float",default:4,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:8,attribute:"grid-size"},{name:"u_duotoneColor",type:"vec3",default:[0,.6,.8],attribute:"duotone-color"},{name:"u_angle",type:"float",default:0,attribute:"angle"}]},V={name:"dot-grid",fragmentShader:`precision mediump float;
|
|
138
138
|
|
|
139
139
|
varying vec2 v_texCoord;
|
|
140
140
|
|
|
@@ -273,14 +273,14 @@ void main() {
|
|
|
273
273
|
|
|
274
274
|
gl_FragColor = vec4(clamp(result, 0.0, 1.0), color.a);
|
|
275
275
|
}
|
|
276
|
-
`,vertexShader:b,uniforms:[{name:"u_dotRadius",type:"float",default:7,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:10,attribute:"grid-size"},{name:"u_angleWarm",type:"float",default:15,attribute:"angle-warm"},{name:"u_angleCool",type:"float",default:75,attribute:"angle-cool"},{name:"u_angleK",type:"float",default:45,attribute:"angle-k"},{name:"u_showWarm",type:"float",default:1,attribute:"show-warm"},{name:"u_showCool",type:"float",default:1,attribute:"show-cool"},{name:"u_showK",type:"float",default:1,attribute:"show-k"},{name:"u_warmColor",type:"vec3",default:[.85,.25,.06],attribute:"warm-color"},{name:"u_coolColor",type:"vec3",default:[.05,.65,.6],attribute:"cool-color"},{name:"u_blendMode",type:"float",default:1,attribute:"blend-mode"},{name:"u_intensityK",type:"float",default:1,attribute:"intensity-k"}]},C=new Map;function
|
|
276
|
+
`,vertexShader:b,uniforms:[{name:"u_dotRadius",type:"float",default:7,attribute:"dot-radius"},{name:"u_gridSize",type:"float",default:10,attribute:"grid-size"},{name:"u_angleWarm",type:"float",default:15,attribute:"angle-warm"},{name:"u_angleCool",type:"float",default:75,attribute:"angle-cool"},{name:"u_angleK",type:"float",default:45,attribute:"angle-k"},{name:"u_showWarm",type:"float",default:1,attribute:"show-warm"},{name:"u_showCool",type:"float",default:1,attribute:"show-cool"},{name:"u_showK",type:"float",default:1,attribute:"show-k"},{name:"u_warmColor",type:"vec3",default:[.85,.25,.06],attribute:"warm-color"},{name:"u_coolColor",type:"vec3",default:[.05,.65,.6],attribute:"cool-color"},{name:"u_blendMode",type:"float",default:1,attribute:"blend-mode"},{name:"u_intensityK",type:"float",default:1,attribute:"intensity-k"}]},C=new Map;function p(e){C.set(e.name,e)}function E(e){return C.get(e)}function O(){return Array.from(C.keys())}p(P),p(I),p(V),p(N);var F=Object.defineProperty,s=(e,o,i,t)=>{for(var u=void 0,r=e.length-1,n;r>=0;r--)(n=e[r])&&(u=n(o,i,u)||u);return u&&F(o,i,u),u};const W=2;let x=Promise.resolve();function T(e){const o=x.then(e,e);return x=o,o}const B=new Set(["effect","dotRadius","gridSize","angleC","angleM","angleY","angleK","showC","showM","showY","showK","intensityK","duotoneColor","angle","dotOffsetX","dotOffsetY","bgColor","angleWarm","angleCool","showWarm","showCool","warmColor","coolColor","blendMode","referenceWidth"]),R=class R extends h.LitElement{constructor(){super(...arguments),this.src="",this.effect="halftone-cmyk",this.dotRadius=4,this.gridSize=8,this.angleC=15,this.angleM=75,this.angleY=0,this.angleK=45,this.showC=1,this.showM=1,this.showY=1,this.showK=1,this.intensityK=1,this.duotoneColor="#0099cc",this.angle=0,this.dotOffsetX=.5,this.dotOffsetY=.5,this.bgColor="#ffffff",this.angleWarm=15,this.angleCool=75,this.showWarm=1,this.showCool=1,this.warmColor="#d94010",this.coolColor="#0da699",this.blendMode=1,this.referenceWidth=1024,this.loadingBlur=0,this._webglAvailable=!0,this._snapshotUrl="",this._snapshotLoaded=!1,this._image=null,this._observer=null,this._visible=!1,this._needsRender=!1}render(){if(!this._webglAvailable)return h.html`<img src=${this.src} alt="" />`;const o=this.loadingBlur>0?`filter: blur(${this.loadingBlur}px)`:"";return h.html`
|
|
277
277
|
<img src=${this.src} alt="" style=${o} />
|
|
278
|
-
${this._snapshotUrl?
|
|
278
|
+
${this._snapshotUrl?h.html`<img
|
|
279
279
|
class="snapshot${this._snapshotLoaded?" loaded":""}"
|
|
280
280
|
src=${this._snapshotUrl}
|
|
281
281
|
@load=${this._onSnapshotLoad}
|
|
282
282
|
alt="" />`:""}
|
|
283
|
-
`}connectedCallback(){super.connectedCallback(),this._observer=new IntersectionObserver(o=>{var
|
|
283
|
+
`}connectedCallback(){super.connectedCallback(),this._observer=new IntersectionObserver(o=>{var t;const i=this._visible;this._visible=((t=o[0])==null?void 0:t.isIntersecting)??!1,this._visible&&!i&&this._needsRender&&(this._needsRender=!1,T(()=>this._renderEffect()))},{rootMargin:"200px"}),this._observer.observe(this)}updated(o){if(o.has("src")&&this.src){this._loadImage(this.src);return}if(!this._image)return;[...o.keys()].some(t=>B.has(t))&&this._scheduleRender()}disconnectedCallback(){var o;super.disconnectedCallback(),(o=this._observer)==null||o.disconnect(),this._revokeSnapshot()}_loadImage(o){const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this._image=i,this._scheduleRender()},i.onerror=()=>{console.warn(`[some-shade] Failed to load image: ${o}`)},i.src=o}_scheduleRender(){this._visible?T(()=>this._renderEffect()):this._needsRender=!0}async _renderEffect(){var v;if(!this._image)return;const o=E(this.effect);if(!o){console.warn(`[some-shade] Unknown effect: ${this.effect}`);return}const i=Math.min(window.devicePixelRatio||1,W),t=this._image.naturalWidth,u=this._image.naturalHeight,r=document.createElement("canvas");r.width=t*i,r.height=u*i;const n=U(r);if(!n){this._webglAvailable=!1;return}try{const c=K(n,o.vertexShader,o.fragmentShader);n.useProgram(c.program);const g=D(n,this._image),d=L(n,c);n.viewport(0,0,r.width,r.height),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,g.texture);const m=c.uniformLocations.get("u_image");m&&n.uniform1i(m,0),k(n,c,this._getUniformValues(g,i)),n.bindBuffer(n.ARRAY_BUFFER,d);const _=4*Float32Array.BYTES_PER_ELEMENT,y=c.attribLocations.get("a_position");y!==void 0&&y!==-1&&(n.enableVertexAttribArray(y),n.vertexAttribPointer(y,2,n.FLOAT,!1,_,0));const w=c.attribLocations.get("a_texCoord");w!==void 0&&w!==-1&&(n.enableVertexAttribArray(w),n.vertexAttribPointer(w,2,n.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT)),M(n);const A=await new Promise(Y=>r.toBlob(Y));n.deleteTexture(g.texture),n.deleteProgram(c.program),n.deleteBuffer(d),A&&(this._snapshotLoaded=!1,this._revokeSnapshot(),this._snapshotUrl=URL.createObjectURL(A))}finally{(v=n.getExtension("WEBGL_lose_context"))==null||v.loseContext()}}_onSnapshotLoad(){this._snapshotLoaded=!0}replayTransition(o=500){this._snapshotUrl&&(this._snapshotLoaded=!1,this.updateComplete.then(()=>{setTimeout(()=>{this._snapshotLoaded=!0},o)}))}_revokeSnapshot(){this._snapshotUrl&&(URL.revokeObjectURL(this._snapshotUrl),this._snapshotUrl="")}_getUniformValues(o,i){const t={};t.u_resolution=[o.width*i,o.height*i];const u=o.width/this.referenceWidth;return t.u_dotRadius=this.dotRadius*u,t.u_gridSize=this.gridSize*u,this.effect==="halftone-cmyk"?(t.u_angleC=this.angleC,t.u_angleM=this.angleM,t.u_angleY=this.angleY,t.u_angleK=this.angleK,t.u_showC=this.showC,t.u_showM=this.showM,t.u_showY=this.showY,t.u_showK=this.showK,t.u_intensityK=this.intensityK):this.effect==="halftone-duotone"?(t.u_duotoneColor=this._parseHexColor(this.duotoneColor),t.u_angle=this.angle):this.effect==="dot-grid"?(t.u_dotOffset=[this.dotOffsetX,this.dotOffsetY],t.u_bgColor=this._parseHexColor(this.bgColor),t.u_angle=this.angle):this.effect==="technicolor-2strip"&&(t.u_angleWarm=this.angleWarm,t.u_angleCool=this.angleCool,t.u_angleK=this.angleK,t.u_showWarm=this.showWarm,t.u_showCool=this.showCool,t.u_showK=this.showK,t.u_warmColor=this._parseHexColor(this.warmColor),t.u_coolColor=this._parseHexColor(this.coolColor),t.u_blendMode=this.blendMode,t.u_intensityK=this.intensityK),t}_parseHexColor(o){const i=o.replace("#",""),t=parseInt(i.substring(0,2),16)/255,u=parseInt(i.substring(2,4),16)/255,r=parseInt(i.substring(4,6),16)/255;return[t,u,r]}};R.styles=h.css`
|
|
284
284
|
:host {
|
|
285
285
|
display: block;
|
|
286
286
|
position: relative;
|
|
@@ -303,4 +303,4 @@ void main() {
|
|
|
303
303
|
img.snapshot.loaded {
|
|
304
304
|
opacity: 1;
|
|
305
305
|
}
|
|
306
|
-
`;let
|
|
306
|
+
`;let a=R;s([l.property()],a.prototype,"src"),s([l.property()],a.prototype,"effect"),s([l.property({type:Number,attribute:"dot-radius"})],a.prototype,"dotRadius"),s([l.property({type:Number,attribute:"grid-size"})],a.prototype,"gridSize"),s([l.property({type:Number,attribute:"angle-c"})],a.prototype,"angleC"),s([l.property({type:Number,attribute:"angle-m"})],a.prototype,"angleM"),s([l.property({type:Number,attribute:"angle-y"})],a.prototype,"angleY"),s([l.property({type:Number,attribute:"angle-k"})],a.prototype,"angleK"),s([l.property({type:Number,attribute:"show-c"})],a.prototype,"showC"),s([l.property({type:Number,attribute:"show-m"})],a.prototype,"showM"),s([l.property({type:Number,attribute:"show-y"})],a.prototype,"showY"),s([l.property({type:Number,attribute:"show-k"})],a.prototype,"showK"),s([l.property({type:Number,attribute:"intensity-k"})],a.prototype,"intensityK"),s([l.property({attribute:"duotone-color"})],a.prototype,"duotoneColor"),s([l.property({type:Number})],a.prototype,"angle"),s([l.property({type:Number,attribute:"dot-offset-x"})],a.prototype,"dotOffsetX"),s([l.property({type:Number,attribute:"dot-offset-y"})],a.prototype,"dotOffsetY"),s([l.property({attribute:"bg-color"})],a.prototype,"bgColor"),s([l.property({type:Number,attribute:"angle-warm"})],a.prototype,"angleWarm"),s([l.property({type:Number,attribute:"angle-cool"})],a.prototype,"angleCool"),s([l.property({type:Number,attribute:"show-warm"})],a.prototype,"showWarm"),s([l.property({type:Number,attribute:"show-cool"})],a.prototype,"showCool"),s([l.property({attribute:"warm-color"})],a.prototype,"warmColor"),s([l.property({attribute:"cool-color"})],a.prototype,"coolColor"),s([l.property({type:Number,attribute:"blend-mode"})],a.prototype,"blendMode"),s([l.property({type:Number,attribute:"reference-width"})],a.prototype,"referenceWidth"),s([l.property({type:Number,attribute:"loading-blur"})],a.prototype,"loadingBlur"),s([l.state()],a.prototype,"_webglAvailable"),s([l.state()],a.prototype,"_snapshotUrl"),s([l.state()],a.prototype,"_snapshotLoaded"),customElements.get("some-shade-image")||customElements.define("some-shade-image",a),f.SomeShadeImage=a,f.get=E,f.list=O,f.register=p,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|