@ape-egg/vibe 2.3.0 → 3.0.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.
Files changed (57) hide show
  1. package/README.md +14 -4
  2. package/boot.js +4 -4
  3. package/component.js +27 -29
  4. package/hot-module-refresh.js +4 -4
  5. package/index.js +10 -15
  6. package/llms.txt +8 -6
  7. package/package.json +19 -14
  8. package/runtime/affected.js +159 -36
  9. package/runtime/cleanup.js +45 -1
  10. package/runtime/component.js +312 -99
  11. package/runtime/conditionals.js +111 -14
  12. package/runtime/debug.js +24 -0
  13. package/runtime/dispatch.js +172 -0
  14. package/runtime/hydrate.js +251 -111
  15. package/runtime/index.js +180 -71
  16. package/runtime/iterate.js +125 -50
  17. package/runtime/iteration-utils.js +59 -8
  18. package/runtime/manifest.js +77 -2
  19. package/runtime/parse.js +69 -5
  20. package/runtime/pre-compiled-iterations.js +19 -6
  21. package/runtime/pre-compiled-manifest.js +13 -4
  22. package/runtime/staging.js +153 -0
  23. package/runtime/state.js +31 -0
  24. package/runtime/tracking.js +173 -0
  25. package/runtime/utils.js +155 -78
  26. package/spa.js +77 -14
  27. package/vibe.css +8 -4
  28. package/CHANGELOG.md +0 -1196
  29. package/ROADMAP.md +0 -397
  30. package/compiler/bin/vibe-compile.js +0 -121
  31. package/compiler/native/.gitkeep +0 -0
  32. package/compiler/native/vibe-compiler-darwin-arm64 +0 -0
  33. package/compiler/native/vibe-compiler-linux-x64 +0 -0
  34. package/compiler/src/Cargo.lock +0 -2023
  35. package/compiler/src/Cargo.toml +0 -38
  36. package/compiler/src/compiler/PRE-RENDERING-IMPLEMENTATION.md +0 -241
  37. package/compiler/src/compiler/binding_case.rs +0 -88
  38. package/compiler/src/compiler/compile.rs +0 -2880
  39. package/compiler/src/compiler/component_tagger.rs +0 -469
  40. package/compiler/src/compiler/iteration_optimizer.rs +0 -455
  41. package/compiler/src/compiler/js_analyzer.rs +0 -715
  42. package/compiler/src/compiler/manifest_builder.rs +0 -693
  43. package/compiler/src/compiler/mod.rs +0 -16
  44. package/compiler/src/compiler/name_binding_protect.rs +0 -207
  45. package/compiler/src/compiler/reassignment_analyzer.rs +0 -456
  46. package/compiler/src/compiler/spa.rs +0 -477
  47. package/compiler/src/compiler/state_extractor.rs +0 -263
  48. package/compiler/src/compiler/value_stamper.rs +0 -921
  49. package/compiler/src/compiler/watcher.rs +0 -1278
  50. package/compiler/src/config.rs +0 -279
  51. package/compiler/src/main.rs +0 -358
  52. package/compiler/src/parser/element.rs +0 -96
  53. package/compiler/src/parser/html.rs +0 -1004
  54. package/compiler/src/parser/mod.rs +0 -8
  55. package/runtime/pre-compiled-manifest.test.mjs +0 -58
  56. package/runtime/scope.js +0 -50
  57. package/test-results/.last-run.json +0 -4
@@ -1,96 +0,0 @@
1
- use std::collections::HashMap;
2
- use std::path::PathBuf;
3
-
4
- /// Represents a parsed Vibe element/component
5
- #[derive(Debug, Clone)]
6
- pub struct Element {
7
- /// Tag name (derived from filename, e.g., "counter" from counter.html)
8
- pub _tag_name: String,
9
- /// Original file path
10
- pub _path: PathBuf,
11
- /// Raw HTML content (the inner content of the element)
12
- pub content: String,
13
- /// Bindings found in this element (@[property])
14
- pub _bindings: Vec<String>,
15
- /// Nested element references (custom tags used within this element)
16
- pub _nested_elements: Vec<String>,
17
- }
18
-
19
- impl Element {
20
- pub fn new(tag_name: String, path: PathBuf, content: String) -> Self {
21
- let bindings = extract_bindings(&content);
22
- let nested_elements = extract_custom_tags(&content);
23
-
24
- Self {
25
- _tag_name: tag_name,
26
- _path: path,
27
- content,
28
- _bindings: bindings,
29
- _nested_elements: nested_elements,
30
- }
31
- }
32
- }
33
-
34
- /// Extract all @[property] bindings from content
35
- fn extract_bindings(content: &str) -> Vec<String> {
36
- let mut bindings = Vec::new();
37
- let re = regex::Regex::new(r"@\[([^\]]+)\]").unwrap();
38
-
39
- for cap in re.captures_iter(content) {
40
- if let Some(m) = cap.get(1) {
41
- let binding = m.as_str().to_string();
42
- if !bindings.contains(&binding) {
43
- bindings.push(binding);
44
- }
45
- }
46
- }
47
-
48
- bindings
49
- }
50
-
51
- /// Extract custom HTML tags (potential element references)
52
- /// Custom tags are lowercase with hyphens, or single-word lowercase non-standard tags
53
- fn extract_custom_tags(content: &str) -> Vec<String> {
54
- let mut tags = Vec::new();
55
- // Match opening tags: <tag-name> or <tagname (self-closing handled too)
56
- let re = regex::Regex::new(r"<([a-z][a-z0-9-]*)[>\s/]").unwrap();
57
-
58
- // Standard HTML5 elements to exclude
59
- let standard_tags: std::collections::HashSet<&str> = [
60
- "a", "abbr", "address", "area", "article", "aside", "audio",
61
- "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button",
62
- "canvas", "caption", "cite", "code", "col", "colgroup",
63
- "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt",
64
- "em", "embed",
65
- "fieldset", "figcaption", "figure", "footer", "form",
66
- "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html",
67
- "i", "iframe", "img", "input", "ins",
68
- "kbd",
69
- "label", "legend", "li", "link",
70
- "main", "map", "mark", "menu", "meta", "meter",
71
- "nav", "noscript",
72
- "object", "ol", "optgroup", "option", "output",
73
- "p", "param", "picture", "pre", "progress",
74
- "q",
75
- "rp", "rt", "ruby",
76
- "s", "samp", "script", "search", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "svg",
77
- "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track",
78
- "u", "ul",
79
- "var", "video",
80
- "wbr",
81
- ].into_iter().collect();
82
-
83
- for cap in re.captures_iter(content) {
84
- if let Some(m) = cap.get(1) {
85
- let tag = m.as_str().to_string();
86
- if !standard_tags.contains(tag.as_str()) && !tags.contains(&tag) {
87
- tags.push(tag);
88
- }
89
- }
90
- }
91
-
92
- tags
93
- }
94
-
95
- /// Cache of loaded elements by tag name
96
- pub type ElementCache = HashMap<String, Element>;