Skip to content

Commit fa9eab5

Browse files
committed
fix: accept to input keys in modal
1 parent 9068400 commit fa9eab5

16 files changed

Lines changed: 301 additions & 282 deletions

File tree

pkgs/ai-deno/src/debug.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
#[macro_export]
22
macro_rules! dai_println {
33
() => {
4-
#[cfg(feature = "debug_lib")]
5-
{
4+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG").is_ok() {
65
let path = std::path::Path::new(file!());
76
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
87
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m ", file_name, line!());
98
}
109
};
1110
($fmt:expr) => {
12-
#[cfg(feature = "debug_lib")]
13-
{
11+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG").is_ok() {
1412
let path = std::path::Path::new(file!());
1513
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
1614
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m {}", file_name, line!(), $fmt);
1715
}
1816
};
1917
($fmt:expr, $($arg:tt)*) => {
20-
#[cfg(feature = "debug_lib")]
21-
{
18+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG").is_ok() {
2219
let path = std::path::Path::new(file!());
2320
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
2421
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m {}", file_name, line!(), format_args!($fmt, $($arg)*));
@@ -29,24 +26,21 @@ macro_rules! dai_println {
2926
#[macro_export]
3027
macro_rules! deno_println {
3128
() => {
32-
#[cfg(feature = "debug_deno")]
33-
{
29+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG_DENO").is_ok() {
3430
let path = std::path::Path::new(file!());
3531
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
3632
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m ", file_name, line!());
3733
}
3834
};
3935
($fmt:expr) => {
40-
#[cfg(feature = "debug_deno")]
41-
{
36+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG_DENO").is_ok() {
4237
let path = std::path::Path::new(file!());
4338
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
4439
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m {}", file_name, line!(), $fmt);
4540
}
4641
};
4742
($fmt:expr, $($arg:tt)*) => {
48-
#[cfg(feature = "debug_deno")]
49-
{
43+
if cfg!(feature = "debug_lib") || std::env::var("AI_DENO_DEBUG_DENO").is_ok() {
5044
let path = std::path::Path::new(file!());
5145
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
5246
println!("\x1b[1m[deno_ai(rust)¦{}:{}]\x1b[0m {}", file_name, line!(), format_args!($fmt, $($arg)*));

pkgs/ai-deno/src/deno/module.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ impl Module {
2323
let filename = MaybePathBuf::Owned(filename.as_ref().to_path_buf());
2424
let contents = Cow::Owned(contents.to_string());
2525

26-
println!("Module::from_string: {:?}", filename.to_str());
2726
Self { filename, contents }
2827
}
2928

pkgs/ai-deno/src/deno/module_loader/cjs_code_analyzer.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use std::sync::Arc;
1515
use std::sync::Mutex;
1616
use sys_traits::impls::RealSys;
1717

18+
use crate::deno_println;
19+
1820
use super::cache_db::CacheDBHash;
1921
use super::npm_package_manager::NpmPackageManager;
2022

@@ -46,14 +48,15 @@ impl AiDenoCjsCodeAnalyzer {
4648
) -> Result<CjsAnalysis<'b>, JsErrorBox> {
4749
let analysis = self.inner_cjs_analysis(specifier, &source)?;
4850

49-
println!("analyze_cjs: {:?}", analysis);
51+
deno_println!("analyze_cjs: {:?}", analysis);
5052

5153
match analysis {
5254
CliCjsAnalysis::Esm => Ok(CjsAnalysis::<'b>::Esm(source)),
5355
CliCjsAnalysis::Cjs { exports, reexports } => {
54-
println!(
56+
deno_println!(
5557
"cjs analysis: exports: {:?}, reexports: {:?}",
56-
exports, reexports
58+
exports,
59+
reexports
5760
);
5861
Ok(CjsAnalysis::Cjs(CjsAnalysisExports { exports, reexports }))
5962
}

pkgs/ai-deno/src/deno/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl Runtime {
265265

266266
let js_runtime = self.deno_runtime();
267267

268-
println!("is main: {}", main);
268+
deno_println!("is main: {}", main);
269269
let module_id: deno_runtime::deno_core::ModuleId = if main {
270270
js_runtime
271271
.load_main_es_module_from_code(&module_specifier, code)

pkgs/ai-deno/src/js/dist/main.mjs

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,10 @@ var testBlueFill = definePlugin({
715715
type: "bool",
716716
default: false
717717
},
718+
fullTransparent: {
719+
type: "bool",
720+
default: false
721+
},
718722
padding: {
719723
type: "int",
720724
default: 0
@@ -769,6 +773,16 @@ var testBlueFill = definePlugin({
769773
height
770774
};
771775
}
776+
if (params.fullTransparent) {
777+
for (let i = 0; i < len; i += 4) {
778+
buffer[i + 3] = 0;
779+
}
780+
return {
781+
data: buffer,
782+
width,
783+
height
784+
};
785+
}
772786
if (params.fillOtherChannels) {
773787
for (let i = 0; i < len; i += 4) {
774788
buffer[i] = 0;
@@ -830,23 +844,32 @@ var testBlueFill = definePlugin({
830844
}),
831845
ui.text({ text: `Count: ${params.count}` })
832846
]),
833-
// ui.text({ text: "Use new buffer" }),
834-
ui.checkbox({
835-
label: "Use new buffer",
836-
key: "useNewBuffer",
837-
value: params.useNewBuffer
838-
}),
839-
// ui.text({ text: "Fill other channels" }),
840-
ui.checkbox({
841-
key: "fillOtherChannels",
842-
label: "Fill other channels",
843-
value: params.fillOtherChannels
844-
}),
845-
ui.checkbox({
846-
key: "passThrough",
847-
label: "Pass through",
848-
value: params.passThrough
849-
}),
847+
ui.group({ direction: "row" }, [
848+
// ui.text({ text: "Use new buffer" }),
849+
ui.checkbox({
850+
label: "Use new buffer",
851+
key: "useNewBuffer",
852+
value: params.useNewBuffer
853+
}),
854+
// ui.text({ text: "Fill other channels" }),
855+
ui.checkbox({
856+
key: "fillOtherChannels",
857+
label: "Fill other channels",
858+
value: params.fillOtherChannels
859+
})
860+
]),
861+
ui.group({ direction: "row" }, [
862+
ui.checkbox({
863+
key: "passThrough",
864+
label: "Pass through",
865+
value: params.passThrough
866+
}),
867+
ui.checkbox({
868+
key: "fullTransparent",
869+
label: "Full transparent",
870+
value: params.fullTransparent
871+
})
872+
]),
850873
ui.text({ text: "Color" }),
851874
ui.colorInput({
852875
key: "color",
@@ -1178,6 +1201,7 @@ var directionalBlur = definePlugin({
11781201
const shader = device.createShaderModule({
11791202
code
11801203
});
1204+
console.log({ shader });
11811205
const defs = makeShaderDataDefinitions2(code);
11821206
const pipeline = device.createComputePipeline({
11831207
layout: "auto",
@@ -3333,7 +3357,8 @@ var t7 = createTranslator({
33333357
scale: "Scale",
33343358
turbulence: "Turbulence",
33353359
colorShift: "Color Shift",
3336-
timeSeed: "Flow Seed"
3360+
timeSeed: "Flow Seed",
3361+
padding: "Padding"
33373362
},
33383363
ja: {
33393364
title: "\u30D5\u30EB\u30A4\u30C9 \u30C7\u30A3\u30B9\u30C8\u30FC\u30B7\u30E7\u30F3 V11",
@@ -3342,7 +3367,8 @@ var t7 = createTranslator({
33423367
scale: "\u30B9\u30B1\u30FC\u30EB",
33433368
turbulence: "\u4E71\u6D41",
33443369
colorShift: "\u8272\u30B7\u30D5\u30C8",
3345-
timeSeed: "\u30D5\u30ED\u30FC\u30B7\u30FC\u30C9"
3370+
timeSeed: "\u30D5\u30ED\u30FC\u30B7\u30FC\u30C9",
3371+
padding: "\u30D1\u30C7\u30A3\u30F3\u30B0"
33463372
}
33473373
});
33483374
var fluidDistortion = definePlugin({
@@ -3375,6 +3401,10 @@ var fluidDistortion = definePlugin({
33753401
type: "real",
33763402
default: 0.1
33773403
},
3404+
padding: {
3405+
type: "int",
3406+
default: 0
3407+
},
33783408
timeSeed: {
33793409
type: "real",
33803410
default: 0
@@ -3515,6 +3545,23 @@ var fluidDistortion = definePlugin({
35153545
value: params.timeSeed
35163546
})
35173547
])
3548+
]),
3549+
ui.group({ direction: "col" }, [
3550+
ui.text({ text: t7("padding") }),
3551+
ui.group({ direction: "row" }, [
3552+
ui.slider({
3553+
key: "padding",
3554+
dataType: "int",
3555+
min: 0,
3556+
max: 600,
3557+
value: params.padding
3558+
}),
3559+
ui.numberInput({
3560+
key: "padding",
3561+
dataType: "int",
3562+
value: params.padding
3563+
})
3564+
])
35183565
])
35193566
]);
35203567
},

pkgs/ai-deno/src/js/src/live-effects/directional-blur.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ export const directionalBlur = definePlugin({
307307
code,
308308
});
309309

310+
console.log({ shader });
311+
310312
const defs = makeShaderDataDefinitions(code);
311313

312314
const pipeline = device.createComputePipeline({

pkgs/ai-deno/src/js/src/live-effects/fluid-distortion.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const t = createTranslator({
2525
turbulence: "Turbulence",
2626
colorShift: "Color Shift",
2727
timeSeed: "Flow Seed",
28+
padding: "Padding",
2829
},
2930
ja: {
3031
title: "フルイド ディストーション V11",
@@ -34,6 +35,7 @@ const t = createTranslator({
3435
turbulence: "乱流",
3536
colorShift: "色シフト",
3637
timeSeed: "フローシード",
38+
padding: "パディング",
3739
},
3840
});
3941

@@ -67,6 +69,10 @@ export const fluidDistortion = definePlugin({
6769
type: "real",
6870
default: 0.1,
6971
},
72+
padding: {
73+
type: "int",
74+
default: 0,
75+
},
7076
timeSeed: {
7177
type: "real",
7278
default: 0.0,
@@ -209,6 +215,23 @@ export const fluidDistortion = definePlugin({
209215
}),
210216
]),
211217
]),
218+
ui.group({ direction: "col" }, [
219+
ui.text({ text: t("padding") }),
220+
ui.group({ direction: "row" }, [
221+
ui.slider({
222+
key: "padding",
223+
dataType: "int",
224+
min: 0,
225+
max: 600,
226+
value: params.padding,
227+
}),
228+
ui.numberInput({
229+
key: "padding",
230+
dataType: "int",
231+
value: params.padding,
232+
}),
233+
]),
234+
]),
212235
]);
213236
},
214237
initLiveEffect: async () => {

pkgs/ai-deno/src/js/src/live-effects/test-blue-fill.ts

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export const testBlueFill = definePlugin({
3838
type: "bool",
3939
default: false,
4040
},
41+
fullTransparent: {
42+
type: "bool",
43+
default: false,
44+
},
4145
padding: {
4246
type: "int",
4347
default: 0,
@@ -101,6 +105,18 @@ export const testBlueFill = definePlugin({
101105
};
102106
}
103107

108+
if (params.fullTransparent) {
109+
for (let i = 0; i < len; i += 4) {
110+
buffer[i + 3] = 0;
111+
}
112+
113+
return {
114+
data: buffer,
115+
width,
116+
height,
117+
};
118+
}
119+
104120
if (params.fillOtherChannels) {
105121
for (let i = 0; i < len; i += 4) {
106122
buffer[i] = 0;
@@ -176,25 +192,35 @@ export const testBlueFill = definePlugin({
176192
ui.text({ text: `Count: ${params.count}` }),
177193
]),
178194

179-
// ui.text({ text: "Use new buffer" }),
180-
ui.checkbox({
181-
label: "Use new buffer",
182-
key: "useNewBuffer",
183-
value: params.useNewBuffer,
184-
}),
195+
ui.group({ direction: "row" }, [
196+
// ui.text({ text: "Use new buffer" }),
197+
ui.checkbox({
198+
label: "Use new buffer",
199+
key: "useNewBuffer",
200+
value: params.useNewBuffer,
201+
}),
185202

186-
// ui.text({ text: "Fill other channels" }),
187-
ui.checkbox({
188-
key: "fillOtherChannels",
189-
label: "Fill other channels",
190-
value: params.fillOtherChannels,
191-
}),
203+
// ui.text({ text: "Fill other channels" }),
204+
ui.checkbox({
205+
key: "fillOtherChannels",
206+
label: "Fill other channels",
207+
value: params.fillOtherChannels,
208+
}),
209+
]),
192210

193-
ui.checkbox({
194-
key: "passThrough",
195-
label: "Pass through",
196-
value: params.passThrough,
197-
}),
211+
ui.group({ direction: "row" }, [
212+
ui.checkbox({
213+
key: "passThrough",
214+
label: "Pass through",
215+
value: params.passThrough,
216+
}),
217+
218+
ui.checkbox({
219+
key: "fullTransparent",
220+
label: "Full transparent",
221+
value: params.fullTransparent,
222+
}),
223+
]),
198224

199225
ui.text({ text: "Color" }),
200226
ui.colorInput({

0 commit comments

Comments
 (0)