xbintsc 0.6.10 → 0.6.12

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 (118) hide show
  1. package/dist/src/checker/globals.js +2 -1
  2. package/dist/src/checker/globals.js.map +1 -1
  3. package/dist/src/cli/help.d.ts +1 -1
  4. package/dist/src/codegen/generator/state.js +3 -0
  5. package/dist/src/codegen/generator/state.js.map +1 -1
  6. package/dist/src/codegen/generator/tables.js +3 -0
  7. package/dist/src/codegen/generator/tables.js.map +1 -1
  8. package/dist/src/driver/compiler.js +1 -1
  9. package/dist/src/driver/compiler.js.map +1 -1
  10. package/dist/src/driver/runtime-objects.d.ts +1 -1
  11. package/dist/src/driver/runtime-objects.js +2 -0
  12. package/dist/src/driver/runtime-objects.js.map +1 -1
  13. package/dist/src/driver/version.d.ts +1 -1
  14. package/dist/src/driver/version.js +1 -1
  15. package/dist/src/extensions/node/crypto/index.js +12 -1
  16. package/dist/src/extensions/node/crypto/index.js.map +1 -1
  17. package/dist/tests/e2e/compile-builtins.test.js +26 -0
  18. package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
  19. package/dist/tests/e2e/compile-node.test.js +37 -1
  20. package/dist/tests/e2e/compile-node.test.js.map +1 -1
  21. package/dist/tests/e2e/crypto-random.test.d.ts +9 -0
  22. package/dist/tests/e2e/crypto-random.test.js +63 -0
  23. package/dist/tests/e2e/crypto-random.test.js.map +1 -0
  24. package/dist/tests/e2e/date-parse.test.js +27 -1
  25. package/dist/tests/e2e/date-parse.test.js.map +1 -1
  26. package/dist/tests/e2e/gui-css-coverage.test.js +1 -1
  27. package/dist/tests/e2e/gui-dom.test.js +29 -0
  28. package/dist/tests/e2e/gui-dom.test.js.map +1 -1
  29. package/dist/tests/e2e/gui-form.test.d.ts +9 -0
  30. package/dist/tests/e2e/gui-form.test.js +359 -0
  31. package/dist/tests/e2e/gui-form.test.js.map +1 -0
  32. package/dist/tests/e2e/gui-script-import-order.test.js +6 -1
  33. package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -1
  34. package/dist/tests/e2e/gui-style.test.js +82 -0
  35. package/dist/tests/e2e/gui-style.test.js.map +1 -1
  36. package/dist/tests/e2e/gui-unsupported.test.js +4 -3
  37. package/dist/tests/e2e/gui-unsupported.test.js.map +1 -1
  38. package/dist/tests/e2e/json-parse-errors.test.d.ts +9 -0
  39. package/dist/tests/e2e/json-parse-errors.test.js +48 -0
  40. package/dist/tests/e2e/json-parse-errors.test.js.map +1 -0
  41. package/doc/ai/language-support.md +2 -1
  42. package/doc/ai/zh-CN/language-support.md +2 -1
  43. package/doc/gui/api.md +8 -2
  44. package/doc/gui/dom.md +21 -12
  45. package/doc/gui/input.md +74 -3
  46. package/doc/implemented/node/crypto.md +8 -0
  47. package/doc/implemented/node/fs.md +1 -1
  48. package/doc/implemented/stdlib.md +10 -2
  49. package/doc/zh-CN/gui/api.md +8 -2
  50. package/doc/zh-CN/gui/dom.md +17 -11
  51. package/doc/zh-CN/gui/input.md +65 -4
  52. package/doc/zh-CN/implemented/node/crypto.md +6 -0
  53. package/doc/zh-CN/implemented/node/fs.md +1 -1
  54. package/doc/zh-CN/implemented/stdlib.md +10 -2
  55. package/package.json +7 -7
  56. package/runtime/ext_gui/css_match.cpp +21 -1
  57. package/runtime/ext_gui/css_selector.cpp +2 -2
  58. package/runtime/ext_gui/document.cpp +12 -0
  59. package/runtime/ext_gui/dom.h +41 -2
  60. package/runtime/ext_gui/dom_api_document.cpp +28 -0
  61. package/runtime/ext_gui/dom_api_events.cpp +17 -14
  62. package/runtime/ext_gui/dom_api_form.cpp +567 -0
  63. package/runtime/ext_gui/dom_api_internal.h +46 -214
  64. package/runtime/ext_gui/dom_api_mutation.cpp +1 -1
  65. package/runtime/ext_gui/dom_api_node.cpp +10 -3
  66. package/runtime/ext_gui/dom_api_node_read.cpp +1 -1
  67. package/runtime/ext_gui/dom_api_proto.cpp +45 -0
  68. package/runtime/ext_gui/dom_api_webgl_methods.h +217 -0
  69. package/runtime/ext_gui/dom_parse.cpp +114 -1
  70. package/runtime/ext_gui/form_focus.cpp +293 -0
  71. package/runtime/ext_gui/form_input.cpp +448 -0
  72. package/runtime/ext_gui/form_internal.h +30 -0
  73. package/runtime/ext_gui/form_shared.cpp +126 -0
  74. package/runtime/ext_gui/form_state.cpp +536 -0
  75. package/runtime/ext_gui/form_state.h +97 -0
  76. package/runtime/ext_gui/gui_engine.h +40 -4
  77. package/runtime/ext_gui/gui_events.cpp +63 -48
  78. package/runtime/ext_gui/layout.cpp +6 -0
  79. package/runtime/ext_gui/layout.h +4 -0
  80. package/runtime/ext_gui/layout_flow.cpp +23 -1
  81. package/runtime/ext_gui/paint.cpp +4 -1
  82. package/runtime/ext_gui/paint_form.cpp +389 -0
  83. package/runtime/ext_gui/paint_internal.h +6 -0
  84. package/runtime/ext_gui/style_print.cpp +30 -0
  85. package/runtime/ext_gui/style_ua.cpp +42 -0
  86. package/runtime/ext_gui/warnings.cpp +5 -7
  87. package/runtime/ext_gui/window.cpp +31 -55
  88. package/runtime/ext_gui/window_diagnostics.cpp +58 -0
  89. package/runtime/ext_gui/window_emit.cpp +51 -0
  90. package/runtime/ext_node/crypto/crypto.c +3 -2
  91. package/runtime/ext_node/crypto/crypto_hash.h +13 -0
  92. package/runtime/ext_node/crypto/crypto_random.c +339 -0
  93. package/runtime/ext_node/fs/async_worker.c +1 -1
  94. package/runtime/ext_node/fs/fs_ops.c +1 -1
  95. package/runtime/ext_node/fs/parts/platform.inc +65 -0
  96. package/runtime/rt.h +27 -0
  97. package/runtime/xt_crypto.c +132 -0
  98. package/runtime/xt_random.c +143 -0
  99. package/runtime/xt_regex/matcher.inc +9 -28
  100. package/runtime/xt_regex/parser.inc +65 -2
  101. package/runtime/xt_regex/types.inc +11 -1
  102. package/runtime/xt_regex.h +6 -2
  103. package/runtime/xt_stdlib/dispatch.inc +2 -0
  104. package/runtime/xt_stdlib/math.inc +1 -1
  105. package/runtime/xt_stdlib2/date.inc +204 -4
  106. package/runtime/xt_stdlib2/json.inc +4 -546
  107. package/runtime/xt_stdlib2/json_parse.inc +347 -0
  108. package/runtime/xt_stdlib2/json_stringify.inc +368 -0
  109. package/runtime/xt_stdlib2/regexp-match.inc +6 -11
  110. package/runtime/xt_stdlib2.c +0 -4
  111. package/runtime/xt_typed_array/elements.inc +6 -1
  112. package/src/checker/globals.ts +2 -0
  113. package/src/codegen/generator/state.ts +3 -0
  114. package/src/codegen/generator/tables.ts +3 -0
  115. package/src/driver/compiler.ts +1 -1
  116. package/src/driver/runtime-objects.ts +2 -0
  117. package/src/driver/version.ts +1 -1
  118. package/src/extensions/node/crypto/index.ts +12 -1
