@helpra/design 0.1.0 → 0.1.3

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 (37) hide show
  1. package/README.md +71 -58
  2. package/design-system/helpra/tokens.json +56 -118
  3. package/dist/embed/types.d.ts +2 -2
  4. package/dist/ui/assets/browserHost-DO0VE7SS.js +1 -0
  5. package/dist/ui/assets/{index-DCndCScv.js → index-B0caw0Dc.js} +10 -10
  6. package/dist/ui/assets/session.schemas-o3W88yfn.js +352 -0
  7. package/dist/ui/index.html +1 -1
  8. package/docs/orca-integration.md +1 -1
  9. package/package.json +2 -1
  10. package/src/contracts/agent-targets.ts +1 -1
  11. package/src/contracts/publication-publish.schemas.ts +2 -2
  12. package/src/contracts/publication.schemas.ts +1 -1
  13. package/src/contracts/publication.types.ts +1 -1
  14. package/src/embed/types.ts +2 -2
  15. package/src/project/dependencies.ts +10 -2
  16. package/src/project/git-commit.ts +1 -2
  17. package/src/project/git.ts +4 -7
  18. package/src/project/watch.ts +20 -11
  19. package/src/publication/cutover.ts +12 -6
  20. package/src/publication/store.constants.ts +2 -2
  21. package/src/publication/validate-store.ts +5 -3
  22. package/src/render/build.ts +6 -5
  23. package/src/render/index.ts +3 -3
  24. package/src/render/vite-build.ts +5 -6
  25. package/src/review/storage.ts +17 -2
  26. package/src/service/agent/dispatch.ts +2 -2
  27. package/src/service/agent/orca.ts +12 -1
  28. package/src/service/agent/payload.ts +1 -1
  29. package/src/source-export/job-store.ts +14 -8
  30. package/src/ui/HomeRecents.tsx +8 -52
  31. package/src/ui/ProjectDialog.tsx +3 -1
  32. package/src/ui/ThreadDetail.tsx +10 -7
  33. package/src/ui/agentDelivery.ts +1 -1
  34. package/src/ui/browserHost.ts +1 -1
  35. package/src/ui/system/ScreenConstantsSection.tsx +1 -1
  36. package/dist/ui/assets/browserHost-CgiYo1Ht.js +0 -1
  37. package/dist/ui/assets/session.schemas-DqTxSFE-.js +0 -352
