hostlet 0.0.0-stage → 0.1.0-alpha.1
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/README.md +233 -2
- package/bin/hostlet.js +61 -0
- package/console/app/api.js +1223 -0
- package/console/app/boot.js +165 -0
- package/console/app/cards.js +222 -0
- package/console/app/compose-quote.js +127 -0
- package/console/app/config-form.js +727 -0
- package/console/app/document-drafts.js +62 -0
- package/console/app/document-tools.mjs +67 -0
- package/console/app/documents.js +106 -0
- package/console/app/pages.js +6483 -0
- package/console/app/plugins.js +509 -0
- package/console/app/preview-tools.js +172 -0
- package/console/app/reference-labels.js +118 -0
- package/console/app/selection.js +372 -0
- package/console/app/store.js +57 -0
- package/console/app/text-anchor.js +26 -0
- package/console/app/topic-local.js +322 -0
- package/console/app/topic-nav.js +414 -0
- package/console/app/topic-status.js +109 -0
- package/console/app/views.js +43 -0
- package/console/apple-touch-icon.png +0 -0
- package/console/avatars/agy.svg +34 -0
- package/console/avatars/alhena.svg +36 -0
- package/console/avatars/castor.svg +38 -0
- package/console/avatars/claude.svg +34 -0
- package/console/avatars/codex.svg +34 -0
- package/console/avatars/devin.svg +34 -0
- package/console/avatars/echo.svg +34 -0
- package/console/avatars/kimi.svg +33 -0
- package/console/avatars/opencode.svg +33 -0
- package/console/avatars/pinion.svg +34 -0
- package/console/avatars/sprocket.svg +34 -0
- package/console/avatars/vela.svg +44 -0
- package/console/avatars/wasat.svg +38 -0
- package/console/clients/agy.svg +1 -0
- package/console/clients/claude.svg +1 -0
- package/console/clients/codex.svg +1 -0
- package/console/clients/devin.svg +1 -0
- package/console/clients/kimi.svg +1 -0
- package/console/clients/opencode.svg +1 -0
- package/console/favicon.ico +0 -0
- package/console/favicon.svg +16 -0
- package/console/index.html +99 -0
- package/console/pdl/engine/README.md +13 -0
- package/console/pdl/engine/anchor.js +195 -0
- package/console/pdl/engine/core.js +1340 -0
- package/console/pdl/engine/frame.js +1252 -0
- package/console/pdl/engine/i18n.js +67 -0
- package/console/pdl/engine/pdl-check.js +102 -0
- package/console/pdl/engine/pdl-doc.js +353 -0
- package/console/pdl/engine/pdl-view.js +280 -0
- package/console/pdl/engine/pdl.js +1064 -0
- package/console/pdl/engine/platform.js +18 -0
- package/console/pdl/engine/proj.js +279 -0
- package/console/pdl/engine/theme.js +176 -0
- package/console/pdl/engine/tree.js +171 -0
- package/console/pdl/engine/units.js +546 -0
- package/console/pdl/library/README.md +28 -0
- package/console/pdl/library/blocks.js +1512 -0
- package/console/pdl/library/buttons.js +86 -0
- package/console/pdl/library/capsules.js +130 -0
- package/console/pdl/library/charts.js +287 -0
- package/console/pdl/library/code.js +98 -0
- package/console/pdl/library/css/base.css +12 -0
- package/console/pdl/library/css/blocks.css +98 -0
- package/console/pdl/library/css/capsules.css +42 -0
- package/console/pdl/library/css/catalog-page.css +24 -0
- package/console/pdl/library/css/chat.css +100 -0
- package/console/pdl/library/css/composer-top.css +145 -0
- package/console/pdl/library/css/controls.css +195 -0
- package/console/pdl/library/css/drag.css +29 -0
- package/console/pdl/library/css/edit-layout.css +93 -0
- package/console/pdl/library/css/floating-window.css +30 -0
- package/console/pdl/library/css/hover.css +50 -0
- package/console/pdl/library/css/label-search.css +37 -0
- package/console/pdl/library/css/layers.css +43 -0
- package/console/pdl/library/css/library-parts.css +33 -0
- package/console/pdl/library/css/library.css +117 -0
- package/console/pdl/library/css/member-select.css +34 -0
- package/console/pdl/library/css/message.css +72 -0
- package/console/pdl/library/css/page.css +104 -0
- package/console/pdl/library/css/parts.css +338 -0
- package/console/pdl/library/css/responsive.css +40 -0
- package/console/pdl/library/css/roles.css +28 -0
- package/console/pdl/library/css/rows.css +231 -0
- package/console/pdl/library/css/settings-rows.css +37 -0
- package/console/pdl/library/css/shell.css +59 -0
- package/console/pdl/library/css/stream.css +296 -0
- package/console/pdl/library/css/theme-calculator.css +18 -0
- package/console/pdl/library/css/thumb-choice.css +69 -0
- package/console/pdl/library/css/tweaks.css +16 -0
- package/console/pdl/library/css/widgets.css +211 -0
- package/console/pdl/library/css/workbench.css +59 -0
- package/console/pdl/library/feedback.js +83 -0
- package/console/pdl/library/floating-window.mjs +100 -0
- package/console/pdl/library/fold.js +238 -0
- package/console/pdl/library/format.js +53 -0
- package/console/pdl/library/frames.js +123 -0
- package/console/pdl/library/icons.js +165 -0
- package/console/pdl/library/identity.js +149 -0
- package/console/pdl/library/inputs.js +801 -0
- package/console/pdl/library/label-search.js +214 -0
- package/console/pdl/library/markdown-text.js +115 -0
- package/console/pdl/library/markdown.js +150 -0
- package/console/pdl/library/media-viewer.js +293 -0
- package/console/pdl/library/member-select.mjs +32 -0
- package/console/pdl/library/message.js +105 -0
- package/console/pdl/library/motion.js +56 -0
- package/console/pdl/library/overlays.js +165 -0
- package/console/pdl/library/page.js +142 -0
- package/console/pdl/library/plugin-form.js +154 -0
- package/console/pdl/library/registry.js +198 -0
- package/console/pdl/library/rows.js +523 -0
- package/console/pdl/library/shell.js +151 -0
- package/console/pdl/library/stream.js +58 -0
- package/console/pdl/library/tabs.js +259 -0
- package/console/pdl/library/theme-calculator.js +300 -0
- package/console/pdl/library/widgets.js +114 -0
- package/console/pdl/load-order.json +74 -0
- package/console/pdl/platform/README.md +3 -0
- package/console/pdl/platform/rich-markdown.mjs +17 -0
- package/console/pdl/platform/web-links.js +26 -0
- package/console/pdl/platform/web.js +80 -0
- package/console/sdk-browser/mentions.d.mts +16 -0
- package/console/sdk-browser/mentions.mjs +84 -0
- package/console/theme/assets.js +21 -0
- package/console/theme/theme.json +9417 -0
- package/console/theme/tokens.json +444 -0
- package/dist/core/a2a.d.ts +288 -0
- package/dist/core/a2a.js +2197 -0
- package/dist/core/address.d.ts +34 -0
- package/dist/core/address.js +33 -0
- package/dist/core/approval-inputs.d.ts +17 -0
- package/dist/core/approval-inputs.js +70 -0
- package/dist/core/archive.d.ts +19 -0
- package/dist/core/archive.js +135 -0
- package/dist/core/attachments.d.ts +17 -0
- package/dist/core/attachments.js +143 -0
- package/dist/core/blocked-handoffs.d.ts +132 -0
- package/dist/core/blocked-handoffs.js +349 -0
- package/dist/core/config-schema.d.ts +124 -0
- package/dist/core/config-schema.js +192 -0
- package/dist/core/config.d.ts +117 -0
- package/dist/core/config.js +638 -0
- package/dist/core/disk-usage.d.ts +26 -0
- package/dist/core/disk-usage.js +83 -0
- package/dist/core/documents.d.ts +9 -0
- package/dist/core/documents.js +48 -0
- package/dist/core/entry.d.ts +316 -0
- package/dist/core/entry.js +711 -0
- package/dist/core/home.d.ts +76 -0
- package/dist/core/home.js +449 -0
- package/dist/core/i18n.d.ts +36 -0
- package/dist/core/i18n.js +458 -0
- package/dist/core/instances.d.ts +224 -0
- package/dist/core/instances.js +1272 -0
- package/dist/core/members.d.ts +190 -0
- package/dist/core/members.js +358 -0
- package/dist/core/mentions.d.ts +12 -0
- package/dist/core/mentions.js +49 -0
- package/dist/core/messages.d.ts +876 -0
- package/dist/core/messages.js +916 -0
- package/dist/core/notices.d.ts +88 -0
- package/dist/core/notices.js +54 -0
- package/dist/core/ops.d.ts +117 -0
- package/dist/core/ops.js +146 -0
- package/dist/core/package.d.ts +2 -0
- package/dist/core/package.js +14 -0
- package/dist/core/parts.d.ts +25 -0
- package/dist/core/parts.js +119 -0
- package/dist/core/plugins/catalog.d.ts +14 -0
- package/dist/core/plugins/catalog.js +54 -0
- package/dist/core/plugins/external.d.ts +7 -0
- package/dist/core/plugins/external.js +921 -0
- package/dist/core/plugins/index.d.ts +5 -0
- package/dist/core/plugins/index.js +51 -0
- package/dist/core/plugins/npm.d.ts +12 -0
- package/dist/core/plugins/npm.js +99 -0
- package/dist/core/plugins/plugin-manifest.d.ts +12 -0
- package/dist/core/plugins/plugin-manifest.js +231 -0
- package/dist/core/push.d.ts +22 -0
- package/dist/core/push.js +63 -0
- package/dist/core/resource.d.ts +77 -0
- package/dist/core/resource.js +48 -0
- package/dist/core/spawn.d.ts +12 -0
- package/dist/core/spawn.js +30 -0
- package/dist/core/storage-inventory.d.ts +118 -0
- package/dist/core/storage-inventory.js +279 -0
- package/dist/core/storage.d.ts +45 -0
- package/dist/core/storage.js +602 -0
- package/dist/core/store.d.ts +15 -0
- package/dist/core/store.js +33 -0
- package/dist/core/topic-index.d.ts +19 -0
- package/dist/core/topic-index.js +70 -0
- package/dist/core/topic-ops.d.ts +139 -0
- package/dist/core/topic-ops.js +507 -0
- package/dist/core/topic-status.d.ts +32 -0
- package/dist/core/topic-status.js +105 -0
- package/dist/core/topics.d.ts +327 -0
- package/dist/core/topics.js +786 -0
- package/dist/core/turn-clients.d.ts +1 -0
- package/dist/core/turn-clients.js +5 -0
- package/dist/core/types.d.ts +2866 -0
- package/dist/core/types.js +166 -0
- package/dist/core/util.d.ts +10 -0
- package/dist/core/util.js +47 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.js +82 -0
- package/dist/plugins/adapter-acp/index.d.ts +3 -0
- package/dist/plugins/adapter-acp/index.js +57 -0
- package/dist/plugins/adapter-acp/plugin.yaml +100 -0
- package/dist/plugins/adapter-agy/command.d.ts +9 -0
- package/dist/plugins/adapter-agy/command.js +34 -0
- package/dist/plugins/adapter-agy/index.d.ts +5 -0
- package/dist/plugins/adapter-agy/index.js +65 -0
- package/dist/plugins/adapter-agy/quota.d.ts +2 -0
- package/dist/plugins/adapter-agy/quota.js +155 -0
- package/dist/plugins/adapter-agy/terminal.d.ts +6 -0
- package/dist/plugins/adapter-agy/terminal.js +132 -0
- package/dist/plugins/adapter-agy/version.d.ts +9 -0
- package/dist/plugins/adapter-agy/version.js +17 -0
- package/dist/plugins/adapter-claude/index.d.ts +43 -0
- package/dist/plugins/adapter-claude/index.js +412 -0
- package/dist/plugins/adapter-claude/quota.d.ts +14 -0
- package/dist/plugins/adapter-claude/quota.js +103 -0
- package/dist/plugins/adapter-codex/index.d.ts +4 -0
- package/dist/plugins/adapter-codex/index.js +688 -0
- package/dist/plugins/adapter-codex/responses-model.d.ts +9 -0
- package/dist/plugins/adapter-codex/responses-model.js +82 -0
- package/dist/plugins/adapter-kimi/index.d.ts +4 -0
- package/dist/plugins/adapter-kimi/index.js +51 -0
- package/dist/plugins/adapter-kimi/quota.d.ts +3 -0
- package/dist/plugins/adapter-kimi/quota.js +171 -0
- package/dist/plugins/adapter-opencode/index.d.ts +12 -0
- package/dist/plugins/adapter-opencode/index.js +64 -0
- package/dist/plugins/annotations/console/cards.css +189 -0
- package/dist/plugins/annotations/console/cards.mjs +439 -0
- package/dist/plugins/annotations/console/pdl.json +52 -0
- package/dist/plugins/annotations/console/view.mjs +241 -0
- package/dist/plugins/annotations/console/window.mjs +219 -0
- package/dist/plugins/annotations/followups.d.ts +51 -0
- package/dist/plugins/annotations/followups.js +112 -0
- package/dist/plugins/annotations/index.d.ts +3 -0
- package/dist/plugins/annotations/index.js +298 -0
- package/dist/plugins/annotations/plugin.yaml +3 -0
- package/dist/plugins/ask-choice/index.d.ts +9 -0
- package/dist/plugins/ask-choice/index.js +24 -0
- package/dist/plugins/ask-choice/plugin.yaml +2 -0
- package/dist/plugins/background/index.d.ts +2 -0
- package/dist/plugins/background/index.js +398 -0
- package/dist/plugins/background/plugin.yaml +7 -0
- package/dist/plugins/builtin.json +37 -0
- package/dist/plugins/cards/console/pdl.json +516 -0
- package/dist/plugins/cards/console/view.mjs +67 -0
- package/dist/plugins/cards/index.d.ts +8 -0
- package/dist/plugins/cards/index.js +627 -0
- package/dist/plugins/cards/plugin.yaml +3 -0
- package/dist/plugins/console/browser.d.ts +2 -0
- package/dist/plugins/console/browser.js +115 -0
- package/dist/plugins/console/console/pdl.json +38 -0
- package/dist/plugins/console/console/view.mjs +26 -0
- package/dist/plugins/console/index.d.ts +4 -0
- package/dist/plugins/console/index.js +94 -0
- package/dist/plugins/console/picker.d.ts +2 -0
- package/dist/plugins/console/picker.js +48 -0
- package/dist/plugins/console/plugin.yaml +3 -0
- package/dist/plugins/console/topic-view.d.ts +3 -0
- package/dist/plugins/console/topic-view.js +388 -0
- package/dist/plugins/handoff/index.d.ts +2 -0
- package/dist/plugins/handoff/index.js +147 -0
- package/dist/plugins/handoff/plugin.yaml +8 -0
- package/dist/plugins/host-api/index.d.ts +7 -0
- package/dist/plugins/host-api/index.js +310 -0
- package/dist/plugins/host-api/plugin.yaml +2 -0
- package/dist/plugins/host-api/signing.d.ts +63 -0
- package/dist/plugins/host-api/signing.js +427 -0
- package/dist/plugins/host-api/skills/host-ops/SKILL.md +28 -0
- package/dist/plugins/host-api/skills/hostlet-plugin-dev/SKILL.md +38 -0
- package/dist/plugins/inbox/index.d.ts +15 -0
- package/dist/plugins/inbox/index.js +161 -0
- package/dist/plugins/inbox/plugin.yaml +2 -0
- package/dist/plugins/keys/account-directories.d.ts +18 -0
- package/dist/plugins/keys/account-directories.js +86 -0
- package/dist/plugins/keys/account-storage.d.ts +18 -0
- package/dist/plugins/keys/account-storage.js +112 -0
- package/dist/plugins/keys/console/pdl.json +710 -0
- package/dist/plugins/keys/console/view.mjs +619 -0
- package/dist/plugins/keys/index.d.ts +7 -0
- package/dist/plugins/keys/index.js +842 -0
- package/dist/plugins/keys/login-link.d.ts +2 -0
- package/dist/plugins/keys/login-link.js +15 -0
- package/dist/plugins/keys/plugin.yaml +3 -0
- package/dist/plugins/keys/quota-history.d.ts +91 -0
- package/dist/plugins/keys/quota-history.js +420 -0
- package/dist/plugins/mcp/console/pdl.json +412 -0
- package/dist/plugins/mcp/console/view.mjs +207 -0
- package/dist/plugins/mcp/index.d.ts +7 -0
- package/dist/plugins/mcp/index.js +494 -0
- package/dist/plugins/mcp/plugin.yaml +3 -0
- package/dist/plugins/member-health/index.d.ts +2 -0
- package/dist/plugins/member-health/index.js +478 -0
- package/dist/plugins/member-health/plugin.yaml +2 -0
- package/dist/plugins/memory/capabilities.d.ts +10 -0
- package/dist/plugins/memory/capabilities.js +70 -0
- package/dist/plugins/memory/console/pdl.json +459 -0
- package/dist/plugins/memory/console/view.mjs +254 -0
- package/dist/plugins/memory/corpus.d.ts +60 -0
- package/dist/plugins/memory/corpus.js +521 -0
- package/dist/plugins/memory/engines/fts-tree-diversity.d.ts +8 -0
- package/dist/plugins/memory/engines/fts-tree-diversity.js +49 -0
- package/dist/plugins/memory/engines/fts-tree-text.d.ts +12 -0
- package/dist/plugins/memory/engines/fts-tree-text.js +93 -0
- package/dist/plugins/memory/engines/fts-tree.d.ts +4 -0
- package/dist/plugins/memory/engines/fts-tree.js +387 -0
- package/dist/plugins/memory/engines/search.d.ts +9 -0
- package/dist/plugins/memory/engines/search.js +35 -0
- package/dist/plugins/memory/index.d.ts +3 -0
- package/dist/plugins/memory/index.js +465 -0
- package/dist/plugins/memory/notes.d.ts +22 -0
- package/dist/plugins/memory/notes.js +140 -0
- package/dist/plugins/memory/plugin.yaml +23 -0
- package/dist/plugins/model-profiles/index.d.ts +2 -0
- package/dist/plugins/model-profiles/index.js +916 -0
- package/dist/plugins/model-profiles/plugin.yaml +13 -0
- package/dist/plugins/model-profiles/review-source.d.ts +11 -0
- package/dist/plugins/model-profiles/review-source.js +640 -0
- package/dist/plugins/model-profiles/rules.d.ts +130 -0
- package/dist/plugins/model-profiles/rules.js +729 -0
- package/dist/plugins/model-profiles/skills/model-profile/SKILL.md +59 -0
- package/dist/plugins/model-profiles/sources.d.ts +61 -0
- package/dist/plugins/model-profiles/sources.js +375 -0
- package/dist/plugins/model-profiles/storage.d.ts +84 -0
- package/dist/plugins/model-profiles/storage.js +315 -0
- package/dist/plugins/model-profiles/types.d.ts +179 -0
- package/dist/plugins/model-profiles/types.js +12 -0
- package/dist/plugins/model-profiles/wakeup.d.ts +29 -0
- package/dist/plugins/model-profiles/wakeup.js +390 -0
- package/dist/plugins/models/index.d.ts +2 -0
- package/dist/plugins/models/index.js +63 -0
- package/dist/plugins/models/plugin.yaml +8 -0
- package/dist/plugins/ops/collector.d.ts +22 -0
- package/dist/plugins/ops/collector.js +48 -0
- package/dist/plugins/ops/config.d.ts +11 -0
- package/dist/plugins/ops/config.js +13 -0
- package/dist/plugins/ops/console/pdl.json +676 -0
- package/dist/plugins/ops/console/view.mjs +700 -0
- package/dist/plugins/ops/index.d.ts +3 -0
- package/dist/plugins/ops/index.js +20 -0
- package/dist/plugins/ops/journal.d.ts +7 -0
- package/dist/plugins/ops/journal.js +109 -0
- package/dist/plugins/ops/metrics.d.ts +3 -0
- package/dist/plugins/ops/metrics.js +81 -0
- package/dist/plugins/ops/plugin.yaml +63 -0
- package/dist/plugins/ops/samples.d.ts +54 -0
- package/dist/plugins/ops/samples.js +100 -0
- package/dist/plugins/ops/trace.d.ts +3 -0
- package/dist/plugins/ops/trace.js +104 -0
- package/dist/plugins/ops/usage.d.ts +2 -0
- package/dist/plugins/ops/usage.js +152 -0
- package/dist/plugins/plans/acceptance.d.ts +284 -0
- package/dist/plugins/plans/acceptance.js +247 -0
- package/dist/plugins/plans/blocked.d.ts +25 -0
- package/dist/plugins/plans/blocked.js +66 -0
- package/dist/plugins/plans/console/pdl.json +639 -0
- package/dist/plugins/plans/console/view.d.mts +2 -0
- package/dist/plugins/plans/console/view.mjs +855 -0
- package/dist/plugins/plans/dependencies.d.ts +5 -0
- package/dist/plugins/plans/dependencies.js +21 -0
- package/dist/plugins/plans/index.d.ts +72 -0
- package/dist/plugins/plans/index.js +2057 -0
- package/dist/plugins/plans/plugin.yaml +44 -0
- package/dist/plugins/plans/progress.d.ts +82 -0
- package/dist/plugins/plans/progress.js +516 -0
- package/dist/plugins/prompt/index.d.ts +8 -0
- package/dist/plugins/prompt/index.js +361 -0
- package/dist/plugins/prompt/plugin.yaml +2 -0
- package/dist/plugins/recovery/console/pdl.json +50 -0
- package/dist/plugins/recovery/console/view.mjs +46 -0
- package/dist/plugins/recovery/index.d.ts +9 -0
- package/dist/plugins/recovery/index.js +454 -0
- package/dist/plugins/recovery/plugin.yaml +9 -0
- package/dist/plugins/recovery/probe.d.ts +11 -0
- package/dist/plugins/recovery/probe.js +128 -0
- package/dist/plugins/restart/console/pdl.json +112 -0
- package/dist/plugins/restart/console/view.mjs +85 -0
- package/dist/plugins/restart/index.d.ts +10 -0
- package/dist/plugins/restart/index.js +669 -0
- package/dist/plugins/restart/plugin.yaml +9 -0
- package/dist/plugins/restart/scope.d.ts +6 -0
- package/dist/plugins/restart/scope.js +44 -0
- package/dist/plugins/schedule/console/pdl.json +696 -0
- package/dist/plugins/schedule/console/view.mjs +398 -0
- package/dist/plugins/schedule/events.d.ts +76 -0
- package/dist/plugins/schedule/events.js +158 -0
- package/dist/plugins/schedule/index.d.ts +32 -0
- package/dist/plugins/schedule/index.js +1199 -0
- package/dist/plugins/schedule/plugin.yaml +26 -0
- package/dist/plugins/schedule/when.d.ts +14 -0
- package/dist/plugins/schedule/when.js +83 -0
- package/dist/plugins/sessions/console/pdl.json +259 -0
- package/dist/plugins/sessions/console/view.mjs +355 -0
- package/dist/plugins/sessions/index.d.ts +3 -0
- package/dist/plugins/sessions/index.js +126 -0
- package/dist/plugins/sessions/participants.d.ts +28 -0
- package/dist/plugins/sessions/participants.js +83 -0
- package/dist/plugins/sessions/plugin.yaml +3 -0
- package/dist/plugins/signals/console/pdl.json +802 -0
- package/dist/plugins/signals/console/view.mjs +284 -0
- package/dist/plugins/signals/content.d.ts +31 -0
- package/dist/plugins/signals/content.js +151 -0
- package/dist/plugins/signals/index.d.ts +2 -0
- package/dist/plugins/signals/index.js +601 -0
- package/dist/plugins/signals/plugin.yaml +32 -0
- package/dist/plugins/signals/skills/signal-sources/SKILL.md +27 -0
- package/dist/plugins/skills/console/pdl.json +254 -0
- package/dist/plugins/skills/console/view.mjs +204 -0
- package/dist/plugins/skills/index.d.ts +11 -0
- package/dist/plugins/skills/index.js +567 -0
- package/dist/plugins/skills/install.d.ts +69 -0
- package/dist/plugins/skills/install.js +265 -0
- package/dist/plugins/skills/plugin.yaml +24 -0
- package/dist/plugins/skills/safety-scan.d.ts +17 -0
- package/dist/plugins/skills/safety-scan.js +78 -0
- package/dist/plugins/skills/skills/skill-ops/SKILL.md +29 -0
- package/dist/plugins/terminal/console/pdl.json +115 -0
- package/dist/plugins/terminal/console/view.mjs +178 -0
- package/dist/plugins/terminal/index.d.ts +3 -0
- package/dist/plugins/terminal/index.js +204 -0
- package/dist/plugins/terminal/plugin.yaml +2 -0
- package/dist/plugins/tools/index.d.ts +3 -0
- package/dist/plugins/tools/index.js +455 -0
- package/dist/plugins/tools/plugin.yaml +2 -0
- package/dist/plugins/tools/token.d.ts +61 -0
- package/dist/plugins/tools/token.js +179 -0
- package/dist/plugins/topic-tools/index.d.ts +9 -0
- package/dist/plugins/topic-tools/index.js +29 -0
- package/dist/plugins/topic-tools/plugin.yaml +2 -0
- package/dist/plugins/topic-tools/skills/topic-tidy/SKILL.md +108 -0
- package/dist/plugins/works/console/pdl.json +120 -0
- package/dist/plugins/works/console/view.mjs +91 -0
- package/dist/plugins/works/document-words.d.ts +50 -0
- package/dist/plugins/works/document-words.js +27 -0
- package/dist/plugins/works/editors.d.ts +3 -0
- package/dist/plugins/works/editors.js +162 -0
- package/dist/plugins/works/events.d.ts +58 -0
- package/dist/plugins/works/events.js +82 -0
- package/dist/plugins/works/files.d.ts +23 -0
- package/dist/plugins/works/files.js +53 -0
- package/dist/plugins/works/index.d.ts +9 -0
- package/dist/plugins/works/index.js +1088 -0
- package/dist/plugins/works/plugin.yaml +9 -0
- package/dist/plugins/works/preview.d.ts +10 -0
- package/dist/plugins/works/preview.js +30 -0
- package/dist/plugins/works/project.d.ts +3 -0
- package/dist/plugins/works/project.js +245 -0
- package/dist/plugins/works/resource.d.ts +28 -0
- package/dist/plugins/works/resource.js +71 -0
- package/dist/plugins/works/retention.d.ts +36 -0
- package/dist/plugins/works/retention.js +295 -0
- package/dist/plugins/works/skills/works-ops/SKILL.md +14 -0
- package/dist/plugins/works/viewers.d.ts +13 -0
- package/dist/plugins/works/viewers.js +87 -0
- package/dist/plugins/works/web/anchors.js +94 -0
- package/dist/plugins/works/web/document-edit.js +245 -0
- package/dist/plugins/works/web/preview-bridge.js +142 -0
- package/dist/plugins/works/web/reading-position.js +74 -0
- package/dist/plugins/works/web/view.html +1118 -0
- package/dist/runtime/runtime.d.ts +210 -0
- package/dist/runtime/runtime.js +338 -0
- package/dist/sdk/adapter-kit.d.ts +1 -0
- package/dist/sdk/adapter-kit.js +1 -0
- package/dist/sdk/client.d.ts +163 -0
- package/dist/sdk/client.js +43 -0
- package/dist/sdk/contracts.d.ts +1263 -0
- package/dist/sdk/contracts.js +1 -0
- package/dist/sdk/index.d.ts +57 -0
- package/dist/sdk/index.js +27 -0
- package/dist/sdk/source-choice.d.ts +40 -0
- package/dist/sdk/source-choice.js +217 -0
- package/dist/sdk/topic-text.d.ts +5 -0
- package/dist/sdk/topic-text.js +26 -0
- package/dist/sdk/transport.d.ts +12 -0
- package/dist/sdk/transport.js +34 -0
- package/node_modules/@hostlet/adapter-kit/dist/acp.d.ts +88 -0
- package/node_modules/@hostlet/adapter-kit/dist/acp.js +674 -0
- package/node_modules/@hostlet/adapter-kit/dist/command.d.ts +18 -0
- package/node_modules/@hostlet/adapter-kit/dist/command.js +39 -0
- package/node_modules/@hostlet/adapter-kit/dist/index.d.ts +8 -0
- package/node_modules/@hostlet/adapter-kit/dist/index.js +6 -0
- package/node_modules/@hostlet/adapter-kit/dist/models.d.ts +29 -0
- package/node_modules/@hostlet/adapter-kit/dist/models.js +108 -0
- package/node_modules/@hostlet/adapter-kit/dist/quota.d.ts +3 -0
- package/node_modules/@hostlet/adapter-kit/dist/quota.js +4 -0
- package/node_modules/@hostlet/adapter-kit/dist/rpc.d.ts +29 -0
- package/node_modules/@hostlet/adapter-kit/dist/rpc.js +84 -0
- package/node_modules/@hostlet/adapter-kit/dist/upstream-failure.d.ts +5 -0
- package/node_modules/@hostlet/adapter-kit/dist/upstream-failure.js +37 -0
- package/node_modules/@hostlet/adapter-kit/package.json +16 -0
- package/node_modules/@hostlet/platform/dist/desktop.d.ts +16 -0
- package/node_modules/@hostlet/platform/dist/desktop.js +270 -0
- package/node_modules/@hostlet/platform/dist/files.d.ts +24 -0
- package/node_modules/@hostlet/platform/dist/files.js +113 -0
- package/node_modules/@hostlet/platform/dist/index.d.ts +6 -0
- package/node_modules/@hostlet/platform/dist/index.js +4 -0
- package/node_modules/@hostlet/platform/dist/paths.d.ts +4 -0
- package/node_modules/@hostlet/platform/dist/paths.js +9 -0
- package/node_modules/@hostlet/platform/dist/process.d.ts +45 -0
- package/node_modules/@hostlet/platform/dist/process.js +297 -0
- package/node_modules/@hostlet/platform/package.json +14 -0
- package/package.json +60 -4
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* 边界:一个含义一个组件、不为接口定制、不按位置推导样式 */
|
|
2
|
+
/* 外壳:窄栏、二级栏、内置容器的画法、侧栏抽屉、拖动与编辑条 */
|
|
3
|
+
/* 窄栏、二级栏的外壳和入口项、各个内置容器的画法(CT_DRAW)、弹窗框架的盒子和按钮、编辑条;工作台的外框(标签条、启动面板、菜单条、把手)在 tabs.js。
|
|
4
|
+
机制(投影、弹窗栈、返回槽、标签式容器的状态)在引擎(engine/frame.js),这里只画。 */
|
|
5
|
+
'use strict';
|
|
6
|
+
/* 导航行:唯一的画法(侧栏导航、页面目录)。o = { label, icon, attrs(data-act 等属性串), current, trail(已渲染的尾部), cls } */
|
|
7
|
+
function navRow(o) { return '<button type="button" class="nav-item' + (o.cls ? ' ' + o.cls : '') + '"' + (o.attrs || '') + (o.current ? ' aria-current="' + (o.current === true ? 'page' : o.current) + '"' : '') + '>' + (o.icon ? icon(o.icon) : '') + '<span>' + h(o.label) + '</span>' + (o.trail || '') + '</button>'; } /* 名字一行,放不下省略,悬停看全文;从不在词中间折行 */
|
|
8
|
+
/* 区域边界的调宽把手(组件库里只有这一个):一种颜色、一套悬停 / 拖动中的状态、同样的宽度和命中区。
|
|
9
|
+
which 说它调的是谁(nav 侧栏 / panel 工作台),side 说它贴在区域的哪条边(end 右边 / start 左边)。编辑布局时隐藏(那时区域的边用来移动区域) */
|
|
10
|
+
function resizeHandle(o) { return '<div class="resize-handle" data-resize="' + o.which + '" data-side="' + o.side + '" role="separator" aria-orientation="vertical" aria-label="' + h(o.label) + '" tabindex="0" data-tip="' + h(o.tip) + '"' + (o.now != null ? ' aria-valuenow="' + o.now + '" aria-valuemin="' + o.min + '" aria-valuemax="' + o.max + '"' : '') + '></div>'; }
|
|
11
|
+
/* 浮层宿主:对话区的模态窗、图片查看、撤销条挂在这里 */
|
|
12
|
+
/* 窄屏的侧栏抽屉(开关是主题声明的 drawer 按钮:toggle s.navOpen):开着时根上带 nav-open;换地方(导航完成,引擎的 NAV_RESET)时收起;
|
|
13
|
+
Esc 收起——排在各模块自己的 Esc 之后(启动时才登记,KEY_FNS 的最后一个),别的浮签先收 */
|
|
14
|
+
S.navOpen = false;
|
|
15
|
+
APP_CLASS.push(function () { return S.navOpen ? 'nav-open' : ''; });
|
|
16
|
+
NAV_RESET.push(function (o) { if (!o.popupsOnly) S.navOpen = false; });
|
|
17
|
+
onStart('boot', function () {
|
|
18
|
+
KEY_FNS.push(function (e) { if (e.key !== 'Escape' || !S.navOpen) return false; S.navOpen = false; render(true); return true; });
|
|
19
|
+
document.addEventListener('pointerdown', function (e) {
|
|
20
|
+
if (!S.navOpen) return;
|
|
21
|
+
const t = e.target;
|
|
22
|
+
if (t && t.closest && (t.closest('.nav') || t.closest('.nav-toggle') || t.closest('.pop-host, .dialog, .menu'))) return;
|
|
23
|
+
S.navOpen = false;
|
|
24
|
+
render(true);
|
|
25
|
+
}, true);
|
|
26
|
+
});
|
|
27
|
+
APP_CLASS.push(function () { return S.layout === 'two' ? 'layout-two' : ''; });
|
|
28
|
+
/* 区域是界面树里同级的节点:根元素带它的键(data-okey),放着设置入口的区域(受保护)固定(data-locked)。
|
|
29
|
+
编辑布局时区域和其它可编辑的节点一样:边缘出现移动光标,按住拖到另一侧,区域里的东西跟着走(拖动机制见 core.js 的 EDGE_DRAG)。
|
|
30
|
+
平时区域的边是调宽度的(左右调整光标),编辑布局时调宽度关掉——两种模式靠模式和光标区分,同一个手势不会有两种意思 */
|
|
31
|
+
function regionAttrs(key) { return ' data-okey="' + key + '"' + (S.editLayout ? ' data-edit="region"' : ''); }
|
|
32
|
+
function rail() {
|
|
33
|
+
const sp = space();
|
|
34
|
+
/* 窄栏是一列格子:品牌标志固定在起始端第 0 格;上方插槽的入口默认从起始端往下排,下方插槽的从结束端往上排;用户可以把入口放到任意一格 */
|
|
35
|
+
const items = [], add = function (slot, anchor) { (pdlNodeHidden(slot) ? [] : pdlKids(slot)).forEach(function (id) { const html = pdlItem(id, slot); if (html) items.push({ key: id, html: html, span: 's', anchor: anchor, locked: slot === 'rail.mark' }); }); }; /* 品牌标志固定;设置入口和别的入口一样能移动 */
|
|
36
|
+
add('rail.mark', 'start'); add('rail.top', 'start'); add('rail.bottom', 'end');
|
|
37
|
+
return '<nav class="rail"' + regionAttrs('rail') + ' aria-label="' + h(tc('frame.rail')) + '">' + cellsHtml({ key: 'rail', axis: 'col', items: items, saved: pdlCells('rail'), edit: false, attrs: ' data-entries="rail.top rail.bottom"' }) + '</nav>';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* 一行导航:当前项 = 路由就是它,或者它的入口声明的 also / alsoFrom 里有当前路由(详情页、新建页),不按路由名写对照 */
|
|
41
|
+
function navItem(to, ic, label, trail, block) {
|
|
42
|
+
const e = pdlEntry(to), cur = S.route === to || !!(e && pdlEntryAlso(e).indexOf(S.route) >= 0);
|
|
43
|
+
/* block:页面描述里的块(入口的稳定名字)。样子是导航行的默认,PDL 不挑表面 */
|
|
44
|
+
return navRow({ label: label, icon: ic, attrs: (block ? ' data-block="' + block + '"' : '') + ' data-act="open" data-page="' + to + '"', current: cur, trail: trail ? '<span class="trail num">' + trail + '</span>' : '' });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* o.trail 可替代 o.title;o.acts 标题操作;o.top 固定在滚动区上方;o.foot 底部入口 */
|
|
48
|
+
function navShell(o) {
|
|
49
|
+
const cls = o.hidden ? 'pdl-hidden' : o.cls;
|
|
50
|
+
const head = o.head != null ? o.head : (o.trail ? breadcrumbs(o.trail) : '<span class="nav-title">' + o.title + '</span>') + (o.acts || '');
|
|
51
|
+
return '<aside class="nav' + (cls ? ' ' + cls : '') + '"' + regionAttrs('nav') + ' aria-label="' + o.label + '">' + '<div class="nav-head">' + head + '</div>' +
|
|
52
|
+
(o.top ? '<div class="nav-top">' + o.top + '</div>' : '') + '<div class="nav-scroll scroll"' + (o.scrollId ? ' id="' + o.scrollId + '"' : '') + '>' + o.body + '</div>' + (o.foot ? '<div class="nav-foot">' + o.foot + '</div>' : '') +
|
|
53
|
+
resizeHandle({ which: 'nav', side: 'end', label: tc('frame.navResize'), tip: tc('frame.navResizeTip'), now: Math.round(RESIZERS.nav.width()), min: Math.round(RESIZERS.nav.min), max: Math.round(RESIZERS.nav.max()) }) + '</aside>';
|
|
54
|
+
}
|
|
55
|
+
/* 现有侧栏外壳的 PDL 入口:标题操作、页面插槽、格子工具条、列表与底部入口。
|
|
56
|
+
结构仍由 navShell / listBar / listWrap / navItem 四个原件画,主题只声明内容和绑定。 */
|
|
57
|
+
PDL_COMPONENTS.navShell = function (p, sc, root) {
|
|
58
|
+
const P = function (x) { return pv(x, sc, root); }, bar = p.bar;
|
|
59
|
+
return navShell({ label: P(p.label), hidden: P(p.hidden), title: pvAny(p.title, sc, root), acts: pvControls(p.actions, sc, root), scrollId: P(p.scrollId),
|
|
60
|
+
trail: p.trail && p.trail.map(function (item) { return { label: P(item.label), act: item.act, data: pvArgs(item.args, sc, root) }; }),
|
|
61
|
+
top: (p.topSlot ? pdlSlot(P(p.topSlot)) : '') + (p.top ? pvBlocks(p.top, sc, root) : ''),
|
|
62
|
+
body: (p.slot ? pdlSlot(P(p.slot)) : '') + (bar ? listBar({ key: bar.key, note: P(bar.note), items: bar.items.filter(function (x) { return pvOk(x.when, sc, root); }).map(function (x) { return { key: x.key, html: pvControl(x.control, sc, root), span: x.span || 's', anchor: x.anchor || 'start' }; }) }) : '') + (p.body ? listWrap(pvBlocks(p.body, sc, root)) : ''),
|
|
63
|
+
foot: p.foot && pvOk(p.foot.when, sc, root) ? navItem(P(p.foot.to), P(p.foot.icon), P(p.foot.label), P(p.foot.trail), p.foot.key) : '' });
|
|
64
|
+
};
|
|
65
|
+
/* 边缘把手:收起的一栏在内容边上留一个竖向小把手(左栏向左、工作台向右),点一下放回来。
|
|
66
|
+
和抽屉标签同一种面、阴影和悬停展宽;放在页面里,位置贴着主窗口的边。 */
|
|
67
|
+
PDL_COMPONENTS.edgeHandle = function (p, sc, root) {
|
|
68
|
+
const P = function (x) { return pv(x, sc, root); }, side = P(p.side) === 'start' ? 'start' : 'end';
|
|
69
|
+
return '<button type="button" class="edge-handle edge-handle--' + side + '" data-act="' + h(P(p.act)) + '" aria-label="' + h(pvText(p.label, sc, root)) + '" data-tip="' + h(pvText(p.tip || p.label, sc, root)) + '">' + icon(P(p.icon), 12) + '</button>';
|
|
70
|
+
};
|
|
71
|
+
PDL_COMPONENTS.navShell.catalog = { g: 'structure', props: { label: '$.label', title: '$.label', scrollId: { lit: 'cat-nav-scroll' }, body: [{ type: 'text', variant: 'para', text: '$.sub' }] } }; /* 静态示例:真的侧栏里的操作会作用到整页 */
|
|
72
|
+
/* 未保存确认:本身是一个声明了 focus + fixLayer 的弹窗 */
|
|
73
|
+
POPUPS.confirm = function () {
|
|
74
|
+
if (!S.popConfirm) return '';
|
|
75
|
+
return dialogHtml({ key: 'confirm', alert: true, title: tc('pop.dirtyTitle'), text: h(tc('pop.dirtyText')), /* 同一个对话框组件(标题 + × + 正文 + 底部按钮),不另写一份 */
|
|
76
|
+
acts: [[tc('pop.keepEditing'), { act: 'close', data: ' data-path="s.popConfirm" data-autofocus="1"' }], [tc('pop.discard'), { primary: true, danger: true, act: 'popDiscard' }]] });
|
|
77
|
+
};
|
|
78
|
+
/* 取消按钮:和 × 一样走 popClose(离开检查);默认焦点在它上面(安全的那个),除非弹窗声明 focus: 'confirm' */
|
|
79
|
+
function popCancel(k, focus) { return btn(tc('common.cancel'), { act: 'close', data: ' data-popup="' + k + '"' + (focus === 'confirm' ? '' : ' data-autofocus="1"') }); }
|
|
80
|
+
/* × 按钮:弹窗唯一的 ×,只在弹窗声明了 exit: x 时画 */
|
|
81
|
+
function popX(k) { return popExits(k, 'x') ? btn(tc('common.close'), { iconOnly: true, icon: 'close', sm: true, act: 'close', data: ' data-popup="' + k + '"' }) : ''; }
|
|
82
|
+
/* 内置容器的画法(区域引擎):窄栏、侧栏、身体(主区 + 工作台的分栏)、主区(页面容器的栈顶)、工作台(标签式容器) */
|
|
83
|
+
CT_DRAW.rail = function () { return { key: 'rail', html: rail(), col: 'var(--rail-w)' }; };
|
|
84
|
+
CT_DRAW.nav = function () { const sp = space(), html = NAV_OVERRIDE[sp] ? NAV_OVERRIDE[sp]() : ''; return html ? { key: 'nav', html: html, col: 'var(--nav-w, var(--nav-w0))', drawer: true } : null; };
|
|
85
|
+
CT_DRAW.main = function () {
|
|
86
|
+
const c = ctPages(), s = navStack(c), top = s[s.length - 1], fr = navNodeOf(top), focus = !!(fr && fr.focus);
|
|
87
|
+
if (CT_DRAW.main.hidden()) return { key: 'main', html: '<div class="main-col scroll" data-okey="main" data-c="' + c + '"' + ctGridAttr('main') + '>' + projSlots(s.concat(navKeptLayers(c))).map(projTag).join('') + '</div>', col: 'minmax(0, 1fr)' }; /* 铺开的工作台盖住主区:主区的层整个按盖住的层留着,不画也不读 */
|
|
88
|
+
if (focus) PROJ_FOCUS = true; /* 声明了 focus 的插件界面框:遮罩在它下面 */
|
|
89
|
+
const html = '<div class="layer' + (focus ? ' occ' : '') + '" data-layer="' + top.id + '" data-lc="' + c + '">' + navWith(c, top, function () { const bk = navBackOf(c); return backIn(bk ? bk.role : 'page', bk, function () { return layerExit(c, top) + projFrame(top); }); }) + '</div>' + projSlots(s.slice(0, -1).concat(navKeptLayers(c))).map(projTag).join(''); /* 被盖住的层 + 切走的兄弟(别的页面、别的空间的页面):隐藏着留在页面容器里 */
|
|
90
|
+
if (space() !== panelSpace()) return { key: 'main', html: html, col: 'minmax(0, 1fr)', bare: true };
|
|
91
|
+
return { key: 'main', html: '<div class="main-col scroll" data-okey="main" data-c="' + c + '"' + ctGridAttr('main') + '>' + html + '</div>', col: 'minmax(0, 1fr)' };
|
|
92
|
+
};
|
|
93
|
+
CT_DRAW.main.hidden = function () { return !!S.panelWide && CT_DRAW.panel.open(); };
|
|
94
|
+
/* 区域的宽窄(分栏按它收起):工作台没放大、或者里面两项并排时是窄的;主区跟着窗口(VIEWPORT.narrow) */
|
|
95
|
+
function regionNarrow(r) { return r === 'panel' && (!S.panelWide || !!navTabs(r).split); }
|
|
96
|
+
/* 临时投影的关闭仍走原有出栈和离开检查;界面只画一个通用图标按钮。 */
|
|
97
|
+
function layerExit(c, l) { return (l.exit || []).indexOf('x') >= 0 ? '<div class="layer-exit">' + btn(tc('common.close'), { iconOnly: true, icon: 'close', act: 'back', data: ' data-c="' + h(c) + '" data-exit="x"' }) + '</div>' : ''; }
|
|
98
|
+
ENGINE_PARTS.layerExit = layerExit;
|
|
99
|
+
onStart('boot', function () { KEY_FNS.push(function (e) { const c = navFocusC(); if (e.key !== 'Escape' || (navTop(c).exit || []).indexOf('esc') < 0) return false; e.preventDefault(); navBack(c); return true; }); });
|
|
100
|
+
/* 身体:主区 + 工作台的分栏(主区自己是主窗口的面:不分栏时 .main 就是它,带主窗口的背景图)(工作台所在的空间里),被覆盖时画覆盖它的那一层;别的空间里主区直接放在里面 */
|
|
101
|
+
CT_DRAW.body = function (kids, base, covered) {
|
|
102
|
+
const head = '<main class="main' + (covered || space() === panelSpace() ? ' split-host' : ' scroll') + '" id="main" data-c="body"' + ctGridAttr(covered || space() === panelSpace() ? 'body' : 'main') + regionAttrs('main') + (space() !== panelSpace() && !covered ? ' data-bg-owner="' + h(ctPages()) + '"' : '') + '>';
|
|
103
|
+
if (covered) return { key: 'body', html: head + kids.map(ctKid).join('') + '</main>', col: 'minmax(0, 1fr)' };
|
|
104
|
+
if (space() !== panelSpace()) return { key: 'body', html: head + '<div class="layer" data-layer="' + base + '">' + kids.map(ctKid).join('') + '</div></main>', col: 'minmax(0, 1fr)' };
|
|
105
|
+
const L = pdlLayout(), panel = kids.find(function (x) { return x.key === 'panel'; });
|
|
106
|
+
const order = (ctNode('body').kids || []).map(function (n) { return n.key; }), panelFirst = order.indexOf('panel') >= 0 && order.indexOf('panel') < order.indexOf('main'); /* 顺序来自容器树(工作台收起时也留着) */
|
|
107
|
+
const extra = kids.filter(function (x) { return x.key !== 'main' && x.key !== 'panel'; }), cols = extra.length ? ' data-cols style="--split-cols:' + kids.map(function (x) { return x.key === 'panel' ? 'var(--ws-w, min(var(--span-7), 44%))' : x.col || 'auto'; }).join(' ') + '"' : '';
|
|
108
|
+
void L;
|
|
109
|
+
return { key: 'body', html: head + '<div data-ocontainer="main.split" data-layer="' + base + '" class="split' + (panel ? ' has-panel' : '') + (panelFirst ? ' panel-first' : '') + (panel && S.panelWide ? ' wide' : '') + '"' + cols + '>' + kids.map(ctKid).join('') + '</div></main>', col: 'minmax(0, 1fr)' };
|
|
110
|
+
};
|
|
111
|
+
CT_DRAW.panel = function () {
|
|
112
|
+
if (!CT_DRAW.panel.open()) return null;
|
|
113
|
+
const html = panelHtml(); return html ? { key: 'panel', html: html, col: 'var(--ws-w, min(var(--span-7), 44%))' } : null;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
CT_DRAW.panel.open = function () { return space() === panelSpace() && !!S.panel && REGION_TABS.panel.visible(S.panel); }; /* 工作台这一次画不画 */
|
|
117
|
+
CT_DRAW.panel.closed = function () { return space() === panelSpace() && !CT_DRAW.panel.open(); }; /* 在工作台所在的空间里、收着(这时才有菜单条和把手) */
|
|
118
|
+
/* 拖动入口时出现的“移出”区 */
|
|
119
|
+
/* 编辑布局的编辑条:一个普通的非模态弹窗框架(PDL_POPUPS.editbar,Esc、×、拖动都来自框架):只有标题和 ×,Esc 或 × 结束编辑;不写说明——晃动本身就说明“可以编辑” */
|
|
120
|
+
POPUPS.editbar = function () { return S.editLayout ? '<div class="edit-bar" role="dialog" aria-label="' + h(tc('pdlDoc.editing')) + '"><span class="edit-bar-t">' + h(tc('pdlDoc.editing')) + '</span>' + popX('editbar') + '</div>' : ''; };
|
|
121
|
+
/* 编辑布局里悬停的叶子:它的公开名字 + 复制定位(唯一 / 同名的都算;插槽里的入口只有一种) */
|
|
122
|
+
ENGINE_PARTS.editLeaf = function (l) {
|
|
123
|
+
const copy = function (label, unique) { return btn(label, { iconOnly: true, icon: 'copy', sm: true, act: 'copy', data: ' data-v="' + h(JSON.stringify(pdlAnchorSpec(l, unique))) + '"' }); };
|
|
124
|
+
return '<code>' + h(l.name) + '</code>' + copy(tc('pdlDoc.copyUnique'), true) + (l.entry ? '' : copy(tc('pdlDoc.copyPlain'), false));
|
|
125
|
+
};
|
|
126
|
+
function dragBin(text) { return '<div id="pdl-bin" class="pdl-bin">' + icon('delete', 14) + h(text) + '</div>'; }
|
|
127
|
+
/* 用户加的容器:一个盒子(方向、在父容器里的份额),里面是放进来的入口;空不空交给引擎(容器的“没有内容时隐藏”),编辑布局时空盒子是虚线的落点 */
|
|
128
|
+
function projBox(k, n, kids, base) {
|
|
129
|
+
const slot = 'ct:' + k, ids = pdlKids(slot).filter(function (id) { return pdlEntry(id); });
|
|
130
|
+
const inner = kids.map(ctKid).join('') + '<div class="pdl-slot ct-slot" data-slot="' + slot + '">' + ids.map(function (id) { return pdlItem(id, slot); }).join('') + '</div>';
|
|
131
|
+
const empty = !kids.length && !ids.length;
|
|
132
|
+
return { key: k, html: '<div class="ct-box" data-c="' + h(k) + '" data-okey="' + h(k) + '" data-dir="' + (n.dir || 'column') + '"' + (base ? ' data-layer="' + base + '"' : '') + (S.editLayout ? ' data-edit="region"' : '') + '>' + inner + '</div>', col: CT_SPAN[n.span || 'fit'], empty: empty };
|
|
133
|
+
}
|
|
134
|
+
const CT_SPAN = { fit: 'auto', 1: 'minmax(0, 1fr)', 2: 'minmax(0, 2fr)', 3: 'minmax(0, 3fr)' };
|
|
135
|
+
ENGINE_PARTS.ctBox = projBox;
|
|
136
|
+
ENGINE_PARTS.dragBin = dragBin;
|
|
137
|
+
|
|
138
|
+
/* 容器底面:同一份结构参数用于内置表面、投影页和用户容器。只输出样式,不替换内容节点。 */
|
|
139
|
+
ENGINE_PARTS.ctSurfaceCss = function () {
|
|
140
|
+
const bg = bgState(), rules = [];
|
|
141
|
+
pdlTreeWalk(pdlTree(), function (n) {
|
|
142
|
+
const p = bg.planes[n.key], independent = p.mode === 'absolute';
|
|
143
|
+
const paint = bg.shell && independent ? 'linear-gradient(var(--glass-surface), var(--glass-surface)), var(--shell-img, var(--page-img))' : 'none';
|
|
144
|
+
rules.push('[data-c="' + CSS.escape(n.key) + '"], [data-bg-owner="' + CSS.escape(n.key) + '"] { --bg-veil:' + (bg.shell ? p.value : 100) + '%; --surface-paint:' + paint + '; --surface-content:' + (bg.shell && independent ? '""' : 'none') + '; --surface-blur:' + p.blur + 'px; --surface-filter:' + (independent ? 'blur(0px)' : p.blur ? 'blur(' + p.blur + 'px)' : 'none') + '; }');
|
|
145
|
+
});
|
|
146
|
+
return rules.join('\n');
|
|
147
|
+
};
|
|
148
|
+
/* ───────── 目录登记:这个文件里的组件 ───────── */
|
|
149
|
+
Object.assign(LIB_CATALOG, {
|
|
150
|
+
resizeHandle: { g: 'structure', inline: true, via: ['shell'], ex: function () { return '<div class="cat-rh">' + resizeHandle({ which: 'catalog', side: 'end', label: tc('catalog.ex.resize'), tip: tc('catalog.ex.resize') }) + '</div><span class="faint">' + h(tc('catalog.ex.resizeHint')) + '</span>'; } }
|
|
151
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* 边界:一个含义一个组件、不为接口定制、不按位置推导样式 */
|
|
2
|
+
/* 消息流:按单元逐步画出、刻度与刻度的键盘 */
|
|
3
|
+
'use strict';
|
|
4
|
+
/* 消息导航的键盘(组件库):焦点在一格刻度上时,上下、Home / End、翻页在刻度之间移动焦点(同一个 keyStep) */
|
|
5
|
+
KEY_FNS.push(function (e) {
|
|
6
|
+
const t = e.target; if (!t || !t.classList || !t.classList.contains('stream-tick')) return false;
|
|
7
|
+
const ticks = Array.from(document.querySelectorAll('button.stream-tick')), k = keyStep(e, ticks.indexOf(t), ticks.length, { page: true });
|
|
8
|
+
if (k == null) return false; e.preventDefault(); ticks[k].focus(); return true;
|
|
9
|
+
});
|
|
10
|
+
/* 消息导航的当前位置(组件库):消息在消息流的视口里时,导航里对应的那一格带 data-vis(高亮)。由视口观察驱动,不在滚动事件里逐帧量;
|
|
11
|
+
观察器跟着消息流走:消息流、消息、刻度进了文档时由引擎的进树通知(treeMatch)接上。只改刻度上的一个属性,不重画 */
|
|
12
|
+
const TICK_VIS = new Set(), TICK_IO = { io: null, root: null, inter: new Set() };
|
|
13
|
+
function tickVisMark(mid) {
|
|
14
|
+
const on = Array.from(TICK_IO.inter).some(function (m) { return m.isConnected && m.dataset.mid === mid; });
|
|
15
|
+
if (on) TICK_VIS.add(mid); else TICK_VIS.delete(mid);
|
|
16
|
+
document.querySelectorAll('.stream-tick[data-mid="' + CSS.escape(mid) + '"]').forEach(function (t) { t.toggleAttribute('data-vis', on); });
|
|
17
|
+
}
|
|
18
|
+
function tickVisRoot(s) {
|
|
19
|
+
if (!s || TICK_IO.root === s) return;
|
|
20
|
+
if (TICK_IO.io) TICK_IO.io.disconnect();
|
|
21
|
+
TICK_IO.root = s; TICK_IO.inter.clear(); TICK_VIS.clear();
|
|
22
|
+
TICK_IO.io = new IntersectionObserver(function (es) {
|
|
23
|
+
const mids = {};
|
|
24
|
+
es.forEach(function (e) { if (e.isIntersecting && e.target.isConnected) TICK_IO.inter.add(e.target); else TICK_IO.inter.delete(e.target); mids[e.target.dataset.mid] = 1; });
|
|
25
|
+
Object.keys(mids).forEach(tickVisMark);
|
|
26
|
+
}, { root: s });
|
|
27
|
+
s.querySelectorAll('[data-stream] > .stream-message[data-mid]').forEach(function (m) { TICK_IO.io.observe(m); });
|
|
28
|
+
}
|
|
29
|
+
/* 重画之后按记下的可见消息重新标刻度:可见性只改这一个属性、不写进 HTML——写进去的话,切一个工作台标签让消息流变窄一格,
|
|
30
|
+
视口里的消息就换了,下一次画出来的刻度 HTML 和上一次不同,整块主区跟着重画,滚一下就冒滚动条 */
|
|
31
|
+
PAINT_SYNC.push(function () { document.querySelectorAll('.stream-tick[data-mid]').forEach(function (t) { t.toggleAttribute('data-vis', TICK_VIS.has(t.dataset.mid)); }); });
|
|
32
|
+
treeMatch('#stream', tickVisRoot);
|
|
33
|
+
treeMatch('#stream [data-stream] > .stream-message[data-mid]', function (m) { const s = m.closest('#stream'); if (s !== TICK_IO.root) tickVisRoot(s); else TICK_IO.io.observe(m); });
|
|
34
|
+
/* 视图引擎经组件库画的入口(PV_DRAW,见 engine/pdl-view.js) */
|
|
35
|
+
/* 同一条回复在流式输出和落定时沿用消息编号,保持 DOM 位置。 */
|
|
36
|
+
function streamUnitKey(it) { return it && it.mid != null ? String(it.mid) : null; }
|
|
37
|
+
function streamNodeKey(n) { return n.nodeType === 1 ? n.dataset.run || n.dataset.mid || null : null; }
|
|
38
|
+
OWN.stream = pdlUnitsOwn(streamNodeKey, {
|
|
39
|
+
start: function (live, next, old) {
|
|
40
|
+
return { hadTyping: old.has('typing') || Array.prototype.some.call(live.children, function (c) { return c.dataset.mid === 'typing'; }),
|
|
41
|
+
had: Array.prototype.some.call(next.children, function (n) { const k = streamNodeKey(n); return k && n.dataset.mid !== 'typing' && old.has(k); }) };
|
|
42
|
+
},
|
|
43
|
+
kept: function (o) { o.classList.remove('arrive'); },
|
|
44
|
+
added: function (n, o, c) { if (!o && c.had && !pdlUnitsFilling() && (n.dataset.mid === 'typing' || !c.hadTyping)) n.classList.add('arrive'); }
|
|
45
|
+
});
|
|
46
|
+
/* 消息导航:一格一个单元,按消息 id */
|
|
47
|
+
OWN.ticks = pdlUnitsOwn(function (n) { return n.nodeType === 1 ? n.dataset.mid || null : null; });
|
|
48
|
+
Object.assign(PV.units, { stream: 1, ticks: 1 });
|
|
49
|
+
|
|
50
|
+
PDL_COMPONENTS.hlEarlier = function (p) {
|
|
51
|
+
if (!p) return '';
|
|
52
|
+
const loadLabel = p.label;
|
|
53
|
+
return '<div class="hl-earlier"' + (p.loading || p.manual ? '' : ' data-auto="1"') + '>' +
|
|
54
|
+
(p.loading
|
|
55
|
+
? '<span class="hl-earlier-loading" role="status">' + loadingGlyph('wait') + '<span>' + h(p.loadingLabel) + '</span></span>'
|
|
56
|
+
: '<button type="button" class="hl-earlier-btn"' + actAttrs(p.act) + ' aria-label="' + h(loadLabel) + '" data-tip="' + h(loadLabel) + '">' + loadingGlyph('wait') + '</button>') +
|
|
57
|
+
'</div>';
|
|
58
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/* 边界:一个含义一个组件、不为接口定制、不按位置推导样式 */
|
|
2
|
+
/* 标签式容器(工作台):标签条、启动面板、菜单、固定、收起的竖条、全部标签、并排 */
|
|
3
|
+
'use strict';
|
|
4
|
+
/* 工作台区域的外框:专注头、启动面板(工具 + 文件搜索)、并排、每个工具的加载 / 失败 / 过期 / 空状态(状态由组件库统一给出,文案来自 WS_SIMS 数据) */
|
|
5
|
+
/* ───────────── 面板外壳 ───────────── */
|
|
6
|
+
function wsHeadHtml() { return rtFocusHead('panel') || rtChrome('panel'); }
|
|
7
|
+
/* 专注头(区域声明 chrome.focus:什么时候出现 when、名字后的后缀、头上的操作——操作自己也可以带 when):当前项的图标 + 名字 + 后缀 · 空白 · 声明的操作。
|
|
8
|
+
什么时候换成专注头、头上有哪些操作都是声明 */
|
|
9
|
+
function rtFocusHead(r) {
|
|
10
|
+
const fc = rtCfg(r).focus; if (!rtWhen(fc, r)) return '';
|
|
11
|
+
const b = REGION_TABS[r], cur = navTabCur(r), vm = rtVM(r);
|
|
12
|
+
return '<div class="panel-head ws-head"' + rtToolsAttr(r) + (cur === rtHome(r) && fc.note ? ' data-note="' + fc.note + '"' : '') + '><span class="ws-focus-t">' + icon(b.icon(cur), 15) + h(b.title(cur)) + '<span class="faint">' + h(fc.suffix) + '</span></span><span class="grow"></span>' +
|
|
13
|
+
(fc.actions || []).filter(function (a) { return pvOk(a.when, vm, vm); }).map(function (a) { return btn(a.label, { sm: true, act: a.act, data: argAttrs(a.args) }); }).join('') + '</div>';
|
|
14
|
+
}
|
|
15
|
+
/* 区域的工具插槽(布局声明 chrome.tools):头和启动面板是它的落点(编辑布局时把页面入口拖进来,引擎按 data-tools 认) */
|
|
16
|
+
function rtToolsAttr(r) { const t = rtCfg(r).tools; return t ? ' data-tools="' + h(t) + '"' : ''; }
|
|
17
|
+
/* 已有内容绑定同时作为页面入口;菜单只保存入口的摆放,不再自带一份不可移动的工具清单。 */
|
|
18
|
+
/* 标签式容器的工具菜单的默认内容:每个登记了菜单分组的面板一个入口节点(others:主题别处已经有打开它的入口的,不再生成第二份) */
|
|
19
|
+
function pdlPanelEntries(r, others) {
|
|
20
|
+
return Array.from(VIEW_ENTRIES.values()).filter(function (v) { return v.group && v.places.includes(r); }).map(function (v) {
|
|
21
|
+
const k = v.id;
|
|
22
|
+
if (Object.keys(others || {}).some(function (id) { return (others[id].open || {}).node === k; })) return null; /* 已有入口的内容不再生成第二份入口。 */
|
|
23
|
+
const id = 'ws.' + k;
|
|
24
|
+
PAGES[id] = function () { return '<div class="page">' + rtBody(r, k, function () { return REGION_TABS[r].view(k); }, ctPages()) + '</div>'; };
|
|
25
|
+
return { id: id, title: v.title, icon: v.icon, open: { page: id, node: k } };
|
|
26
|
+
}).filter(Boolean);
|
|
27
|
+
}
|
|
28
|
+
function rtToolAttrs(k) { return ' data-k="' + h(k) + '"' + (S.editLayout ? ' data-edit="tool"' : ''); }
|
|
29
|
+
/* 菜单里的一项:一行 lrow(小行),放在格子里;行尾一个图钉(固定这一项)。菜单和首页的“最近打开”画同一种行 */
|
|
30
|
+
function rtToolRow(r, k) { const d = VIEW_ENTRIES.get(k), title = pdlText(d.title), about = pdlText(d.about || ''), b = REGION_TABS[r]; return lrow({ layout: 'record', hook: 'ws-tool' + (rtHas(r, k) ? ' open' : ''), rootAttrs: rtToolAttrs(k), act: 'wsTool', data: ' data-k="' + h(k) + '"', headAttrs: ' data-tip="' + h(about) + (rtHas(r, k) ? tc('frame.alreadyOpen') : '') + '"', cur: rtHas(r, k), lead: icon(d.icon, 15), title: h(title), actsHtml: b && b.acts ? pvControls(b.acts(k), {}, {}) : '' }); }
|
|
31
|
+
function wsLauncher() {
|
|
32
|
+
const q = S.wsQ.trim().toLowerCase(), r = 'panel', menu = rtMenuItems(r), tool = function (k) { return rtToolRow(r, k); }; /* 菜单里的项和顺序(固定的在前,其余按分组、名字) */
|
|
33
|
+
let body = '';
|
|
34
|
+
if (q) {
|
|
35
|
+
const tools = menu.filter(function (k) { const d = VIEW_ENTRIES.get(k); return (pdlText(d.title) + pdlText(d.about || '')).toLowerCase().includes(q); });
|
|
36
|
+
const byName = (REGION_TABS[r].files ? REGION_TABS[r].files() : []).filter(function (f) { return f.p.toLowerCase().split('/').pop().indexOf(q) >= 0; });
|
|
37
|
+
const byBody = (REGION_TABS[r].files ? REGION_TABS[r].files() : []).filter(function (f) { return byName.indexOf(f) < 0 && f.body.toLowerCase().indexOf(q) >= 0; });
|
|
38
|
+
const fileRow = function (f, snip) { return lrow({ layout: 'record', hook: 'ws-res', act: 'wsFile', data: ' data-p="' + h(f.p) + '"', lead: icon('file', 14), title: h(f.p.split('/').pop()), sub: '<span class="mono">' + h(snip ? wsSnippet(f.body, q) : f.p) + '</span>' }); };
|
|
39
|
+
body = (tools.length ? lrSection(tc('frame.tools'), '', { v: 'float' }) + '<div class="ws-grid">' + tools.map(tool).join('') + '</div>' : '') +
|
|
40
|
+
(byName.length ? lrSection(tc('frame.byName', byName.length), '', { v: 'float' }) + byName.slice(0, 5).map(function (f) { return fileRow(f); }).join('') : '') +
|
|
41
|
+
(byBody.length ? lrSection(tc('frame.byBody', byBody.length), '', { v: 'float' }) + byBody.slice(0, 5).map(function (f) { return fileRow(f, true); }).join('') : '') +
|
|
42
|
+
((byName.length > 5 || byBody.length > 5) ? btn(tc('frame.viewAll', byName.length + byBody.length), { link: true, cls: 'ws-all', act: 'open', data: ' data-node="files" data-anchor="panel"' }) : '') +
|
|
43
|
+
(!tools.length && !byName.length && !byBody.length ? '<div class="u-p-m empty">' + h(tc('frame.noResults', S.wsQ.trim())) + '</div>' : '');
|
|
44
|
+
} else {
|
|
45
|
+
body = rtGroups().map(function (g) {
|
|
46
|
+
const ks = menu.filter(function (k) { return rtGroupOf(k) === g[0]; });
|
|
47
|
+
return ks.length ? lrSection('', '', { v: 'float', html: pdlText(g[1]) }) + '<div class="ws-grid">' + ks.map(tool).join('') + '</div>' : ''; /* 空的分组不画(和所有空分区同一条规则) */
|
|
48
|
+
}).join('');
|
|
49
|
+
}
|
|
50
|
+
return floatHtml({ cls: 'ws-pop ws-launcher', label: tc('frame.launcher'), attrs: rtToolsAttr(r) + (S.panel === rtHome('panel') ? ' data-note="3"' : ''), head: search('ws-q', tc('frame.launcherSearch'), S.wsQ, 'wsQ', 'ws-q') + popX('ws.launcher'), body: body }); /* 面(阴影)和滚动分两层;搜索头留在滚动外;头上的图钉固定整个菜单(右边缘的菜单条) */
|
|
51
|
+
}
|
|
52
|
+
PDL_COMPONENTS.tabPicker = function (p) {
|
|
53
|
+
return floatHtml({ cls: 'ws-pop ws-launcher', label: p.label, body: '<div class="ws-grid">' + p.items.map(function (item) {
|
|
54
|
+
return btn(item.label, { act: item.act, data: argAttrs(item.args), current: item.current, link: true, sm: true });
|
|
55
|
+
}).join('') + '</div>' });
|
|
56
|
+
};
|
|
57
|
+
POPUPS['ws.launcher'] = function () { return rtWhen(rtCfg('panel').launcher, 'panel') ? wsLauncher() : ''; }; /* 贴着打开它的按钮:工作台头上的 + */
|
|
58
|
+
/* 工作台首页:最近打开的几项(还没有打开过时按菜单的顺序),下面接绑定方给首页的内容(比如最近的作品)。全部工具在 + 的菜单里 */
|
|
59
|
+
const RT_HOME_RECENT = 6;
|
|
60
|
+
function rtHomeRecent(r) {
|
|
61
|
+
const menu = rtMenuItems(r), seen = (rtMenuSt(r).recent || []).filter(function (k) { return menu.indexOf(k) >= 0; }); /* 旧的本地记录里没有 recent */
|
|
62
|
+
const ks = (seen.length ? seen : menu).slice(0, RT_HOME_RECENT);
|
|
63
|
+
return ks.length ? '<div class="ws-recent"' + rtToolsAttr(r) + '>' + section({ title: tc('frame.recentOpened'), body: '<div class="ws-grid">' + ks.map(function (k) { return rtToolRow(r, k); }).join('') + '</div>' }) + '</div>' : ''; /* 和下面的小节同一种标题 */
|
|
64
|
+
}
|
|
65
|
+
function wsSnippet(body, q) { const i = body.toLowerCase().indexOf(q); const s = Math.max(0, i - 18); return (s ? '…' : '') + body.slice(s, i + q.length + 30).replace(/\n/g, ' ') + '…'; }
|
|
66
|
+
function panelHtml() {
|
|
67
|
+
const r = 'panel', b = REGION_TABS[r], ts = navTabs(r);
|
|
68
|
+
if (!b.exists(navTabCur(r))) rtShow(r, rtHome(r));
|
|
69
|
+
rtSplitSync(r);
|
|
70
|
+
const cur = navTabCur(r); rtEnsure(r, cur);
|
|
71
|
+
if (b.before) b.before();
|
|
72
|
+
return '<aside class="panel ws" data-okey="panel" data-c="' + r + '"' + (S.editLayout ? ' data-edit="region"' : '') + ' aria-label="' + h(tc('frame.workbench')) + '">' + resizeHandle({ which: 'panel', side: pdlLayout().order.indexOf('panel') < pdlLayout().order.indexOf('main') ? 'end' : 'start', label: tc('frame.panelDivider'), tip: tc('frame.navResizeTip') }) +
|
|
73
|
+
wsHeadHtml() + rtNotice(b.notice ? b.notice() : null) + rtPanes(r) + '</aside>';
|
|
74
|
+
}
|
|
75
|
+
/* 区域的框架提示(绑定方给 { tone, text, act }):组件库的提示条,“知道了”执行 act */
|
|
76
|
+
function rtNotice(n) { return n ? '<div class="ws-fnotice">' + notice({ tone: n.tone, text: n.text, action: btn(tc('common.gotIt'), { sm: true, act: n.act, data: ' data-v=""' }) }) + '</div>' : '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* 摆放引擎的画法:被占用区域、插槽里的入口、页面元素插槽、工作台里的页面工具;区域运行时(标签条、放不下的标签、返回)。pdl.js 只留描述数据和摆放逻辑 */
|
|
80
|
+
/* 插槽里进来的每个入口都叠加插槽声明的操作(比如设置菜单的“固定到窄栏”) */
|
|
81
|
+
const ITEM_ACTIONS = {
|
|
82
|
+
pin: function (id) {
|
|
83
|
+
const on = pdlInRail(id), t = pdlText(pdlEntry(id).title);
|
|
84
|
+
return btn(tc(on ? 'frame.unpinRailNamed' : 'frame.pinRailNamed', t), { size: 'xs', iconOnly: true, cls: 'nav-pin', icon: 'pin', act: 'rail', data: argAttrs({ k: id }), pressed: on, tip: tc(on ? 'frame.unpinRail' : 'frame.pinRail') });
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function pdlItem(id, slot) {
|
|
88
|
+
const e = pdlEntry(id), disp = PDL_SLOTS[slot].display;
|
|
89
|
+
if (!e) return '';
|
|
90
|
+
if (!pdlWhen(e.when) || pdlNodeHidden(id)) return '';
|
|
91
|
+
/* 平时什么都不能拖;编辑布局时只有导航结构里的入口能拖(页面内容不在范围里) */
|
|
92
|
+
const title = pdlText(e.title), cur = pdlCur(id), data = ' data-act="open" data-ref="' + id + '" data-entry="' + id + '" data-from="' + slot + '"' + (S.editLayout && e.movable !== false ? ' data-edit="entry"' : '');
|
|
93
|
+
const n = e.badge && BADGES[e.badge] ? BADGES[e.badge]() : null; /* 入口的计数(数据给的):窄栏是角上的点,行是行尾的数 */
|
|
94
|
+
let html;
|
|
95
|
+
if (disp === 'mark') html = '<button type="button" class="rail-mark"' + data + ' aria-label="' + h(title) + '" data-tip="' + h(title) + '"><img src="' + asset(e.asset) + '" alt=""></button>';
|
|
96
|
+
else if (disp === 'icon') {
|
|
97
|
+
const dot = e.badge && BADGES[e.badge] ? badge(n, { corner: true }) : '';
|
|
98
|
+
html = '<button type="button" class="rail-btn' + (S.justAdded && S.justAdded === id ? ' arrive' : '') + '"' + data + ' aria-label="' + h(title) + '" data-tip="' + h(title) + '"' + (cur ? ' aria-current="page"' : '') + '>' + icon(e.icon, 20) + dot + '</button>';
|
|
99
|
+
} else html = navRow({ label: title, icon: e.icon, attrs: data, current: cur, trail: n ? '<span class="trail">' + badge(n) + '</span>' : '' });
|
|
100
|
+
const acts = PDL_SLOTS[slot].itemActions || [];
|
|
101
|
+
return acts.length ? '<div class="nav-row" data-entry="' + id + '" data-from="' + slot + '">' + html + acts.map(function (a) { return ITEM_ACTIONS[a] ? ITEM_ACTIONS[a](id) : ''; }).join('') + '</div>' : html;
|
|
102
|
+
}
|
|
103
|
+
function pdlSlot(slot, p) {
|
|
104
|
+
const list = pdlNodeHidden(slot) ? [] : pdlKids(slot);
|
|
105
|
+
/* 分组标题:编辑布局时可以拖动调整分组顺序(标题带着它下面的入口一起走)、可以改名 */
|
|
106
|
+
const head = function (id) {
|
|
107
|
+
const ed = S.editLayout;
|
|
108
|
+
const label = pdlHeadLabel(id);
|
|
109
|
+
const edit = ed && typeof inlineEditReg === 'function' ? inlineEditReg({ key: 'navHead:' + id, value: label, act: 'rename', args: { entity: 'navHead', id: id }, label: tc('pdlDoc.renameTitle') }) : null;
|
|
110
|
+
return lrSection(label, ed ? btn(tc('common.rename'), { sm: true, iconOnly: true, icon: 'pen', act: 'rename', cls: 'pdl-head-act', data: argAttrs({ entity: 'navHead', id: id }) }) : '', { v: 'nav', edit: edit, attrs: ' data-head="' + h(id) + '" data-from="' + slot + '"' + (ed ? ' data-edit="head"' : '') });
|
|
111
|
+
};
|
|
112
|
+
return '<div class="pdl-slot" data-slot="' + slot + '">' + list.map(function (id) { return id[0] === '#' ? head(id) : pdlItem(id, slot); }).join('') + '</div>';
|
|
113
|
+
}
|
|
114
|
+
/* 页面插槽里的元素(输入框工具、消息操作……):一个图标按钮(组件库的 btn)。和状态的绑定都写在入口的声明里(不读应用的状态、不认动作名):
|
|
115
|
+
open.args 里的 @字段 取这一处的上下文(视图模型给的 ctx);pressed = { when: '@字段', title, icon }:条件成立时按下(aria-pressed),名字 / 图标换成它的;
|
|
116
|
+
arrive('@字段')成立时播一次到达;打开菜单的(open.action = menu)带上右键找菜单的标记 */
|
|
117
|
+
function pdlItemBtn(e, c) {
|
|
118
|
+
const pr = e.pressed && pvOk(e.pressed.when, c, c) ? e.pressed : null, a = e.open.action || 'open';
|
|
119
|
+
return btn(pdlText(pr && pr.title || e.title), { iconOnly: PDL_SLOTS[c.slot].display === 'icon', sm: true, icon: pr && pr.icon || e.icon, act: a, danger: e.tone === 'danger' || !!e.danger, pressed: pr ? true : null, cls: e.arrive && pvOk(e.arrive, c, c) ? 'arrive' : '',
|
|
120
|
+
data: argAttrs(e.open.action ? pvArgsObj(e.open.args || {}, c, c) : { ref: c.id, entry: c.id, from: c.slot }) + (c.i != null ? ' data-i="' + c.i + '"' : '') + (a === 'menu' ? MENU_DECL : '') + (e.plugin ? ' data-plugin="' + e.plugin + '" data-entry="' + c.id + '"' : '') });
|
|
121
|
+
}
|
|
122
|
+
/* 页面插槽(输入框工具、消息操作):用户可以调整顺序(order[插槽]),可以整组或单项隐藏;编辑布局时每项包一层可拖的壳 */
|
|
123
|
+
function pdlTools(slot, c, cells) {
|
|
124
|
+
if (pdlNodeHidden(slot)) return '';
|
|
125
|
+
const items = pdlKids(slot).map(function (id) {
|
|
126
|
+
const e = pdlEntry(id); if (!e || !pdlWhen(e.when, c) || pdlNodeHidden(id) || !pdlEntryActionReady(e)) return null; /* when 里可以有对这一处上下文的条件(@字段,比如这条消息是不是成员发的) */
|
|
127
|
+
return { key: id, span: e.span || 's', html: pdlItemBtn(e, Object.assign({ id: id, slot: slot }, c)) };
|
|
128
|
+
}).filter(Boolean);
|
|
129
|
+
/* 消息操作这类独立的操作条是一排格子(编辑布局时可以放到任意一格);嵌在别的条里的一组工具就照顺序排 */
|
|
130
|
+
return cells ? cellsHtml({ key: slot, axis: 'row', items: items, saved: pdlCells(slot), edit: S.editLayout }) : items.map(function (x) { return x.html; }).join('');
|
|
131
|
+
}
|
|
132
|
+
/* 标签页上的操作和“关闭”:绑定的区域可以给一项自己的操作(工作台给的是“放到主窗口”),没给就用原来的固定。
|
|
133
|
+
都是组件库的 xs 图标按钮(不另写一种);就地操作,在弹窗里点它弹窗不关(stay) */
|
|
134
|
+
function rtTabActs(r, c, t, ti) {
|
|
135
|
+
const b = REGION_TABS[r];
|
|
136
|
+
const pinned = !!(b.pinned && b.pinned(t.k));
|
|
137
|
+
const pinBtn = b.canPin && b.canPin(t.k)
|
|
138
|
+
? btn(tc(pinned ? 'frame.unpinTab' : 'frame.pinTab'), { iconOnly: true, size: 'xs', icon: 'pin', pressed: pinned, act: 'tab', data: ' data-op="pin" data-r="' + r + '" data-k="' + h(t.k) + '" data-stay', aria: tc(pinned ? 'frame.unpinTabNamed' : 'frame.pinTabNamed', ti), tip: tc(pinned ? 'frame.unpinTab' : 'frame.pinTab') })
|
|
139
|
+
: '';
|
|
140
|
+
const own = b.acts ? pvControls(b.acts(t.k), {}, {}) : '';
|
|
141
|
+
return pinBtn + own +
|
|
142
|
+
btn(tc('common.close'), { iconOnly: true, size: 'xs', icon: 'close', act: 'tab', data: ' data-op="close" data-r="' + r + '" data-k="' + h(t.k) + '" data-stay', aria: tc('frame.closeNamed', ti) }); /* 就地操作(data-stay):在全部标签里点它不关 */
|
|
143
|
+
}
|
|
144
|
+
/* A toolbar can accept the same placement command offered by a tab's button.
|
|
145
|
+
Home can be placed too, but has no order key and stays at the start of the strip. */
|
|
146
|
+
function rtDragAttrs(r, k) {
|
|
147
|
+
const action = REGION_TABS[r].acts?.(k);
|
|
148
|
+
return action?.act ? ' data-drag-act="' + h(action.act) + '"' + argAttrs(action.args) : '';
|
|
149
|
+
}
|
|
150
|
+
function rtChip(r, t) {
|
|
151
|
+
const b = REGION_TABS[r], ts = navTabs(r), on = t.k === navTabCur(r), side = !!ts.split && (ts.split.left === t.k || ts.split.right === t.k), ti = b.title(t.k), pinned = !!(b.pinned && b.pinned(t.k));
|
|
152
|
+
return '<span class="ws-chip' + (t.preview ? ' preview' : '') + (side ? ' side' : '') + '" role="tab" aria-selected="' + on + '"' + (pinned ? ' data-pinned="true"' : '') + ' data-okey="' + h(t.k) + '" data-edit="order"' + rtDragAttrs(r, t.k) + '>' +
|
|
153
|
+
'<button type="button" class="ws-chip-t" data-drag-handle data-act="tab" data-op="show" data-r="' + r + '" data-k="' + h(t.k) + '" data-rt-tab="' + h(t.k) + '" data-tip="' + h(ti) + (t.preview ? tc('frame.previewTab') : '') + '">' +
|
|
154
|
+
(!on && pinned ? icon('pin', 11) : '') +
|
|
155
|
+
'<span class="ws-chip-l">' + h(ti) + '</span>' + (b.badge(t.k) ? badge(true, { tip: tc('frame.newActivity') }) : '') + '</button>' +
|
|
156
|
+
(on ? rtTabActs(r, rtCfg(r), t, ti) : '') + '</span>';
|
|
157
|
+
}
|
|
158
|
+
/* 控制条:标签条 + 区域动作(动作是布局数据里的控件) */
|
|
159
|
+
function rtChrome(r) {
|
|
160
|
+
const b = REGION_TABS[r], ts = navTabs(r), c = rtCfg(r), home = c.home, atHome = home && navTabCur(r) === home.key, tabs = rtShownTabs(r), notes = c.notes || {};
|
|
161
|
+
const homeTitle = home && b.title(home.key);
|
|
162
|
+
const homeChip = home ? '<span class="ws-chip" role="tab" aria-selected="' + atHome + '"' + (!S.editLayout ? ' data-edit="order"' + rtDragAttrs(r, home.key) : '') + '><button type="button" class="ws-chip-t" data-drag-handle data-act="tab" data-op="show" data-r="' + r + '" data-k="' + home.key + '" aria-label="' + h(homeTitle) + '" data-tip="' + h(homeTitle) + '">' + icon(b.icon(home.key), 14) + '</button></span>' : '';
|
|
163
|
+
const vm = rtVM(r);
|
|
164
|
+
/* 标签条是横向滚动的一行(组件库的 .scroll-x,两端渐隐),不估算放得下几个;当前标签由浏览器滚进视野(scroll-initial-target)。
|
|
165
|
+
有标签时末尾一个“全部标签”菜单,列出所有标签(放不下的也能从这里找到) */
|
|
166
|
+
return '<div class="panel-head ws-head"' + rtToolsAttr(r) + '><div class="ws-tabs" role="tablist" aria-label="' + h(tc('frame.openTabs')) + '"' + (atHome && notes.tabs ? ' data-note="' + notes.tabs + '"' : '') + '><div class="ws-strip scroll-x" data-drag-handles data-ocontainer="tabs.' + r + '" data-order-act="tab" data-op="order" data-r="' + r + '">' + homeChip + tabs.map(function (t) { return rtChip(r, t); }).join('') + '</div>' +
|
|
167
|
+
'</div>' +
|
|
168
|
+
'<span class="ws-headacts"' + (atHome && notes.actions ? ' data-note="' + notes.actions + '"' : '') + '>' + pvControls(c.actions || [], vm, vm) + '</span></div>';
|
|
169
|
+
}
|
|
170
|
+
/* ───────── 标签式容器组件自己的状态和操作─────────
|
|
171
|
+
引擎只有通用的标签栈(frame.js:打开、显示、关、固定、恢复、排序,每项自己的栈);全部标签、并排、批量关闭、菜单 / 菜单条 / 把手是这个组件的事,
|
|
172
|
+
登记进同一个动作 tab(TAB_OPS)。变化本身就是反馈,不弹提示;能撤回的给撤销提示 */
|
|
173
|
+
Object.assign(TAB_OPS, {
|
|
174
|
+
pin: function (d, r) { const b = REGION_TABS[r]; if (b && b.onPin) b.onPin(d.k); },
|
|
175
|
+
/* 并排先留出选择区;用户明确选定第二项才组成一对。 */
|
|
176
|
+
split: function (d, r) { const ts = navTabs(r); ts.split = ts.split ? null : { left: navTabCur(r), right: null }; render(true); },
|
|
177
|
+
splitPick: function (d, r) { const ts = navTabs(r); if (!ts.split || d.k === ts.split.left) return; ts.split.right = d.k; render(true); },
|
|
178
|
+
splitLeave: function (d, r) { navTabs(r).split = null; if (d.k) rtShow(r, d.k); render(true); },
|
|
179
|
+
});
|
|
180
|
+
RT_CLOSED.push(function (r) { rtSplitSync(r); });
|
|
181
|
+
/* 菜单、菜单条、把手:
|
|
182
|
+
菜单本身可以固定(默认固定,固定着就在主窗口右边缘画成一条浮着的菜单条);把手(右边缘的一个小标签,只负责打开区域,菜单不固定时也在)。
|
|
183
|
+
菜单里有哪些项由绑定方给(b.menu)。顺序按分组、组里按名字;分组按组名排,主题声明的最后一组是“其他”,永远在最后。菜单和菜单条是同一个顺序。
|
|
184
|
+
菜单状态是用户的偏好(这台设备上记着):{ 区域: { recent: [最近打开的项] } } */
|
|
185
|
+
S.rtMenu = store.get('rtMenu', {});
|
|
186
|
+
function rtMenuSt(r) { return S.rtMenu[r] || (S.rtMenu[r] = { recent: [] }); }
|
|
187
|
+
/* 记下最近打开的一项(组件自己的本地偏好,和固定放在一起):画工作台时当前项换了就记 */
|
|
188
|
+
function rtSeen(r, k) { const st = rtMenuSt(r), rc = st.recent || []; if (k === rtHome(r) || rc[0] === k || rtMenuItems(r).indexOf(k) < 0) return; st.recent = [k].concat(rc.filter(function (x) { return x !== k; })).slice(0, RT_HOME_RECENT); rtMenuSave(); }
|
|
189
|
+
/* 菜单的分组顺序:按组名;主题声明的最后一组(其他)永远在最后 */
|
|
190
|
+
function rtGroups() { const last = WS_GROUPS[WS_GROUPS.length - 1]; return WS_GROUPS.slice(0, -1).sort(function (a, b) { return String(pdlText(a[1])).localeCompare(String(pdlText(b[1])), i18nLang()); }).concat([last]); }
|
|
191
|
+
function rtMenuItems(r) {
|
|
192
|
+
const b = REGION_TABS[r]; if (!b || !b.menu) return [];
|
|
193
|
+
const available = b.menu(), gs = rtGroups().map(function (g) { return g[0]; });
|
|
194
|
+
const ks = pdlKids(rtCfg(r).tools).map(function (id) { return rtPageKey(r, id); }).filter(function (k) { return available.indexOf(k) >= 0; });
|
|
195
|
+
return ks.sort(function (x, y) { return gs.indexOf(rtGroupOf(x)) - gs.indexOf(rtGroupOf(y)) || String(b.title(x)).localeCompare(String(b.title(y)), 'zh'); });
|
|
196
|
+
}
|
|
197
|
+
function rtMenuSave() { store.set('rtMenu', S.rtMenu); }
|
|
198
|
+
/* 页面放进标签式容器(工具插槽 chrome.tools 里的页面入口、开到这个区域的页面入口):变成一项 pg.<入口>——标题、图标来自入口,分组是布局声明的 chrome.pageGroup,内容就是那一页。
|
|
199
|
+
引擎经 ENGINE_PARTS 调这几个(rtPage 登记并给出键、rtPageKey 只给键、rtPagePrune 拿掉不在插槽里的、rtPageEntry 从一项认回入口),不认识这种键 */
|
|
200
|
+
const RT_PAGE = 'pg.';
|
|
201
|
+
function rtPageKey(r, id) { const o = pdlEntry(id)?.open; return o ? o.node || RT_PAGE + id : null; }
|
|
202
|
+
/* 一项在菜单里的分组:它自己声明的分组(标签);主题里没有这个组就放进最后一组(其他),不悄悄消失 */
|
|
203
|
+
function rtGroupOf(k) { const g = VIEW_ENTRIES.get(k).group; return WS_GROUPS.some(function (x) { return x[0] === g; }) ? g : WS_GROUPS[WS_GROUPS.length - 1][0]; }
|
|
204
|
+
function rtPageEntry(r, k) { return pdlKids(rtCfg(r).tools).find(function (id) { return rtPageKey(r, id) === k; }); }
|
|
205
|
+
function rtPage(r, id) {
|
|
206
|
+
const e = pdlEntry(id), k = rtPageKey(r, id);
|
|
207
|
+
if (e.open.node) return k;
|
|
208
|
+
registerView({ id: k, title: e.title, icon: e.icon, group: e.group || rtCfg(r).pageGroup, about: tc('frame.openInWorkbench', e.title) });
|
|
209
|
+
return k;
|
|
210
|
+
}
|
|
211
|
+
function rtEntryOf(r, k) { return pdlEntryIds().find(function (id) { return rtPageKey(r, id) === k; }); }
|
|
212
|
+
function openTab(r, k, o) {
|
|
213
|
+
const id = rtEntryOf(r, k), target = id && pdlOpenOf(id);
|
|
214
|
+
if (!id) return rtReveal(r, k, o);
|
|
215
|
+
if (REGION_TABS[target.target]) return rtReveal(target.target, k, Object.assign({ from: null }, o));
|
|
216
|
+
pdlOpenSpec({ ref: id }, null);
|
|
217
|
+
if (o && o.args) { const c = ctPages(); navReplace(c, null, Object.assign({}, navTop(c).a, o.args)); navAfter(); }
|
|
218
|
+
}
|
|
219
|
+
function rtPagePrune(r, ids) {
|
|
220
|
+
rtTabs(r).slice().forEach(function (t) { const id = rtEntryOf(r, t.k); if (id && ids.indexOf(id) < 0) rtClose(r, t.k); });
|
|
221
|
+
VIEW_ENTRIES.forEach(function (_, k) { if (k.startsWith(RT_PAGE) && !ids.includes(k.slice(RT_PAGE.length))) VIEW_ENTRIES.delete(k); });
|
|
222
|
+
}
|
|
223
|
+
Object.assign(ENGINE_PARTS, { rtPage: rtPage, rtPageKey: rtPageKey, rtPageEntry: rtPageEntry, rtPagePrune: rtPagePrune, openTab: openTab, panelEntries: pdlPanelEntries });
|
|
224
|
+
function rtClosed(r) { return !!(CT_DRAW[r] && CT_DRAW[r].closed && CT_DRAW[r].closed()); } /* 这个区域在、但收着(区域的画法回答) */
|
|
225
|
+
/* 区域控制条的视图模型:区域自己的状态(菜单固定没有、收着没有、窄屏、在不在它的空间里)+ 应用给的(chromeVM)。菜单条 / 把手 / 入口 / 启动面板 / 专注头什么时候出现由布局声明的 when 决定 */
|
|
226
|
+
function rtVM(r) { const b = REGION_TABS[r]; return Object.assign({ closed: rtClosed(r), narrow: !!VIEWPORT.narrow, inSpace: space() === panelSpace() }, b && b.chromeVM ? b.chromeVM() : {}); }
|
|
227
|
+
function rtWhen(d, r) { if (!d) return false; const vm = rtVM(r); return pvOk(d.when, vm, vm); }
|
|
228
|
+
/* 把手:通用的侧边抽屉标签——贴在对话主窗口右边缘、上下居中的一小块浮层的面(外侧圆角、贴边那侧齐平),里面是区域声明的小图标(缺省 ‹)。
|
|
229
|
+
和菜单条是两个职责,各自按布局声明的 when 出现(缺省声明:工作台收着)。demo 只供组件目录展示。 */
|
|
230
|
+
function rtHandle(r, o) { const hd = rtCfg(r).handle; if (!hd || !(o && o.demo || rtWhen(hd, r))) return ''; return '<button type="button" class="rt-handle" data-act="' + hd.act + '"' + argAttrs(hd.args) + ' aria-label="' + h(pdlText(hd.label)) + '" data-tip="' + h(pdlText(hd.label)) + '">' + icon(hd.icon, 12) + '</button>'; }
|
|
231
|
+
const RT_CHROME = { handle: function (r, o) { return rtHandle(r, o); } }; /* PDL 的 app 控件({ type: 'app', name, region }):区域固定件的名字 → 画法 */
|
|
232
|
+
/* 全部标签(标签条放不下时从这里找):同一份数据的第三种画法 */
|
|
233
|
+
/* 画出来的标签:只画来源还在的(来源暂时不在时标签留在状态里,回来时照样显示) */
|
|
234
|
+
function rtShownTabs(r) { return rtTabs(r).filter(function (t) { return REGION_TABS[r].exists(t.k); }); }
|
|
235
|
+
/* 并排的生命周期属于标签管理组件;关闭一侧仍走同一个通用关闭动作。 */
|
|
236
|
+
function rtSplitSync(r) {
|
|
237
|
+
const ts = navTabs(r), pair = ts.split; if (!pair) return;
|
|
238
|
+
const has = function (k) { return k && (k === rtHome(r) || !!rtTab(r, k)); };
|
|
239
|
+
const left = has(pair.left), right = has(pair.right);
|
|
240
|
+
if (!left || pair.right && !right) { ts.split = null; const keep = left ? pair.left : right ? pair.right : null; if (keep) rtShow(r, keep); return; }
|
|
241
|
+
if (navTabCur(r) !== pair.left && navTabCur(r) !== pair.right) ts.split = null;
|
|
242
|
+
}
|
|
243
|
+
ENGINE_PARTS.tabVisible = function (r) { const p = navTabs(r).split; return p ? [p.left, p.right].filter(Boolean) : [navTabCur(r)]; };
|
|
244
|
+
/* 同一项在单栏和并排使用相同正文;只有并排容器增加边框和对称的标签头。 */
|
|
245
|
+
function rtPanes(r) {
|
|
246
|
+
const b = REGION_TABS[r], ts = navTabs(r), cur = navTabCur(r), home = rtHome(r), pair = ts.split;
|
|
247
|
+
const pane = function (k) { const sk = navTabKey(r, k), s = navStack(sk), top = s[s.length - 1]; return '<div class="panel-body scroll" data-layer="' + top.id + '" data-lc="' + h(sk) + '"' + ctGridAttr(r) + '>' + navWith(sk, top, function () { return rtBody(r, k, function () { return k === home ? rtHomeRecent(r) + b.view(k) : b.view(k); }); }) + '</div>'; };
|
|
248
|
+
rtSeen(r, cur);
|
|
249
|
+
const vis = ENGINE_PARTS.tabVisible(r), slots = [];
|
|
250
|
+
rtKeys(r).forEach(function (k) { const s = NAV.st[navTabKey(r, k)]; if (s) s.forEach(function (l, i) { if (i < s.length - 1 || vis.indexOf(k) < 0) slots.push(l); }); });
|
|
251
|
+
const rest = projSlots(slots).map(projTag).join('');
|
|
252
|
+
if (!pair) return pane(cur) + rest;
|
|
253
|
+
const framed = function (k, other) {
|
|
254
|
+
const close = k === home ? { op: 'splitLeave', k: other || '' } : { op: 'close', k: k };
|
|
255
|
+
return '<section class="ws-pane" data-pane="' + h(k) + '"><div class="panel-head">' + icon(b.icon(k), 14) + '<span class="grow">' + h(b.title(k)) + '</span>' + btn(tc('common.close'), { iconOnly: true, sm: true, icon: 'close', act: 'tab', data: argAttrs(Object.assign({ r: r }, close)) }) + '</div>' + pane(k) + '</section>';
|
|
256
|
+
};
|
|
257
|
+
const picker = '<section class="ws-pane"><div class="panel-head"><span class="grow">' + h(tc('frame.chooseSplit')) + '</span>' + btn(tc('common.cancel'), { iconOnly: true, sm: true, icon: 'close', act: 'tab', data: ' data-op="splitLeave" data-r="' + r + '"' }) + '</div><div class="panel-body scroll">' + rtKeys(r).filter(function (k) { return k !== pair.left; }).map(function (k) { return lrow({ layout: 'record', lead: icon(b.icon(k), 16), title: h(b.title(k)), act: 'tab', data: ' data-op="splitPick" data-r="' + r + '" data-k="' + h(k) + '"' }); }).join('') + '</div></section>';
|
|
258
|
+
return '<div class="ws-split">' + framed(pair.left, pair.right) + (pair.right ? framed(pair.right, pair.left) : picker) + '</div>' + rest;
|
|
259
|
+
}
|