shaders 2.5.107 → 2.5.108
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/dist/js/createShader.js +1 -1
- package/dist/partner/index.d.ts +65 -0
- package/dist/partner/index.d.ts.map +1 -0
- package/dist/partner/index.js +50 -0
- package/dist/react/Shader.js +1 -1
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/package.json +8 -1
package/dist/js/createShader.js
CHANGED
|
@@ -47,7 +47,7 @@ async function createShader(canvas, preset, options) {
|
|
|
47
47
|
if (isExternalUser()) {
|
|
48
48
|
const checkRendering = () => {
|
|
49
49
|
if (renderer.getPerformanceStats().fps > 0) {
|
|
50
|
-
telemetryCollector = startTelemetry(renderer, "2.5.
|
|
50
|
+
telemetryCollector = startTelemetry(renderer, "2.5.108", options?.disableTelemetry || false, false);
|
|
51
51
|
if (telemetryCollector) telemetryCollector.start();
|
|
52
52
|
telemetryStartTimeout = null;
|
|
53
53
|
} else telemetryStartTimeout = setTimeout(checkRendering, 500);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface PartnerPresetComponent {
|
|
2
|
+
type: string;
|
|
3
|
+
id?: string;
|
|
4
|
+
props?: Record<string, unknown>;
|
|
5
|
+
children?: PartnerPresetComponent[];
|
|
6
|
+
}
|
|
7
|
+
export interface PartnerPresetDefinition {
|
|
8
|
+
components: PartnerPresetComponent[];
|
|
9
|
+
structureVersion?: number;
|
|
10
|
+
colorSpace?: string;
|
|
11
|
+
devicePreview?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PartnerCollection {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
}
|
|
18
|
+
export type PartnerPresetLabel = 'gradient' | 'geometric' | 'organic' | 'glowing' | 'textured' | 'retro' | '3d' | 'minimal' | 'vibrant' | 'dark' | 'calm' | 'dramatic';
|
|
19
|
+
export interface PartnerKeyProp {
|
|
20
|
+
component_id: string;
|
|
21
|
+
prop: string;
|
|
22
|
+
label: string;
|
|
23
|
+
type: 'color' | 'range';
|
|
24
|
+
}
|
|
25
|
+
export interface PartnerPreset {
|
|
26
|
+
id: string;
|
|
27
|
+
collection: PartnerCollection | null;
|
|
28
|
+
definition: PartnerPresetDefinition;
|
|
29
|
+
thumbnail_url: string | null;
|
|
30
|
+
visual_description: string | null;
|
|
31
|
+
primary_colors: string[] | null;
|
|
32
|
+
color_hex_codes: string[] | null;
|
|
33
|
+
labels: PartnerPresetLabel[] | null;
|
|
34
|
+
key_props: PartnerKeyProp[] | null;
|
|
35
|
+
created_at: string;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PartnerPagination {
|
|
39
|
+
page: number;
|
|
40
|
+
limit: number;
|
|
41
|
+
total: number;
|
|
42
|
+
has_more: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface PartnerListPresetsResponse {
|
|
45
|
+
presets: PartnerPreset[];
|
|
46
|
+
pagination: PartnerPagination;
|
|
47
|
+
}
|
|
48
|
+
export interface PartnerClientOptions {
|
|
49
|
+
apiKey: string;
|
|
50
|
+
baseUrl?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ListPresetsOptions {
|
|
53
|
+
page?: number;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class PartnerClient {
|
|
57
|
+
private readonly apiKey;
|
|
58
|
+
private readonly baseUrl;
|
|
59
|
+
private readonly cache;
|
|
60
|
+
constructor(options: PartnerClientOptions);
|
|
61
|
+
private getCached;
|
|
62
|
+
private setCached;
|
|
63
|
+
listPresets(options?: ListPresetsOptions): Promise<PartnerListPresetsResponse>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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IACnC,SAAS,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,UAAU,EAAE,iBAAiB,CAAA;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAUD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;gBAEnD,OAAO,EAAE,oBAAoB;IAMzC,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,SAAS;IAIX,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,0BAA0B,CAAC;CA6BzF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const DEFAULT_BASE_URL = "https://shaders.com";
|
|
2
|
+
const CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
3
|
+
class PartnerClient {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
6
|
+
if (!options.apiKey) throw new Error("PartnerClient requires an apiKey");
|
|
7
|
+
this.apiKey = options.apiKey;
|
|
8
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
9
|
+
}
|
|
10
|
+
getCached(key) {
|
|
11
|
+
const entry = this.cache.get(key);
|
|
12
|
+
if (!entry) return null;
|
|
13
|
+
if (Date.now() > entry.expiresAt) {
|
|
14
|
+
this.cache.delete(key);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return entry.data;
|
|
18
|
+
}
|
|
19
|
+
setCached(key, data) {
|
|
20
|
+
this.cache.set(key, { data, expiresAt: Date.now() + CACHE_TTL_MS });
|
|
21
|
+
}
|
|
22
|
+
async listPresets(options = {}) {
|
|
23
|
+
const page = Math.max(1, options.page ?? 1);
|
|
24
|
+
const limit = Math.min(100, Math.max(1, options.limit ?? 20));
|
|
25
|
+
const cacheKey = `presets:p${page}:l${limit}`;
|
|
26
|
+
const cached = this.getCached(cacheKey);
|
|
27
|
+
if (cached) return cached;
|
|
28
|
+
const url = new URL(`${this.baseUrl}/api/partner/v1/presets`);
|
|
29
|
+
url.searchParams.set("page", String(page));
|
|
30
|
+
url.searchParams.set("limit", String(limit));
|
|
31
|
+
const response = await fetch(url.toString(), {
|
|
32
|
+
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
let message = response.statusText;
|
|
36
|
+
try {
|
|
37
|
+
const body = await response.json();
|
|
38
|
+
if (body.message) message = body.message;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`Partner API error ${response.status}: ${message}`);
|
|
42
|
+
}
|
|
43
|
+
const data = await response.json();
|
|
44
|
+
this.setCached(cacheKey, data);
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
PartnerClient
|
|
50
|
+
};
|
package/dist/react/Shader.js
CHANGED
|
@@ -89,7 +89,7 @@ const Shader = ({ children, disableTelemetry = false, colorSpace = "p3-linear",
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (rendererRef.current.getPerformanceStats().fps > 0) {
|
|
92
|
-
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.
|
|
92
|
+
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.108", disableTelemetry, isPreview);
|
|
93
93
|
if (telemetryCollectorRef.current) telemetryCollectorRef.current.start();
|
|
94
94
|
telemetryStartTimeoutRef.current = null;
|
|
95
95
|
} else telemetryStartTimeoutRef.current = window.setTimeout(checkRendering, 500);
|
|
@@ -67,7 +67,7 @@ function Shader(allProps) {
|
|
|
67
67
|
const checkRendering = () => {
|
|
68
68
|
const stats = rendererInstance.getPerformanceStats();
|
|
69
69
|
if (stats.fps > 0) {
|
|
70
|
-
const version = "2.5.
|
|
70
|
+
const version = "2.5.108";
|
|
71
71
|
telemetryCollector = startTelemetry(rendererInstance, version, props.disableTelemetry, props.isPreview);
|
|
72
72
|
if (telemetryCollector) {
|
|
73
73
|
telemetryCollector.start();
|
package/dist/svelte/index.js
CHANGED
|
@@ -21342,7 +21342,7 @@ function Shader($$anchor, $$props) {
|
|
|
21342
21342
|
const checkRendering = () => {
|
|
21343
21343
|
if (!rendererInstance) return;
|
|
21344
21344
|
if (rendererInstance.getPerformanceStats().fps > 0) {
|
|
21345
|
-
telemetryCollector = startTelemetry(rendererInstance, "2.5.
|
|
21345
|
+
telemetryCollector = startTelemetry(rendererInstance, "2.5.108", disableTelemetry(), isPreview());
|
|
21346
21346
|
if (telemetryCollector) telemetryCollector.start();
|
|
21347
21347
|
telemetryStartTimeout = null;
|
|
21348
21348
|
} else telemetryStartTimeout = window.setTimeout(checkRendering, 500);
|
|
@@ -60,7 +60,7 @@ var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
60
60
|
const startTelemetryWhenReady = () => {
|
|
61
61
|
const checkRendering = () => {
|
|
62
62
|
if (rendererInstance.value.getPerformanceStats().fps > 0) {
|
|
63
|
-
telemetryCollector = startTelemetry(rendererInstance.value, "2.5.
|
|
63
|
+
telemetryCollector = startTelemetry(rendererInstance.value, "2.5.108", props.disableTelemetry, props.isPreview);
|
|
64
64
|
if (telemetryCollector) telemetryCollector.start();
|
|
65
65
|
telemetryStartTimeout = null;
|
|
66
66
|
} else telemetryStartTimeout = setTimeout(checkRendering, 500);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaders",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.108",
|
|
4
4
|
"description": "Shader magic for modern frontends",
|
|
5
5
|
"author": "Shader Effects Inc.",
|
|
6
6
|
"homepage": "https://shaders.com/",
|
|
@@ -657,6 +657,10 @@
|
|
|
657
657
|
"types": "./dist/core/shaders/Fog/index.d.ts",
|
|
658
658
|
"import": "./dist/core/shaders/Fog/index.js",
|
|
659
659
|
"require": "./dist/core/shaders/Fog/index.js"
|
|
660
|
+
},
|
|
661
|
+
"./partner": {
|
|
662
|
+
"types": "./dist/partner/index.d.ts",
|
|
663
|
+
"import": "./dist/partner/index.js"
|
|
660
664
|
}
|
|
661
665
|
},
|
|
662
666
|
"typesVersions": {
|
|
@@ -703,6 +707,9 @@
|
|
|
703
707
|
"registry": [
|
|
704
708
|
"./dist/registry.d.ts"
|
|
705
709
|
],
|
|
710
|
+
"partner": [
|
|
711
|
+
"./dist/partner/index.d.ts"
|
|
712
|
+
],
|
|
706
713
|
"core/AngularBlur": [
|
|
707
714
|
"./dist/core/shaders/AngularBlur/index.d.ts"
|
|
708
715
|
],
|