@hanzo/dev 4.0.1 → 4.1.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/LICENSE +21 -0
- package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +31 -0
- package/dist/builder/api/git.js +47 -0
- package/dist/builder/api/github.d.ts +176 -0
- package/dist/builder/api/github.js +271 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +570 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +591 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +164 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The Big Five questionnaire Clone yourself asks, and what it found.
|
|
4
|
+
*
|
|
5
|
+
* On a phone one statement fills the screen, with a bar, Back, and the keys 1
|
|
6
|
+
* to 5; a wider window shows a focused block of 5 statements at a time (with an
|
|
7
|
+
* option to view all), and the keys answer the first one left. Every answer goes
|
|
8
|
+
* to `onChange` as it is given, which keeps it in this browser, so a closed
|
|
9
|
+
* dialog opens where it stopped. The statements are the IPIP's (ocean.ts), drawn
|
|
10
|
+
* through `t`; figures are drawn as given.
|
|
11
|
+
*/
|
|
12
|
+
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
13
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
14
|
+
import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from '@hanzogui/lucide-icons-2';
|
|
15
|
+
import { Button } from '@hanzo/ui';
|
|
16
|
+
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
17
|
+
import { RING, RING_INSET } from '../pane.js';
|
|
18
|
+
import { ANCHORS, DOMAIN, DOMAINS, FACET, FACETS, ITEMS } from './ocean.js';
|
|
19
|
+
const LEVELS = [1, 2, 3, 4, 5];
|
|
20
|
+
const PAGE_SIZE = 5;
|
|
21
|
+
export function Inventory({ answers, onChange, onDone }) {
|
|
22
|
+
const { t } = useI18n();
|
|
23
|
+
const phone = !useMedia().sm;
|
|
24
|
+
const items = ITEMS[answers.form];
|
|
25
|
+
const given = answers[answers.form];
|
|
26
|
+
const n = given.filter(Boolean).length;
|
|
27
|
+
const complete = n === items.length;
|
|
28
|
+
const firstOpen = given.indexOf(0);
|
|
29
|
+
const [at, setAt] = useState(() => Math.max(0, firstOpen));
|
|
30
|
+
const [page, setPage] = useState(() => Math.floor(Math.max(0, firstOpen) / PAGE_SIZE));
|
|
31
|
+
const [showAll, setShowAll] = useState(false);
|
|
32
|
+
const list = useRef(null);
|
|
33
|
+
const totalPages = Math.max(1, Math.ceil(items.length / PAGE_SIZE));
|
|
34
|
+
const safeAt = Math.min(at, Math.max(0, items.length - 1));
|
|
35
|
+
const safePage = Math.min(page, totalPages - 1);
|
|
36
|
+
const pageStart = showAll ? 0 : safePage * PAGE_SIZE;
|
|
37
|
+
const pageEnd = showAll ? items.length : Math.min(items.length, pageStart + PAGE_SIZE);
|
|
38
|
+
// The keys answer the statement on screen, or the first unanswered one on the active page (or anywhere in the list).
|
|
39
|
+
const pageOpen = given.findIndex((x, idx) => idx >= pageStart && idx < pageEnd && !x);
|
|
40
|
+
const current = phone ? safeAt : showAll ? firstOpen : pageOpen >= 0 ? pageOpen : firstOpen;
|
|
41
|
+
const answer = (i, v) => {
|
|
42
|
+
const next = given.map((x, j) => (j === i ? v : x));
|
|
43
|
+
onChange({ ...answers, [answers.form]: next });
|
|
44
|
+
const after = next.findIndex((x, j) => j > i && !x);
|
|
45
|
+
const left = after >= 0 ? after : next.indexOf(0);
|
|
46
|
+
if (phone) {
|
|
47
|
+
if (left < 0)
|
|
48
|
+
onDone();
|
|
49
|
+
else
|
|
50
|
+
setAt(left);
|
|
51
|
+
}
|
|
52
|
+
else if (showAll) {
|
|
53
|
+
if (left >= 0)
|
|
54
|
+
list.current?.querySelector(`[data-item="${left}"]`)?.scrollIntoView({ block: 'nearest' });
|
|
55
|
+
}
|
|
56
|
+
else if (left >= 0) {
|
|
57
|
+
// Advance smoothly once every statement on the visible page has an answer.
|
|
58
|
+
const stillOnPage = next.findIndex((x, j) => j >= pageStart && j < pageEnd && !x);
|
|
59
|
+
if (stillOnPage < 0)
|
|
60
|
+
setPage(Math.floor(left / PAGE_SIZE));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const press = useRef(answer);
|
|
64
|
+
press.current = answer;
|
|
65
|
+
// One handler for every row, so a row redraws only when its own answer or highlight changes.
|
|
66
|
+
const pick = useCallback((i, v) => press.current(i, v), []);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const key = (e) => {
|
|
69
|
+
const target = e.target;
|
|
70
|
+
if (target instanceof HTMLElement && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable))
|
|
71
|
+
return;
|
|
72
|
+
const v = Number(e.key);
|
|
73
|
+
if (e.metaKey || e.ctrlKey || e.altKey || !(v >= 1 && v <= 5) || current < 0)
|
|
74
|
+
return;
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
press.current(current, v);
|
|
77
|
+
};
|
|
78
|
+
window.addEventListener('keydown', key);
|
|
79
|
+
return () => window.removeEventListener('keydown', key);
|
|
80
|
+
}, [current]);
|
|
81
|
+
const progressPct = items.length ? Math.round((n / items.length) * 100) : 0;
|
|
82
|
+
// Pinned to the top of the dialog's scroll, so the count and Done stay in reach down the list.
|
|
83
|
+
const head = (_jsxs(YStack, { gap: "$2", pb: "$2.5", borderBottomWidth: 1, borderColor: "$borderColor", bg: "$background", z: 1, position: "sticky", t: 0, children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(YStack, { flex: 1, height: 6, overflow: "hidden", role: "progressbar", "aria-label": t('Answered'), "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": items.length, children: _jsx(YStack, { height: 6, width: `${progressPct}%`, rounded: 999, bg: "$ink" }) }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], shrink: 0, children: t('{n} of {total}', { n, total: items.length }) }), _jsx(Button, { size: "sm", variant: complete ? 'primary' : 'outline', borderColor: complete ? undefined : 'var(--border-strong)', onPress: onDone, children: t('Done') })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Describe yourself as you generally are now, not as you wish to be in the future. From 1, very inaccurate, to 5, very accurate.') })] }));
|
|
84
|
+
if (phone) {
|
|
85
|
+
const item = items[safeAt];
|
|
86
|
+
return (_jsxs(YStack, { gap: "$4", children: [head, _jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: t('Statement {i} of {total}', { i: safeAt + 1, total: items.length }) }), _jsx(SizableText, { size: "$5", fontWeight: "500", color: "$ink", minH: 56, children: t(item.text) })] }), _jsx(YStack, { role: "radiogroup", "aria-label": t(item.text), gap: "$2", children: LEVELS.map((v) => {
|
|
87
|
+
const selected = given[safeAt] === v;
|
|
88
|
+
return (_jsxs(XStack, { render: "button", role: "radio", "aria-checked": selected, "aria-label": t(ANCHORS[v - 1]), onPress: () => answer(safeAt, v), width: "100%", minH: 48, px: "$3.5", py: "$2", gap: "$3", items: "center", focusVisibleStyle: RING, "$platform-web": { textAlign: 'start' }, children: [_jsx(SizableText, { size: "$2", fontWeight: "500", color: selected ? '$ink' : '$soft', width: 16, fontVariant: ['tabular-nums'], shrink: 0, children: v }), _jsx(SizableText, { size: "$3", color: "$ink", flex: 1, minW: 0, children: t(ANCHORS[v - 1]) }), selected ? _jsx(Check, { size: 15, color: "$ink", "aria-hidden": true }) : null] }, v));
|
|
89
|
+
}) }), _jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: safeAt === 0, onPress: () => setAt(safeAt - 1), children: [_jsx(ChevronLeft, { size: 14 }), " ", t('Back')] }), _jsxs(Button, { size: "sm", variant: "ghost", disabled: safeAt >= items.length - 1, onPress: () => setAt(safeAt + 1), children: [t('Next'), " ", _jsx(ChevronRight, { size: 14 })] })] })] }));
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs(YStack, { gap: "$3", children: [head, _jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", px: "$1", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('1 Very inaccurate · 5 Very accurate') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Keys 1–5 answer the highlighted row') })] }), _jsx(YStack, { ref: list, role: "list", "aria-label": t('Statements'), rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", overflow: "hidden", children: items.slice(pageStart, pageEnd).map((item, offset) => {
|
|
92
|
+
const idx = pageStart + offset;
|
|
93
|
+
return _jsx(Statement, { i: idx, first: offset === 0, text: t(item.text), value: given[idx] ?? 0, current: idx === current, onAnswer: pick }, idx);
|
|
94
|
+
}) }), _jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", flexWrap: "wrap", children: [!showAll ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: safePage === 0, onPress: () => setPage(safePage - 1), children: [_jsx(ChevronLeft, { size: 14 }), " ", t('Previous')] }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: t('Page {page} of {total}', { page: safePage + 1, total: totalPages }) }), _jsxs(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: safePage >= totalPages - 1, onPress: () => setPage(safePage + 1), children: [t('Next'), " ", _jsx(ChevronRight, { size: 14 })] })] })) : (_jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: t('Showing all {total} statements', { total: items.length }) })), _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setShowAll((v) => !v), children: showAll ? t('Show 5 at a time') : t('Show all {total}', { total: items.length }) })] })] }));
|
|
95
|
+
}
|
|
96
|
+
/** One statement of the list, with its five answers. */
|
|
97
|
+
const Statement = memo(function Statement({ i, first, text, value, current, onAnswer, }) {
|
|
98
|
+
const { t } = useI18n();
|
|
99
|
+
return (_jsxs(XStack, { role: "listitem", "data-item": i, items: "center", gap: "$3", px: "$3", py: "$2.5", minH: 48, borderTopWidth: first ? 0 : 1, children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 24, fontVariant: ['tabular-nums'], shrink: 0, children: i + 1 }), _jsx(SizableText, { flex: 1, minW: 0, size: "$2", fontWeight: current ? '500' : '400', color: value && !current ? '$soft' : '$ink', children: text }), _jsx(XStack, { role: "radiogroup", "aria-label": text, gap: "$1.5", shrink: 0, children: LEVELS.map((v) => {
|
|
100
|
+
const selected = value === v;
|
|
101
|
+
return (_jsx(XStack, { render: "button", role: "radio", "aria-checked": selected, "aria-label": t(ANCHORS[v - 1]), onPress: () => onAnswer(i, v), width: 32, height: 32, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: selected ? '600' : '400', color: selected ? '$background' : '$soft', fontVariant: ['tabular-nums'], children: v }) }, v));
|
|
102
|
+
}) })] }));
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* The five domains as bars of their raw means, 1 to 5. On the long form, each
|
|
106
|
+
* domain's six facets stay folded by default so only 5 primary bars appear at rest.
|
|
107
|
+
*/
|
|
108
|
+
export function Traits({ form, score }) {
|
|
109
|
+
const { t } = useI18n();
|
|
110
|
+
const [expanded, setExpanded] = useState({});
|
|
111
|
+
const hasFacets = form === 'long';
|
|
112
|
+
const allOpen = hasFacets && DOMAINS.every((d) => expanded[d]);
|
|
113
|
+
const toggleDomain = (d) => setExpanded((prev) => ({ ...prev, [d]: !prev[d] }));
|
|
114
|
+
const toggleAll = () => {
|
|
115
|
+
const next = !allOpen;
|
|
116
|
+
setExpanded(Object.fromEntries(DOMAINS.map((d) => [d, next])));
|
|
117
|
+
};
|
|
118
|
+
return (_jsxs(YStack, { gap: "$2.5", children: [_jsx(YStack, { rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", overflow: "hidden", children: DOMAINS.map((d, idx) => {
|
|
119
|
+
const open = hasFacets && Boolean(expanded[d]);
|
|
120
|
+
return (_jsxs(YStack, { borderTopWidth: idx ? 1 : 0, borderColor: "$borderColor", children: [hasFacets ? (_jsxs(XStack, { render: "button", "aria-expanded": open, "aria-label": t('{domain}: {score}', { domain: t(DOMAIN[d]), score: score.domains[d].toFixed(1) }), onPress: () => toggleDomain(d), width: "100%", px: "$3", py: "$2.5", minH: 44, items: "center", gap: "$2", focusVisibleStyle: RING_INSET, "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Bar, { label: t(DOMAIN[d]), value: score.domains[d], strong: true }) }), open ? _jsx(ChevronUp, { size: 14, color: "$soft", "aria-hidden": true }) : _jsx(ChevronDown, { size: 14, color: "$soft", "aria-hidden": true })] })) : (_jsx(YStack, { px: "$3", py: "$2.5", children: _jsx(Bar, { label: t(DOMAIN[d]), value: score.domains[d], strong: true }) })), open ? (_jsx(YStack, { px: "$3", py: "$2.5", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", bg: "$background", children: FACETS(d).map((f) => (_jsx(Bar, { label: t(FACET[f]), value: score.facets[f] ?? 0 }, f))) })) : null] }, d));
|
|
121
|
+
}) }), hasFacets ? (_jsx(XStack, { justify: "flex-end", children: _jsx(Button, { size: "sm", variant: "ghost", onPress: toggleAll, children: allOpen ? t('Hide facets') : t('Show all facets') }) })) : null] }));
|
|
122
|
+
}
|
|
123
|
+
function Bar({ label, value, strong = false }) {
|
|
124
|
+
const h = strong ? 6 : 4;
|
|
125
|
+
const pct = Math.max(0, Math.min(100, ((value - 1) / 4) * 100));
|
|
126
|
+
return (_jsxs(XStack, { items: "center", gap: "$3", role: "meter", "aria-label": label, "aria-valuenow": value, "aria-valuemin": 1, "aria-valuemax": 5, "aria-valuetext": value.toFixed(1), pl: strong ? 0 : '$2', children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", width: strong ? 150 : 142, shrink: 0, "$max-sm": { width: '100%' }, children: [_jsx(SizableText, { size: strong ? '$2' : '$1', fontWeight: strong ? '500' : '400', color: strong ? '$ink' : '$soft', numberOfLines: 1, flex: 1, minW: 0, children: label }), _jsx(XStack, { display: "none", shrink: 0, "$max-sm": { display: 'flex' }, children: _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: value.toFixed(1) }) })] }), _jsx(YStack, { flex: 1, minW: 0, height: h, rounded: 999, bg: "$hover", overflow: "hidden", "$max-sm": { flexBasis: 'auto', grow: 0, minW: 0, width: '100%' }, children: _jsx(YStack, { height: h, width: `${pct}%`, rounded: 999, bg: strong ? '$ink' : '$soft' }) }), _jsx(XStack, { width: 28, justify: "flex-end", shrink: 0, "$max-sm": { display: 'none' }, children: _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: value.toFixed(1) }) })] }));
|
|
127
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customize's reads: data.ts `useRead`, given up on after `WAIT`. A read that
|
|
3
|
+
* hangs says so and offers a retry instead of loading forever; the request
|
|
4
|
+
* itself is left to finish or fail on its own.
|
|
5
|
+
*/
|
|
6
|
+
import { type Read } from '../data.ts';
|
|
7
|
+
/** `p`, or a `Slow` refusal once `ms` pass first. */
|
|
8
|
+
export declare function within<T>(p: Promise<T>, ms?: number): Promise<T>;
|
|
9
|
+
export declare function useLoad<T>(load: (() => Promise<T>) | null, initial: T, key: unknown[]): Read<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customize's reads: data.ts `useRead`, given up on after `WAIT`. A read that
|
|
3
|
+
* hangs says so and offers a retry instead of loading forever; the request
|
|
4
|
+
* itself is left to finish or fail on its own.
|
|
5
|
+
*/
|
|
6
|
+
import { Slow, useRead, WAIT } from '../data.js';
|
|
7
|
+
/** `p`, or a `Slow` refusal once `ms` pass first. */
|
|
8
|
+
export function within(p, ms = WAIT) {
|
|
9
|
+
return new Promise((ok, no) => {
|
|
10
|
+
const id = setTimeout(() => no(new Slow()), ms);
|
|
11
|
+
p.then((v) => {
|
|
12
|
+
clearTimeout(id);
|
|
13
|
+
ok(v);
|
|
14
|
+
}, (e) => {
|
|
15
|
+
clearTimeout(id);
|
|
16
|
+
no(e);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function useLoad(load, initial, key) {
|
|
21
|
+
return useRead(load ? () => within(load()) : null, initial, key);
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type Domain = 'O' | 'C' | 'E' | 'A' | 'N';
|
|
2
|
+
export declare const DOMAINS: readonly Domain[];
|
|
3
|
+
export type Facet = `${Domain}${1 | 2 | 3 | 4 | 5 | 6}`;
|
|
4
|
+
export type Form = 'short' | 'long';
|
|
5
|
+
export interface Item {
|
|
6
|
+
text: string;
|
|
7
|
+
domain: Domain;
|
|
8
|
+
/** The long form's facet; null on the short form. */
|
|
9
|
+
facet: Facet | null;
|
|
10
|
+
/** +1 scores the answer, -1 scores 6 - answer. */
|
|
11
|
+
key: 1 | -1;
|
|
12
|
+
}
|
|
13
|
+
export declare const DOMAIN: Record<Domain, string>;
|
|
14
|
+
export declare const FACET: Record<Facet, string>;
|
|
15
|
+
/** A domain's six facets, in order. */
|
|
16
|
+
export declare const FACETS: (d: Domain) => Facet[];
|
|
17
|
+
/** The five answers, as the IPIP words them, for 1 to 5. */
|
|
18
|
+
export declare const ANCHORS: readonly [string, string, string, string, string];
|
|
19
|
+
export declare const ITEMS: Record<Form, readonly Item[]>;
|
|
20
|
+
export interface Score {
|
|
21
|
+
domains: Record<Domain, number>;
|
|
22
|
+
/** The long form's 30; empty for the short form. */
|
|
23
|
+
facets: Partial<Record<Facet, number>>;
|
|
24
|
+
}
|
|
25
|
+
/** Every scale's mean over its answered items (0 where none is); `answers[i]` is item i's 1 to 5, 0 unanswered. */
|
|
26
|
+
export declare function score(form: Form, answers: readonly number[]): Score;
|
|
27
|
+
/**
|
|
28
|
+
* How `name` tends to think and write, from a whole answer sheet's score: a
|
|
29
|
+
* line for each domain at either end, the facets furthest out (long form), and
|
|
30
|
+
* the five means.
|
|
31
|
+
*/
|
|
32
|
+
export declare function nature(name: string, form: Form, s: Score): string;
|
|
33
|
+
/** Both answer sheets and the form being taken: what this browser keeps between visits. */
|
|
34
|
+
export interface Answers {
|
|
35
|
+
form: Form;
|
|
36
|
+
short: number[];
|
|
37
|
+
long: number[];
|
|
38
|
+
}
|
|
39
|
+
/** The answers kept for `who`, or blank sheets. */
|
|
40
|
+
export declare function kept(who: string): Answers;
|
|
41
|
+
export declare function keep(who: string, a: Answers): void;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Big Five (OCEAN) as the International Personality Item Pool asks it, and
|
|
3
|
+
* how an answer sheet is scored.
|
|
4
|
+
*
|
|
5
|
+
* Long: the IPIP-NEO-120. Johnson, J. A. (2014). Measuring thirty facets of
|
|
6
|
+
* the Five Factor Model with a 120-item public domain inventory: Development of
|
|
7
|
+
* the IPIP-NEO-120. Journal of Research in Personality, 51, 78-89. Statements
|
|
8
|
+
* and keys: https://ipip.ori.org/30FacetNEO-PI-RItems.htm; facet names:
|
|
9
|
+
* https://ipip.ori.org/newNEO_FacetsTable.htm. In Johnson's order, item n is
|
|
10
|
+
* facet (n - 1) mod 30 of N1 E1 O1 A1 C1 N2 … C6, as in the MIT-licensed
|
|
11
|
+
* `five-factor-e` package (`ipipneo`, NeuroQuest AI), whose reversed-item list
|
|
12
|
+
* agrees with every key here.
|
|
13
|
+
*
|
|
14
|
+
* Short: the 50-item IPIP Big-Five factor markers, in their published order,
|
|
15
|
+
* each with the factor and key printed beside it:
|
|
16
|
+
* https://ipip.ori.org/new_ipip-50-item-scale.htm (Goldberg, L. R. (1992). The
|
|
17
|
+
* development of markers for the Big-Five factor structure. Psychological
|
|
18
|
+
* Assessment, 4, 26-42). Factor IV there is Emotional Stability; here it is
|
|
19
|
+
* Neuroticism, every key turned over, so Neuroticism = 6 - Emotional Stability.
|
|
20
|
+
*
|
|
21
|
+
* The IPIP's items and scales are in the public domain (https://ipip.ori.org).
|
|
22
|
+
*
|
|
23
|
+
* Answers run 1 (very inaccurate) to 5 (very accurate). An item keyed minus
|
|
24
|
+
* counts 6 - answer. A scale's score is the mean of its answered items: raw,
|
|
25
|
+
* 1 to 5, against no norm table.
|
|
26
|
+
*/
|
|
27
|
+
import { phrase } from '@hanzo/i18n';
|
|
28
|
+
export const DOMAINS = ['O', 'C', 'E', 'A', 'N'];
|
|
29
|
+
export const DOMAIN = {
|
|
30
|
+
O: phrase('Openness'),
|
|
31
|
+
C: phrase('Conscientiousness'),
|
|
32
|
+
E: phrase('Extraversion'),
|
|
33
|
+
A: phrase('Agreeableness'),
|
|
34
|
+
N: phrase('Neuroticism'),
|
|
35
|
+
};
|
|
36
|
+
export const FACET = {
|
|
37
|
+
N1: phrase('Anxiety'),
|
|
38
|
+
N2: phrase('Anger'),
|
|
39
|
+
N3: phrase('Depression'),
|
|
40
|
+
N4: phrase('Self-consciousness'),
|
|
41
|
+
N5: phrase('Immoderation'),
|
|
42
|
+
N6: phrase('Vulnerability'),
|
|
43
|
+
E1: phrase('Friendliness'),
|
|
44
|
+
E2: phrase('Gregariousness'),
|
|
45
|
+
E3: phrase('Assertiveness'),
|
|
46
|
+
E4: phrase('Activity level'),
|
|
47
|
+
E5: phrase('Excitement-seeking'),
|
|
48
|
+
E6: phrase('Cheerfulness'),
|
|
49
|
+
O1: phrase('Imagination'),
|
|
50
|
+
O2: phrase('Artistic interests'),
|
|
51
|
+
O3: phrase('Emotionality'),
|
|
52
|
+
O4: phrase('Adventurousness'),
|
|
53
|
+
O5: phrase('Intellect'),
|
|
54
|
+
O6: phrase('Liberalism'),
|
|
55
|
+
A1: phrase('Trust'),
|
|
56
|
+
A2: phrase('Morality'),
|
|
57
|
+
A3: phrase('Altruism'),
|
|
58
|
+
A4: phrase('Cooperation'),
|
|
59
|
+
A5: phrase('Modesty'),
|
|
60
|
+
A6: phrase('Sympathy'),
|
|
61
|
+
C1: phrase('Self-efficacy'),
|
|
62
|
+
C2: phrase('Orderliness'),
|
|
63
|
+
C3: phrase('Dutifulness'),
|
|
64
|
+
C4: phrase('Achievement-striving'),
|
|
65
|
+
C5: phrase('Self-discipline'),
|
|
66
|
+
C6: phrase('Cautiousness'),
|
|
67
|
+
};
|
|
68
|
+
/** A domain's six facets, in order. */
|
|
69
|
+
export const FACETS = (d) => [1, 2, 3, 4, 5, 6].map((n) => `${d}${n}`);
|
|
70
|
+
/** The five answers, as the IPIP words them, for 1 to 5. */
|
|
71
|
+
export const ANCHORS = [phrase('Very inaccurate'), phrase('Moderately inaccurate'), phrase('Neither accurate nor inaccurate'), phrase('Moderately accurate'), phrase('Very accurate')];
|
|
72
|
+
/** The IPIP-NEO-120, as published: facet, key, statement. */
|
|
73
|
+
const long = [
|
|
74
|
+
['N1', '+', phrase('Worry about things.')],
|
|
75
|
+
['E1', '+', phrase('Make friends easily.')],
|
|
76
|
+
['O1', '+', phrase('Have a vivid imagination.')],
|
|
77
|
+
['A1', '+', phrase('Trust others.')],
|
|
78
|
+
['C1', '+', phrase('Complete tasks successfully.')],
|
|
79
|
+
['N2', '+', phrase('Get angry easily.')],
|
|
80
|
+
['E2', '+', phrase('Love large parties.')],
|
|
81
|
+
['O2', '+', phrase('Believe in the importance of art.')],
|
|
82
|
+
['A2', '-', phrase('Use others for my own ends.')],
|
|
83
|
+
['C2', '+', phrase('Like to tidy up.')],
|
|
84
|
+
['N3', '+', phrase('Often feel blue.')],
|
|
85
|
+
['E3', '+', phrase('Take charge.')],
|
|
86
|
+
['O3', '+', phrase('Experience my emotions intensely.')],
|
|
87
|
+
['A3', '+', phrase('Love to help others.')],
|
|
88
|
+
['C3', '+', phrase('Keep my promises.')],
|
|
89
|
+
['N4', '+', phrase('Find it difficult to approach others.')],
|
|
90
|
+
['E4', '+', phrase('Am always busy.')],
|
|
91
|
+
['O4', '+', phrase('Prefer variety to routine.')],
|
|
92
|
+
['A4', '-', phrase('Love a good fight.')],
|
|
93
|
+
['C4', '+', phrase('Work hard.')],
|
|
94
|
+
['N5', '+', phrase('Go on binges.')],
|
|
95
|
+
['E5', '+', phrase('Love excitement.')],
|
|
96
|
+
['O5', '+', phrase('Love to read challenging material.')],
|
|
97
|
+
['A5', '-', phrase('Believe that I am better than others.')],
|
|
98
|
+
['C5', '+', phrase('Am always prepared.')],
|
|
99
|
+
['N6', '+', phrase('Panic easily.')],
|
|
100
|
+
['E6', '+', phrase('Radiate joy.')],
|
|
101
|
+
['O6', '+', phrase('Tend to vote for liberal political candidates.')],
|
|
102
|
+
['A6', '+', phrase('Sympathize with the homeless.')],
|
|
103
|
+
['C6', '-', phrase('Jump into things without thinking.')],
|
|
104
|
+
['N1', '+', phrase('Fear for the worst.')],
|
|
105
|
+
['E1', '+', phrase('Feel comfortable around people.')],
|
|
106
|
+
['O1', '+', phrase('Enjoy wild flights of fantasy.')],
|
|
107
|
+
['A1', '+', phrase('Believe that others have good intentions.')],
|
|
108
|
+
['C1', '+', phrase('Excel in what I do.')],
|
|
109
|
+
['N2', '+', phrase('Get irritated easily.')],
|
|
110
|
+
['E2', '+', phrase('Talk to a lot of different people at parties.')],
|
|
111
|
+
['O2', '+', phrase('See beauty in things that others might not notice.')],
|
|
112
|
+
['A2', '-', phrase('Cheat to get ahead.')],
|
|
113
|
+
['C2', '-', phrase('Often forget to put things back in their proper place.')],
|
|
114
|
+
['N3', '+', phrase('Dislike myself.')],
|
|
115
|
+
['E3', '+', phrase('Try to lead others.')],
|
|
116
|
+
['O3', '+', phrase("Feel others' emotions.")],
|
|
117
|
+
['A3', '+', phrase('Am concerned about others.')],
|
|
118
|
+
['C3', '+', phrase('Tell the truth.')],
|
|
119
|
+
['N4', '+', phrase('Am afraid to draw attention to myself.')],
|
|
120
|
+
['E4', '+', phrase('Am always on the go.')],
|
|
121
|
+
['O4', '-', phrase('Prefer to stick with things that I know.')],
|
|
122
|
+
['A4', '-', phrase('Yell at people.')],
|
|
123
|
+
['C4', '+', phrase("Do more than what's expected of me.")],
|
|
124
|
+
['N5', '-', phrase('Rarely overindulge.')],
|
|
125
|
+
['E5', '+', phrase('Seek adventure.')],
|
|
126
|
+
['O5', '-', phrase('Avoid philosophical discussions.')],
|
|
127
|
+
['A5', '-', phrase('Think highly of myself.')],
|
|
128
|
+
['C5', '+', phrase('Carry out my plans.')],
|
|
129
|
+
['N6', '+', phrase('Become overwhelmed by events.')],
|
|
130
|
+
['E6', '+', phrase('Have a lot of fun.')],
|
|
131
|
+
['O6', '+', phrase('Believe that there is no absolute right and wrong.')],
|
|
132
|
+
['A6', '+', phrase('Feel sympathy for those who are worse off than myself.')],
|
|
133
|
+
['C6', '-', phrase('Make rash decisions.')],
|
|
134
|
+
['N1', '+', phrase('Am afraid of many things.')],
|
|
135
|
+
['E1', '-', phrase('Avoid contacts with others.')],
|
|
136
|
+
['O1', '+', phrase('Love to daydream.')],
|
|
137
|
+
['A1', '+', phrase('Trust what people say.')],
|
|
138
|
+
['C1', '+', phrase('Handle tasks smoothly.')],
|
|
139
|
+
['N2', '+', phrase('Lose my temper.')],
|
|
140
|
+
['E2', '-', phrase('Prefer to be alone.')],
|
|
141
|
+
['O2', '-', phrase('Do not like poetry.')],
|
|
142
|
+
['A2', '-', phrase('Take advantage of others.')],
|
|
143
|
+
['C2', '-', phrase('Leave a mess in my room.')],
|
|
144
|
+
['N3', '+', phrase('Am often down in the dumps.')],
|
|
145
|
+
['E3', '+', phrase('Take control of things.')],
|
|
146
|
+
['O3', '-', phrase('Rarely notice my emotional reactions.')],
|
|
147
|
+
['A3', '-', phrase('Am indifferent to the feelings of others.')],
|
|
148
|
+
['C3', '-', phrase('Break rules.')],
|
|
149
|
+
['N4', '+', phrase('Only feel comfortable with friends.')],
|
|
150
|
+
['E4', '+', phrase('Do a lot in my spare time.')],
|
|
151
|
+
['O4', '-', phrase('Dislike changes.')],
|
|
152
|
+
['A4', '-', phrase('Insult people.')],
|
|
153
|
+
['C4', '-', phrase('Do just enough work to get by.')],
|
|
154
|
+
['N5', '-', phrase('Easily resist temptations.')],
|
|
155
|
+
['E5', '+', phrase('Enjoy being reckless.')],
|
|
156
|
+
['O5', '-', phrase('Have difficulty understanding abstract ideas.')],
|
|
157
|
+
['A5', '-', phrase('Have a high opinion of myself.')],
|
|
158
|
+
['C5', '-', phrase('Waste my time.')],
|
|
159
|
+
['N6', '+', phrase("Feel that I'm unable to deal with things.")],
|
|
160
|
+
['E6', '+', phrase('Love life.')],
|
|
161
|
+
['O6', '-', phrase('Tend to vote for conservative political candidates.')],
|
|
162
|
+
['A6', '-', phrase("Am not interested in other people's problems.")],
|
|
163
|
+
['C6', '-', phrase('Rush into things.')],
|
|
164
|
+
['N1', '+', phrase('Get stressed out easily.')],
|
|
165
|
+
['E1', '-', phrase('Keep others at a distance.')],
|
|
166
|
+
['O1', '+', phrase('Like to get lost in thought.')],
|
|
167
|
+
['A1', '-', phrase('Distrust people.')],
|
|
168
|
+
['C1', '+', phrase('Know how to get things done.')],
|
|
169
|
+
['N2', '-', phrase('Am not easily annoyed.')],
|
|
170
|
+
['E2', '-', phrase('Avoid crowds.')],
|
|
171
|
+
['O2', '-', phrase('Do not enjoy going to art museums.')],
|
|
172
|
+
['A2', '-', phrase("Obstruct others' plans.")],
|
|
173
|
+
['C2', '-', phrase('Leave my belongings around.')],
|
|
174
|
+
['N3', '-', phrase('Feel comfortable with myself.')],
|
|
175
|
+
['E3', '-', phrase('Wait for others to lead the way.')],
|
|
176
|
+
['O3', '-', phrase("Don't understand people who get emotional.")],
|
|
177
|
+
['A3', '-', phrase('Take no time for others.')],
|
|
178
|
+
['C3', '-', phrase('Break my promises.')],
|
|
179
|
+
['N4', '-', phrase('Am not bothered by difficult social situations.')],
|
|
180
|
+
['E4', '-', phrase('Like to take it easy.')],
|
|
181
|
+
['O4', '-', phrase('Am attached to conventional ways.')],
|
|
182
|
+
['A4', '-', phrase('Get back at others.')],
|
|
183
|
+
['C4', '-', phrase('Put little time and effort into my work.')],
|
|
184
|
+
['N5', '-', phrase('Am able to control my cravings.')],
|
|
185
|
+
['E5', '+', phrase('Act wild and crazy.')],
|
|
186
|
+
['O5', '-', phrase('Am not interested in theoretical discussions.')],
|
|
187
|
+
['A5', '-', phrase('Boast about my virtues.')],
|
|
188
|
+
['C5', '-', phrase('Have difficulty starting tasks.')],
|
|
189
|
+
['N6', '-', phrase('Remain calm under pressure.')],
|
|
190
|
+
['E6', '+', phrase('Look at the bright side of life.')],
|
|
191
|
+
['O6', '-', phrase('Believe that we should be tough on crime.')],
|
|
192
|
+
['A6', '-', phrase('Try not to think about the needy.')],
|
|
193
|
+
['C6', '-', phrase('Act without thinking.')],
|
|
194
|
+
];
|
|
195
|
+
/** The 50 markers, as published: factor (I Extraversion, II Agreeableness, III Conscientiousness, IV Emotional Stability, V Intellect/Imagination), key, statement. */
|
|
196
|
+
const short = [
|
|
197
|
+
[1, '+', phrase('Am the life of the party.')],
|
|
198
|
+
[2, '-', phrase('Feel little concern for others.')],
|
|
199
|
+
[3, '+', phrase('Am always prepared.')],
|
|
200
|
+
[4, '-', phrase('Get stressed out easily.')],
|
|
201
|
+
[5, '+', phrase('Have a rich vocabulary.')],
|
|
202
|
+
[1, '-', phrase("Don't talk a lot.")],
|
|
203
|
+
[2, '+', phrase('Am interested in people.')],
|
|
204
|
+
[3, '-', phrase('Leave my belongings around.')],
|
|
205
|
+
[4, '+', phrase('Am relaxed most of the time.')],
|
|
206
|
+
[5, '-', phrase('Have difficulty understanding abstract ideas.')],
|
|
207
|
+
[1, '+', phrase('Feel comfortable around people.')],
|
|
208
|
+
[2, '-', phrase('Insult people.')],
|
|
209
|
+
[3, '+', phrase('Pay attention to details.')],
|
|
210
|
+
[4, '-', phrase('Worry about things.')],
|
|
211
|
+
[5, '+', phrase('Have a vivid imagination.')],
|
|
212
|
+
[1, '-', phrase('Keep in the background.')],
|
|
213
|
+
[2, '+', phrase("Sympathize with others' feelings.")],
|
|
214
|
+
[3, '-', phrase('Make a mess of things.')],
|
|
215
|
+
[4, '+', phrase('Seldom feel blue.')],
|
|
216
|
+
[5, '-', phrase('Am not interested in abstract ideas.')],
|
|
217
|
+
[1, '+', phrase('Start conversations.')],
|
|
218
|
+
[2, '-', phrase("Am not interested in other people's problems.")],
|
|
219
|
+
[3, '+', phrase('Get chores done right away.')],
|
|
220
|
+
[4, '-', phrase('Am easily disturbed.')],
|
|
221
|
+
[5, '+', phrase('Have excellent ideas.')],
|
|
222
|
+
[1, '-', phrase('Have little to say.')],
|
|
223
|
+
[2, '+', phrase('Have a soft heart.')],
|
|
224
|
+
[3, '-', phrase('Often forget to put things back in their proper place.')],
|
|
225
|
+
[4, '-', phrase('Get upset easily.')],
|
|
226
|
+
[5, '-', phrase('Do not have a good imagination.')],
|
|
227
|
+
[1, '+', phrase('Talk to a lot of different people at parties.')],
|
|
228
|
+
[2, '-', phrase('Am not really interested in others.')],
|
|
229
|
+
[3, '+', phrase('Like order.')],
|
|
230
|
+
[4, '-', phrase('Change my mood a lot.')],
|
|
231
|
+
[5, '+', phrase('Am quick to understand things.')],
|
|
232
|
+
[1, '-', phrase("Don't like to draw attention to myself.")],
|
|
233
|
+
[2, '+', phrase('Take time out for others.')],
|
|
234
|
+
[3, '-', phrase('Shirk my duties.')],
|
|
235
|
+
[4, '-', phrase('Have frequent mood swings.')],
|
|
236
|
+
[5, '+', phrase('Use difficult words.')],
|
|
237
|
+
[1, '+', phrase("Don't mind being the center of attention.")],
|
|
238
|
+
[2, '+', phrase("Feel others' emotions.")],
|
|
239
|
+
[3, '+', phrase('Follow a schedule.')],
|
|
240
|
+
[4, '-', phrase('Get irritated easily.')],
|
|
241
|
+
[5, '+', phrase('Spend time reflecting on things.')],
|
|
242
|
+
[1, '-', phrase('Am quiet around strangers.')],
|
|
243
|
+
[2, '+', phrase('Make people feel at ease.')],
|
|
244
|
+
[3, '+', phrase('Am exacting in my work.')],
|
|
245
|
+
[4, '-', phrase('Often feel blue.')],
|
|
246
|
+
[5, '+', phrase('Am full of ideas.')],
|
|
247
|
+
];
|
|
248
|
+
const FACTOR = { 1: 'E', 2: 'A', 3: 'C', 4: 'N', 5: 'O' };
|
|
249
|
+
export const ITEMS = {
|
|
250
|
+
long: long.map(([facet, key, text]) => ({ text, domain: facet[0], facet, key: key === '+' ? 1 : -1 })),
|
|
251
|
+
short: short.map(([factor, key, text]) => ({ text, domain: FACTOR[factor], facet: null, key: (key === '+') !== (factor === 4) ? 1 : -1 })),
|
|
252
|
+
};
|
|
253
|
+
/** Every scale's mean over its answered items (0 where none is); `answers[i]` is item i's 1 to 5, 0 unanswered. */
|
|
254
|
+
export function score(form, answers) {
|
|
255
|
+
const sums = new Map();
|
|
256
|
+
const add = (scale, v) => {
|
|
257
|
+
const [s, n] = sums.get(scale) ?? [0, 0];
|
|
258
|
+
sums.set(scale, [s + v, n + 1]);
|
|
259
|
+
};
|
|
260
|
+
ITEMS[form].forEach((item, i) => {
|
|
261
|
+
const a = answers[i] ?? 0;
|
|
262
|
+
if (!a)
|
|
263
|
+
return;
|
|
264
|
+
const v = item.key === 1 ? a : 6 - a;
|
|
265
|
+
add(item.domain, v);
|
|
266
|
+
if (item.facet)
|
|
267
|
+
add(item.facet, v);
|
|
268
|
+
});
|
|
269
|
+
const mean = (scale) => {
|
|
270
|
+
const [s, n] = sums.get(scale) ?? [0, 0];
|
|
271
|
+
return n ? s / n : 0;
|
|
272
|
+
};
|
|
273
|
+
return {
|
|
274
|
+
domains: Object.fromEntries(DOMAINS.map((d) => [d, mean(d)])),
|
|
275
|
+
facets: form === 'long' ? Object.fromEntries(DOMAINS.flatMap(FACETS).map((f) => [f, mean(f)])) : {},
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/** How a high (≥ 3.5) and a low (≤ 2.5) domain reads in the clone's instructions. Prompt text: English. */
|
|
279
|
+
const READS = {
|
|
280
|
+
O: [
|
|
281
|
+
'Curious and imaginative: drawn to ideas, abstraction and new approaches; writes with range and the odd metaphor.',
|
|
282
|
+
'Practical and concrete: trusts the proven over the novel; writes plainly, with examples rather than theory.',
|
|
283
|
+
],
|
|
284
|
+
C: ['Organized and thorough: plans ahead and follows through; writes in a structured, precise way.', 'Spontaneous and flexible: improvises rather than plans; writes loosely and gets to the point.'],
|
|
285
|
+
E: ['Outgoing and energetic: thinks out loud and takes the lead; writes with warmth and enthusiasm.', 'Reserved and reflective: thinks before speaking; writes briefly and without fuss.'],
|
|
286
|
+
A: ['Warm and cooperative: assumes good intent; writes tactfully and generously.', 'Direct and skeptical: questions claims and says what they think; writes bluntly, without softening.'],
|
|
287
|
+
N: ['Sensitive to pressure: alert to what could go wrong; writes with care and caveats.', 'Calm and steady: unflustered under pressure; writes with an even tone.'],
|
|
288
|
+
};
|
|
289
|
+
const NAME = { long: 'IPIP-NEO-120', short: 'IPIP 50-item Big-Five markers' };
|
|
290
|
+
const fixed = (m) => m.toFixed(1);
|
|
291
|
+
/**
|
|
292
|
+
* How `name` tends to think and write, from a whole answer sheet's score: a
|
|
293
|
+
* line for each domain at either end, the facets furthest out (long form), and
|
|
294
|
+
* the five means.
|
|
295
|
+
*/
|
|
296
|
+
export function nature(name, form, s) {
|
|
297
|
+
const lines = DOMAINS.flatMap((d) => (s.domains[d] >= 3.5 ? [READS[d][0]] : s.domains[d] <= 2.5 ? [READS[d][1]] : []));
|
|
298
|
+
const far = Object.entries(s.facets).sort((a, b) => Math.abs(b[1] - 3) - Math.abs(a[1] - 3));
|
|
299
|
+
const list = (fs) => fs.slice(0, 3).map(([f, m]) => `${FACET[f]} (${fixed(m)})`).join(', ');
|
|
300
|
+
const high = list(far.filter(([, m]) => m >= 4.25));
|
|
301
|
+
const low = list(far.filter(([, m]) => m <= 1.75));
|
|
302
|
+
if (high || low)
|
|
303
|
+
lines.push(`Stands out: ${[high && `high ${high}`, low && `low ${low}`].filter(Boolean).join('; ')}.`);
|
|
304
|
+
const means = `Big Five (${NAME[form]}, means on 1 to 5): ${DOMAINS.map((d) => `${DOMAIN[d]} ${fixed(s.domains[d])}`).join(', ')}.`;
|
|
305
|
+
return [lines.length ? `How ${name} thinks and writes:\n${lines.map((l) => `- ${l}`).join('\n')}` : '', means].filter(Boolean).join('\n');
|
|
306
|
+
}
|
|
307
|
+
const sheet = (form, v) => {
|
|
308
|
+
const n = ITEMS[form].length;
|
|
309
|
+
return Array.isArray(v) && v.length === n && v.every((a) => Number.isInteger(a) && a >= 0 && a <= 5) ? v : Array(n).fill(0);
|
|
310
|
+
};
|
|
311
|
+
const KEY = (who) => `hanzo.build.ocean.${who}`;
|
|
312
|
+
/** The answers kept for `who`, or blank sheets. */
|
|
313
|
+
export function kept(who) {
|
|
314
|
+
let v = {};
|
|
315
|
+
try {
|
|
316
|
+
const raw = JSON.parse(window.localStorage.getItem(KEY(who)) ?? 'null');
|
|
317
|
+
if (raw && typeof raw === 'object')
|
|
318
|
+
v = raw;
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
/* blank sheets */
|
|
322
|
+
}
|
|
323
|
+
return { form: v.form === 'long' ? 'long' : 'short', short: sheet('short', v.short), long: sheet('long', v.long) };
|
|
324
|
+
}
|
|
325
|
+
export function keep(who, a) {
|
|
326
|
+
try {
|
|
327
|
+
window.localStorage.setItem(KEY(who), JSON.stringify(a));
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
/* kept only while the dialog is open */
|
|
331
|
+
}
|
|
332
|
+
}
|