nullius-eval 0.1.0__py3-none-any.whl
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.
- _nullius_app/.env.example +55 -0
- _nullius_app/app.py +96 -0
- _nullius_app/requirements.txt +1 -0
- _nullius_app/static/brand/README.md +20 -0
- _nullius_app/static/brand/docker.svg +1 -0
- _nullius_app/static/brand/favicon.svg +1 -0
- _nullius_app/static/brand/huggingface.svg +37 -0
- _nullius_app/static/brand/mark-dark.svg +1 -0
- _nullius_app/static/brand/marks.svg +34 -0
- _nullius_app/static/brand/tokens.json +51 -0
- _nullius_app/static/brand/typesafe.png +0 -0
- _nullius_app/static/brand/wordmark-dark.svg +1 -0
- _nullius_app/static/builder/command-builder-core.js +763 -0
- _nullius_app/static/builder/command-builder.css +248 -0
- _nullius_app/static/builder/command-builder.js +997 -0
- _nullius_app/static/builder/model-picker.js +113 -0
- _nullius_app/static/catalogue/add.js +46 -0
- _nullius_app/static/catalogue/agents/README.md +19 -0
- _nullius_app/static/catalogue/agents/goose.svg +1 -0
- _nullius_app/static/catalogue/agents/jiuwenswarm.svg +33 -0
- _nullius_app/static/catalogue/agents/marks.json +8 -0
- _nullius_app/static/catalogue/agents/mini-swe-agent.svg +7 -0
- _nullius_app/static/catalogue/agents/opencode.svg +7 -0
- _nullius_app/static/catalogue/catalogue.css +436 -0
- _nullius_app/static/catalogue/catalogue.js +87 -0
- _nullius_app/static/catalogue/marks.svg +29 -0
- _nullius_app/static/catalogue/new.js +78 -0
- _nullius_app/static/catalogue/versions.js +27 -0
- _nullius_app/static/compare/comparison.css +117 -0
- _nullius_app/static/controls.js +117 -0
- _nullius_app/static/disclosures.js +70 -0
- _nullius_app/static/fonts/0569c822cab6c510.ttf +0 -0
- _nullius_app/static/fonts/DMSans-Medium.woff2 +0 -0
- _nullius_app/static/fonts/DMSans-Regular.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Medium.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Regular.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Italic.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Regular.woff2 +0 -0
- _nullius_app/static/fonts/README.md +11 -0
- _nullius_app/static/fonts/c1e7453ea26a1d1e.ttf +0 -0
- _nullius_app/static/fonts/dmsans-OFL.txt +93 -0
- _nullius_app/static/fonts/ibmplexmono-OFL.txt +93 -0
- _nullius_app/static/fonts/instrumentserif-OFL.txt +93 -0
- _nullius_app/static/fonts.css +49 -0
- _nullius_app/static/notifications.js +49 -0
- _nullius_app/static/onboarding.css +78 -0
- _nullius_app/static/onboarding.js +158 -0
- _nullius_app/static/runs/board.css +358 -0
- _nullius_app/static/runs/board.js +127 -0
- _nullius_app/static/runs/launches.css +88 -0
- _nullius_app/static/runs/live-board.css +186 -0
- _nullius_app/static/runs/live-board.js +394 -0
- _nullius_app/static/runs/path-suggestions.js +119 -0
- _nullius_app/static/runs/start.css +38 -0
- _nullius_app/static/settings/autosave.js +162 -0
- _nullius_app/static/settings/custom-keys.js +100 -0
- _nullius_app/static/settings/data-providers.js +88 -0
- _nullius_app/static/settings/judges.js +61 -0
- _nullius_app/static/settings/modal.css +32 -0
- _nullius_app/static/settings/modal.js +91 -0
- _nullius_app/static/settings/navigation.js +55 -0
- _nullius_app/static/settings/prices.js +68 -0
- _nullius_app/static/settings/providers.js +134 -0
- _nullius_app/static/settings/sandbox.js +20 -0
- _nullius_app/static/settings/settings.css +288 -0
- _nullius_app/static/style.css +1752 -0
- _nullius_app/static/traces/conversation.css +49 -0
- _nullius_app/static/traces/conversation.js +215 -0
- _nullius_app/templates/agents/entry.html +145 -0
- _nullius_app/templates/agents/kits.html +55 -0
- _nullius_app/templates/agents/standard.html +58 -0
- _nullius_app/templates/base.html +479 -0
- _nullius_app/templates/builder/new_run.html +55 -0
- _nullius_app/templates/catalogue/add_dialog.html +32 -0
- _nullius_app/templates/catalogue/benchmark.html +270 -0
- _nullius_app/templates/catalogue/benchmarks.html +91 -0
- _nullius_app/templates/catalogue/new.html +141 -0
- _nullius_app/templates/catalogue/use_bundle.html +11 -0
- _nullius_app/templates/compare/_detail.html +37 -0
- _nullius_app/templates/compare/compare.html +298 -0
- _nullius_app/templates/compare/compare_picker.html +51 -0
- _nullius_app/templates/compare/compare_task.html +329 -0
- _nullius_app/templates/runs/_execution.html +131 -0
- _nullius_app/templates/runs/_runtime.html +5 -0
- _nullius_app/templates/runs/ascii-mark.html +485 -0
- _nullius_app/templates/runs/feasibility.html +127 -0
- _nullius_app/templates/runs/index.html +609 -0
- _nullius_app/templates/runs/job.html +460 -0
- _nullius_app/templates/runs/preparing.html +14 -0
- _nullius_app/templates/runs/reconcile.html +124 -0
- _nullius_app/templates/runs/setup.html +272 -0
- _nullius_app/templates/runs/start.html +51 -0
- _nullius_app/templates/settings/custom_keys.html +82 -0
- _nullius_app/templates/settings/data_providers.html +27 -0
- _nullius_app/templates/settings/settings.html +564 -0
- _nullius_app/templates/traces/_charts.html +165 -0
- _nullius_app/templates/traces/_conversation.html +37 -0
- _nullius_app/templates/traces/_judgement.html +72 -0
- _nullius_app/templates/traces/artifact.html +15 -0
- _nullius_app/templates/traces/trial.html +838 -0
- _nullius_app/templates/workspaces/workspaces.html +54 -0
- _nullius_app/web/__init__.py +1 -0
- _nullius_app/web/agents.py +230 -0
- _nullius_app/web/builder.py +406 -0
- _nullius_app/web/catalogue.py +370 -0
- _nullius_app/web/compare.py +489 -0
- _nullius_app/web/core.py +17 -0
- _nullius_app/web/execute.py +223 -0
- _nullius_app/web/feasibility.py +60 -0
- _nullius_app/web/filters.py +231 -0
- _nullius_app/web/judge.py +623 -0
- _nullius_app/web/judge_tasks.py +33 -0
- _nullius_app/web/onboarding.py +20 -0
- _nullius_app/web/reconcile.py +47 -0
- _nullius_app/web/runs.py +464 -0
- _nullius_app/web/settings.py +324 -0
- _nullius_app/web/shared.py +507 -0
- _nullius_app/web/traces.py +306 -0
- _nullius_app/web/workspaces.py +84 -0
- nullius/__init__.py +32 -0
- nullius/__main__.py +5 -0
- nullius/catalogue/__init__.py +0 -0
- nullius/catalogue/agents/codex/agent.json +222 -0
- nullius/catalogue/agents/codex/config.toml +25 -0
- nullius/catalogue/agents/goose/agent.json +131 -0
- nullius/catalogue/agents/goose/config.yaml +20 -0
- nullius/catalogue/agents/jiuwenswarm/agent.json +197 -0
- nullius/catalogue/agents/jiuwenswarm/agent.py +355 -0
- nullius/catalogue/agents/mini-swe-agent/agent.json +68 -0
- nullius/catalogue/agents/mini-swe-agent/run.py +37 -0
- nullius/catalogue/agents/opencode/agent.json +135 -0
- nullius/catalogue/agents/opencode/opencode.json +32 -0
- nullius/catalogue/agents/reference/agent.json +89 -0
- nullius/catalogue/agents/reference/agent.py +209 -0
- nullius/catalogue/agents/terminus-2/agent.json +64 -0
- nullius/catalogue/agents/terminus-2/run.py +139 -0
- nullius/catalogue/benchmarks/gaia/benchmark.json +72 -0
- nullius/catalogue/benchmarks/gaia/data-source.json +29 -0
- nullius/catalogue/benchmarks/gaia/driver.py +188 -0
- nullius/catalogue/benchmarks/gaia/env/data.Dockerfile +1 -0
- nullius/catalogue/benchmarks/gaia/standard.json +278 -0
- nullius/catalogue/benchmarks/gaia/upstream-settings.json +275 -0
- nullius/catalogue/benchmarks/gsm8k/benchmark.json +34 -0
- nullius/catalogue/benchmarks/gsm8k/driver.py +101 -0
- nullius/catalogue/benchmarks/gsm8k/standard.json +124 -0
- nullius/catalogue/benchmarks/gsm8k/upstream-settings.json +86 -0
- nullius/catalogue/benchmarks/humaneval/benchmark.json +36 -0
- nullius/catalogue/benchmarks/humaneval/driver.py +243 -0
- nullius/catalogue/benchmarks/humaneval/standard.json +115 -0
- nullius/catalogue/benchmarks/humaneval/upstream-settings.json +72 -0
- nullius/catalogue/benchmarks/locomo/benchmark.json +43 -0
- nullius/catalogue/benchmarks/locomo/driver.py +270 -0
- nullius/catalogue/benchmarks/locomo/standard.json +265 -0
- nullius/catalogue/benchmarks/locomo/upstream-settings.json +112 -0
- nullius/catalogue/benchmarks/longmemeval/benchmark.json +65 -0
- nullius/catalogue/benchmarks/longmemeval/driver.py +379 -0
- nullius/catalogue/benchmarks/longmemeval/standard.json +733 -0
- nullius/catalogue/benchmarks/longmemeval/upstream-settings.json +76 -0
- nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +87 -0
- nullius/catalogue/benchmarks/swe-bench-verified/driver.py +116 -0
- nullius/catalogue/benchmarks/swe-bench-verified/images.json +502 -0
- nullius/catalogue/benchmarks/swe-bench-verified/standard.json +108 -0
- nullius/catalogue/benchmarks/swe-bench-verified/upstream-settings.json +32 -0
- nullius/catalogue/benchmarks/tau3-bench/benchmark.json +49 -0
- nullius/catalogue/benchmarks/tau3-bench/driver.py +608 -0
- nullius/catalogue/benchmarks/tau3-bench/mcp_server.py +114 -0
- nullius/catalogue/benchmarks/tau3-bench/search_relay.py +19 -0
- nullius/catalogue/benchmarks/tau3-bench/standard.json +547 -0
- nullius/catalogue/benchmarks/tau3-bench/upstream-settings.json +639 -0
- nullius/catalogue/benchmarks/terminal-bench/benchmark.json +69 -0
- nullius/catalogue/benchmarks/terminal-bench/driver.py +267 -0
- nullius/catalogue/benchmarks/terminal-bench/standard.json +166 -0
- nullius/catalogue/benchmarks/terminal-bench/upstream-settings.json +36 -0
- nullius/catalogue/capabilities/keyword-memory/capability.json +33 -0
- nullius/catalogue/capabilities/keyword-memory/capability.py +55 -0
- nullius/catalogue/capabilities/mem0/capability.json +135 -0
- nullius/catalogue/capabilities/mem0/capability.py +173 -0
- nullius/catalogue/catalog.py +426 -0
- nullius/catalogue/citation.py +116 -0
- nullius/catalogue/harbor_entry.py +367 -0
- nullius/catalogue/sources.py +107 -0
- nullius/catalogue/storage.py +125 -0
- nullius/cli.py +85 -0
- nullius/compare/__init__.py +0 -0
- nullius/compare/cli.py +265 -0
- nullius/compare/comparison.py +184 -0
- nullius/execution.py +1653 -0
- nullius/gitrefs.py +128 -0
- nullius/harbor/__init__.py +0 -0
- nullius/harbor/feed.py +228 -0
- nullius/harbor/source.py +582 -0
- nullius/hosts.py +368 -0
- nullius/importers/__init__.py +140 -0
- nullius/importers/atif.py +387 -0
- nullius/importers/cli.py +135 -0
- nullius/importers/otel.py +274 -0
- nullius/judge/__init__.py +14 -0
- nullius/judge/batch.py +122 -0
- nullius/judge/client.py +433 -0
- nullius/judge/floors.json +86 -0
- nullius/judge/lanes.py +89 -0
- nullius/judge/questions.py +309 -0
- nullius/judge/reconcile.py +176 -0
- nullius/judge/state.py +224 -0
- nullius/judge/store.py +167 -0
- nullius/migrate.py +268 -0
- nullius/onboarding.py +116 -0
- nullius/paths.py +89 -0
- nullius/prerequisites.py +129 -0
- nullius/prices.py +283 -0
- nullius/progress.py +294 -0
- nullius/providers.py +335 -0
- nullius/recipes/__init__.py +0 -0
- nullius/recipes/launch.py +78 -0
- nullius/redact.py +72 -0
- nullius/runs/__init__.py +0 -0
- nullius/runs/artifacts.py +67 -0
- nullius/runs/classify.py +216 -0
- nullius/runs/cli.py +316 -0
- nullius/runs/feasibility.py +442 -0
- nullius/runs/launches.py +149 -0
- nullius/runs/live.py +715 -0
- nullius/runs/parse.py +1016 -0
- nullius/runs/verifier.py +241 -0
- nullius/sandbox.py +109 -0
- nullius/secrets.py +218 -0
- nullius/settings.py +544 -0
- nullius/standard/__init__.py +15 -0
- nullius/standard/acp.py +305 -0
- nullius/standard/cancellation.py +19 -0
- nullius/standard/cli.py +703 -0
- nullius/standard/conform.py +149 -0
- nullius/standard/container.py +1870 -0
- nullius/standard/definitions.py +1651 -0
- nullius/standard/egress.py +192 -0
- nullius/standard/fidelity.py +256 -0
- nullius/standard/forward.py +139 -0
- nullius/standard/hostreq.py +105 -0
- nullius/standard/howto.py +220 -0
- nullius/standard/install.py +428 -0
- nullius/standard/job.py +551 -0
- nullius/standard/jsonl.py +129 -0
- nullius/standard/kits/agent-conversation-v1/driver.py +27 -0
- nullius/standard/kits/agent-conversation-v1/standard.json +26 -0
- nullius/standard/kits/agent-search-v1/driver.py +171 -0
- nullius/standard/kits/agent-search-v1/standard.json +99 -0
- nullius/standard/kits/agent-task-v1/driver.py +25 -0
- nullius/standard/kits/agent-task-v1/standard.json +100 -0
- nullius/standard/kits/agent-tools-v1/driver.py +206 -0
- nullius/standard/kits/agent-tools-v1/mcp_kit.py +209 -0
- nullius/standard/kits/agent-tools-v1/standard.json +119 -0
- nullius/standard/kits/agent-workspace-v1/driver.py +65 -0
- nullius/standard/kits/agent-workspace-v1/standard.json +95 -0
- nullius/standard/kits/cap-memory-v1/driver.py +39 -0
- nullius/standard/kits/cap-memory-v1/standard.json +91 -0
- nullius/standard/ledger.py +326 -0
- nullius/standard/match.py +66 -0
- nullius/standard/mcp_bridge.py +62 -0
- nullius/standard/mcp_machine.py +193 -0
- nullius/standard/merge.py +239 -0
- nullius/standard/names.py +37 -0
- nullius/standard/network_requirements.py +44 -0
- nullius/standard/pace.py +53 -0
- nullius/standard/payload.py +278 -0
- nullius/standard/pins.py +130 -0
- nullius/standard/ports.py +70 -0
- nullius/standard/prove.py +373 -0
- nullius/standard/recipe.py +746 -0
- nullius/standard/relay.py +785 -0
- nullius/standard/run.py +1781 -0
- nullius/standard/setup_container.py +208 -0
- nullius/standard/shard.py +71 -0
- nullius/standard/web_services.py +30 -0
- nullius/traces/__init__.py +0 -0
- nullius/traces/behavior.py +131 -0
- nullius/traces/charts.py +898 -0
- nullius/traces/conversation.py +159 -0
- nullius/traces/otel.py +608 -0
- nullius/traces/trace.py +1477 -0
- nullius/traces/trajectory.py +586 -0
- nullius/workspace.py +417 -0
- nullius/workspace_cli.py +119 -0
- nullius_eval-0.1.0.dist-info/METADATA +93 -0
- nullius_eval-0.1.0.dist-info/RECORD +291 -0
- nullius_eval-0.1.0.dist-info/WHEEL +5 -0
- nullius_eval-0.1.0.dist-info/entry_points.txt +2 -0
- nullius_eval-0.1.0.dist-info/licenses/LICENSE +202 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/dmsans-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/ibmplexmono-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/instrumentserif-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2022 The Instrument Serif Project Authors (https://github.com/Instrument/instrument-serif)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* Locally bundled fonts; licenses and provenance in fonts/README.md. */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'DM Sans';
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
font-display: swap;
|
|
7
|
+
src: url(fonts/DMSans-Regular.woff2) format('woff2');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@font-face {
|
|
11
|
+
font-family: 'DM Sans';
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
font-display: swap;
|
|
15
|
+
src: url(fonts/DMSans-Medium.woff2) format('woff2');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@font-face {
|
|
19
|
+
font-family: 'IBM Plex Mono';
|
|
20
|
+
font-style: normal;
|
|
21
|
+
font-weight: 400;
|
|
22
|
+
font-display: swap;
|
|
23
|
+
src: url(fonts/IBMPlexMono-Regular.woff2) format('woff2');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: 'IBM Plex Mono';
|
|
28
|
+
font-style: normal;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
font-display: swap;
|
|
31
|
+
src: url(fonts/IBMPlexMono-Medium.woff2) format('woff2');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: 'Instrument Serif';
|
|
36
|
+
font-style: italic;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
font-display: swap;
|
|
39
|
+
src: url(fonts/InstrumentSerif-Italic.woff2) format('woff2');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@font-face {
|
|
43
|
+
font-family: 'Instrument Serif';
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
font-display: swap;
|
|
47
|
+
src: url(fonts/InstrumentSerif-Regular.woff2) format('woff2');
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Notifications belong to the main viewport, including saves made in Settings.
|
|
2
|
+
(() => {
|
|
3
|
+
function host() {
|
|
4
|
+
return [...document.querySelectorAll('dialog[open]')].at(-1) || document.body;
|
|
5
|
+
}
|
|
6
|
+
window.nulliusNotify = (message, {error = false, key = ''} = {}) => {
|
|
7
|
+
if (window.parent !== window) {
|
|
8
|
+
try { if (window.parent.nulliusNotify) return window.parent.nulliusNotify(message, {error, key}); } catch (_) {}
|
|
9
|
+
}
|
|
10
|
+
let tray = document.querySelector('.toasts');
|
|
11
|
+
if (!tray) {
|
|
12
|
+
tray = document.createElement('div'); tray.className = 'toasts';
|
|
13
|
+
tray.setAttribute('role', 'status'); tray.setAttribute('aria-live', 'polite');
|
|
14
|
+
}
|
|
15
|
+
tray.setAttribute('popover', 'manual');
|
|
16
|
+
if (tray.parentElement !== host()) host().append(tray);
|
|
17
|
+
if (key) [...tray.children].filter(t => t.dataset.noticeKey === key).forEach(t => t.remove());
|
|
18
|
+
const toast = document.createElement('div'); toast.className = 'toast ' + (error ? 'bad' : 'ok'); toast.dataset.noticeKey = key;
|
|
19
|
+
const text = document.createElement('span'); text.className = 'toast-text'; text.textContent = message;
|
|
20
|
+
const close = document.createElement('button'); close.type = 'button'; close.className = 'toast-close'; close.setAttribute('aria-label', 'Dismiss'); close.textContent = '×';
|
|
21
|
+
const bar = document.createElement('span'); bar.className = 'toast-bar'; bar.setAttribute('aria-hidden', 'true');
|
|
22
|
+
const dismiss = () => { toast.remove(); if (!tray.children.length) tray.remove(); };
|
|
23
|
+
close.addEventListener('click', dismiss); bar.addEventListener('animationend', dismiss);
|
|
24
|
+
toast.append(text, close, bar); tray.append(toast);
|
|
25
|
+
if (tray.showPopover) { if (tray.matches(':popover-open')) tray.hidePopover(); tray.showPopover(); }
|
|
26
|
+
};
|
|
27
|
+
// Every request of a page goes through here. A server that serves other code than the page was
|
|
28
|
+
// rendered with, or no longer holds its form token (a restart), gets one notice: the page is out of date.
|
|
29
|
+
const rendered = document.querySelector('meta[name=nullius-interface]')?.content;
|
|
30
|
+
let told = false;
|
|
31
|
+
const outOfDate = () => window.nulliusNotify('This page is out of date. Reload it.', {error: true, key: 'out-of-date'});
|
|
32
|
+
window.nulliusFetch = async (url, options) => {
|
|
33
|
+
const response = await fetch(url, options);
|
|
34
|
+
const served = response.headers.get('X-Nullius-Interface');
|
|
35
|
+
if (rendered && served && served !== rendered && !told) { told = true; outOfDate(); }
|
|
36
|
+
if (response.status === 403 && response.headers.get('X-Nullius-Reason') === 'stale-form-token') {
|
|
37
|
+
outOfDate();
|
|
38
|
+
return new Promise(() => {}); // never settles: the caller's own error would only repeat the notice
|
|
39
|
+
}
|
|
40
|
+
return response;
|
|
41
|
+
};
|
|
42
|
+
// Keep a notification visible and operable when a dialog closes beneath it.
|
|
43
|
+
new MutationObserver(() => {
|
|
44
|
+
const tray = document.querySelector('.toasts');
|
|
45
|
+
if (tray && tray.parentElement !== host()) {
|
|
46
|
+
host().append(tray); if (tray.showPopover && !tray.matches(':popover-open')) tray.showPopover();
|
|
47
|
+
}
|
|
48
|
+
}).observe(document.body, {subtree: true, attributes: true, attributeFilter: ['open']});
|
|
49
|
+
})();
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* First steps: the first-open question, the tour's spotlight, the checklist panel docked on the right,
|
|
2
|
+
and the pointer at what to do. Colours from the page's own tokens, so both themes follow. */
|
|
3
|
+
.onb-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; }
|
|
4
|
+
.onb-dialog { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; padding: 1.6rem; max-width: 440px; width: 100%;
|
|
5
|
+
display: grid; gap: .9rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
|
|
6
|
+
.onb-dialog .onb-mark { font-size: 1.9rem; line-height: 1; }
|
|
7
|
+
.onb-dialog h2 { margin: 0; font-size: 1.35rem; text-wrap: balance; }
|
|
8
|
+
.onb-dialog p { margin: 0; color: var(--text-dim); }
|
|
9
|
+
.onb-dialog ul { margin: 0; padding-left: 1.1rem; color: var(--text-dim); font-size: .88rem; display: grid; gap: .2rem; }
|
|
10
|
+
.onb-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
|
|
11
|
+
|
|
12
|
+
.onb-spot { position: fixed; z-index: 91; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; transition: all .3s ease; }
|
|
13
|
+
.onb-pop { position: fixed; z-index: 92; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
|
|
14
|
+
padding: 1rem; display: grid; gap: .5rem; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); }
|
|
15
|
+
.onb-pop .onb-k { font-size: .7rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
|
|
16
|
+
.onb-pop h3 { margin: 0; font-size: 1rem; text-transform: none; letter-spacing: 0; }
|
|
17
|
+
.onb-pop p { margin: 0; color: var(--text-dim); font-size: .86rem; }
|
|
18
|
+
.onb-pop .onb-actions { justify-content: space-between; }
|
|
19
|
+
.onb-dots { display: flex; gap: 4px; }
|
|
20
|
+
.onb-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
|
|
21
|
+
.onb-dots i.on { background: var(--accent); }
|
|
22
|
+
|
|
23
|
+
.onb-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: 310px; max-width: 100vw; overflow-y: auto;
|
|
24
|
+
background: var(--surface); border-left: 1px solid var(--border-soft); padding: 1.1rem 1rem 1.4rem; display: flex; flex-direction: column; gap: .75rem; }
|
|
25
|
+
body.onb-open .shell { margin-right: 310px; }
|
|
26
|
+
@media (max-width: 1100px) { body.onb-open .shell { margin-right: 0; } .onb-panel { box-shadow: -10px 0 40px rgba(0, 0, 0, .3); } }
|
|
27
|
+
.onb-panel header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
|
|
28
|
+
.onb-panel h2 { margin: 0; font-size: 1rem; }
|
|
29
|
+
.onb-hide { border: 0; background: none; color: var(--text-faint); font-size: .8rem; cursor: pointer; }
|
|
30
|
+
.onb-prog { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
|
|
31
|
+
.onb-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
|
|
32
|
+
.onb-bar i { display: block; height: 100%; background: var(--ok); }
|
|
33
|
+
.onb-done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-radius: 8px; padding: .6rem .75rem; font-size: .84rem; font-weight: 500; }
|
|
34
|
+
.onb-cat { border: 1px solid var(--border-soft); border-radius: 9px; }
|
|
35
|
+
.onb-cat.now { border-color: var(--accent); }
|
|
36
|
+
.onb-cat > button { width: 100%; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; padding: .65rem .75rem;
|
|
37
|
+
display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: .6rem; align-items: center; border-radius: 9px; font: inherit; }
|
|
38
|
+
.onb-cat > button:hover { background: var(--surface-2); }
|
|
39
|
+
.onb-ring { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--text-faint); display: grid; place-items: center; font-size: .7rem; font-weight: 500; }
|
|
40
|
+
.onb-cat.done .onb-ring { background: var(--ok); border-color: var(--ok); color: var(--surface); }
|
|
41
|
+
.onb-cat.now .onb-ring { border-color: var(--accent); color: var(--accent); }
|
|
42
|
+
.onb-name { font-weight: 500; font-size: .86rem; display: block; }
|
|
43
|
+
.onb-where { font-size: .73rem; color: var(--text-faint); }
|
|
44
|
+
.onb-cnt { font-family: var(--mono, ui-monospace, monospace); font-size: .75rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
|
|
45
|
+
.onb-subs { list-style: none; margin: 0; padding: 0 .75rem .6rem 2.75rem; display: grid; gap: 1px; }
|
|
46
|
+
.onb-subs button { border: 0; background: none; color: inherit; cursor: pointer; padding: .2rem 0; text-align: left; font: inherit; font-size: .82rem;
|
|
47
|
+
display: flex; gap: .5rem; align-items: baseline; width: 100%; }
|
|
48
|
+
.onb-tick { width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid var(--text-faint); flex: none; transform: translateY(2px); display: grid; place-items: center; font-size: .55rem; }
|
|
49
|
+
.onb-subs li.done button { color: var(--text-faint); }
|
|
50
|
+
.onb-subs li.done .onb-tick { background: var(--ok); border-color: var(--ok); color: var(--surface); }
|
|
51
|
+
.onb-subs li.next button { font-weight: 500; }
|
|
52
|
+
.onb-opt { font-size: .7rem; color: var(--text-faint); font-weight: 400; }
|
|
53
|
+
.onb-hint { font-size: .76rem; color: var(--text-faint); border-top: 1px solid var(--border-soft); padding-top: .6rem; }
|
|
54
|
+
.onb-restart { border: 0; background: none; color: var(--text-faint); font-size: .76rem; cursor: pointer; text-decoration: underline; padding: 0; align-self: flex-start; }
|
|
55
|
+
|
|
56
|
+
.onb-todo { outline: 2px solid var(--accent) !important; outline-offset: 3px; border-radius: 6px; animation: onb-pulse 1.6s ease-in-out infinite; }
|
|
57
|
+
@keyframes onb-pulse { 50% { outline-color: color-mix(in srgb, var(--accent) 35%, transparent); } }
|
|
58
|
+
.onb-label { position: absolute; z-index: 25; background: var(--accent); color: var(--btn-fg); font-size: .76rem; font-weight: 500; padding: .25rem .6rem;
|
|
59
|
+
border-radius: 6px; pointer-events: none; max-width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
|
|
60
|
+
.onb-rail { position: relative; }
|
|
61
|
+
.onb-rail .onb-x { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center;
|
|
62
|
+
border: 0; border-radius: 5px; background: none; color: var(--text-faint); cursor: pointer; padding: 0; }
|
|
63
|
+
.onb-rail .onb-x .ic { width: 13px; height: 13px; }
|
|
64
|
+
.onb-rail .onb-count { margin-right: 22px; }
|
|
65
|
+
.onb-rail .onb-x:hover { background: var(--surface-2); color: var(--text); }
|
|
66
|
+
:root[data-rail="collapsed"] .onb-rail .onb-x { display: none; }
|
|
67
|
+
.onb-state { color: var(--text-dim); margin-right: .6rem; }
|
|
68
|
+
button.nav-item#onb-open { border: 0; background: none; width: 100%; font: inherit; color: inherit; cursor: pointer; text-align: left; }
|
|
69
|
+
button.nav-item#onb-open[aria-expanded="true"] { background: var(--accent-soft); }
|
|
70
|
+
.nav-item .onb-count { margin-left: auto; font-size: .72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
|
|
71
|
+
@media (prefers-reduced-motion: reduce) { .onb-todo { animation: none; } .onb-spot { transition: none; } }
|
|
72
|
+
:root[data-rail="collapsed"] .nav-item .onb-count { display: none; }
|
|
73
|
+
#other .st-row-value { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: .6rem; flex-wrap: wrap; text-align: left; }
|
|
74
|
+
#other .st-row-value .btn { width: auto; flex: none; }
|
|
75
|
+
|
|
76
|
+
.onb-mark { font-size: 0; width: 32px; height: 32px; background: currentColor; mask: url(brand/mark-dark.svg) center / contain no-repeat; }
|
|
77
|
+
|
|
78
|
+
#onb-open .lbl { white-space: nowrap; }
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// First steps. On a first open the page asks whether to be guided; yes runs a short tour that moves
|
|
2
|
+
// from page to page, then opens the checklist docked on the right. A section or a sub-task opens the page
|
|
3
|
+
// that does it and points at the thing to do there. What is done comes from /onboarding (facts this
|
|
4
|
+
// machine can check) and from the pages this browser has been on (visits, kept here, nowhere else).
|
|
5
|
+
(() => {
|
|
6
|
+
const me = document.currentScript, STATE_URL = me.dataset.state, TOUR = JSON.parse(me.dataset.tour || '[]');
|
|
7
|
+
const KEY = 'nullius-onboarding';
|
|
8
|
+
const read = (store, k, fallback) => { try { return JSON.parse(store.getItem(k)) ?? fallback; } catch { return fallback; } };
|
|
9
|
+
const write = (store, k, v) => { try { v == null ? store.removeItem(k) : store.setItem(k, JSON.stringify(v)); } catch {} };
|
|
10
|
+
const S = Object.assign({asked: false, open: false, dismissed: false, visits: {}}, read(localStorage, KEY, {}));
|
|
11
|
+
const save = () => write(localStorage, KEY, S);
|
|
12
|
+
const esc = s => String(s).replace(/[&<>"']/g, c => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''}[c]));
|
|
13
|
+
let sections = [];
|
|
14
|
+
|
|
15
|
+
const isDone = x => x.done === true || (x.done === null && !!S.visits[x.id]);
|
|
16
|
+
const required = s => s.subs.filter(x => !x.optional);
|
|
17
|
+
const sectionDone = s => required(s).every(isDone);
|
|
18
|
+
const current = () => sections.find(s => !sectionDone(s));
|
|
19
|
+
|
|
20
|
+
const railItem = document.getElementById('onb-open'), rail = document.getElementById('onb-rail'), restore = document.getElementById('onb-restore');
|
|
21
|
+
let panel = null;
|
|
22
|
+
function renderPanel() {
|
|
23
|
+
const all = sections.flatMap(s => s.subs), n = all.filter(isDone).length;
|
|
24
|
+
if (restore) restore.hidden = !S.dismissed;
|
|
25
|
+
const said = document.getElementById('onb-state');
|
|
26
|
+
if (said) said.textContent = S.dismissed ? 'Removed from the rail.' : !S.asked ? 'Not started yet.' : S.open ? 'Open on the right.' : 'In the rail.';
|
|
27
|
+
if (rail) rail.hidden = S.dismissed;
|
|
28
|
+
if (S.dismissed) { S.open = false; unpoint(); }
|
|
29
|
+
if (railItem) {
|
|
30
|
+
railItem.querySelector('.onb-count').textContent = sections.length ? `${n}/${all.length}` : '';
|
|
31
|
+
railItem.setAttribute('aria-expanded', String(S.open));
|
|
32
|
+
}
|
|
33
|
+
document.body.classList.toggle('onb-open', S.open);
|
|
34
|
+
if (!S.open) { panel?.remove(); panel = null; return; }
|
|
35
|
+
if (!panel) { panel = document.createElement('aside'); panel.className = 'onb-panel'; panel.id = 'onb-panel'; panel.setAttribute('aria-label', 'First steps'); document.body.append(panel); }
|
|
36
|
+
const cur = current();
|
|
37
|
+
panel.innerHTML = `<header><h2>First steps</h2><button class="onb-hide" type="button" data-onb="hide">Hide</button></header>
|
|
38
|
+
<div class="onb-prog"><span class="onb-bar"><i style="width:${all.length ? 100 * n / all.length : 0}%"></i></span>${n}/${all.length}</div>
|
|
39
|
+
${cur || !sections.length ? '' : '<div class="onb-done">All done: Nullius is set up and you have read and compared runs.</div>'}
|
|
40
|
+
${sections.map((s, i) => {
|
|
41
|
+
const subs = s.subs, done = sectionDone(s), next = subs.find(x => !isDone(x)), open = s === cur || location.pathname === new URL(s.url, location).pathname;
|
|
42
|
+
return `<div class="onb-cat${done ? ' done' : ''}${s === cur ? ' now' : ''}">
|
|
43
|
+
<button type="button" data-onb-cat="${s.id}"><span class="onb-ring">${done ? '✓' : i + 1}</span><span><span class="onb-name">${esc(s.name)}</span><span class="onb-where">${esc(s.where)} →</span></span><span class="onb-cnt">${subs.filter(isDone).length}/${subs.length}</span></button>
|
|
44
|
+
${open ? `<ul class="onb-subs">${subs.map(x => `<li class="${isDone(x) ? 'done' : ''}${x === next ? ' next' : ''}"><button type="button" data-onb-sub="${s.id}:${x.id}"><span class="onb-tick" aria-hidden="true">${isDone(x) ? '✓' : ''}</span><span>${esc(x.text)}${x.optional ? ' <span class="onb-opt">optional</span>' : ''}</span></button></li>`).join('')}</ul>` : ''}
|
|
45
|
+
</div>`;
|
|
46
|
+
}).join('')}
|
|
47
|
+
<div class="onb-hint">Click a step: Nullius opens its page and points at what to do.</div>
|
|
48
|
+
<button class="onb-restart" type="button" data-onb="tour">Replay the tour</button>`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---- pointing at what to do: the first target on this page, else its page opened and pointed at there
|
|
52
|
+
let pointed = null, label = null;
|
|
53
|
+
// The label sits on the element's top edge, so a tall element (a whole form) keeps it in view, and it
|
|
54
|
+
// follows the element as the page around it grows or shrinks (a builder step changing, say).
|
|
55
|
+
const watch = new ResizeObserver(() => place());
|
|
56
|
+
function unpoint() { pointed?.classList.remove('onb-todo'); label?.remove(); watch.disconnect(); pointed = label = null; }
|
|
57
|
+
function place() {
|
|
58
|
+
if (!pointed || !label) return;
|
|
59
|
+
if (!pointed.isConnected) return unpoint();
|
|
60
|
+
const r = pointed.getBoundingClientRect(), h = label.offsetHeight;
|
|
61
|
+
label.style.left = Math.max(8, Math.min(r.left + scrollX, scrollX + innerWidth - label.offsetWidth - 16)) + 'px';
|
|
62
|
+
label.style.top = (r.top + scrollY - h - 8 >= 8 ? r.top + scrollY - h - 8 : r.bottom + scrollY + 8) + 'px';
|
|
63
|
+
}
|
|
64
|
+
function point(sub, navigate = true) {
|
|
65
|
+
unpoint();
|
|
66
|
+
if (!sub) return;
|
|
67
|
+
for (const [sel, text] of sub.target) {
|
|
68
|
+
const el = [...document.querySelectorAll(sel)].find(e => e.getClientRects().length);
|
|
69
|
+
if (!el) continue;
|
|
70
|
+
// where the panel covers the page, it steps aside for what it points at
|
|
71
|
+
if (S.open && matchMedia('(max-width: 1100px)').matches) { S.open = false; save(); renderPanel(); }
|
|
72
|
+
pointed = el; el.classList.add('onb-todo');
|
|
73
|
+
label = document.createElement('div'); label.className = 'onb-label'; label.textContent = text; document.body.append(label);
|
|
74
|
+
place(); watch.observe(el); watch.observe(document.body); el.scrollIntoView({block: 'center', behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth'});
|
|
75
|
+
write(sessionStorage, 'onb-point', null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (navigate && new URL(sub.url, location).pathname !== location.pathname) { write(sessionStorage, 'onb-point', sub.id); location.href = sub.url; }
|
|
79
|
+
}
|
|
80
|
+
addEventListener('resize', place);
|
|
81
|
+
const firstToDo = s => required(s).find(x => !isDone(x)) || s.subs.find(x => !isDone(x)) || s.subs[0];
|
|
82
|
+
|
|
83
|
+
// ---- the first-open question
|
|
84
|
+
function welcome() {
|
|
85
|
+
const layer = document.createElement('div');
|
|
86
|
+
layer.className = 'onb-scrim';
|
|
87
|
+
layer.innerHTML = `<div class="onb-dialog" role="dialog" aria-modal="true" aria-labelledby="onb-w-h"><div class="onb-mark" aria-hidden="true">∅</div>
|
|
88
|
+
<h2 id="onb-w-h">Welcome to Nullius. Want a guided start?</h2>
|
|
89
|
+
<p>A one-minute look at the main pages, then a checklist that takes you to a first result:</p>
|
|
90
|
+
<ul><li>Set up a key and where runs happen</li><li>A free check run: oracle and nop call no model</li><li>Read the result, then compare an agent's run</li></ul>
|
|
91
|
+
<div class="onb-actions"><button class="btn ghost" type="button" data-a="no">No, I'll explore</button><button class="btn" type="button" data-a="yes">Yes, guide me</button></div></div>`;
|
|
92
|
+
document.body.append(layer);
|
|
93
|
+
layer.querySelector('[data-a=yes]').focus();
|
|
94
|
+
layer.addEventListener('click', e => {
|
|
95
|
+
const a = e.target.closest('[data-a]')?.dataset.a;
|
|
96
|
+
if (!a) return;
|
|
97
|
+
S.asked = true; S.open = a === 'yes'; save(); layer.remove();
|
|
98
|
+
if (a === 'yes') startTour(); else renderPanel();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ---- the tour: one stop per page, the page opened by the tour itself
|
|
103
|
+
function startTour() { write(sessionStorage, 'onb-tour', 0); stop(0); }
|
|
104
|
+
function stop(i) {
|
|
105
|
+
const s = TOUR[i];
|
|
106
|
+
document.querySelectorAll('.onb-spot, .onb-pop').forEach(e => e.remove());
|
|
107
|
+
if (!s) { write(sessionStorage, 'onb-tour', null); S.open = true; save(); renderPanel(); const c = current(); if (c) point(firstToDo(c)); return; }
|
|
108
|
+
write(sessionStorage, 'onb-tour', i);
|
|
109
|
+
if (s.url && new URL(s.url, location).pathname !== location.pathname) { location.href = s.url; return; }
|
|
110
|
+
if (s.sel === '#onb-panel') { S.open = true; save(); renderPanel(); }
|
|
111
|
+
let el = document.querySelector(s.sel);
|
|
112
|
+
if (!el || !el.getClientRects().length) el = document.getElementById('main-content') || document.body;
|
|
113
|
+
const r = el.getBoundingClientRect(), pad = 6;
|
|
114
|
+
const spot = document.createElement('div'); spot.className = 'onb-spot';
|
|
115
|
+
Object.assign(spot.style, {top: r.top - pad + 'px', left: r.left - pad + 'px', width: r.width + 2 * pad + 'px', height: Math.min(r.height, innerHeight - r.top - 16) + 2 * pad + 'px'});
|
|
116
|
+
const pop = document.createElement('div'); pop.className = 'onb-pop'; pop.setAttribute('role', 'dialog'); pop.setAttribute('aria-label', s.k);
|
|
117
|
+
pop.innerHTML = `<span class="onb-k">${i + 1} of ${TOUR.length} · ${esc(s.k)}</span><h3>${esc(s.h)}</h3><p>${esc(s.p)}</p>
|
|
118
|
+
<div class="onb-actions"><span class="onb-dots">${TOUR.map((_, j) => `<i class="${j === i ? 'on' : ''}"></i>`).join('')}</span>
|
|
119
|
+
<span class="onb-actions"><button class="btn ghost sm" type="button" data-t="skip">Skip tour</button><button class="btn sm" type="button" data-t="next">${i === TOUR.length - 1 ? 'Start the checklist' : 'Next'}</button></span></div>`;
|
|
120
|
+
document.body.append(spot, pop);
|
|
121
|
+
const pw = pop.offsetWidth, ph = pop.offsetHeight;
|
|
122
|
+
let left = s.sel === '#onb-panel' ? r.left - pw - 16 : r.right + 16, top = Math.max(16, Math.min(r.top, innerHeight - ph - 16));
|
|
123
|
+
if (left + pw > innerWidth - 16 || left < 16) { left = Math.max(16, Math.min(r.left, innerWidth - pw - 16)); top = Math.max(16, Math.min(r.bottom + 16, innerHeight - ph - 16)); }
|
|
124
|
+
pop.style.left = left + 'px'; pop.style.top = top + 'px';
|
|
125
|
+
pop.querySelector('[data-t=next]').focus();
|
|
126
|
+
pop.addEventListener('click', e => {
|
|
127
|
+
const t = e.target.closest('[data-t]')?.dataset.t;
|
|
128
|
+
if (t === 'next') stop(i + 1); else if (t === 'skip') stop(TOUR.length);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
document.addEventListener('click', e => {
|
|
133
|
+
const cat = e.target.closest('[data-onb-cat]'), sub = e.target.closest('[data-onb-sub]'), act = e.target.closest('[data-onb]')?.dataset.onb;
|
|
134
|
+
if (cat) { const s = sections.find(x => x.id === cat.dataset.onbCat); return point(firstToDo(s)); }
|
|
135
|
+
if (sub) { const [c, id] = sub.dataset.onbSub.split(':'); return point(sections.find(x => x.id === c).subs.find(x => x.id === id)); }
|
|
136
|
+
if (act === 'dismiss') { S.dismissed = true; save(); return renderPanel(); }
|
|
137
|
+
if (act === 'restore') { S.dismissed = false; S.open = true; save(); return renderPanel(); }
|
|
138
|
+
if (act === 'hide') { S.open = false; save(); unpoint(); return renderPanel(); }
|
|
139
|
+
if (act === 'replay') { S.asked = false; S.dismissed = false; save(); renderPanel(); return welcome(); }
|
|
140
|
+
if (act === 'tour') { S.dismissed = false; save(); return startTour(); }
|
|
141
|
+
if (e.target.closest('#onb-open')) { S.open = !S.open; save(); return renderPanel(); }
|
|
142
|
+
if (pointed && pointed.contains(e.target)) unpoint();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// ---- on load: the checklist read, this page's visit kept, then whatever was under way carried on
|
|
146
|
+
nulliusFetch(STATE_URL, {headers: {Accept: 'application/json'}}).then(r => r.ok ? r.json() : {sections: []}).catch(() => ({sections: []})).then(j => {
|
|
147
|
+
sections = j.sections || [];
|
|
148
|
+
const here = location.pathname + location.search, tour = read(sessionStorage, 'onb-tour', null);
|
|
149
|
+
// a page the tour opened was shown, not used: it counts as no visit
|
|
150
|
+
if (tour == null) for (const x of sections.flatMap(s => s.subs)) if (x.visit && new RegExp(x.visit).test(here)) S.visits[x.id] = 1;
|
|
151
|
+
save();
|
|
152
|
+
renderPanel();
|
|
153
|
+
if (!S.asked) return welcome();
|
|
154
|
+
if (tour != null) return stop(tour);
|
|
155
|
+
const want = read(sessionStorage, 'onb-point', null), sub = want && sections.flatMap(s => s.subs).find(x => x.id === want);
|
|
156
|
+
if (sub) point(sub, false);
|
|
157
|
+
});
|
|
158
|
+
})();
|