@ikonai/sdk-react-ui 1.10.0 → 1.11.2
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/account/use-account-removal.d.ts +37 -0
- package/account/use-account-removal.d.ts.map +1 -0
- package/app/boot-snapshot-variant.d.ts +2 -1
- package/app/boot-snapshot-variant.d.ts.map +1 -0
- package/app/connection-recovery.d.ts +1 -0
- package/app/connection-recovery.d.ts.map +1 -0
- package/app/connection-state-renderer.d.ts +2 -1
- package/app/connection-state-renderer.d.ts.map +1 -0
- package/app/feedback/feedback-controls.d.ts +24 -0
- package/app/feedback/feedback-controls.d.ts.map +1 -0
- package/app/feedback/feedback-form.d.ts +26 -0
- package/app/feedback/feedback-form.d.ts.map +1 -0
- package/app/feedback/platform-layer.d.ts +32 -0
- package/app/feedback/platform-layer.d.ts.map +1 -0
- package/app/feedback/use-ikon-feedback.d.ts +13 -0
- package/app/feedback/use-ikon-feedback.d.ts.map +1 -0
- package/app/ikon-app.d.ts +1 -0
- package/app/ikon-app.d.ts.map +1 -0
- package/app/index.d.ts +2 -0
- package/app/index.d.ts.map +1 -0
- package/app/use-ikon-app.d.ts +29 -1
- package/app/use-ikon-app.d.ts.map +1 -0
- package/app/use-ikon-debug.d.ts +2 -1
- package/app/use-ikon-debug.d.ts.map +1 -0
- package/auth/auth-context.d.ts +2 -1
- package/auth/auth-context.d.ts.map +1 -0
- package/auth/auth-service.d.ts +39 -6
- package/auth/auth-service.d.ts.map +1 -0
- package/auth/index.d.ts +4 -2
- package/auth/index.d.ts.map +1 -0
- package/auth/oauth-continuation.d.ts +1 -0
- package/auth/oauth-continuation.d.ts.map +1 -0
- package/auth/storage.d.ts +2 -1
- package/auth/storage.d.ts.map +1 -0
- package/auth/types.d.ts +22 -7
- package/auth/types.d.ts.map +1 -0
- package/auth/use-auth-guard.d.ts +1 -0
- package/auth/use-auth-guard.d.ts.map +1 -0
- package/auth/use-sso-sign-in.d.ts +18 -0
- package/auth/use-sso-sign-in.d.ts.map +1 -0
- package/base/base-div.d.ts +1 -0
- package/base/base-div.d.ts.map +1 -0
- package/base/base-module.d.ts +1 -0
- package/base/base-module.d.ts.map +1 -0
- package/base/focus-hint-dispatch.d.ts +41 -0
- package/base/focus-hint-dispatch.d.ts.map +1 -0
- package/consent/use-consent.d.ts +35 -0
- package/consent/use-consent.d.ts.map +1 -0
- package/debug/debug-overlay.d.ts +2 -1
- package/debug/debug-overlay.d.ts.map +1 -0
- package/feedback-form-BSy2olwD.js +511 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/use-ikon-reactive.d.ts +2 -1
- package/hooks/use-ikon-reactive.d.ts.map +1 -0
- package/hooks/use-reactive.d.ts +2 -1
- package/hooks/use-reactive.d.ts.map +1 -0
- package/hooks/use-toasts.d.ts +1 -0
- package/hooks/use-toasts.d.ts.map +1 -0
- package/i18n/i18n.d.ts +2 -1
- package/i18n/i18n.d.ts.map +1 -0
- package/i18n/index.d.ts +1 -0
- package/i18n/index.d.ts.map +1 -0
- package/ikon-ui-registry.d.ts +1 -0
- package/ikon-ui-registry.d.ts.map +1 -0
- package/ikon-ui.d.ts +3 -2
- package/ikon-ui.d.ts.map +1 -0
- package/index.d.ts +9 -6
- package/index.d.ts.map +1 -0
- package/index.js +2279 -1931
- package/inspect/inspect-overlay.d.ts +1 -0
- package/inspect/inspect-overlay.d.ts.map +1 -0
- package/media/audio-player.d.ts +1 -0
- package/media/audio-player.d.ts.map +1 -0
- package/media/media-module.d.ts +1 -0
- package/media/media-module.d.ts.map +1 -0
- package/media/use-media-capture.d.ts +2 -1
- package/media/use-media-capture.d.ts.map +1 -0
- package/media/use-sibling-client.d.ts +2 -1
- package/media/use-sibling-client.d.ts.map +1 -0
- package/media/video-canvas.d.ts +1 -0
- package/media/video-canvas.d.ts.map +1 -0
- package/media/video-stream-view.d.ts +4 -2
- package/media/video-stream-view.d.ts.map +1 -0
- package/motion/motion-controller.d.ts +2 -1
- package/motion/motion-controller.d.ts.map +1 -0
- package/package.json +1 -1
- package/parallax-view.d.ts +3 -2
- package/parallax-view.d.ts.map +1 -0
- package/renderer/component-library.d.ts +1 -0
- package/renderer/component-library.d.ts.map +1 -0
- package/renderer/index.d.ts +2 -0
- package/renderer/index.d.ts.map +1 -0
- package/renderer/lazy-resolver.d.ts +10 -0
- package/renderer/lazy-resolver.d.ts.map +1 -0
- package/renderer/types.d.ts +5 -4
- package/renderer/types.d.ts.map +1 -0
- package/renderer/ui-renderer.d.ts +4 -3
- package/renderer/ui-renderer.d.ts.map +1 -0
- package/renderer/use-root-view.d.ts +2 -1
- package/renderer/use-root-view.d.ts.map +1 -0
- package/renderer/use-ui-node.d.ts +2 -1
- package/renderer/use-ui-node.d.ts.map +1 -0
- package/renderer/use-ui-store.d.ts +2 -1
- package/renderer/use-ui-store.d.ts.map +1 -0
- package/shadertoy/shadertoy-gl.d.ts +1 -0
- package/shadertoy/shadertoy-gl.d.ts.map +1 -0
- package/shadertoy/shadertoy-module.d.ts +4 -3
- package/shadertoy/shadertoy-module.d.ts.map +1 -0
- package/shadertoy/shadertoy-renderer.d.ts +1 -1
- package/shadertoy/shadertoy-renderer.d.ts.map +1 -0
- package/shadertoy/shadertoy-type.d.ts +2 -0
- package/shadertoy/shadertoy-type.d.ts.map +1 -0
- package/shadertoy-renderer-Cq1lOXBs.js +428 -0
- package/shadertoy-type-Cs2WeCWV.js +15 -0
- package/shared/render-motion-letters.d.ts +1 -0
- package/shared/render-motion-letters.d.ts.map +1 -0
- package/surface.d.ts +8 -5
- package/surface.d.ts.map +1 -0
- package/theme/ikon-auth.css +7 -5
- package/use-ikon-styles.d.ts +2 -1
- package/use-ikon-styles.d.ts.map +1 -0
- package/use-ikon-ui-stores.d.ts +2 -0
- package/use-ikon-ui-stores.d.ts.map +1 -0
- package/app/connection-state-renderer.spec.d.ts +0 -1
- package/app/ikon-app.spec.d.ts +0 -1
- package/auth/auth-context.spec.d.ts +0 -1
- package/base/focus-hint-scroll.spec.d.ts +0 -1
- package/media/use-media-capture.spec.d.ts +0 -1
- package/media/use-sibling-client.spec.d.ts +0 -1
- package/media/video-stream-view.spec.d.ts +0 -1
- package/renderer/unresolved-node.spec.d.ts +0 -1
- package/vite.config.d.ts +0 -2
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { n as e } from "./shadertoy-type-Cs2WeCWV.js";
|
|
2
|
+
import { memo as t, useCallback as n, useEffect as r, useMemo as i, useRef as a } from "react";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
4
|
+
//#region src/shadertoy/shadertoy-gl.ts
|
|
5
|
+
var s = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", c = 4;
|
|
6
|
+
function l(e, t) {
|
|
7
|
+
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
8
|
+
}
|
|
9
|
+
function u(e, t) {
|
|
10
|
+
let n = [];
|
|
11
|
+
for (let [r, i] of Object.entries(t)) {
|
|
12
|
+
if (l(e, r)) continue;
|
|
13
|
+
let t;
|
|
14
|
+
switch (i.type) {
|
|
15
|
+
case "float":
|
|
16
|
+
t = "float";
|
|
17
|
+
break;
|
|
18
|
+
case "vec2":
|
|
19
|
+
t = "vec2";
|
|
20
|
+
break;
|
|
21
|
+
case "vec3":
|
|
22
|
+
t = "vec3";
|
|
23
|
+
break;
|
|
24
|
+
case "vec4":
|
|
25
|
+
t = "vec4";
|
|
26
|
+
break;
|
|
27
|
+
case "int":
|
|
28
|
+
t = "int";
|
|
29
|
+
break;
|
|
30
|
+
case "bool":
|
|
31
|
+
t = "bool";
|
|
32
|
+
break;
|
|
33
|
+
default: t = "float";
|
|
34
|
+
}
|
|
35
|
+
n.push(`uniform ${t} ${r};`);
|
|
36
|
+
}
|
|
37
|
+
return `#version 300 es
|
|
38
|
+
precision highp float;
|
|
39
|
+
|
|
40
|
+
// Standard ShaderToy uniforms
|
|
41
|
+
uniform vec3 iResolution;
|
|
42
|
+
uniform float iTime;
|
|
43
|
+
uniform float iTimeDelta;
|
|
44
|
+
uniform int iFrame;
|
|
45
|
+
uniform vec4 iMouse;
|
|
46
|
+
uniform vec4 iDate;
|
|
47
|
+
|
|
48
|
+
// ShaderToy texture channels (2D images)
|
|
49
|
+
uniform sampler2D iChannel0;
|
|
50
|
+
uniform sampler2D iChannel1;
|
|
51
|
+
uniform sampler2D iChannel2;
|
|
52
|
+
uniform sampler2D iChannel3;
|
|
53
|
+
uniform vec3 iChannelResolution[4];
|
|
54
|
+
uniform float iChannelTime[4];
|
|
55
|
+
|
|
56
|
+
// Custom uniforms
|
|
57
|
+
${n.join("\n")}
|
|
58
|
+
|
|
59
|
+
out vec4 frag_out_color;
|
|
60
|
+
|
|
61
|
+
${e}
|
|
62
|
+
|
|
63
|
+
void main() {
|
|
64
|
+
vec4 color = vec4(0.0);
|
|
65
|
+
mainImage(color, gl_FragCoord.xy);
|
|
66
|
+
frag_out_color = color;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
var d = class {
|
|
71
|
+
gl;
|
|
72
|
+
program = null;
|
|
73
|
+
positionBuffer = null;
|
|
74
|
+
vao = null;
|
|
75
|
+
uniformLocations = /* @__PURE__ */ new Map();
|
|
76
|
+
customUniforms = {};
|
|
77
|
+
startTime = performance.now();
|
|
78
|
+
lastFrameTime = performance.now();
|
|
79
|
+
frameCount = 0;
|
|
80
|
+
mouseX = 0;
|
|
81
|
+
mouseY = 0;
|
|
82
|
+
mouseClickX = 0;
|
|
83
|
+
mouseClickY = 0;
|
|
84
|
+
channels = [];
|
|
85
|
+
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
86
|
+
channelTime = new Float32Array(c);
|
|
87
|
+
lastError = null;
|
|
88
|
+
currentShaderSource = "";
|
|
89
|
+
constructor(e) {
|
|
90
|
+
let t = e.getContext("webgl2", {
|
|
91
|
+
alpha: !1,
|
|
92
|
+
antialias: !1,
|
|
93
|
+
depth: !1,
|
|
94
|
+
stencil: !1,
|
|
95
|
+
preserveDrawingBuffer: !1
|
|
96
|
+
});
|
|
97
|
+
if (!t) throw Error("WebGL2 is not supported");
|
|
98
|
+
this.gl = t, this.initializeGeometry(), this.initializeChannels();
|
|
99
|
+
}
|
|
100
|
+
initializeGeometry() {
|
|
101
|
+
let e = this.gl;
|
|
102
|
+
this.vao = e.createVertexArray(), e.bindVertexArray(this.vao), this.positionBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.positionBuffer);
|
|
103
|
+
let t = new Float32Array([
|
|
104
|
+
-1,
|
|
105
|
+
-1,
|
|
106
|
+
1,
|
|
107
|
+
-1,
|
|
108
|
+
-1,
|
|
109
|
+
1,
|
|
110
|
+
-1,
|
|
111
|
+
1,
|
|
112
|
+
1,
|
|
113
|
+
-1,
|
|
114
|
+
1,
|
|
115
|
+
1
|
|
116
|
+
]);
|
|
117
|
+
e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.bindVertexArray(null);
|
|
118
|
+
}
|
|
119
|
+
initializeChannels() {
|
|
120
|
+
let e = this.gl;
|
|
121
|
+
for (let t = 0; t < c; t++) {
|
|
122
|
+
let t = e.createTexture();
|
|
123
|
+
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
124
|
+
0,
|
|
125
|
+
0,
|
|
126
|
+
0,
|
|
127
|
+
255
|
|
128
|
+
])), 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), this.channels.push({
|
|
129
|
+
texture: t,
|
|
130
|
+
width: 0,
|
|
131
|
+
height: 0,
|
|
132
|
+
url: null
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
e.bindTexture(e.TEXTURE_2D, null);
|
|
136
|
+
}
|
|
137
|
+
setChannels(e) {
|
|
138
|
+
for (let t = 0; t < c; t++) {
|
|
139
|
+
let n = e[t] ?? null, r = this.channels[t];
|
|
140
|
+
if (r.url !== n) {
|
|
141
|
+
if (r.url = n, !n) {
|
|
142
|
+
this.resetChannel(t);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
this.loadChannelImage(t, n);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
resetChannel(e) {
|
|
150
|
+
let t = this.gl, n = this.channels[e];
|
|
151
|
+
t.bindTexture(t.TEXTURE_2D, n.texture), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, 1, 1, 0, t.RGBA, t.UNSIGNED_BYTE, new Uint8Array([
|
|
152
|
+
0,
|
|
153
|
+
0,
|
|
154
|
+
0,
|
|
155
|
+
255
|
|
156
|
+
])), t.bindTexture(t.TEXTURE_2D, null), n.width = 0, n.height = 0, this.channelResolution[e * 3] = 0, this.channelResolution[e * 3 + 1] = 0, this.channelResolution[e * 3 + 2] = 0;
|
|
157
|
+
}
|
|
158
|
+
loadChannelImage(e, t) {
|
|
159
|
+
let n = this.gl, r = new Image();
|
|
160
|
+
t.startsWith("data:") || (r.crossOrigin = "anonymous"), r.onload = () => {
|
|
161
|
+
let i = this.channels[e];
|
|
162
|
+
i.url !== t || !i.texture || (n.bindTexture(n.TEXTURE_2D, i.texture), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !0), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, r), n.generateMipmap(n.TEXTURE_2D), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR_MIPMAP_LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !1), n.bindTexture(n.TEXTURE_2D, null), i.width = r.naturalWidth, i.height = r.naturalHeight, this.channelResolution[e * 3] = r.naturalWidth, this.channelResolution[e * 3 + 1] = r.naturalHeight, this.channelResolution[e * 3 + 2] = 1);
|
|
163
|
+
}, r.onerror = () => {
|
|
164
|
+
this.lastError = `Failed to load texture for iChannel${e}`;
|
|
165
|
+
}, r.src = t;
|
|
166
|
+
}
|
|
167
|
+
compile(e, t = {}) {
|
|
168
|
+
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
169
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, s);
|
|
170
|
+
if (!r) return !1;
|
|
171
|
+
let i = u(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
172
|
+
if (!a) return n.deleteShader(r), !1;
|
|
173
|
+
let o = n.createProgram();
|
|
174
|
+
return o ? (n.attachShader(o, r), n.attachShader(o, a), n.linkProgram(o), n.deleteShader(r), n.deleteShader(a), n.getProgramParameter(o, n.LINK_STATUS) ? (this.program && n.deleteProgram(this.program), this.program = o, this.cacheUniformLocations(), !0) : (this.lastError = n.getProgramInfoLog(o) || "Program link failed", n.deleteProgram(o), !1)) : (this.lastError = "Failed to create program", n.deleteShader(r), n.deleteShader(a), !1);
|
|
175
|
+
}
|
|
176
|
+
recompileWithUniforms(e) {
|
|
177
|
+
return this.currentShaderSource ? this.compile(this.currentShaderSource, e) : !1;
|
|
178
|
+
}
|
|
179
|
+
compileShader(e, t) {
|
|
180
|
+
let n = this.gl, r = n.createShader(e);
|
|
181
|
+
return r ? (n.shaderSource(r, t), n.compileShader(r), n.getShaderParameter(r, n.COMPILE_STATUS) ? r : (this.lastError = n.getShaderInfoLog(r) || "Shader compilation failed", n.deleteShader(r), null)) : (this.lastError = "Failed to create shader", null);
|
|
182
|
+
}
|
|
183
|
+
cacheUniformLocations() {
|
|
184
|
+
if (!this.program) return;
|
|
185
|
+
let e = this.gl;
|
|
186
|
+
this.uniformLocations.clear();
|
|
187
|
+
for (let t of [
|
|
188
|
+
"iResolution",
|
|
189
|
+
"iTime",
|
|
190
|
+
"iTimeDelta",
|
|
191
|
+
"iFrame",
|
|
192
|
+
"iMouse",
|
|
193
|
+
"iDate"
|
|
194
|
+
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
195
|
+
for (let t = 0; t < c; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
196
|
+
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
197
|
+
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
198
|
+
}
|
|
199
|
+
setCustomUniforms(e) {
|
|
200
|
+
let t = Object.keys(e).some((e) => !(e in this.customUniforms)), n = Object.keys(this.customUniforms).some((t) => !(t in e));
|
|
201
|
+
t || n ? this.recompileWithUniforms(e) : this.customUniforms = e;
|
|
202
|
+
}
|
|
203
|
+
setMouse(e, t, n, r) {
|
|
204
|
+
this.mouseX = e, this.mouseY = t, this.mouseClickX = n, this.mouseClickY = r;
|
|
205
|
+
}
|
|
206
|
+
draw() {
|
|
207
|
+
if (!this.program) return;
|
|
208
|
+
let e = this.gl, t = e.canvas, n = typeof window < "u" && window.devicePixelRatio || 1, r = Math.max(1, Math.round(t.clientWidth * n)), i = Math.max(1, Math.round(t.clientHeight * n));
|
|
209
|
+
(t.width !== r || t.height !== i) && (t.width = r, t.height = i, e.viewport(0, 0, r, i));
|
|
210
|
+
let a = performance.now(), o = (a - this.startTime) / 1e3, s = (a - this.lastFrameTime) / 1e3;
|
|
211
|
+
this.lastFrameTime = a, this.frameCount++, e.clearColor(0, 0, 0, 1), e.clear(e.COLOR_BUFFER_BIT), e.useProgram(this.program), e.bindVertexArray(this.vao);
|
|
212
|
+
let l = this.uniformLocations.get("iResolution");
|
|
213
|
+
l && e.uniform3f(l, r, i, 1);
|
|
214
|
+
let u = this.uniformLocations.get("iTime");
|
|
215
|
+
u && e.uniform1f(u, o);
|
|
216
|
+
let d = this.uniformLocations.get("iTimeDelta");
|
|
217
|
+
d && e.uniform1f(d, s);
|
|
218
|
+
let f = this.uniformLocations.get("iFrame");
|
|
219
|
+
f && e.uniform1i(f, this.frameCount);
|
|
220
|
+
let p = this.uniformLocations.get("iMouse");
|
|
221
|
+
p && e.uniform4f(p, this.mouseX, this.mouseY, this.mouseClickX, this.mouseClickY);
|
|
222
|
+
let m = this.uniformLocations.get("iDate");
|
|
223
|
+
if (m) {
|
|
224
|
+
let t = /* @__PURE__ */ new Date();
|
|
225
|
+
e.uniform4f(m, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
226
|
+
}
|
|
227
|
+
for (let t = 0; t < c; t++) {
|
|
228
|
+
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
229
|
+
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
230
|
+
n && e.uniform1i(n, t);
|
|
231
|
+
}
|
|
232
|
+
let h = this.uniformLocations.get("iChannelResolution");
|
|
233
|
+
h && e.uniform3fv(h, this.channelResolution);
|
|
234
|
+
let g = this.uniformLocations.get("iChannelTime");
|
|
235
|
+
g && e.uniform1fv(g, this.channelTime);
|
|
236
|
+
for (let [t, n] of Object.entries(this.customUniforms)) {
|
|
237
|
+
let r = this.uniformLocations.get(t);
|
|
238
|
+
if (r) switch (n.type) {
|
|
239
|
+
case "float":
|
|
240
|
+
e.uniform1f(r, n.value);
|
|
241
|
+
break;
|
|
242
|
+
case "vec2": {
|
|
243
|
+
let t = n.value;
|
|
244
|
+
e.uniform2f(r, t[0], t[1]);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case "vec3": {
|
|
248
|
+
let t = n.value;
|
|
249
|
+
e.uniform3f(r, t[0], t[1], t[2]);
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case "vec4": {
|
|
253
|
+
let t = n.value;
|
|
254
|
+
e.uniform4f(r, t[0], t[1], t[2], t[3]);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case "int":
|
|
258
|
+
e.uniform1i(r, n.value);
|
|
259
|
+
break;
|
|
260
|
+
case "bool": e.uniform1i(r, +!!n.value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
e.drawArrays(e.TRIANGLES, 0, 6), e.bindVertexArray(null);
|
|
264
|
+
}
|
|
265
|
+
getError() {
|
|
266
|
+
return this.lastError;
|
|
267
|
+
}
|
|
268
|
+
destroy() {
|
|
269
|
+
let e = this.gl;
|
|
270
|
+
this.program &&= (e.deleteProgram(this.program), null), this.positionBuffer &&= (e.deleteBuffer(this.positionBuffer), null), this.vao &&= (e.deleteVertexArray(this.vao), null);
|
|
271
|
+
for (let t of this.channels) t.texture &&= (e.deleteTexture(t.texture), null);
|
|
272
|
+
this.channels = [], this.uniformLocations.clear();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
277
|
+
function f(e) {
|
|
278
|
+
if (typeof e == "string") {
|
|
279
|
+
let t = e.trim();
|
|
280
|
+
return t.length > 0 ? t : void 0;
|
|
281
|
+
}
|
|
282
|
+
if (Array.isArray(e)) {
|
|
283
|
+
let t = e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean);
|
|
284
|
+
return t.length > 0 ? t.join(" ") : void 0;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function p(...e) {
|
|
288
|
+
let t = [];
|
|
289
|
+
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
290
|
+
return t.length > 0 ? t.join(" ") : void 0;
|
|
291
|
+
}
|
|
292
|
+
function m(e) {
|
|
293
|
+
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
294
|
+
if (typeof e == "string" && e.trim().length > 0) {
|
|
295
|
+
let t = Number(e);
|
|
296
|
+
if (Number.isFinite(t)) return Math.floor(t);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function h(e) {
|
|
300
|
+
return typeof e == "string" ? e : "";
|
|
301
|
+
}
|
|
302
|
+
function g(e) {
|
|
303
|
+
if (typeof e == "boolean") return e;
|
|
304
|
+
if (typeof e == "string") {
|
|
305
|
+
let t = e.trim().toLowerCase();
|
|
306
|
+
if (t === "true") return !0;
|
|
307
|
+
if (t === "false") return !1;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function _(e) {
|
|
311
|
+
if (!e || typeof e != "object") return {};
|
|
312
|
+
let t = {}, n = e;
|
|
313
|
+
for (let [e, r] of Object.entries(n)) {
|
|
314
|
+
if (!r || typeof r != "object") continue;
|
|
315
|
+
let n = r, i = n.value, a = n.type;
|
|
316
|
+
i !== void 0 && typeof a == "string" && [
|
|
317
|
+
"float",
|
|
318
|
+
"vec2",
|
|
319
|
+
"vec3",
|
|
320
|
+
"vec4",
|
|
321
|
+
"int",
|
|
322
|
+
"bool"
|
|
323
|
+
].includes(a) && (t[e] = {
|
|
324
|
+
value: i,
|
|
325
|
+
type: a
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return t;
|
|
329
|
+
}
|
|
330
|
+
function v(e) {
|
|
331
|
+
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
332
|
+
}
|
|
333
|
+
function y(e, t) {
|
|
334
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
335
|
+
if (n.length !== r.length) return !1;
|
|
336
|
+
for (let r of n) {
|
|
337
|
+
if (!(r in t)) return !1;
|
|
338
|
+
let n = e[r], i = t[r];
|
|
339
|
+
if (n.type !== i.type) return !1;
|
|
340
|
+
if (Array.isArray(n.value) && Array.isArray(i.value)) {
|
|
341
|
+
if (n.value.length !== i.value.length) return !1;
|
|
342
|
+
for (let e = 0; e < n.value.length; e++) if (n.value[e] !== i.value[e]) return !1;
|
|
343
|
+
} else if (n.value !== i.value) return !1;
|
|
344
|
+
}
|
|
345
|
+
return !0;
|
|
346
|
+
}
|
|
347
|
+
function b() {
|
|
348
|
+
let s = t(function({ nodeId: t, context: s, className: c }) {
|
|
349
|
+
let l = e(s.store, t), u = a(null), b = a(null), x = a(null), S = a(0), C = a(""), w = a({}), T = a({
|
|
350
|
+
x: 0,
|
|
351
|
+
y: 0,
|
|
352
|
+
clickX: 0,
|
|
353
|
+
clickY: 0,
|
|
354
|
+
isDown: !1
|
|
355
|
+
}), E = l ? h(l.props?.shaderSource) : "", D = l ? m(l.props?.fps) ?? 60 : 60, O = l?.props?.uniforms, k = i(() => _(O), [O]), A = l?.props?.channels, j = i(() => v(A), [A]), M = l ? g(l.props?.enableMouse) ?? !0 : !0, N = l ? m(l.props?.width) : void 0, P = l ? m(l.props?.height) : void 0, F = l ? p(f(l.props?.className), c) : c;
|
|
356
|
+
r(() => {
|
|
357
|
+
let e = u.current;
|
|
358
|
+
if (e) {
|
|
359
|
+
try {
|
|
360
|
+
let t = new d(e);
|
|
361
|
+
b.current = t;
|
|
362
|
+
} catch (e) {
|
|
363
|
+
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
364
|
+
}
|
|
365
|
+
return () => {
|
|
366
|
+
b.current &&= (b.current.destroy(), null);
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
}, []), r(() => {
|
|
370
|
+
let e = b.current;
|
|
371
|
+
if (!(!e || !E) && C.current !== E) {
|
|
372
|
+
if (e.compile(E, k)) C.current = E, w.current = k;
|
|
373
|
+
else {
|
|
374
|
+
let t = e.getError();
|
|
375
|
+
console.error("[ShadertoyRenderer] Shader compilation failed:", t);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}, [E, k]), r(() => {
|
|
379
|
+
let e = b.current;
|
|
380
|
+
!e || !C.current || y(w.current, k) || (e.setCustomUniforms(k), w.current = k);
|
|
381
|
+
}, [k]), r(() => {
|
|
382
|
+
let e = b.current;
|
|
383
|
+
e && e.setChannels(j);
|
|
384
|
+
}, [j]), r(() => {
|
|
385
|
+
let e = b.current;
|
|
386
|
+
if (!e || !C.current) return;
|
|
387
|
+
let t = 1e3 / D, n = (r) => {
|
|
388
|
+
let i = r - S.current;
|
|
389
|
+
i >= t && (S.current = r - i % t, e.draw()), x.current = requestAnimationFrame(n);
|
|
390
|
+
};
|
|
391
|
+
return x.current = requestAnimationFrame(n), () => {
|
|
392
|
+
x.current !== null && (cancelAnimationFrame(x.current), x.current = null);
|
|
393
|
+
};
|
|
394
|
+
}, [D]);
|
|
395
|
+
let I = n((e) => {
|
|
396
|
+
if (!M) return;
|
|
397
|
+
let t = u.current, n = b.current;
|
|
398
|
+
if (!t || !n) return;
|
|
399
|
+
let r = window.devicePixelRatio || 1, i = t.getBoundingClientRect(), a = (e.clientX - i.left) * r, o = (i.height - (e.clientY - i.top)) * r;
|
|
400
|
+
T.current.x = a, T.current.y = o, n.setMouse(a, o, T.current.clickX, T.current.clickY);
|
|
401
|
+
}, [M]), L = n((e) => {
|
|
402
|
+
if (!M) return;
|
|
403
|
+
let t = u.current, n = b.current;
|
|
404
|
+
if (!t || !n) return;
|
|
405
|
+
let r = window.devicePixelRatio || 1, i = t.getBoundingClientRect(), a = (e.clientX - i.left) * r, o = (i.height - (e.clientY - i.top)) * r;
|
|
406
|
+
T.current.isDown = !0, T.current.clickX = a, T.current.clickY = o, n.setMouse(a, o, a, o);
|
|
407
|
+
}, [M]), R = n(() => {
|
|
408
|
+
M && (T.current.isDown = !1, T.current.clickX = -Math.abs(T.current.clickX));
|
|
409
|
+
}, [M]);
|
|
410
|
+
return l ? /* @__PURE__ */ o("canvas", {
|
|
411
|
+
ref: u,
|
|
412
|
+
"data-ikon-node-id": l.id,
|
|
413
|
+
"data-ikon-source": l.sourceMarker,
|
|
414
|
+
className: F,
|
|
415
|
+
...N ? { width: N } : {},
|
|
416
|
+
...P ? { height: P } : {},
|
|
417
|
+
onMouseMove: I,
|
|
418
|
+
onMouseDown: L,
|
|
419
|
+
onMouseUp: R,
|
|
420
|
+
onMouseLeave: R
|
|
421
|
+
}) : null;
|
|
422
|
+
});
|
|
423
|
+
return ({ type: e }) => {
|
|
424
|
+
if (e === "std.shadertoy-canvas") return s;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
export { b as createShadertoyRendererResolver };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useMemo as e, useSyncExternalStore as t } from "react";
|
|
2
|
+
//#region src/renderer/use-ui-node.ts
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
let i = t((e) => n.subscribeNode(r, e), () => n.getNodeVersion(r), () => n.getNodeVersion(r));
|
|
5
|
+
return e(() => n.getNode(r), [
|
|
6
|
+
n,
|
|
7
|
+
r,
|
|
8
|
+
i
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/shadertoy/shadertoy-type.ts
|
|
13
|
+
var r = "std.shadertoy-canvas";
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n, r as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-motion-letters.d.ts","sourceRoot":"","sources":["../../../../sdk/sdk-react-ui/src/shared/render-motion-letters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AA8HtD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAgC7E"}
|
package/surface.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UIStreamCategories } from '
|
|
2
|
-
import { UiStreamStore } from '
|
|
1
|
+
import { UIStreamCategories } from '@ikonai/protocol';
|
|
2
|
+
import { IKON_UI_STREAM_CATEGORY, UiStreamStore } from '@ikonai/sdk-ui';
|
|
3
3
|
import { DispatchActionOptions, UiComponentLibrary } from './renderer';
|
|
4
|
-
import { IkonClient } from '
|
|
5
|
-
export
|
|
4
|
+
import { IkonClient } from '@ikonai/sdk';
|
|
5
|
+
export { IKON_UI_STREAM_CATEGORY, IKON_PLATFORM_STREAM_CATEGORY } from '@ikonai/sdk-ui';
|
|
6
6
|
export type IkonUiCategory = UIStreamCategories | typeof IKON_UI_STREAM_CATEGORY | (string & {});
|
|
7
7
|
export interface IkonUiStoreEntry {
|
|
8
8
|
category: IkonUiCategory;
|
|
@@ -15,5 +15,8 @@ export interface IkonUiSurfaceProps {
|
|
|
15
15
|
category?: IkonUiCategory;
|
|
16
16
|
onAction?: (actionId: string, payload?: string, options?: DispatchActionOptions) => void;
|
|
17
17
|
client?: IkonClient | null;
|
|
18
|
+
/** Mounts the element inspector with this surface. Only one surface on a page may carry it. */
|
|
19
|
+
inspect?: boolean;
|
|
18
20
|
}
|
|
19
|
-
export declare const IkonUiSurface: import('react').MemoExoticComponent<({ stores, registry, category, onAction, client }: IkonUiSurfaceProps) => import(
|
|
21
|
+
export declare const IkonUiSurface: import('react').MemoExoticComponent<({ stores, registry, category, onAction, client, inspect }: IkonUiSurfaceProps) => import('react').JSX.Element | null>;
|
|
22
|
+
//# sourceMappingURL=surface.d.ts.map
|
package/surface.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../sdk/sdk-react-ui/src/surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG7E,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAc,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,OAAO,uBAAuB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAE5G;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzF,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,kGAA2H,kBAAkB,wCA4DrK,CAAC"}
|
package/theme/ikon-auth.css
CHANGED
|
@@ -212,6 +212,8 @@
|
|
|
212
212
|
font-weight: 500;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/* Outlined like the provider buttons, so a form's submit reads as one more way in rather than as
|
|
216
|
+
the screen's single primary action */
|
|
215
217
|
.ikon-auth-email-button {
|
|
216
218
|
display: flex;
|
|
217
219
|
align-items: center;
|
|
@@ -220,20 +222,20 @@
|
|
|
220
222
|
width: 100%;
|
|
221
223
|
min-height: 44px;
|
|
222
224
|
padding: 0 16px;
|
|
223
|
-
background: var(--ikon-bg-
|
|
224
|
-
border: 1px solid
|
|
225
|
+
background: var(--ikon-bg-card);
|
|
226
|
+
border: 1px solid var(--ikon-border-primary);
|
|
225
227
|
border-radius: var(--ikon-radius-md);
|
|
226
|
-
color: var(--ikon-text-
|
|
228
|
+
color: var(--ikon-text-primary);
|
|
227
229
|
font-family: inherit;
|
|
228
230
|
font-size: 15px;
|
|
229
231
|
font-weight: 500;
|
|
230
232
|
line-height: 1;
|
|
231
233
|
cursor: pointer;
|
|
232
|
-
transition: background-color 0.15s ease;
|
|
234
|
+
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
.ikon-auth-email-button:hover:not(:disabled) {
|
|
236
|
-
background: var(--ikon-bg-
|
|
238
|
+
background: var(--ikon-bg-hover);
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
.ikon-auth-email-button:focus {
|
package/use-ikon-styles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UiStyleListener, UiStyleDeleteListener, UiStylePayload } from '
|
|
1
|
+
import { UiStyleListener, UiStyleDeleteListener, UiStylePayload } from '@ikonai/sdk-ui';
|
|
2
2
|
export interface IkonUiStyleSource {
|
|
3
3
|
getUiStyles(): Iterable<UiStylePayload> | readonly UiStylePayload[];
|
|
4
4
|
subscribeToStyles(listener: UiStyleListener): () => void;
|
|
@@ -9,3 +9,4 @@ export declare function useIkonStyles(source?: IkonUiStyleSource | null): {
|
|
|
9
9
|
deleteStyles: (styleIds: string[]) => void;
|
|
10
10
|
reset: () => void;
|
|
11
11
|
};
|
|
12
|
+
//# sourceMappingURL=use-ikon-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ikon-styles.d.ts","sourceRoot":"","sources":["../../../sdk/sdk-react-ui/src/use-ikon-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI7F,MAAM,WAAW,iBAAiB;IAChC,WAAW,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,cAAc,EAAE,CAAC;IACpE,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI,CAAC;IACzD,uBAAuB,CAAC,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,IAAI,CAAC;CACvE;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI;yCAGL,cAAc;6BAmB1B,MAAM,EAAE;;EA+CrD"}
|
package/use-ikon-ui-stores.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { IkonUiStoreEntry } from './surface';
|
|
|
4
4
|
* Hook that subscribes to IkonUi store changes.
|
|
5
5
|
* Triggers re-renders when:
|
|
6
6
|
* - Stores are added/removed
|
|
7
|
+
* - A store's category changes
|
|
7
8
|
* - A store transitions from empty to having valid data (rootViewId + views)
|
|
8
9
|
* Does NOT re-render on every node update within stores.
|
|
9
10
|
*/
|
|
10
11
|
export declare function useIkonUiStores(ikonUi: IkonUi | null | undefined): ReadonlyMap<string, IkonUiStoreEntry> | undefined;
|
|
12
|
+
//# sourceMappingURL=use-ikon-ui-stores.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ikon-ui-stores.d.ts","sourceRoot":"","sources":["../../../sdk/sdk-react-ui/src/use-ikon-ui-stores.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAkBlD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,SAAS,CAyBpH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/app/ikon-app.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/vite.config.d.ts
DELETED