diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-12 09:43:19 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-12 09:43:19 +0200 |
| commit | 0b2af471b6d5dfc4eaf53639102c1b854bbb324b (patch) | |
| tree | aba3943b8c54d26d8552d0685d4178bc995d91c3 | |
| parent | 812f547d84b5ce1a2924ae16f6257e4fd19efcc0 (diff) | |
first version of zilch
| -rw-r--r-- | build.zig | 8 | ||||
| -rw-r--r-- | src/app/components/icons/index.css | 4 | ||||
| -rw-r--r-- | src/app/components/icons/root.zig | 6 | ||||
| -rw-r--r-- | src/app/components/image/index.css | 0 | ||||
| -rw-r--r-- | src/app/components/image/index.html | 0 | ||||
| -rw-r--r-- | src/app/components/image/root.zig | 8 | ||||
| -rw-r--r-- | src/app/components/navbutton/index.css | 12 | ||||
| -rw-r--r-- | src/app/components/navbutton/root.zig | 18 | ||||
| -rw-r--r-- | src/app/components/root.zig | 5 | ||||
| -rw-r--r-- | src/app/root.zig | 12 | ||||
| -rw-r--r-- | src/root.zig | 2 | ||||
| -rw-r--r-- | src/zeroscript/App/symbols.js | 2 | ||||
| -rw-r--r-- | src/zilch/App/main.js (renamed from src/zeroscript/App/main.js) | 0 | ||||
| -rw-r--r-- | src/zilch/App/object-store.js (renamed from src/zeroscript/App/object-store.js) | 0 | ||||
| -rw-r--r-- | src/zilch/App/root.zig (renamed from src/zeroscript/App/root.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/App/symbols.js | 2 | ||||
| -rw-r--r-- | src/zilch/AppBundle.zig (renamed from src/zeroscript/AppBundle.zig) | 6 | ||||
| -rw-r--r-- | src/zilch/Component.zig (renamed from src/zeroscript/Component.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Env/call.zig (renamed from src/zeroscript/Env/call.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Env/future.zig (renamed from src/zeroscript/Env/future.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Env/js.zig (renamed from src/zeroscript/Env/js.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Env/root.zig (renamed from src/zeroscript/Env/root.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Env/value.zig (renamed from src/zeroscript/Env/value.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/Object.zig (renamed from src/zeroscript/Object.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/component.template.js (renamed from src/zeroscript/component.template.js) | 0 | ||||
| -rw-r--r-- | src/zilch/html/Attribute.zig (renamed from src/zeroscript/html/Attribute.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/Document.zig (renamed from src/zeroscript/html/Document.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/Fragment.zig (renamed from src/zeroscript/html/Fragment.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/Tag.zig (renamed from src/zeroscript/html/Tag.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/element.zig (renamed from src/zeroscript/html/element.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/parser.zig (renamed from src/zeroscript/html/parser.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/html/root.zig (renamed from src/zeroscript/html/root.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/log/js.zig (renamed from src/zeroscript/log/js.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/log/root.zig (renamed from src/zeroscript/log/root.zig) | 0 | ||||
| -rw-r--r-- | src/zilch/root.zig (renamed from src/zeroscript/root.zig) | 0 |
35 files changed, 55 insertions, 30 deletions
@@ -1,6 +1,6 @@ const std = @import("std"); -const AppBundle = @import("src/zeroscript/AppBundle.zig"); +const AppBundle = @import("src/zilch/AppBundle.zig"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); @@ -31,15 +31,15 @@ pub fn build(b: *std.Build) void { api_mod.addImport("http", http_mod); - const zeroscript_mod = b.addModule("zeroscript", .{ - .root_source_file = b.path("src/zeroscript/root.zig"), + const zilch_mod = b.addModule("zilch", .{ + .root_source_file = b.path("src/zilch/root.zig"), .target = target, }); const site: AppBundle = .init(b, .{ .root_source_file = b.path("src/app/root.zig"), .target = target, - }, zeroscript_mod); + }, zilch_mod); const exe = b.addExecutable(.{ .name = "memora", diff --git a/src/app/components/icons/index.css b/src/app/components/icons/index.css index e69de29..81badfd 100644 --- a/src/app/components/icons/index.css +++ b/src/app/components/icons/index.css @@ -0,0 +1,4 @@ +:host { + width: 16px; + height: 16px; +} diff --git a/src/app/components/icons/root.zig b/src/app/components/icons/root.zig index 6f7ab4a..be814d8 100644 --- a/src/app/components/icons/root.zig +++ b/src/app/components/icons/root.zig @@ -1,12 +1,12 @@ -const zs = @import("zeroscript"); +const zilch = @import("zilch"); -pub const icons: []const zs.Component = &.{ +pub const icons: []const zilch.Component = &.{ icon("menu"), icon("upload"), icon("settings"), }; -pub fn icon(name: []const u8) zs.Component { +pub fn icon(name: []const u8) zilch.Component { return .{ .namespace = "icon", .name = name, diff --git a/src/app/components/image/index.css b/src/app/components/image/index.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/app/components/image/index.css diff --git a/src/app/components/image/index.html b/src/app/components/image/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/app/components/image/index.html diff --git a/src/app/components/image/root.zig b/src/app/components/image/root.zig new file mode 100644 index 0000000..971713d --- /dev/null +++ b/src/app/components/image/root.zig @@ -0,0 +1,8 @@ +const zilch = @import("zilch"); + +pub const component: zilch.Component = .{ + .name = "image", + .html = .parse(@embedFile("index.html")), + .css = @embedFile("index.css"), + .link = @This(), +}; diff --git a/src/app/components/navbutton/index.css b/src/app/components/navbutton/index.css index 4c1a138..6909464 100644 --- a/src/app/components/navbutton/index.css +++ b/src/app/components/navbutton/index.css @@ -48,4 +48,16 @@ .item { margin: auto; + width: 40px; + height: 40px; + border-radius: 40px; + display: grid; +} + +.item * { + margin: auto; +} + +.item:hover { + background: #5f5e9c; } diff --git a/src/app/components/navbutton/root.zig b/src/app/components/navbutton/root.zig index b76af43..3505840 100644 --- a/src/app/components/navbutton/root.zig +++ b/src/app/components/navbutton/root.zig @@ -1,23 +1,23 @@ const std = @import("std"); -const zs = @import("zeroscript"); +const zilch = @import("zilch"); const Self = @This(); -pub const component: zs.Component = .{ +pub const component: zilch.Component = .{ .name = "navbutton", .html = .parse(@embedFile("index.html")), .css = @embedFile("index.css"), .link = @This(), }; -element: *zs.Object, -shadow_root: *zs.Object, +element: *zilch.Object, +shadow_root: *zilch.Object, button: struct { - classList: *zs.Object, + classList: *zilch.Object, }, -pub fn init(self: *Self, element: *zs.Object) !void { - var env: zs.Env = .default; +pub fn init(self: *Self, element: *zilch.Object) !void { + var env: zilch.Env = .default; defer env.deinit(); self.element = element; @@ -28,7 +28,7 @@ pub fn init(self: *Self, element: *zs.Object) !void { } pub fn deinit(self: *Self) !void { - var env: zs.Env = .default; + var env: zilch.Env = .default; defer env.deinit(); _ = self.element.free(&env); @@ -37,7 +37,7 @@ pub fn deinit(self: *Self) !void { } pub fn open(self: *Self) !void { - var env: zs.Env = .default; + var env: zilch.Env = .default; defer env.deinit(); _ = self.button.classList.call(&env, "toggle", .{"open"}); diff --git a/src/app/components/root.zig b/src/app/components/root.zig index 131ddb7..f51e3c1 100644 --- a/src/app/components/root.zig +++ b/src/app/components/root.zig @@ -1,7 +1,8 @@ -const zs = @import("zeroscript"); +const zilch = @import("zilch"); const icons = @import("icons/root.zig").icons; -pub const components = &[_]zs.Component{ +pub const components = &[_]zilch.Component{ @import("navbutton/root.zig").component, + @import("image/root.zig").component, } ++ icons; diff --git a/src/app/root.zig b/src/app/root.zig index bbd07d2..d172b23 100644 --- a/src/app/root.zig +++ b/src/app/root.zig @@ -1,19 +1,19 @@ const builtin = @import("builtin"); const std = @import("std"); -const zs = @import("zeroscript"); +const zilch = @import("zilch"); -pub const panic = zs.panic; +pub const panic = zilch.panic; pub const std_options: std.Options = .{ - .logFn = zs.log.default, + .logFn = zilch.log.default, }; const components = @import("components/root.zig").components; -pub const app: zs.App(.{ +pub const app: zilch.App(.{ .name = "Memora", .globals = &.{ - zs.Object.global(.window), - zs.Object.global(.Object), + zilch.Object.global(.window), + zilch.Object.global(.Object), }, .components = components, .body = .parse(@embedFile("index.html")), diff --git a/src/root.zig b/src/root.zig index dd32a7d..d09f37e 100644 --- a/src/root.zig +++ b/src/root.zig @@ -3,5 +3,5 @@ pub const db = @import("db"); pub const api = @import("api"); pub const html = @import("html"); -pub const zeroscript = @import("zeroscript"); +pub const zilch = @import("zilch"); pub const http = @import("http"); diff --git a/src/zeroscript/App/symbols.js b/src/zeroscript/App/symbols.js deleted file mode 100644 index 3df42b4..0000000 --- a/src/zeroscript/App/symbols.js +++ /dev/null @@ -1,2 +0,0 @@ -const ZsId = Symbol("zeroscript::id"); -const ZsPtr = Symbol("zeroscript::ptr"); diff --git a/src/zeroscript/App/main.js b/src/zilch/App/main.js index 265c886..265c886 100644 --- a/src/zeroscript/App/main.js +++ b/src/zilch/App/main.js diff --git a/src/zeroscript/App/object-store.js b/src/zilch/App/object-store.js index 096d085..096d085 100644 --- a/src/zeroscript/App/object-store.js +++ b/src/zilch/App/object-store.js diff --git a/src/zeroscript/App/root.zig b/src/zilch/App/root.zig index 52cbfc2..52cbfc2 100644 --- a/src/zeroscript/App/root.zig +++ b/src/zilch/App/root.zig diff --git a/src/zilch/App/symbols.js b/src/zilch/App/symbols.js new file mode 100644 index 0000000..c0870c5 --- /dev/null +++ b/src/zilch/App/symbols.js @@ -0,0 +1,2 @@ +const ZsId = Symbol("zilch::id"); +const ZsPtr = Symbol("zilch::ptr"); diff --git a/src/zeroscript/AppBundle.zig b/src/zilch/AppBundle.zig index 1d4ebb9..233495f 100644 --- a/src/zeroscript/AppBundle.zig +++ b/src/zilch/AppBundle.zig @@ -11,11 +11,11 @@ wasm: struct { exe: *std.Build.Step.Compile, }, -pub fn init(b: *std.Build, options: Options, zeroscript_mod: *std.Build.Module) @This() { +pub fn init(b: *std.Build, options: Options, zilch_mod: *std.Build.Module) @This() { const module = b.addModule("site", .{ .root_source_file = options.root_source_file, .target = options.target, - .imports = &.{ .{ .name = "zeroscript", .module = zeroscript_mod } }, + .imports = &.{ .{ .name = "zilch", .module = zilch_mod } }, }); const wasm_module = b.createModule(.{ @@ -24,7 +24,7 @@ pub fn init(b: *std.Build, options: Options, zeroscript_mod: *std.Build.Module) .cpu_arch = .wasm32, .os_tag = .freestanding, }), - .imports = &.{ .{ .name = "zeroscript", .module = zeroscript_mod } }, + .imports = &.{ .{ .name = "zilch", .module = zilch_mod } }, }); const exe = b.addExecutable(.{ diff --git a/src/zeroscript/Component.zig b/src/zilch/Component.zig index 35fafbe..35fafbe 100644 --- a/src/zeroscript/Component.zig +++ b/src/zilch/Component.zig diff --git a/src/zeroscript/Env/call.zig b/src/zilch/Env/call.zig index a5db835..a5db835 100644 --- a/src/zeroscript/Env/call.zig +++ b/src/zilch/Env/call.zig diff --git a/src/zeroscript/Env/future.zig b/src/zilch/Env/future.zig index a014990..a014990 100644 --- a/src/zeroscript/Env/future.zig +++ b/src/zilch/Env/future.zig diff --git a/src/zeroscript/Env/js.zig b/src/zilch/Env/js.zig index c1ff85d..c1ff85d 100644 --- a/src/zeroscript/Env/js.zig +++ b/src/zilch/Env/js.zig diff --git a/src/zeroscript/Env/root.zig b/src/zilch/Env/root.zig index 6fd2bab..6fd2bab 100644 --- a/src/zeroscript/Env/root.zig +++ b/src/zilch/Env/root.zig diff --git a/src/zeroscript/Env/value.zig b/src/zilch/Env/value.zig index 59b788f..59b788f 100644 --- a/src/zeroscript/Env/value.zig +++ b/src/zilch/Env/value.zig diff --git a/src/zeroscript/Object.zig b/src/zilch/Object.zig index 064d48b..064d48b 100644 --- a/src/zeroscript/Object.zig +++ b/src/zilch/Object.zig diff --git a/src/zeroscript/component.template.js b/src/zilch/component.template.js index e8cb914..e8cb914 100644 --- a/src/zeroscript/component.template.js +++ b/src/zilch/component.template.js diff --git a/src/zeroscript/html/Attribute.zig b/src/zilch/html/Attribute.zig index 1db49a0..1db49a0 100644 --- a/src/zeroscript/html/Attribute.zig +++ b/src/zilch/html/Attribute.zig diff --git a/src/zeroscript/html/Document.zig b/src/zilch/html/Document.zig index b1122e1..b1122e1 100644 --- a/src/zeroscript/html/Document.zig +++ b/src/zilch/html/Document.zig diff --git a/src/zeroscript/html/Fragment.zig b/src/zilch/html/Fragment.zig index d05ad4a..d05ad4a 100644 --- a/src/zeroscript/html/Fragment.zig +++ b/src/zilch/html/Fragment.zig diff --git a/src/zeroscript/html/Tag.zig b/src/zilch/html/Tag.zig index 90b5641..90b5641 100644 --- a/src/zeroscript/html/Tag.zig +++ b/src/zilch/html/Tag.zig diff --git a/src/zeroscript/html/element.zig b/src/zilch/html/element.zig index 739eb0b..739eb0b 100644 --- a/src/zeroscript/html/element.zig +++ b/src/zilch/html/element.zig diff --git a/src/zeroscript/html/parser.zig b/src/zilch/html/parser.zig index 38b28bb..38b28bb 100644 --- a/src/zeroscript/html/parser.zig +++ b/src/zilch/html/parser.zig diff --git a/src/zeroscript/html/root.zig b/src/zilch/html/root.zig index 7bf91e8..7bf91e8 100644 --- a/src/zeroscript/html/root.zig +++ b/src/zilch/html/root.zig diff --git a/src/zeroscript/log/js.zig b/src/zilch/log/js.zig index 16f562c..16f562c 100644 --- a/src/zeroscript/log/js.zig +++ b/src/zilch/log/js.zig diff --git a/src/zeroscript/log/root.zig b/src/zilch/log/root.zig index ba9141e..ba9141e 100644 --- a/src/zeroscript/log/root.zig +++ b/src/zilch/log/root.zig diff --git a/src/zeroscript/root.zig b/src/zilch/root.zig index 321bde4..321bde4 100644 --- a/src/zeroscript/root.zig +++ b/src/zilch/root.zig |