@hyperfrontend/questions 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.2.0](https://github.com/AndrewRedican/hyperfrontend/compare/587d0dc108d5bb7f48c44a5a0065e349c774e4cf...67a22dd91c9e232145571c0070ed048d1965ae69) - 2026-04-25
5
+ ## [0.3.0](https://github.com/AndrewRedican/hyperfrontend/compare/5f116abb8ba6355dfb283fa03b7481e5eb029480...7e783d3d9e6b6b3a42d226b44256b943958a5813) - 2026-08-04
6
+
7
+ ### Features
8
+
9
+ - support clipboard paste and resize-aware redraw
10
+
11
+ ## [0.2.1](https://github.com/AndrewRedican/hyperfrontend/compare/926d40cab470e589fc30a1ef3a61ca764ff047bd...466c0388c4cd516b9c704214140b4df1004098e6) - 2026-06-23
12
+
13
+ ### Other
14
+
15
+ - **@hyperfrontend/workspace:** remove lib-builder and tool-package as implicit dependencies for all lib projects
16
+
17
+ ## [0.2.0](https://github.com/AndrewRedican/hyperfrontend/compare/587d0dc108d5bb7f48c44a5a0065e349c774e4cf...b5f254d41cb9549c783146db48eff78ed39e5bf5) - 2026-04-25
6
18
 
7
19
  ### Features
8
20
 
package/README.md CHANGED
@@ -48,6 +48,8 @@ A terminal prompting library built on functional programming principles. Create
48
48
  - **Type-Safe** — Full TypeScript support with discriminated unions for prompt outcomes
49
49
  - **Zero External Dependencies** — Uses only Node.js built-ins and `@hyperfrontend` utilities
50
50
  - **Searchable Multiselect** — Type-to-filter functionality for large option lists
51
+ - **Clipboard Paste** — Bracketed paste mode on TTYs (with a multi-character-chunk fallback elsewhere); pasted text is sanitized and never auto-submits
52
+ - **Resize-Aware Rendering** — Prompts hard-wrap to the terminal width and repaint on resize, preserving value, cursor, selection, and validation state
51
53
 
52
54
  ### Architecture Highlights
53
55
 
@@ -56,6 +58,8 @@ Each prompt follows a functional state machine pattern:
56
58
  - **Immutable State** — All prompt state is frozen; updates create new state objects
57
59
  - **Explicit Outcomes** — Prompts return either `{ result: 'submitted', value: T }` or `{ result: 'cancelled', value: undefined }`
58
60
  - **Terminal Abstraction** — Low-level I/O is encapsulated in a `Terminal` interface for testability
61
+ - **Token Input Stream** — Raw input is tokenized into keys, pastes, and resize notifications by a persistent listener, with raw mode held for the whole prompt session and restored on close
62
+ - **Frame Renderer** — A width-aware screen helper erases and repaints exact frames; on resize it recomputes the previous frame's height at the new width (assumes a reflowing terminal; display width is code-point based, east-asian double width out of scope)
59
63
 
60
64
  ## Why Use @hyperfrontend/questions?
61
65
 
@@ -148,11 +152,16 @@ type PromptOutcome<T> = { result: 'submitted'; value: T } | { result: 'cancelled
148
152
 
149
153
  ## Compatibility
150
154
 
151
- | Environment | Supported |
152
- | -------------- | --------- |
153
- | Node.js >= 18 | ✅ |
154
- | TTY Terminal | ✅ |
155
- | Tree Shakeable | ✅ |
155
+ | Environment | Supported |
156
+ | ------------------------------ | --------- |
157
+ | Node.js >= 18 | ✅ |
158
+ | TTY Terminal | ✅ |
159
+ | Bracketed paste (TTY) | ✅ |
160
+ | Resize redraw (SIGWINCH) | ✅ |
161
+ | Non-TTY streams (tests, pipes) | ✅ |
162
+ | Tree Shakeable | ✅ |
163
+
164
+ On TTY inputs a prompt session enables bracketed paste mode (`ESC[?2004h`) and restores it on close; terminals without bracketed paste still paste correctly because multi-character input chunks are treated as pastes. Single-line prompts collapse pasted newlines into spaces, so pasting can never submit a value.
156
165
 
157
166
  ## License
158
167
 
package/SECURITY.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Security Policy
2
2
 
3
+ ## The Security Model
4
+
5
+ Before reporting or reviewing, read the model this project is built on:
6
+ **[Security Model](https://www.hyperfrontend.dev/docs/core-concepts/security)**. It is the canonical
7
+ statement of what hyperfrontend defends against and what it does not, and it is the reference every
8
+ other security claim in these docs points back to. In short:
9
+
10
+ - **The named adversary is co-resident script** — an analytics snippet, tag manager, compromised
11
+ dependency, or unknown page that embeds a feature URL. A host that deliberately installs a feature
12
+ is trusting it, the way it trusts any dependency; the controls exist to bound a trusted
13
+ feature's bad day, not to treat its authors as hostile.
14
+ - **Origin checks authenticate rooms, not speakers.** Once arbitrary script runs inside a page, no
15
+ message check distinguishes it from the application. Threats inside a page need Content Security
16
+ Policy, Trusted Types, dependency provenance, and server-side authorisation — a different
17
+ treatment, deliberately outside this model.
18
+ - **Three parties carry the security of an integration.** The browser enforces document isolation
19
+ and the frame's capability attributes; the protocol enforces the relationship (pinned
20
+ counterparts, gated handshake, validated payloads, versioned contracts, an optional encrypted
21
+ envelope); and **you** decide authorisation — `frame-ancestors`, backend checks, HTTPS, the
22
+ envelope you choose, and the containment posture you set.
23
+
24
+ A vulnerability report is most useful when it names which of those three the issue defeats.
25
+
3
26
  ## Reporting a Vulnerability
4
27
 
5
28
  We take the security of hyperfrontend seriously. If you discover a security vulnerability, please help us protect our users by following responsible disclosure practices.
@@ -58,14 +81,30 @@ Thank you for helping keep hyperfrontend and its users safe!
58
81
 
59
82
  ## Security Best Practices
60
83
 
61
- When using hyperfrontend in your applications:
62
-
63
- 1. **Keep Dependencies Updated**: Regularly update to the latest version to receive security patches
64
- 2. **Content Security Policy**: Implement appropriate CSP headers when embedding features
65
- 3. **Input Validation**: Validate and sanitize all data passed between features
66
- 4. **Origin Verification**: Always verify the origin of messages in cross-frame communication
67
- 5. **Authentication**: Implement proper authentication and authorization for sensitive features
68
- 6. **HTTPS**: Always serve hyperfrontend features over HTTPS in production
84
+ These are the decisions the SDK cannot make for you. Everything the protocol already enforces —
85
+ origin pinning, window binding, instance identity, the gated handshake, payload validation on both
86
+ ends is on by default and is not something you should be re-implementing by hand.
87
+
88
+ 1. **Restrict who may embed the feature.** Send
89
+ `Content-Security-Policy: frame-ancestors <hosts>` on the response that serves the feature
90
+ document. Origin pinning keeps a conversation consistent; only `frame-ancestors` decides whether
91
+ a page was ever allowed to frame you.
92
+ 2. **Authorise on the server.** A message that crossed the boundary is not an authorised operation.
93
+ Protected work needs credentials the feature's own backend validates.
94
+ 3. **Choose the envelope deliberately.** `v2` with a pre-shared key is the confidentiality control;
95
+ `v1` is time-window obfuscation and buys deterrence only. Provision and rotate the `v2` key
96
+ yourself — a key is never baked into a built artifact. A handshake that cannot agree on an
97
+ encrypted transport falls back to plaintext; where that would be unacceptable, drive
98
+ `@hyperfrontend/nexus` directly and set `security.mode: 'fail-closed'` on the channel so the
99
+ connection is denied instead.
100
+ 4. **Declare schemas and a contract version.** Actions without a schema pass unvalidated, and a side
101
+ without a version always passes the compatibility gate. Both are how drift is caught early.
102
+ 5. **Grant capability narrowly.** Delegate only the Permissions-Policy features the integration
103
+ needs, and price a `sandbox` posture against what the product actually requires.
104
+ 6. **Serve everything over HTTPS**, host and feature alike.
105
+ 7. **Keep dependencies updated** on both sides of the boundary, and pair that with the page-integrity
106
+ controls this model deliberately leaves to you: Content Security Policy, Trusted Types,
107
+ Subresource Integrity, and dependency provenance.
69
108
 
70
109
  ## Security Updates
71
110
 
@@ -73,10 +112,6 @@ Security updates will be released as patch versions and documented in the [CHANG
73
112
 
74
113
  ## Supported Versions
75
114
 
76
- We currently provide security updates for:
77
-
78
- | Version | Supported |
79
- | ------- | ------------------ |
80
- | 0.0.x | :white_check_mark: |
81
-
82
- As the project matures, we will update this table to reflect our long-term support policy.
115
+ Security updates are provided for the latest published version of each `@hyperfrontend/*` package.
116
+ Older releases receive no backports. A long-term support policy will replace this section once the
117
+ packages settle on a stable release cadence.
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const _Math = globalThis.Math;
4
+ const ceil = _Math.ceil;
5
+ const floor = _Math.floor;
6
+ const max = _Math.max;
7
+ const min = _Math.min;
8
+ exports.ceil = ceil;
9
+ exports.floor = floor;
10
+ exports.max = max;
11
+ exports.min = min;
@@ -0,0 +1,7 @@
1
+ const _Math = globalThis.Math;
2
+ const ceil = _Math.ceil;
3
+ const floor = _Math.floor;
4
+ const max = _Math.max;
5
+ const min = _Math.min;
6
+
7
+ export { ceil, floor, max, min };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const _Object = globalThis.Object;
4
+ const freeze = _Object.freeze;
5
+ exports.freeze = freeze;
@@ -0,0 +1,4 @@
1
+ const _Object = globalThis.Object;
2
+ const freeze = _Object.freeze;
3
+
4
+ export { freeze };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ const _Promise = globalThis.Promise;
4
+ const _Reflect = globalThis.Reflect;
5
+ const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
6
+ const promiseResolve = _Promise.resolve.bind(_Promise);
7
+ exports.createPromise = createPromise;
8
+ exports.promiseResolve = promiseResolve;
@@ -0,0 +1,6 @@
1
+ const _Promise = globalThis.Promise;
2
+ const _Reflect = globalThis.Reflect;
3
+ const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
4
+ const promiseResolve = _Promise.resolve.bind(_Promise);
5
+
6
+ export { createPromise, promiseResolve };