anentrypoint-design 0.0.352 → 0.0.354

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.352",
3
+ "version": "0.0.354",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -112,10 +112,10 @@
112
112
  },
113
113
  "devDependencies": {
114
114
  "axe-core": "^4.12.1",
115
- "esbuild": "^0.28.0",
115
+ "esbuild": "^0.28.1",
116
116
  "playwright": "^1.61.1",
117
117
  "pngjs": "^7.0.0",
118
- "postcss": "^8.5.12",
118
+ "postcss": "^8.5.19",
119
119
  "postcss-prefix-selector": "^2.1.1"
120
120
  }
121
121
  }
@@ -315,6 +315,40 @@ export function PermissionMenu({ trigger, categories = [], approved = [], onTogg
315
315
  : h('button', { type: 'button', class: 'ov-perm-trigger', ref: refFn }, child || 'Permissions');
316
316
  }
317
317
 
318
+ // ApprovalPrompt — an inline, in-thread tool-permission card (as opposed to
319
+ // PermissionMenu's settings-style dropdown): shows the tool name + an
320
+ // optional args preview, an optional free-text note the user can attach to
321
+ // their decision (auto-focused, since the note is usually the primary
322
+ // reason to open this card at all), and up to four resolution actions
323
+ // (once/session/all/deny). Mirrors docstudio's chat-approval-prompts.js
324
+ // buildApprovalPrompt shape. The note textarea is entirely optional -
325
+ // omitting `onDecision`'s use of the note arg keeps existing simpler
326
+ // once/deny-only call sites unaffected.
327
+ export function ApprovalPrompt({ toolName, categoryLabel, argsPreview, onDecision, autoFocusNote = true } = {}) {
328
+ let noteEl = null;
329
+ const noteRef = (el) => {
330
+ if (!el || noteEl === el) return;
331
+ noteEl = el;
332
+ if (autoFocusNote) queueMicrotask(() => noteEl && noteEl.focus());
333
+ };
334
+ const decide = (kind) => { if (onDecision) onDecision(kind, (noteEl && noteEl.value || '').trim()); };
335
+ return h('div', { class: 'ov-approval', role: 'group', 'aria-label': toolName ? `Permission requested: ${toolName}` : 'Permission requested' },
336
+ h('div', { class: 'ov-approval-head' },
337
+ h('span', { class: 'ov-approval-icon' }, Icon('lock', { size: 16 })),
338
+ h('strong', { class: 'ov-approval-tool' }, toolName || ''),
339
+ categoryLabel ? h('span', { class: 'ov-approval-cat' }, '- ' + categoryLabel) : null),
340
+ argsPreview ? h('pre', { class: 'ov-approval-args' }, argsPreview) : null,
341
+ h('textarea', {
342
+ class: 'ov-approval-note', ref: noteRef,
343
+ placeholder: 'Add instructions for the assistant (optional)...',
344
+ }),
345
+ h('div', { class: 'ov-approval-actions' },
346
+ h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-primary', onclick: () => decide('once') }, 'Allow once'),
347
+ h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-soft', onclick: () => decide('session') }, 'Allow for session'),
348
+ h('button', { type: 'button', class: 'ov-approval-btn', onclick: () => decide('all') }, 'Allow all'),
349
+ h('button', { type: 'button', class: 'ov-approval-btn ov-approval-btn-deny', onclick: () => decide('deny') }, 'Deny')));
350
+ }
351
+
318
352
  // Clamp a fixed-position box to the viewport given desired top-left coords.
319
353
  function _clampToViewport(x, y, w, h, margin = CLAMP_MARGIN) {
320
354
  const vw = (typeof window !== 'undefined' ? window.innerWidth : 1024);
@@ -143,6 +143,7 @@ export function Glyph({ children, color, size = 'base', label } = {}) {
143
143
  // Monochrome inline-SVG icons (stroke=currentColor) so chrome reads as one
144
144
  // coherent line-icon set instead of multicolor OS emoji. 16px box, 1.6 stroke.
145
145
  export const ICON_PATHS = {
146
+ lock: '<rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/>',
146
147
  mic: '<path d="M12 3a3 3 0 0 0-3 3v5a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/>',
147
148
  'mic-off': '<path d="M9 9v2a3 3 0 0 0 4.5 2.6M15 11V6a3 3 0 0 0-5.9-.8"/><path d="M5 11a7 7 0 0 0 11.5 5.4M12 18v3"/><path d="m4 4 16 16"/>',
148
149
  speaker: '<path d="M11 5 6 9H3v6h3l5 4z"/><path d="M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13"/>',
package/src/components.js CHANGED
@@ -90,7 +90,7 @@ export {
90
90
  export {
91
91
  Tooltip, Popover, Dropdown, useLongPress, useFloating,
92
92
  CommandPalette, EmojiPicker, BootOverlay, SettingsPopover,
93
- AuthModal, VideoLightbox, PermissionMenu
93
+ AuthModal, VideoLightbox, PermissionMenu, ApprovalPrompt
94
94
  } from './components/overlay-primitives.js';
95
95
 
96
96
  export {
package/src/index.js CHANGED
@@ -104,7 +104,7 @@ export const applyDiff = webjsx.applyDiff;
104
104
 
105
105
  // spoint kit paint surfaces (loading screen, HUD, editor chrome).
106
106
  export { renderLoadingScreen } from './kits/spoint/loading-screen.js';
107
- export { renderGameHud } from './kits/spoint/game-hud.js';
107
+ export { renderGameHud, Crosshair, AmmoCounter, HealthBar, BoostIndicator } from './kits/spoint/game-hud.js';
108
108
  export { renderHostJoinLobby } from './kits/spoint/host-join-lobby.js';
109
109
 
110
110
  // Re-export freddie helpers so consumers can `import { FREDDIE_PAGES } from
@@ -3,6 +3,61 @@
3
3
  // -> a vnode the consumer mounts. Pure presentation; the app owns all state.
4
4
  // `h` is the consumer's createElement (webjsx) so the tree composes into the
5
5
  // app's existing render() return.
6
+ //
7
+ // Composed from four independent primitives below (Crosshair, AmmoCounter,
8
+ // HealthBar, BoostIndicator) -- each takes the same `h` + a narrow slice of
9
+ // props and returns its own vnode, so a consumer that wants a custom HUD
10
+ // layout (e.g. reposition the ammo counter, drop the boost badge) can import
11
+ // just the pieces it needs instead of the whole composed tree.
12
+
13
+ /** Center-screen aim reticle. No props beyond `h`. */
14
+ export function Crosshair(h) {
15
+ return h('div', { class: 'sp-hud-crosshair' }, '+')
16
+ }
17
+
18
+ /**
19
+ * Ammo readout — `ammo/magazine`, or a reload-progress label while reloading.
20
+ * @param {Object} [props]
21
+ * @param {number} [props.ammo=0]
22
+ * @param {number} [props.magazine=30]
23
+ * @param {boolean} [props.reloading=false]
24
+ * @param {number} [props.reloadProgress=0]
25
+ */
26
+ export function AmmoCounter(h, props = {}) {
27
+ const { ammo = 0, magazine = 30, reloading = false, reloadProgress = 0 } = props
28
+ return h('div', { class: 'sp-hud-ammo' },
29
+ reloading
30
+ ? h('span', { class: 'sp-hud-ammo-reloading' }, `RELOADING ${reloadProgress}%`)
31
+ : h('span', null, `${ammo}/${magazine}`)
32
+ )
33
+ }
34
+
35
+ /**
36
+ * Bottom-center health bar with a threshold-colored fill and a numeric label.
37
+ * @param {Object} [props]
38
+ * @param {number} [props.hp=100]
39
+ */
40
+ export function HealthBar(h, props = {}) {
41
+ const { hp = 100 } = props
42
+ const hpClass = hp > 60 ? 'sp-hud-hp-high' : hp > 30 ? 'sp-hud-hp-mid' : 'sp-hud-hp-low'
43
+ return h('div', { class: 'sp-hud-health' },
44
+ h('div', { class: `sp-hud-health-fill ${hpClass}`, style: `width:${hp}%` }),
45
+ h('span', { class: 'sp-hud-health-num' }, String(hp))
46
+ )
47
+ }
48
+
49
+ /**
50
+ * Top-right boost badge. Renders nothing while boostSec <= 0 (consumer can
51
+ * check this before calling too; kept internal so composition stays a
52
+ * one-liner in renderGameHud).
53
+ * @param {Object} [props]
54
+ * @param {number} [props.boostSec=0]
55
+ */
56
+ export function BoostIndicator(h, props = {}) {
57
+ const { boostSec = 0 } = props
58
+ if (boostSec <= 0) return null
59
+ return h('div', { class: 'sp-hud-boost' }, `BOOSTED ${boostSec}s`)
60
+ }
6
61
 
7
62
  export function renderGameHud(h, state = {}) {
8
63
  const {
@@ -14,19 +69,10 @@ export function renderGameHud(h, state = {}) {
14
69
  boostSec = 0,
15
70
  } = state
16
71
 
17
- const hpClass = hp > 60 ? 'sp-hud-hp-high' : hp > 30 ? 'sp-hud-hp-mid' : 'sp-hud-hp-low'
18
-
19
72
  return h('div', { class: 'sp-hud' },
20
- h('div', { class: 'sp-hud-crosshair' }, '+'),
21
- h('div', { class: 'sp-hud-ammo' },
22
- reloading
23
- ? h('span', { class: 'sp-hud-ammo-reloading' }, `RELOADING ${reloadProgress}%`)
24
- : h('span', null, `${ammo}/${magazine}`)
25
- ),
26
- h('div', { class: 'sp-hud-health' },
27
- h('div', { class: `sp-hud-health-fill ${hpClass}`, style: `width:${hp}%` }),
28
- h('span', { class: 'sp-hud-health-num' }, String(hp))
29
- ),
30
- boostSec > 0 ? h('div', { class: 'sp-hud-boost' }, `BOOSTED ${boostSec}s`) : null
73
+ Crosshair(h),
74
+ AmmoCounter(h, { ammo, magazine, reloading, reloadProgress }),
75
+ HealthBar(h, { hp }),
76
+ BoostIndicator(h, { boostSec })
31
77
  )
32
78
  }
@@ -4,7 +4,7 @@
4
4
  // through the main bundle entry so spoint can import directly from unpkg.
5
5
 
6
6
  export { renderLoadingScreen } from './loading-screen.js';
7
- export { renderGameHud } from './game-hud.js';
7
+ export { renderGameHud, Crosshair, AmmoCounter, HealthBar, BoostIndicator } from './game-hud.js';
8
8
  export { renderHostJoinLobby } from './host-join-lobby.js';
9
9
 
10
10
  export const themeUrl = new URL('./loading-screen.css', import.meta.url).href;