@@ -44,6 +44,8 @@ export function ProjectDialog({
44
44
  const [missingDs, setMissingDs] = useState<MissingDesignSystemInfo | null>(null);
45
45
 
46
46
  const effectiveAction: ProjectAction = action === "clone" ? "clone" : mode;
47
+ const projectsDirectory = client.identity?.projectsDirectory ?? "~/.helpra/design/projects";
48
+ const pathSeparator = projectsDirectory.includes("\\") ? "\\" : "/";
47
49
 
48
50
  useEffect(() => {
49
51
  if (designSystems) {
@@ -168,7 +170,7 @@ export function ProjectDialog({
168
170
  label={effectiveAction === "clone" ? localized("Папка назначения") : effectiveAction === "create" ? t("optionalProjectFolder") : localized("Папка проекта")}
169
171
  autoFocus={effectiveAction === "open"} required={effectiveAction !== "create"}
170
172
  value={path} onChange={setPath} onError={setError} disabled={busy}
171
- placeholder={effectiveAction === "create" ? `${client.identity?.projectsDirectory ?? "~/.helpra/design/projects"}/<slug>` : localized("Абсолютный путь к локальной папке")} />
173
+ placeholder={effectiveAction === "create" ? `${projectsDirectory}${pathSeparator}<slug>` : localized("Абсолютный путь к локальной папке")} />
172
174
  {effectiveAction === "create" && client.can("design_list_design_systems") && (
173
175
  <label>
174
176
  {t("designSystem")}
@@ -261,13 +261,16 @@ export function ThreadDetail({
261
261
  disabled={busy}
262
262
  compact
263
263
  />
264
- {!publicSandbox && <AgentDeliveryControl delivery={delivery} />}
265
- <Button
266
- type="submit"
267
- variant="primary"
268
- disabled={busy || replyMedia.uploading || (!reply.trim() && replyMedia.attachments.length === 0)}
269
- >
270
- {localized("Отправить ответ")}</Button>
264
+ <div className="comment-compose-actions">
265
+ {!publicSandbox && <AgentDeliveryControl delivery={delivery} />}
266
+ <Button
267
+ type="submit"
268
+ variant="primary"
269
+ disabled={busy || replyMedia.uploading || (!reply.trim() && replyMedia.attachments.length === 0)}
270
+ >
271
+ {localized("Отправить ответ")}
272
+ </Button>
273
+ </div>
271
274
  </form>
272
275
  )}
273
276
  {(client.can("design_set_comment_status") || client.can("design_delete_comment")) && (
@@ -24,7 +24,7 @@ export function useAgentTargets(client: DesignClient, enabled = true) {
24
24
  const host = useSyncExternalStore(client.host?.subscribe ?? subscribe, client.host?.snapshot ?? snapshot);
25
25
  const native = host?.capabilities.sendToAgent && host.activeAgent ? host.activeAgent : null;
26
26
  const hostDestination = !publicSandbox && native && host ? {
27
- ideId: 'host-bridge', ideLabel: host.host === 'orca' ? 'Orca' : 'Helpra Works',
27
+ ideId: 'host-bridge', ideLabel: host.host === 'orca' ? 'Orca' : 'Desktop',
28
28
  hasOpenAgent: true as const, isSelectedForSession: true,
29
29
  currentAgent: { targetRef: native.id, agentName: native.name },
30
30
  } : null;
@@ -5,7 +5,7 @@ import { setLanguage } from './workbenchI18n.js';
5
5
 
6
6
  const target = z.object({ id: z.string().min(1).max(200), name: z.string().min(1).max(120), kind: z.enum(['bot', 'session', 'worker', 'webhook']), isActiveDefault: z.boolean().optional() });
7
7
  const contextSchema = z.object({
8
- host: z.enum(['orca', 'helpra-works']), authMode: z.literal('trusted-local'),
8
+ host: z.enum(['orca', 'desktop']), authMode: z.literal('trusted-local'),
9
9
  theme: z.string(), locale: z.enum(['ru', 'en']),
10
10
  activeAgent: target.nullable(), availableAgents: z.array(target).max(64),
11
11
  initialView: z.enum(['projects_and_ds', 'project', 'design_systems']).optional(),
@@ -41,7 +41,7 @@ function ScreenConstantSource({ onCopy }: {
41
41
  <details className="screen-constant-source">
42
42
  <summary>{localized("Как изменить константы")}</summary>
43
43
  <p>{localized("Меняйте основные значения строками CSS. Связанные варианты обновятся при пересборке. Запускайте команды из каталога Helpra Design, подставив свои пути.")}</p>
44
- <h3>{currentLanguage() === "ru" ? "Общая библиотека Business, Works и Workshop" : "Shared library for Business, Works, and Workshop"}</h3>
44
+ <h3>{currentLanguage() === "ru" ? "Общая библиотека компонентов" : "Shared component library"}</h3>
45
45
  <p>{localized("Измените") + " "}<code>shared-library/{SCREEN_CONSTANTS_PATH}</code> {localized("в каталоге набора. Синхронизация обновит и пересоберёт все три проекта.")}</p>
46
46
  <SystemValue value={localized("%1 \"/путь/к/набору\" --apply", syncCommand)} label={localized("команду синхронизации")} onCopy={onCopy} />
47
47
  <h3>{localized("Отдельный переносимый проект")}</h3>
@@ -1 +0,0 @@
1
- import{At as e,Ct as t,Dt as n,_t as r,at as i,gt as a,ht as o,xt as s}from"./index-DCndCScv.js";var c=`helpra-design-host/v1`;function l(e){if(e&&typeof e==`object`&&`protocol`in e&&e.protocol===c)return e}function u(e){if(!/^https?:\/\//.test(e)||new URL(e).origin!==e)throw Error(`Expected an exact host origin`);return e}function d(e){let t=e?.child??window,n=t.helpraDesignHost;if(typeof n?.getContext==`function`&&typeof n.onContextChanged==`function`&&typeof n.sendToAgent==`function`)return n;if(!e||t.parent===t)return;let r=u(e.parentOrigin),i=t.parent;function a(e,n){let a=crypto.randomUUID();return new Promise((o,s)=>{function u(){clearTimeout(f),t.removeEventListener(`message`,d)}function d(e){if(e.origin!==r||e.source!==i)return;let t=l(e.data);t?.type===`result`&&t.id===a&&(u(),t.ok===!0?o(t.value):s(Error(`Design host command failed`)))}let f=setTimeout(()=>{u(),s(Error(`Design host did not respond`))},1e4);t.addEventListener(`message`,d),i.postMessage({protocol:c,type:`call`,id:a,method:e,value:n},r)})}return{getContext:()=>a(`getContext`),sendToAgent:e=>a(`sendToAgent`,e),onContextChanged(e){let n=t=>{if(t.origin!==r||t.source!==i)return;let n=l(t.data);n?.type===`context`&&n.value&&typeof n.value==`object`&&e(n.value)};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)},titleChanged:e=>{a(`titleChanged`,e).catch(()=>void 0)},selectionChanged:e=>{a(`selectionChanged`,e).catch(()=>void 0)},openExternal:e=>a(`openExternal`,e),contextMenu:e=>{a(`contextMenu`,e).catch(()=>void 0)},revealInFolder:e=>a(`revealInFolder`,e),setFullscreen:e=>a(`setFullscreen`,e)}}var f=t({id:n().min(1).max(200),name:n().min(1).max(120),kind:o([`bot`,`session`,`worker`,`webhook`]),isActiveDefault:r().optional()}),p=t({host:o([`orca`,`helpra-works`]),authMode:s(`trusted-local`),theme:n(),locale:o([`ru`,`en`]),activeAgent:f.nullable(),availableAgents:a(f).max(64),initialView:o([`projects_and_ds`,`project`,`design_systems`]).optional(),initialTarget:t({workingCopyId:n().optional(),systemId:n().optional(),canvasId:n().optional(),pageId:n().optional(),artboardId:n().optional()}).optional(),capabilities:t({sendToAgent:r(),nativeContextMenu:r(),revealInFolder:r(),fullscreenToggle:r()})});function m(t){e(t.locale),(t.theme===`light`||t.theme===`dark`)&&i(t.theme)}var h;function g(e){return h??=_(e).catch(()=>void 0)}async function _(e){let t=d(e?{parentOrigin:e}:void 0);if(!t)return;let n=p.safeParse(await t.getContext());if(!n.success)return;let r=n.data,i=new Set;m(r);let a=new URL(location.href);if(!a.search){for(let[e,t]of Object.entries(r.initialTarget??{}))t&&a.searchParams.set(e,t);r.initialView===`design_systems`&&a.searchParams.set(`view`,`design-systems`),a.search&&history.replaceState(history.state,``,a)}let o=t.onContextChanged(e=>{let t=p.safeParse({...r,...e});if(!t.success)return;let n=r;r=t.data,(r.theme!==n.theme||r.locale!==n.locale)&&m(r);for(let e of i)e()}),s=!1;function c(e){e.key===`F11`&&r.capabilities.fullscreenToggle&&t?.setFullscreen&&(e.preventDefault(),s=!s,t.setFullscreen(s).catch(()=>{s=!s}))}function l(e){if(e.defaultPrevented||!(e.target instanceof Element)||!t?.openExternal)return;let n=e.target.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement))return;let r=new URL(n.href);r.origin!==location.origin&&[`https:`,`http:`].includes(r.protocol)&&(e.preventDefault(),t.openExternal(r.href).catch(()=>void 0))}return window.addEventListener(`keydown`,c),window.addEventListener(`click`,l),window.addEventListener(`pagehide`,e=>{e.persisted||(o(),window.removeEventListener(`keydown`,c),window.removeEventListener(`click`,l))}),{bridge:t,snapshot:()=>r,subscribe(e){return i.add(e),()=>i.delete(e)}}}export{g as connectBrowserHost};