ferrovue 0.3.0 → 0.5.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 (106) hide show
  1. package/README.md +225 -42
  2. package/dist/attrs.d.ts +3 -53
  3. package/dist/attrs.js +41 -469
  4. package/dist/calls.d.ts +4 -0
  5. package/dist/calls.js +221 -0
  6. package/dist/children.d.ts +16 -0
  7. package/dist/children.js +286 -0
  8. package/dist/classes.d.ts +13 -0
  9. package/dist/classes.js +176 -0
  10. package/dist/cli.js +31 -22
  11. package/dist/client.d.ts +35 -2
  12. package/dist/client.js +77 -14
  13. package/dist/compiler.d.ts +1 -1
  14. package/dist/compiler.js +31 -92
  15. package/dist/component.d.ts +3 -1
  16. package/dist/component.js +123 -104
  17. package/dist/constants.d.ts +42 -0
  18. package/dist/constants.js +292 -0
  19. package/dist/context.d.ts +29 -67
  20. package/dist/context.js +13 -38
  21. package/dist/diagnostics.d.ts +23 -0
  22. package/dist/diagnostics.js +30 -0
  23. package/dist/diff.d.ts +0 -3
  24. package/dist/diff.js +0 -9
  25. package/dist/emitter.d.ts +0 -8
  26. package/dist/emitter.js +0 -12
  27. package/dist/errors.d.ts +867 -0
  28. package/dist/errors.js +330 -0
  29. package/dist/expr.d.ts +1 -70
  30. package/dist/expr.js +142 -934
  31. package/dist/fallthrough.d.ts +9 -0
  32. package/dist/fallthrough.js +78 -0
  33. package/dist/fixture.d.ts +4 -10
  34. package/dist/fixture.js +38 -27
  35. package/dist/hydration.d.ts +15 -0
  36. package/dist/hydration.js +80 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.js +2 -0
  39. package/dist/islands.d.ts +1 -0
  40. package/dist/islands.js +1 -0
  41. package/dist/link-router.d.ts +24 -0
  42. package/dist/link-router.js +36 -0
  43. package/dist/lists.d.ts +0 -11
  44. package/dist/lists.js +34 -60
  45. package/dist/loops.d.ts +3 -0
  46. package/dist/loops.js +168 -0
  47. package/dist/model.d.ts +46 -144
  48. package/dist/model.js +150 -18
  49. package/dist/narrowing.d.ts +27 -0
  50. package/dist/narrowing.js +157 -0
  51. package/dist/numbers.d.ts +8 -0
  52. package/dist/numbers.js +73 -0
  53. package/dist/parens.d.ts +0 -27
  54. package/dist/parens.js +0 -44
  55. package/dist/plugin.d.ts +84 -0
  56. package/dist/plugin.js +26 -0
  57. package/dist/plugins/client-only.d.ts +8 -0
  58. package/dist/plugins/client-only.js +107 -0
  59. package/dist/plugins/i18n.d.ts +23 -0
  60. package/dist/{i18n.js → plugins/i18n.js} +88 -31
  61. package/dist/plugins/index.d.ts +2 -0
  62. package/dist/plugins/index.js +10 -0
  63. package/dist/plugins/router-link.d.ts +8 -0
  64. package/dist/{router.js → plugins/router-link.js} +52 -91
  65. package/dist/plugins/router.d.ts +42 -0
  66. package/dist/plugins/router.js +256 -0
  67. package/dist/plugins/scoped.d.ts +12 -0
  68. package/dist/plugins/scoped.js +125 -0
  69. package/dist/plugins/shared-types.d.ts +2 -0
  70. package/dist/plugins/shared-types.js +7 -0
  71. package/dist/plugins/stores.d.ts +37 -0
  72. package/dist/plugins/stores.js +379 -0
  73. package/dist/plugins/teleport.d.ts +5 -0
  74. package/dist/plugins/teleport.js +55 -0
  75. package/dist/plugins/twins.d.ts +10 -0
  76. package/dist/plugins/twins.js +164 -0
  77. package/dist/routes.d.ts +10 -0
  78. package/dist/routes.js +6 -0
  79. package/dist/rust.d.ts +1 -7
  80. package/dist/rust.js +56 -174
  81. package/dist/script.d.ts +3 -6
  82. package/dist/script.js +127 -140
  83. package/dist/settle.d.ts +6 -0
  84. package/dist/settle.js +34 -0
  85. package/dist/slots.d.ts +13 -0
  86. package/dist/slots.js +160 -0
  87. package/dist/strings.d.ts +13 -0
  88. package/dist/strings.js +208 -0
  89. package/dist/styles.d.ts +14 -0
  90. package/dist/styles.js +181 -0
  91. package/dist/template.d.ts +1 -42
  92. package/dist/template.js +25 -749
  93. package/dist/testing.d.ts +2 -0
  94. package/dist/testing.js +4 -10
  95. package/dist/types.d.ts +2 -0
  96. package/dist/typescript.d.ts +2 -14
  97. package/dist/typescript.js +53 -59
  98. package/dist/vite.d.ts +2 -1
  99. package/dist/vite.js +11 -32
  100. package/package.json +15 -6
  101. package/dist/i18n.d.ts +0 -27
  102. package/dist/router.d.ts +0 -17
  103. package/dist/scoped.d.ts +0 -24
  104. package/dist/scoped.js +0 -177
  105. package/dist/stores.d.ts +0 -6
  106. package/dist/stores.js +0 -229