@@ -1 +1 @@
1
- {"version":3,"file":"gui-style.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-style.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC3D,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAElC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,aAAa,CACrC,SAAS,EACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DC,CACF,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAA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BAA+B,CAAC,CAAC;QAC5D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -54,7 +54,7 @@ const HTML = ${JSON.stringify(PAGE)};
54
54
  const win = createWindow({ title: "unsupported", width: 320, height: 240 });
55
55
  win.on("ready", () => {
56
56
  /* A run-time created element is reported too, not just markup from the page. */
57
- win.document.createElement("select");
57
+ win.document.createElement("meter");
58
58
  win.document.querySelector(".one").style.setProperty("unsupported-two", "3px");
59
59
  win.computedStyle(".one", "color");
60
60
  console.log("done=1");
@@ -74,10 +74,11 @@ describe.skipIf(!guiAvailable)("gui extension — unsupported features", () => {
74
74
  });
75
75
  expect(value("done")).toBe("1");
76
76
  expect(stderr).toContain("unsupported element <table>");
77
- expect(stderr).toContain("unsupported element <input>");
77
+ /* `input`/`select`/`textarea` are implemented form controls now. */
78
+ expect(stderr).not.toContain("unsupported element <input>");
78
79
  expect(stderr).toContain("unsupported element <iframe>");
79
80
  /* Created through `document.createElement`, after the page was parsed. */
80
- expect(stderr).toContain("unsupported element <select>");
81
+ expect(stderr).toContain("unsupported element <meter>");
81
82
  /* Declared by two rules, but reported as one property name. */
82
83
  expect(stderr).toContain("unsupported CSS property 'unsupported-one'");
83
84
  /* Set through the CSSOM after the page was parsed. */
@@ -1 +1 @@
1
- {"version":3,"file":"gui-unsupported.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-unsupported.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,MAAM,IAAI,GAAG;;;;;;;;;;;;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AAI,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `JSON.parse` error handling.
3
+ *
4
+ * The parser used to return `0`/`undefined` for malformed input instead of
5
+ * throwing, so `try { JSON.parse(input) } catch` never ran. It now validates
6
+ * the grammar (numbers, strings, literals, separators, trailing text) and
7
+ * throws a catchable `SyntaxError`.
8
+ */
9
+ export {};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `JSON.parse` error handling.
3
+ *
4
+ * The parser used to return `0`/`undefined` for malformed input instead of
5
+ * throwing, so `try { JSON.parse(input) } catch` never ran. It now validates
6
+ * the grammar (numbers, strings, literals, separators, trailing text) and
7
+ * throws a catchable `SyntaxError`.
8
+ */
9
+ import { expect, it } from "vitest";
10
+ import { describeE2E } from "./harness.js";
11
+ describeE2E("JSON.parse errors", (harness) => {
12
+ it("throws a catchable SyntaxError for malformed input", () => {
13
+ const stdout = harness.runProgram(`
14
+ const bad = [
15
+ "", "{bad", "{\\"a\\":}", "[1,]", "1 2", "undefined", "NaN", "'x'",
16
+ "{", "[1", "\\"abc", "01", "1.", "1e", "tru", "{\\"a\\" 1}", "{\\"a\\":1,}",
17
+ ];
18
+ for (const text of bad) {
19
+ let caught = false;
20
+ try {
21
+ JSON.parse(text);
22
+ } catch (e) {
23
+ caught = true;
24
+ console.log("throw=" + (e instanceof SyntaxError) + ":" + (e as any).name +
25
+ ":" + ((e as any).message.length > 0));
26
+ }
27
+ if (!caught) console.log("no-throw=" + text);
28
+ }
29
+
30
+ // A valid document still parses, including escapes and nested containers.
31
+ console.log("valid=" + JSON.stringify(
32
+ JSON.parse(" {\\"a\\": [1, true, null, \\"\\u4e2d\\"]} ")));
33
+ // The reviver keeps working on the successful path.
34
+ console.log("reviver=" + JSON.stringify(
35
+ JSON.parse("{\\"n\\":1}", (key: string, value: any) =>
36
+ key === "n" ? (value as number) + 1 : value)));
37
+ `);
38
+ const lines = stdout.trim().split("\n");
39
+ expect(lines).toHaveLength(19);
40
+ for (const line of lines.slice(0, 17)) {
41
+ expect(line).toBe("throw=true:SyntaxError:true");
42
+ }
43
+ expect(lines[17]).toBe('valid={"a":[1,true,null,"中"]}');
44
+ expect(lines[18]).toBe('reviver={"n":2}');
45
+ expect(stdout).not.toContain("no-throw=");
46
+ });
47
+ });
48
+ //# sourceMappingURL=json-parse-errors.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-parse-errors.test.js","sourceRoot":"","sources":["../../../tests/e2e/json-parse-errors.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,WAAW,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE;IAC3C,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAwBjC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -108,7 +108,8 @@ construct can hide a bug but never reject working code.
108
108
 
109
109
  Implemented: `Math`, `JSON`, `Date`, `RegExp`, `Map`, `Set`, `WeakMap`/`WeakSet`/`WeakRef`,
110
110
  `Symbol`, `Error` family, `BigInt`, `Array`/`String`/`Number`/`Object` methods,
111
- typed arrays, `String.prototype.match`/`split`/`replace` with capture groups,
111
+ typed arrays, `String.prototype.match`/`split`/`replace` with capture groups and
112
+ the `*`/`+`/`?`/`{n,m}` regex quantifiers,
112
113
  immutable array helpers (`toReversed`, `toSorted`, `toSpliced`, `with`), global
113
114
  URI functions, first-class built-in constructors (`const A = Array; new A(...)`,
114
115
  `A.isArray`, `x instanceof A`) and `Object.prototype`
@@ -104,7 +104,8 @@ xbintsc 编译 TypeScript 的一个**实用子集**。本页用来判断你能
104
104
 
105
105
  已实现:`Math`、`JSON`、`Date`、`RegExp`、`Map`、`Set`、`WeakMap`/`WeakSet`/`WeakRef`、
106
106
  `Symbol`、`Error` 家族、`BigInt`、`Array`/`String`/`Number`/`Object` 方法、TypedArray、
107
- 带捕获组的 `String.prototype.match`/`split`/`replace`、不可变数组方法
107
+ 带捕获组的 `String.prototype.match`/`split`/`replace` 与 `*`/`+`/`?`/`{n,m}`
108
+ 正则量词、不可变数组方法
108
109
  (`toReversed`、`toSorted`、`toSpliced`、`with`)、全局 URI 函数、
109
110
  一等公民内建构造器(`const A = Array; new A(...)`、`A.isArray`、`x instanceof A`)
110
111
  与 `Object.prototype`(`Object.getPrototypeOf({}) === Object.prototype`)。
package/doc/gui/api.md CHANGED
@@ -45,7 +45,9 @@ and hit testing follow it), and `scrollX` / `scrollY` / `pageXOffset` /
45
45
  `document.hasFocus()`; `blur()` clears it. Events emitted:
46
46
  `ready` (after the first presented frame), `load`, `close`, `resize`, `scroll`,
47
47
  `focus`, `blur` and the input events `mousemove`, `mousedown`, `mouseup`,
48
- `click`, `wheel`, `keydown`, `keyup`.
48
+ `click`, `wheel`, `keydown`, `keyup`, `keypress`, `textInput`,
49
+ `compositionstart` / `compositionupdate` / `compositionend`, `beforeinput`,
50
+ `input`, `change`, `submit` and `reset`.
49
51
 
50
52
  `createWindow(options)` honours more than the title and size:
51
53
  `{ title, width, height, highDensity, resizable, borderless, alwaysOnTop,
@@ -183,6 +185,8 @@ bubbles from the focused element or `<body>`, before the window listeners run.
183
185
  | `key`, `code` | keyboard | browser `KeyboardEvent` spellings: produced value and physical key |
184
186
  | `repeat`, `ctrl`, `shift`, `alt`, `meta` | keyboard | modifiers (the legacy DOM spellings) |
185
187
  | `ctrlKey`, `shiftKey`, `altKey`, `metaKey` | keyboard | modifiers (the current DOM spellings) |
188
+ | `data` | composition | pre-edit text (`compositionstart`/`update`/`end`) |
189
+ | `text` | `textInput` | the text an IME/keyboard layout produced |
186
190
  | `target` | pointer, wheel | deepest element under the point as a CSS-like descriptor (`div#main.card`), or absent |
187
191
 
188
192
  ## Diagnostics
@@ -202,7 +206,9 @@ win.inlineSvg(selector) // serialized inline <svg>: { markup, wid
202
206
  win.measureText(text, fontSize?, family?) // shaped advance width in pixels
203
207
  win.fontMetrics(fontSize?, family?) // { ascent, descent, lineHeight, ready }
204
208
  win.hitTest(x, y) // deepest element descriptor, or ""
205
- win.sendEvent(type, options?) // synthesise input (testing)
209
+ win.sendEvent(type, options?) // synthesise input (testing); also
210
+ // "textInput" + { text } and the
211
+ // "composition*" events + { data }
206
212
  win.advance(ms) // step the CSS transition clock (testing)
207
213
  win.stats() // engine/runtime counters (memory debugging)
208
214
  ```
package/doc/gui/dom.md CHANGED
@@ -9,7 +9,12 @@
9
9
  **HTML parser** (`runtime/ext_gui/dom.{h,cpp}`): tags/attributes/text,
10
10
  comments and doctype skipped, entity decoding (named + numeric/hex), void
11
11
  elements, raw-text elements (`<style>`/`<script>`), and the common implicit
12
- close rules (`li`, `dt`/`dd`, `option`, `p`, headings, table cells/rows).
12
+ close rules (`li`, `dt`/`dd`, `option`, `p`, headings, table cells/rows). A
13
+ parsed fragment is wrapped in the implicit `<html>`/`<head>`/`<body>` (head-like
14
+ top-level elements such as `<style>`/`<title>` go to `<head>`, everything else
15
+ to `<body>`), so `document.body`, `document.head` and `body { … }` work even
16
+ when the source is only a `<div>`. `innerHTML`/`insertAdjacentHTML` parse their
17
+ input as a fragment and do **not** synthesize another document wrapper.
13
18
 
14
19
  **CSS parser** (`runtime/ext_gui/css.{h,cpp}`): comments are stripped; `@media`
15
20
  blocks are parsed recursively (nested queries combine with `and`, and a comma
@@ -22,7 +27,8 @@ commas, brackets or parentheses without splitting the list. Selectors: type,
22
27
  combinators (descendant, child, adjacent and general sibling), the pseudo-classes
23
28
  `:first-child`, `:last-child`, `:only-child`, `:empty`, `:root`, `:not(...)`,
24
29
  `:nth-child(an+b)`, `:disabled`, `:checked`, plus the stateful `:hover`,
25
- `:focus`, `:focus-visible` (currently an alias of `:focus`) and `:active` (see
30
+ `:focus`, `:focus-visible` (currently an alias of `:focus`), `:focus-within`
31
+ (the focused element and its ancestors) and `:active` (see
26
32
  [Input](./input.md)), and the pseudo-elements `::before`/`::after`
27
33
  (legacy `:before`/`:after` too). Values: lengths (`px`, `%`, `em`, `rem`, `vw`,
28
34
  `vh`, `pt`, `pc`, `in`, `cm`, `mm`, `q`), colors (hex, `rgb()`/`rgba()`, a named
@@ -90,17 +96,16 @@ or a cell repeated on every row appears once. The parser/cascade path reports:
90
96
 
91
97
  - **HTML elements** with browser behaviour the engine lacks: `applet`, `area`,
92
98
  `basefont`, `bgsound`, `blink`, `caption`, `col`, `colgroup`, `datalist`,
93
- `details`, `dialog`, `embed`, `frame`, `frameset`, `iframe`, `input`,
94
- `isindex`, `keygen`, `map`, `marquee`, `math`, `meter`, `noembed`, `noframes`,
95
- `object`, `optgroup`, `option`, `output`, `param`, `plaintext`, `progress`,
96
- `select`, `summary`, `table`, `tbody`, `td`, `template`, `textarea`, `tfoot`,
97
- `th`, `thead`, `tr`, `track` and `xmp`. Every other tag — including `button`,
98
- `label`, custom elements and a typo such as `<dvi>` — is rendered as a plain
99
- box, which is the intended fallback rather than a dropped feature, so it is
100
- not reported.
99
+ `details`, `dialog`, `embed`, `frame`, `frameset`, `iframe`, `isindex`,
100
+ `keygen`, `map`, `marquee`, `math`, `meter`, `noembed`, `noframes`, `object`,
101
+ `output`, `param`, `plaintext`, `progress`, `summary`, `table`, `tbody`,
102
+ `td`, `template`, `tfoot`, `th`, `thead`, `tr`, `track` and `xmp`. Every other
103
+ tag — including `button`, `input`, `label`, `select`, `textarea`, custom
104
+ elements and a typo such as `<dvi>` — is rendered as a box, which is the
105
+ intended fallback rather than a dropped feature, so it is not reported.
101
106
  - **HTML attributes** that request unsupported behaviour: `href` (links do not
102
107
  navigate), `srcset`, `sizes`, `poster`, `controls`, `contenteditable`,
103
- `draggable`, `autofocus`, `tabindex`, `hidden`, and the SVG
108
+ `draggable`, `autofocus`, `hidden`, and the SVG
104
109
  `filter`/`mask`/`clip-path`/`marker-*` attributes.
105
110
  - **CSS properties** outside the subset, and **length units** the parser does
106
111
  not implement (`ch`, `ex`, `vmin`, `dvh`, …). A recognised property with an
@@ -193,7 +198,11 @@ removes it, and `Object.keys(dataset)` / `for...in` list only the data keys.
193
198
  author rules, inheritance and the inline declarations — rather than echoing the
194
199
  inline block, so a stylesheet rule is visible. It exposes `getPropertyValue`,
195
200
  `getPropertyPriority` and named properties (`cs.width`, `cs.backgroundColor`,
196
- `cs["--accent"]`). Pass `"::before"`/`"::after"` to read generated content; any
201
+ `cs["--accent"]`). Border properties are serialized per side too:
202
+ `border-top-color` / `border-right-color` / … resolve `currentColor` to the
203
+ element's computed colour, `border-*-width` reports the used `0px` for a
204
+ `none` border, and `border-*-style` reports the computed style keyword.
205
+ Pass `"::before"`/`"::after"` to read generated content; any
197
206
  other pseudo-element answers empty values. Every read flushes a pending restyle,
198
207
  so a handle created early stays live after later mutations.
199
208
 
package/doc/gui/input.md CHANGED
@@ -12,7 +12,8 @@ scaled or translated element is hit exactly where it is drawn — and `:hover`
12
12
  follows the artwork, not the box flow left behind.
13
13
 
14
14
  - SDL pointer/wheel/key events are routed to the owning window, hit tested, and
15
- delivered to the handlers registered with `on`. `mousedown` also moves focus.
15
+ delivered to the handlers registered with `on`. `mousedown` also moves focus
16
+ and places the caret in a text field.
16
17
  - Keyboard events also follow the DOM path: the target is the focused element (or
17
18
  `<body>` when nothing is focused), the event bubbles through its ancestors to
18
19
  `document`, and finally reaches `window` listeners. This is what lets a page
@@ -21,12 +22,82 @@ delivered to the handlers registered with `on`. `mousedown` also moves focus.
21
22
  (`"KeyW"`, `"ArrowUp"`, `"Space"`) and `key` the produced value (`"w"`, `"W"`,
22
23
  `" "`) — not SDL's scancode/key names.
23
24
  - `:hover` matches the hovered element **and its ancestors** (so hovering a child
24
- lights up its parents); `:focus` matches the focused element. When either
25
+ lights up its parents); `:focus` matches the focused element and
26
+ `:focus-within` its ancestors too. When either
25
27
  changes, `XtDocument::setHover`/`setFocus` recompute styles and layout and mark
26
28
  the window's geometry dirty, so the change is painted on the next frame.
27
29
  - `win.hitTest(x, y)` and `win.sendEvent(type, options)` expose hit testing and
28
30
  synthetic input so the whole path is testable headlessly (the e2e suite drives
29
31
  clicks, wheels and keys without a real mouse).
30
32
 
31
- Still to do for full input: text selection, drag, IME and clipboard.
33
+ ## Form controls (M23)
32
34
 
35
+ `<input>`, `<textarea>` and `<select>` are native leaf boxes: their value,
36
+ selection and checked state live in `Node::form` (`FormState`) and are painted
37
+ by the engine, so no browser/DOM layer is involved.
38
+
39
+ ```ts
40
+ const user = document.getElementById("user"); // <input id="user" value="abc">
41
+ user.focus();
42
+ user.value; // "abc"
43
+ user.selectionStart; // 3
44
+ user.setSelectionRange(1, 3);
45
+ user.placeholder = "name";
46
+ user.disabled = true;
47
+ ```
48
+
49
+ - **`<input>` types**: `text`, `search`, `tel`, `url`, `email`, `password`,
50
+ `number`, `date`, `month`, `week`, `time`, `datetime-local`, `range`, `color`,
51
+ `checkbox`, `radio`, `file`, `submit`, `reset`, `button`, `image` and
52
+ `hidden`. Text-like types are editable; checkbox/radio paint their box and
53
+ toggle on click (radios uncheck the rest of their `name` group); range paints a
54
+ track and thumb and updates from a drag; color paints a swatch; submit/reset/
55
+ button paint their label. `hidden` has no box.
56
+ - **`<textarea>`** is multi-line (`\n` breaks a line), **`<select>`** paints the
57
+ selected `<option>`'s label and cycles the selection on click (there is no
58
+ popup menu). `date`/`time`/`month`/`week` inputs are editable text fields with
59
+ the browser's value shape, and `color`/`file` expose their value/state without
60
+ opening a native picker or file dialog.
61
+ - **`value`** is the live value, separate from the `value` attribute (the
62
+ default). `<textarea>` reads its default from its text content and `<select>`
63
+ from the selected/first `<option>`. Assigning `value` moves the caret to the
64
+ end, as browsers do.
65
+ - **`selectionStart` / `selectionEnd` / `selectionDirection`**,
66
+ `setSelectionRange(start, end, direction)` and `select()` use UTF-16 code-unit
67
+ offsets (the DOM convention), backed by UTF-8 storage.
68
+ - **`checked`**, `type`, `name`, `disabled`, `readOnly`, `required`,
69
+ `placeholder`, `min`, `max`, `step`, `maxLength`, `tabIndex`, `form`,
70
+ `options` and `selectedIndex` are live DOM properties.
71
+ - **`document.activeElement`** is the focused element, or `<body>` when nothing
72
+ is focused. `tabindex` establishes the Tab order (`tabindex="1"` before the
73
+ implicit `0` stops; `-1` is click-focusable but skipped by Tab); Tab and
74
+ Shift+Tab move focus even when no text field is focused. A disabled or hidden
75
+ control cannot be focused, is skipped by Tab and paints dimmed.
76
+ - **Text input** comes from `SDL_EVENT_TEXT_INPUT`, which carries the text the
77
+ keyboard layout or IME actually produced. `keydown` handles the editing
78
+ commands (Backspace/Delete/arrows/Home/End/Ctrl+A/C/X/V, with Shift extending
79
+ the selection) and `keypress` + `input` are dispatched after an edit.
80
+ - **IME** uses `SDL_EVENT_TEXT_EDITING`: the pre-edit text is displayed at the
81
+ caret and `compositionstart` / `compositionupdate` / `compositionend` fire;
82
+ the commit is inserted into the value on `compositionend`.
83
+ - **Clipboard** is the system clipboard through SDL: Ctrl+C/X/V.
84
+ - **Events** fire automatically: `beforeinput` (cancelable) before a text edit,
85
+ `input` after every value change (typing, deletion, checkbox/radio toggle,
86
+ range drag, select), and `change` when the value is committed (a text field
87
+ losing focus after a change, Enter in a single-line field, a checkbox/radio
88
+ click, a range release or a select change). `input`/`change` payloads carry
89
+ `value`; `change` also carries `checked`.
90
+ - **Forms**: a submit button (or Enter in a single-line field) fires a
91
+ cancelable `submit` on the enclosing `<form>` with the `submitter` when one
92
+ was clicked; there is no navigation, so preventing the event or not has the
93
+ same visible result. A reset button or `form.reset()` fires `reset` and
94
+ restores every control's default value/checked state. `form.submit()` and
95
+ `form.requestSubmit(submitter?)` dispatch the same event.
96
+
97
+ `win.sendEvent` also accepts `{ type: "textInput", text }` (as if SDL delivered
98
+ that text), `{ type: "compositionstart" | "compositionupdate" | "compositionend",
99
+ data }` and printable `keydown` events. A real physical `keydown` never inserts
100
+ its US-layout `key`: the matching text-input event does, so an IME or a non-US
101
+ layout cannot double a character.
102
+
103
+ Still to do for full input: drag-selection across several lines and undo/redo.
@@ -7,3 +7,11 @@ Location: `src/extensions/node/crypto/index.ts`, `runtime/ext_node/crypto/crypto
7
7
  - `createHash(algorithm)` returns a hash object with `update(...)` and `digest([encoding])`.
8
8
  - The streaming form (`setEncoding` / `write` / `end` / `read`) is supported.
9
9
  - SHA-1 and SHA-256 are available.
10
+ - `randomBytes(size[, callback])`, `randomUUID()`, `randomInt([min, ]max[, callback])`,
11
+ `randomFillSync(buffer[, offset[, size]])` and `randomFill(...)` read the OS
12
+ CSPRNG (`BCryptGenRandom` on Windows, `/dev/urandom` elsewhere). `webcrypto`
13
+ exposes the same `getRandomValues` / `randomUUID` object as the global
14
+ `crypto`.
15
+ - `pbkdf2Sync(password, salt, iterations, keylen[, digest])` and
16
+ `pbkdf2(...)` implement PBKDF2-HMAC-SHA1/SHA-256 (the async form invokes the
17
+ callback immediately; the work is synchronous).
@@ -18,7 +18,7 @@ Location: `src/extensions/node/fs/*.ts`, `runtime/ext_node/fs/*.c`
18
18
  | `rmSync(path[, options])` | `xt_node_rm` | delete a file/directory; `{ recursive: true }` deletes recursively |
19
19
  | `rmdirSync(path[, options])` | `xt_node_rmdir` | delete an empty directory |
20
20
  | `unlinkSync(path)` | `xt_node_unlink` | delete a file |
21
- | `renameSync(oldPath, newPath)` | `xt_node_rename` | rename / move |
21
+ | `renameSync(oldPath, newPath)` | `xt_node_rename` | rename / move; atomically replaces an existing target (`MoveFileExW` + `MOVEFILE_REPLACE_EXISTING` on Windows) |
22
22
  | `copyFileSync(src, dest[, flags])` | `xt_node_copy_file` | copy a file; honours `COPYFILE_EXCL` |
23
23
  | `cpSync(src, dest[, options])` | `xt_node_cp` | recursive copy; `recursive`, `force`, `errorOnExist`, `dereference`, `preserveTimestamps` |
24
24
  | `realpathSync(path)` | `xt_node_realpath` | resolve to an absolute path |
@@ -37,17 +37,19 @@ own pages: [Collections](./collections.md), [Typed arrays and binary data](./typ
37
37
 
38
38
  ## JSON
39
39
 
40
- - `JSON.parse` with a `reviver`.
40
+ - `JSON.parse` with a `reviver`; malformed input (bad numbers/strings, trailing text, missing separators) throws a catchable `SyntaxError` instead of returning `undefined`.
41
41
  - `JSON.stringify` with a function or array `replacer`, `toJSON`, and `space` (number or string, clamped to 10). `undefined` / function / symbol values follow the standard omission rules.
42
42
  - Object keys are emitted in insertion order, with integer keys ordered numerically; circular references throw.
43
43
 
44
44
  ## Date
45
45
 
46
46
  - `Date` backed by `gmtime_r`; ISO 8601 parsing through `Date.parse` / `new Date(string)`.
47
+ - `toLocaleDateString` / `toLocaleTimeString` / `toLocaleString` format the local time (`M/D/YYYY`, `h:mm:ss AM`); a small options subset (`weekday`/`year`/`month`/`day`/`hour`/`minute`/`second`/`hour12`) is honoured. `toDateString` / `toTimeString` / `toUTCString` are available too, and an invalid date formats as `Invalid Date`.
47
48
 
48
49
  ## RegExp
49
50
 
50
- - `RegExp` uses POSIX ERE (`regcomp` / `regexec`) for `test` / `exec`, with capture groups exposed through `exec` / `match` / `replace` / `split` / `search`.
51
+ - `RegExp` uses the runtime's self-contained POSIX-ERE-compatible matcher (`regcomp` / `regexec` style) on every host, so results do not depend on the platform's libc. Capture groups are exposed through `exec` / `match` / `replace` / `split` / `search`.
52
+ - Quantifiers include `*`, `+`, `?` and the counted forms `{n}`, `{n,}` and `{n,m}` (with a lazy `?` suffix). Malformed brace groups such as `{x}` and `{,2}` stay literal, as in JavaScript; an inverted range such as `{2,1}` is also treated as literal instead of being rejected.
51
53
  - Matching is byte-oriented and `/g` / `/y` `lastIndex` is not honoured — see [Runtime deviations](../unimplemented/deviations.md).
52
54
 
53
55
  ## Symbol
@@ -94,3 +96,9 @@ own pages: [Collections](./collections.md), [Typed arrays and binary data](./typ
94
96
  - `btoa` / `atob` base64 encoding and decoding (core globals; not Node-extension-only).
95
97
  - `structuredClone`: arrays, objects, `Map`, `Set`, `Date`, `RegExp` and typed arrays, preserving cycles and shared references; functions, symbols, promises and generators are rejected.
96
98
  - Timers, `queueMicrotask` and `performance.now` are described in [Async, promises and generators](./async.md); `fetch` in [fetch](./fetch.md).
99
+
100
+ ## Global crypto
101
+
102
+ - `crypto.getRandomValues(typedArray)` fills an integer typed array (up to 65 536 bytes) from the OS CSPRNG and returns it; `crypto.randomUUID()` returns a v4 UUID string. `crypto` is also a first-class object and the methods can be detached (`const uuid = crypto.randomUUID`).
103
+ - `Math.random` draws from a xoshiro256** stream seeded from the OS CSPRNG (53 random bits), not from the C `rand()`.
104
+ - Node's `crypto.randomBytes` / `randomInt` / `randomFillSync` / `pbkdf2Sync` surface is documented in [node/crypto](../implemented/node/crypto.md).
@@ -43,7 +43,9 @@ API 编写的文档可以原样运行。
43
43
  提升操作系统窗口并置位 `document.hasFocus()`,`blur()` 清除它。事件:
44
44
  `ready`(首帧呈现后)、`load`、`close`、`resize`、`scroll`、`focus`、`blur`,
45
45
  以及输入事件 `mousemove`、`mousedown`、`mouseup`、`click`、`wheel`、
46
- `keydown`、`keyup`。
46
+ `keydown`、`keyup`、`keypress`、`textInput`、
47
+ `compositionstart` / `compositionupdate` / `compositionend`、`beforeinput`、
48
+ `input`、`change`、`submit` 与 `reset`。
47
49
 
48
50
  `createWindow(options)` 除标题与尺寸外还支持:`{ title, width, height,
49
51
  highDensity, resizable, borderless, alwaysOnTop, hidden, fullscreen, x, y,
@@ -171,6 +173,8 @@ win.on("keydown", (e) => console.log(e.key, e.code, e.ctrlKey, e.shiftKey));
171
173
  | `key`、`code` | keyboard | 浏览器 `KeyboardEvent` 写法:产生的值与物理键 |
172
174
  | `repeat`、`ctrl`、`shift`、`alt`、`meta` | keyboard | 修饰键(旧版 DOM 写法) |
173
175
  | `ctrlKey`、`shiftKey`、`altKey`、`metaKey` | keyboard | 修饰键(现行 DOM 写法) |
176
+ | `data` | composition | 预编辑文本(`compositionstart`/`update`/`end`) |
177
+ | `text` | `textInput` | IME/键盘布局实际产生的文本 |
174
178
  | `target` | pointer、wheel | 该点下最深的元素,表示为类 CSS 描述符(`div#main.card`),可能缺省 |
175
179
 
176
180
  ## 诊断
@@ -189,7 +193,9 @@ win.inlineSvg(selector) // 序列化的内联 <svg>:{ markup, w
189
193
  win.measureText(text, fontSize?, family?) // 整形后的推进宽度(像素)
190
194
  win.fontMetrics(fontSize?, family?) // { ascent, descent, lineHeight, ready }
191
195
  win.hitTest(x, y) // 最深的元素描述符,或 ""
192
- win.sendEvent(type, options?) // 合成输入(测试用)
196
+ win.sendEvent(type, options?) // 合成输入(测试用);也支持
197
+ // "textInput" + { text } 与
198
+ // "composition*" 事件 + { data }
193
199
  win.advance(ms) // 推进 CSS transition 时钟(测试用)
194
200
  win.stats() // 引擎/运行时计数器(内存排查用)
195
201
  ```
@@ -10,7 +10,10 @@
10
10
  **HTML 解析器**(`runtime/ext_gui/dom.{h,cpp}`):标签/属性/文本,注释与
11
11
  doctype 跳过,实体解码(命名 + 十进制/十六进制),空元素,原始文本元素
12
12
  (`<style>`/`<script>`),以及常见的隐式闭合规则(`li`、`dt`/`dd`、`option`、
13
- `p`、标题、表格单元格/行)。
13
+ `p`、标题、表格单元格/行)。解析片段时会补上隐式的 `<html>`/`<head>`/`<body>`
14
+ (顶层 `<style>`/`<title>` 等进入 `<head>`,其余进入 `<body>`),因此即使源文件
15
+ 只有一个 `<div>`,`document.body`、`document.head` 与 `body { … }` 也能工作。
16
+ `innerHTML`/`insertAdjacentHTML` 按片段解析,**不会**再合成一层文档包装。
14
17
 
15
18
  **CSS 解析器**(`runtime/ext_gui/css.{h,cpp}`):会剥离注释;`@media` 块递归解析
16
19
  (嵌套查询用 `and` 合并,逗号列表会分配到内层查询),其他 at-rule 跳过。规则支持
@@ -20,7 +23,8 @@ doctype 跳过,实体解码(命名 + 十进制/十六进制),空元素
20
23
  (`=`、`~=`、`|=`、`^=`、`$=`、`*=`)、四种组合器(后代、子、相邻兄弟与
21
24
  通用兄弟)、伪类 `:first-child`、`:last-child`、`:only-child`、`:empty`、
22
25
  `:root`、`:not(...)`、`:nth-child(an+b)`、`:disabled`、`:checked`、有状态的
23
- `:hover`、`:focus`、`:focus-visible`(目前等同 `:focus`)与 `:active`
26
+ `:hover`、`:focus`、`:focus-visible`(目前等同 `:focus`)、`:focus-within`
27
+ (聚焦元素及其祖先)与 `:active`
24
28
  (见[输入](./input.md)),以及伪元素
25
29
  `::before`/`::after`(也接受旧式 `:before`/`:after`)。值:长度
26
30
  (`px`、`%`、`em`、`rem`、`vw`、`vh`、`pt`、`pc`、`in`、`cm`、`mm`、`q`)、
@@ -82,16 +86,15 @@ xt_gui: warning: unsupported CSS unit 'vmin'; the value is ignored
82
86
 
83
87
  - **HTML 元素**:引擎缺少其浏览器行为的标签——`applet`、`area`、`basefont`、
84
88
  `bgsound`、`blink`、`caption`、`col`、`colgroup`、`datalist`、`details`、
85
- `dialog`、`embed`、`frame`、`frameset`、`iframe`、`input`、`isindex`、
86
- `keygen`、`map`、`marquee`、`math`、`meter`、`noembed`、`noframes`、
87
- `object`、`optgroup`、`option`、`output`、`param`、`plaintext`、`progress`、
88
- `select`、`summary`、`table`、`tbody`、`td`、`template`、`textarea`、`tfoot`、
89
- `th`、`thead`、`tr`、`track` 与 `xmp`。其余标签——包括 `button`、`label`、
90
- 自定义元素以及 `<dvi>` 这类拼写错误——都会渲染成普通盒子,这是预期的回退而
91
- 不是被丢弃的特性,因此不会报告。
89
+ `dialog`、`embed`、`frame`、`frameset`、`iframe`、`isindex`、`keygen`、`map`、
90
+ `marquee`、`math`、`meter`、`noembed`、`noframes`、`object`、`output`、`param`、
91
+ `plaintext`、`progress`、`summary`、`table`、`tbody`、`td`、`template`、`tfoot`、
92
+ `th`、`thead`、`tr`、`track` 与 `xmp`。其余标签——包括 `button`、`input`、
93
+ `label`、`select`、`textarea`、自定义元素以及 `<dvi>` 这类拼写错误——都会渲染
94
+ 成盒子,这是预期的回退而不是被丢弃的特性,因此不会报告。
92
95
  - **HTML 特性(attribute)**:请求了不支持行为的 `href`(链接不会导航)、
93
96
  `srcset`、`sizes`、`poster`、`controls`、`contenteditable`、`draggable`、
94
- `autofocus`、`tabindex`、`hidden`,以及 SVG 的
97
+ `autofocus`、`hidden`,以及 SVG 的
95
98
  `filter`/`mask`/`clip-path`/`marker-*` 特性。
96
99
  - **CSS 属性**:子集之外的属性名;以及解析器未实现的长度单位(`ch`、`ex`、
97
100
  `vmin`、`dvh` 等)。已支持属性上的非法值不会按“不支持”报告——只检查属性的
@@ -175,7 +178,10 @@ console.log(box.contains(inner)); // 后代判断
175
178
  `getComputedStyle(el, pseudoElt)` 从**层叠结果**读取——UA 样式表、作者规则、
176
179
  继承和内联声明——而不是回显内联块,因此写在样式表里的规则同样可见。它支持
177
180
  `getPropertyValue`、`getPropertyPriority` 与命名属性(`cs.width`、
178
- `cs.backgroundColor`、`cs["--accent"]`)。传入 `"::before"` 或 `"::after"`
181
+ `cs.backgroundColor`、`cs["--accent"]`)。边框属性也按边序列化:
182
+ `border-top-color` / `border-right-color` / … 会把 `currentColor` 解析为元素
183
+ 计算颜色,`border-*-width` 对 `none` 边框报告实际使用的 `0px`,
184
+ `border-*-style` 报告计算后的样式关键字。传入 `"::before"` 或 `"::after"`
179
185
  可读取生成内容盒;其他伪元素返回空值。每次读取都会先结算待处理的重新样式,
180
186
  因此早先创建的句柄在后续变更后仍然有效。
181
187
 
@@ -11,18 +11,79 @@
11
11
  出来**的位置被命中——`:hover` 跟着画面走,而不是跟着流式布局留下的盒子走。
12
12
 
13
13
  - SDL 指针/滚轮/键盘事件会被路由到所属窗口,进行命中测试,并投递给用 `on`
14
- 注册的处理器。`mousedown` 还会移动焦点。
14
+ 注册的处理器。`mousedown` 还会移动焦点,并在文本框中放置光标。
15
15
  - 键盘事件同时走 DOM 路径:目标为聚焦元素(没有焦点时为 `<body>`),事件沿祖先
16
16
  冒泡到 `document`,最后到达 `window` 监听器。因此按浏览器写的
17
17
  `document.addEventListener("keydown", …)` 可以直接工作。负载使用浏览器
18
18
  `KeyboardEvent` 的写法:`code` 是物理键(`"KeyW"`、`"ArrowUp"`、`"Space"`),
19
19
  `key` 是产生的值(`"w"`、`"W"`、`" "`),而不是 SDL 的扫描码/键名。
20
20
  - `:hover` 匹配悬停元素**及其祖先**(因此悬停子元素会点亮其父元素);
21
- `:focus` 匹配聚焦元素。当任一改变时,`XtDocument::setHover`/`setFocus`
22
- 重新计算样式与布局,并把窗口几何标记为脏,因此改动会在下一帧绘制。
21
+ `:focus` 匹配聚焦元素,`:focus-within` 同时匹配其祖先。当任一改变时,
22
+ `XtDocument::setHover`/`setFocus` 重新计算样式与布局,并把窗口几何标记为
23
+ 脏,因此改动会在下一帧绘制。
23
24
  - `win.hitTest(x, y)` 与 `win.sendEvent(type, options)` 暴露命中测试与合成
24
25
  输入,使整条路径可无头测试(e2e 套件在没有真实鼠标的情况下驱动点击、滚轮
25
26
  与按键)。
26
27
 
27
- 完整输入仍需完成:文本选择、拖拽、IME 与剪贴板。
28
+ ## 表单控件(M23)
28
29
 
30
+ `<input>`、`<textarea>` 与 `<select>` 是引擎原生的叶子盒:值、选区与勾选状态
31
+ 保存在 `Node::form`(`FormState`)中,由引擎绘制,不涉及浏览器/DOM 层。
32
+
33
+ ```ts
34
+ const user = document.getElementById("user"); // <input id="user" value="abc">
35
+ user.focus();
36
+ user.value; // "abc"
37
+ user.selectionStart; // 3
38
+ user.setSelectionRange(1, 3);
39
+ user.placeholder = "name";
40
+ user.disabled = true;
41
+ ```
42
+
43
+ - **`<input>` 类型**:`text`、`search`、`tel`、`url`、`email`、`password`、
44
+ `number`、`date`、`month`、`week`、`time`、`datetime-local`、`range`、`color`、
45
+ `checkbox`、`radio`、`file`、`submit`、`reset`、`button`、`image` 与 `hidden`。
46
+ 文本类可编辑;checkbox/radio 绘制方框并在点击时切换(radio 会取消同 `name`
47
+ 组的其它项);range 绘制轨道与滑块并支持拖动;color 绘制色块;
48
+ submit/reset/button 绘制标签;`hidden` 不产生盒。
49
+ - **`<textarea>`** 支持多行(`\n` 换行),**`<select>`** 绘制当前 `<option>`
50
+ 的标签,点击切换选项(没有弹出菜单)。`date`/`time`/`month`/`week` 输入框
51
+ 是按浏览器值格式编辑的文本框;`color`/`file` 暴露值/状态,但不会打开原生
52
+ 取色器或文件对话框。
53
+ - **`value`** 是活动值,与 `value` 属性(默认值)分离。`<textarea>` 的默认值
54
+ 来自其文本内容,`<select>` 来自被选中/第一个 `<option>`。给 `value` 赋值会
55
+ 把光标移到末尾,与浏览器一致。
56
+ - **`selectionStart` / `selectionEnd` / `selectionDirection`**、
57
+ `setSelectionRange(start, end, direction)` 与 `select()` 使用 UTF-16 码元
58
+ 偏移(DOM 约定),底层存储为 UTF-8。
59
+ - **`checked`**、`type`、`name`、`disabled`、`readOnly`、`required`、
60
+ `placeholder`、`min`、`max`、`step`、`maxLength`、`tabIndex`、`form`、
61
+ `options` 与 `selectedIndex` 均为活动 DOM 属性。
62
+ - **`document.activeElement`** 是聚焦元素;没有焦点时为 `<body>`。`tabindex`
63
+ 决定 Tab 顺序(`tabindex="1"` 排在隐式 `0` 之前;`-1` 可点击聚焦但被 Tab
64
+ 跳过);即使没有文本框聚焦,Tab 与 Shift+Tab 也能移动焦点。禁用或隐藏的控件
65
+ 不能聚焦、会被 Tab 跳过,并以灰色绘制。
66
+ - **文本输入**来自 `SDL_EVENT_TEXT_INPUT`,它携带键盘布局或 IME 实际产生的
67
+ 文本。`keydown` 处理编辑命令(Backspace/Delete/方向键/Home/End/Ctrl+A/C/X/V,
68
+ Shift 扩展选区),编辑后派发 `keypress` 与 `input`。
69
+ - **IME** 使用 `SDL_EVENT_TEXT_EDITING`:预编辑文本显示在光标处,并触发
70
+ `compositionstart` / `compositionupdate` / `compositionend`;提交内容在
71
+ `compositionend` 时插入值中。
72
+ - **剪贴板**通过 SDL 使用系统剪贴板:Ctrl+C/X/V。
73
+ - **事件**自动派发:文本编辑前触发可取消的 `beforeinput`,每次值变化后触发
74
+ `input`(输入、删除、checkbox/radio 切换、range 拖动、select 切换),值提交时
75
+ 触发 `change`(有改动的文本框失焦、单行输入框回车、checkbox/radio 点击、
76
+ range 释放或 select 切换)。`input`/`change` 负载携带 `value`;`change` 还
77
+ 携带 `checked`。
78
+ - **表单**:提交按钮(或单行输入框回车)在所属 `<form>` 上触发可取消的
79
+ `submit`,被点击时携带 `submitter`;引擎不会导航,因此是否阻止事件在视觉上
80
+ 没有区别。重置按钮或 `form.reset()` 触发 `reset`,并把每个控件恢复到默认
81
+ 值/勾选状态。`form.submit()` 与 `form.requestSubmit(submitter?)` 派发同一个
82
+ 事件。
83
+
84
+ `win.sendEvent` 也接受 `{ type: "textInput", text }`(等同于 SDL 投递该文本)、
85
+ `{ type: "compositionstart" | "compositionupdate" | "compositionend", data }` 与
86
+ 可打印的 `keydown`。真实的物理 `keydown` 不会插入其 US 布局的 `key`:对应的
87
+ 文本输入事件才会插入,因此 IME 或非 US 布局不会重复字符。
88
+
89
+ 完整输入仍需完成:跨多行的拖动选择与撤销/重做。
@@ -7,3 +7,9 @@
7
7
  - `createHash(algorithm)` 返回带 `update(...)` 与 `digest([encoding])` 的哈希对象。
8
8
  - 支持流式形式(`setEncoding` / `write` / `end` / `read`)。
9
9
  - 提供 SHA-1 与 SHA-256。
10
+ - `randomBytes(size[, callback])`、`randomUUID()`、`randomInt([min, ]max[, callback])`、
11
+ `randomFillSync(buffer[, offset[, size]])` 与 `randomFill(...)` 读取操作系统
12
+ CSPRNG(Windows 上的 `BCryptGenRandom`,其它平台的 `/dev/urandom`)。
13
+ `webcrypto` 暴露与全局 `crypto` 相同的 `getRandomValues` / `randomUUID` 对象。
14
+ - `pbkdf2Sync(password, salt, iterations, keylen[, digest])` 与 `pbkdf2(...)`
15
+ 实现 PBKDF2-HMAC-SHA1/SHA-256(异步形式会立即调用回调,计算本身是同步的)。
@@ -18,7 +18,7 @@
18
18
  | `rmSync(path[, options])` | `xt_node_rm` | 删除文件/目录,`{ recursive: true }` 递归删除 |
19
19
  | `unlinkSync(path)` | `xt_node_unlink` | 删除文件 |
20
20
  | `rmdirSync(path)` | `xt_node_rmdir` | 删除空目录 |
21
- | `renameSync(oldPath, newPath)` | `xt_node_rename` | 重命名 / 移动 |
21
+ | `renameSync(oldPath, newPath)` | `xt_node_rename` | 重命名 / 移动;原子替换已存在的目标(Windows 使用 `MoveFileExW` + `MOVEFILE_REPLACE_EXISTING`) |
22
22
  | `copyFileSync(src, dest[, flags])` | `xt_node_copy_file` | 复制文件;支持 `COPYFILE_EXCL` |
23
23
  | `cpSync(src, dest[, options])` | `xt_node_cp` | 递归复制;`recursive` / `force` / `errorOnExist` / `dereference` / `preserveTimestamps` |
24
24
  | `realpathSync(path)` | `xt_node_realpath` | 解析为绝对路径 |