package/dist/emitter.d.ts CHANGED
@@ -1,23 +1,15 @@
1
- /** Statements, with adjacent literal pushes merged into one `push_str`. */
2
1
  export declare class Emitter {
3
2
  lines: string[];
4
- /** Bytes of markup written once per render, part of what `render` reserves up front: the literal
5
- * markup, and what the numbers written at run time are expected to take. */
6
3
  literalBytes: number;
7
- /** Rust expressions for the rest of the reservation: a loop's markup once per item. */
8
4
  perItem: string[];
9
5
  private pending;
10
6
  private depth;
11
7
  lit(s: string): void;
12
- /** `bytes` more expected of a value written at run time. */
13
8
  expect(bytes: number): void;
14
9
  stmt(code: string): void;
15
10
  open(code: string): void;
16
11
  close(tail?: string): void;
17
- /** Whether the lines from \`from\` on read \`name\`. Literals are skipped, so markup that happens to
18
- * spell the name does not count, and so are fields of that name. */
19
12
  reads(name: string, from: number): boolean;
20
- /** Replace \`from\` with \`to\` in line \`index\`: an unused binding renamed to \`_\`. */
21
13
  replace(index: number, from: string, to: string): void;
22
14
  flush(): void;
23
15
  }
package/dist/emitter.js CHANGED
@@ -1,13 +1,8 @@
1
- /* The Rust statements a render is written as. */
2
1
  import { rustChar, rustStr } from "./model.js";
3
2
  import { occurrences } from "./parens.js";
4
- /** Statements, with adjacent literal pushes merged into one `push_str`. */
5
3
  export class Emitter {
6
4
  lines = [];
7
- /** Bytes of markup written once per render, part of what `render` reserves up front: the literal
8
- * markup, and what the numbers written at run time are expected to take. */
9
5
  literalBytes = 0;
10
- /** Rust expressions for the rest of the reservation: a loop's markup once per item. */
11
6
  perItem = [];
12
7
  pending = "";
13
8
  depth = 1;
@@ -15,7 +10,6 @@ export class Emitter {
15
10
  this.pending += s;
16
11
  this.literalBytes += Buffer.byteLength(s);
17
12
  }
18
- /** `bytes` more expected of a value written at run time. */
19
13
  expect(bytes) {
20
14
  this.literalBytes += bytes;
21
15
  }
@@ -31,19 +25,14 @@ export class Emitter {
31
25
  this.flush();
32
26
  this.depth--;
33
27
  this.lines.push(" ".repeat(this.depth) + "}" + tail);
34
- // `} else {` closes one block and opens the next.
35
28
  if (tail.endsWith("{"))
36
29
  this.depth++;
37
30
  }
38
- /** Whether the lines from \`from\` on read \`name\`. Literals are skipped, so markup that happens to
39
- * spell the name does not count, and so are fields of that name. */
40
31
  reads(name, from) {
41
32
  this.flush();
42
33
  return occurrences(this.lines.slice(from).join("\n"), name) > 0;
43
34
  }
44
- /** Replace \`from\` with \`to\` in line \`index\`: an unused binding renamed to \`_\`. */
45
35
  replace(index, from, to) {
46
- // A function, so a `$&` or `$'` in the generated text is not read as a replacement pattern.
47
36
  this.lines[index] = this.lines[index].replace(from, () => to);
48
37
  }
49
38
  flush() {
@@ -51,7 +40,6 @@ export class Emitter {
51
40
  return;
52
41
  const text = this.pending;
53
42
  this.pending = "";
54
- // One character is pushed as a `char`.
55
43
  const push = /^.$/su.test(text) ? `out.push(${rustChar(text)});` : `out.push_str(${rustStr(text)});`;
56
44
  this.lines.push(" ".repeat(this.depth) + push);
57
45
  }