odant-work 1.0.42 → 1.0.44
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/#system/certs/russian_trusted_root_ca.pem +32 -32
- package/#system/mail.json.example +9 -9
- package/#system/package-manifest.json +30 -30
- package/#system/settings.json.example +3 -3
- package/$server/$folder/$class/$device/class.js +2 -2
- package/$server/$folder/$class/$domain/class.js +4 -4
- package/$server/$folder/$class/$domain/readme.md +5 -5
- package/$server/$folder/$class/$handler/$task/class.js +2 -2
- package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
- package/$server/$folder/$class/$handler/class.js +9 -9
- package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
- package/$server/$folder/$class/$handler/readme.md +23 -23
- package/$server/$folder/$class/$service/$class/$service/class.js +3 -3
- package/$server/$folder/$class/$structure/$base/class.js +9 -9
- package/$server/$folder/$class/$structure/$user/class.js +2 -2
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +4 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
- package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/database.js +18 -43
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +21 -26
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +34 -34
- package/$server/$folder/$class/ai/config.js +19 -19
- package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
- package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
- package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
- package/$server/$folder/$class/ai/skills/computer.md +27 -27
- package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
- package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
- package/$server/$folder/$class/ai/skills/lan-inventory.md +16 -16
- package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
- package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
- package/$server/$folder/$class/handlers/pages/form/builder/$handler/builder.js +259 -259
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/editor.js +19 -19
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +1 -1
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +20 -20
- package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
- package/$server/$folder/$file/$call/class.js +10 -10
- package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
- package/$server/$folder/$file/$data/class.js +16 -16
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +5 -5
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +26 -26
- package/$server/$folder/$file/$devs/$js/class.js +2 -2
- package/$server/$folder/$file/$devs/$json/class.js +2 -2
- package/$server/$folder/$file/$devs/$ts/class.js +2 -2
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +30 -30
- package/$server/$folder/$file/$eml/class.js +17 -17
- package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +97 -97
- package/$server/$folder/$file/$ics/class.js +44 -44
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +10 -10
- package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
- package/$server/$folder/$file/$ics/readme.md +21 -21
- package/$server/$folder/$file/$image/$svg/class.js +11 -11
- package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$logs/class.js +39 -39
- package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +63 -63
- package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
- package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +16 -8
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/dock.js +17 -26
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js +94 -94
- package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$task/progress.md +20 -20
- package/$server/$folder/$file/$task/readme.md +32 -32
- package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
- package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
- package/$server/$folder/$file/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
- package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +28 -28
- package/$server/$folder/$file/readme.md +31 -31
- package/$server/$folder/class.js +11 -11
- package/$server/$folder/handlers/methods/create/progress.md +15 -15
- package/$server/$folder/handlers/pages/form/$handler/class.js +5 -5
- package/$server/$folder/handlers/pages/form/$handler/form.js +199 -129
- package/$server/$folder/handlers/readme.md +24 -24
- package/$server/$folder/lib/calendar-form/calendar-form.js +296 -296
- package/$server/$folder/lib/dialogs/confirm/confirm.js +30 -30
- package/$server/$folder/lib/dialogs/input/input.js +57 -57
- package/$server/$folder/lib/email/settings.js +82 -82
- package/$server/$folder/lib/explorer/explorer.js +104 -11
- package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
- package/$server/$folder/lib/icon/user/user.js +6 -6
- package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
- package/$server/$folder/lib/item-form/item-form.js +84 -84
- package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +17 -37
- package/$server/$folder/lib/menu/progress.md +13 -13
- package/$server/$folder/lib/menu/readme.md +29 -29
- package/$server/$folder/lib/node/progress.md +13 -13
- package/$server/$folder/lib/node/readme.md +29 -29
- package/$server/$folder/lib/pack/pack.js +4 -4
- package/$server/$folder/lib/prompt-bar/progress.md +13 -13
- package/$server/$folder/lib/security/admin/admin.js +30 -30
- package/$server/$folder/lib/site-loc/readme.md +16 -16
- package/$server/$folder/lib/site-loc/site-loc.js +80 -80
- package/$server/$folder/lib/tools/tools.js +24 -6
- package/$server/$folder/lib/tree/progress.md +16 -16
- package/$server/$folder/readme.md +18 -18
- package/$server/readme.md +13 -13
- package/.cursor/rules/work.mdc +8 -8
- package/.github/workflows/ci.yml +39 -39
- package/MODELS/$ai/$folder/$class/$ai/class.js +18 -8
- package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +70 -219
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +19 -41
- package/MODELS/$ai/$folder/$class/$provider/readme.md +16 -16
- package/MODELS/GigaChat/$provider/readme.md +24 -24
- package/MODULES/Register/$module/$folder/$class/$register/class.js +4 -4
- package/MODULES/Register/$module/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/class.js +14 -14
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +11 -11
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +40 -40
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +56 -56
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +18 -18
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/class.js +11 -11
- package/MODULES/Register/REGISTER/68/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/68/02/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/320/265/321/200/320/262/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js +1 -1
- package/MODULES/Register/STRUCTS/$struct/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +11 -11
- package/MODULES/Register/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +11 -11
- package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +11 -11
- package/NODES/$node/$folder/$class/$node/class.js +35 -35
- package/NODES/$node/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/network.js +110 -110
- package/NODES/teewtew/$node/class.js +2 -2
- package/NODES/work.odant.org/$node/class.js +3 -3
- package/ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base/class.js +17 -17
- package/ORGANIZATIONS/$domain/$folder/$class/$base/class.js +4 -4
- package/SERVICES/$service/$folder/$storage/$service/class.js +8 -8
- package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +18 -43
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/class.js +356 -356
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/orders/$handler/class.js +244 -244
- package/SERVICES/ArgoCD/$service/class.js +4 -4
- package/SERVICES/ArgoCD/$service/readme.md +63 -63
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/class.js +10 -10
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/checkDomain/$method/class.js +33 -33
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/provision/$method/class.js +225 -225
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/submitOrder/$method/class.js +77 -77
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/readme.md +33 -33
- package/SERVICES/ArgoCD/PaaS/$service/class.js +347 -347
- package/SERVICES/ArgoCD/PaaS/$service/order/pass.order +8 -8
- package/SERVICES/DuckDuckGo/$service/class.js +367 -367
- package/SERVICES/SearXNG/$service/class.js +70 -70
- package/SERVICES/Telegram/$service/class.js +114 -114
- package/SERVICES/Weather/$service/class.js +76 -76
- package/SERVICES/Yandex/$service/class.js +120 -120
- package/SERVICES/readme.md +43 -43
- package/USERS/$users/class.js +2 -2
- package/eslint.config.js +51 -51
- package/jsconfig.json +37 -37
- package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
- package/oda/benchmarks/dbmon/lib/ga.js +11 -11
- package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
- package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
- package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
- package/oda/components/editors/code-editor/code-editor.js +387 -387
- package/oda/components/editors/code-editor/src/ace.js +16 -16
- package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
- package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
- package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
- package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
- package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
- package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
- package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
- package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
- package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
- package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
- package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
- package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-options.js +7 -7
- package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
- package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
- package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
- package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
- package/oda/components/editors/code-editor/src/ext-split.js +7 -7
- package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
- package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
- package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
- package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
- package/oda/components/editors/code-editor/src/mode-css.js +7 -7
- package/oda/components/editors/code-editor/src/mode-html.js +7 -7
- package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
- package/oda/components/editors/code-editor/src/mode-json.js +7 -7
- package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
- package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
- package/oda/components/editors/code-editor/src/mode-text.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
- package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
- package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
- package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
- package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
- package/oda/components/editors/markdown/markdown.js +76 -76
- package/oda/components/inputs/block/readme.md +39 -39
- package/oda/components/inputs/checkbox/checkbox.js +92 -92
- package/oda/components/inputs/color/color.js +83 -83
- package/oda/components/inputs/date/date.js +40 -40
- package/oda/components/inputs/input/input.js +219 -219
- package/oda/components/inputs/link/readme.md +42 -42
- package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
- package/oda/components/inputs/numeric/numeric.js +141 -141
- package/oda/components/inputs/table-input/readme.md +39 -39
- package/oda/components/inputs/text/text.js +88 -88
- package/oda/components/inputs/toggle/toggle.js +101 -101
- package/oda/components/layouts/app-layout/app-layout.js +4 -1
- package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
- package/oda/components/layouts/tabs/tabs.js +784 -395
- package/oda/components/menus/menu/index_old.html +140 -140
- package/oda/components/menus/menu/menu.js +238 -238
- package/oda/components/packets/packets.js +25 -20
- package/oda/components/structure/controls-map.js +56 -56
- package/oda/components/structure/controls.js +29 -29
- package/oda/components/structure/readme.md +31 -31
- package/oda/components/structure/structure.js +64 -64
- package/oda/components/table/index.html +210 -210
- package/oda/components/table/lib/coerce.js +68 -68
- package/oda/components/table/lib/column.js +568 -568
- package/oda/components/table/readme.md +120 -120
- package/oda/components/table/router.js +86 -86
- package/oda/components/table/row.js +6 -4
- package/oda/components/table/settings.js +89 -89
- package/oda/components/table/table.js +2 -2
- package/oda/index.html +159 -159
- package/oda/tools/icons/icons-set/icons-set.js +60 -60
- package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
- package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
- package/oda/tools/icons/lib/svg/info.json +46 -46
- package/oda/tools/jupyter/demo.ipynb +160 -160
- package/oda/tools/jupyter/lib/print_elements.js +73 -73
- package/oda/tools/jupyter/test-2.ipynb +305 -305
- package/oda/tools/jupyter/test.ipynb +603 -603
- package/oda/tools/styles/adoptedStyleSheets.js +333 -333
- package/oda/tools/tester/device-preview/devices.json +9 -9
- package/opencode.json +9 -9
- package/package.json +1 -1
- package/publish.cmd +2 -2
- package/readme.md +164 -164
- package/rules/rules.md +445 -445
- package/scripts/SYNC-README.md +107 -107
- package/scripts/agent-eval.mjs +223 -223
- package/scripts/dump-svn-chat.mjs +9 -9
- package/scripts/extract-chat-day.mjs +21 -21
- package/scripts/rag-bench.mjs +166 -166
- package/scripts/restore-chat.mjs +166 -166
- package/scripts/sync-svn-git.bat +129 -129
- package/scripts/test-merge.mjs +75 -75
- package/scripts/work-desktop-bridge.mjs +101 -101
- package/sources/client/field.js +168 -168
- package/sources/client/index.js +32 -32
- package/sources/client/readme.md +16 -16
- package/sources/core.js +91 -91
- package/sources/data/choices.js +125 -125
- package/sources/data/progress.md +13 -0
- package/sources/host/auto-updater.js +12 -1
- package/sources/host/babel-merge.js +353 -353
- package/sources/host/config.js +48 -48
- package/sources/host/email-utils.js +269 -269
- package/sources/host/http-server.js +1 -1
- package/sources/host/index-db.js +94 -94
- package/sources/host/net-guard.js +228 -228
- package/sources/host/package-install.js +63 -63
- package/sources/host/progress.md +14 -14
- package/sources/host/push.js +86 -86
- package/sources/host/readme.md +41 -41
- package/sources/host/secret-box.js +93 -93
- package/sources/host/server-id.js +26 -26
- package/sources/host/stun.js +33 -33
- package/sources/host/tls-ca.js +60 -60
- package/sources/host/vapid.js +14 -14
- package/sources/index.html +49 -49
- package/sources/manifest.json +49 -49
- package/sources/modules/a2a/server.js +608 -608
- package/sources/modules/agent/connections.js +442 -442
- package/sources/modules/agent/diff.js +69 -69
- package/sources/modules/agent/eval.js +222 -222
- package/sources/modules/agent/hooks.js +131 -131
- package/sources/modules/agent/log.js +43 -43
- package/sources/modules/agent/mcp-pool.js +253 -253
- package/sources/modules/agent/plugins.js +343 -343
- package/sources/modules/agent/recovery.js +89 -89
- package/sources/modules/agent/taint.js +100 -100
- package/sources/modules/agent/tools/branch.js +311 -311
- package/sources/modules/agent/tools/browser.js +254 -254
- package/sources/modules/agent/tools/computer.js +120 -120
- package/sources/modules/agent/tools/connect.js +316 -316
- package/sources/modules/agent/tools/dev/lsp.js +334 -334
- package/sources/modules/agent/tools/dev/patch.js +564 -564
- package/sources/modules/agent/tools/memory.js +153 -153
- package/sources/modules/agent/tools/os-files.js +358 -358
- package/sources/modules/agent/tools/plugins.js +80 -80
- package/sources/modules/agent/tools/sandbox.js +268 -268
- package/sources/modules/agent/types.d.ts +183 -183
- package/sources/modules/agent/undo.js +254 -254
- package/sources/modules/agent/util.js +179 -179
- package/sources/modules/contacts/contacts.js +200 -200
- package/sources/modules/contacts/index.html +546 -546
- package/sources/modules/lan/discovery.js +192 -192
- package/sources/modules/lan/store.js +62 -62
- package/sources/modules/mcp/readme.md +70 -70
- package/sources/modules/mcp/server.js +525 -525
- package/sources/modules/mcp/tokens.js +140 -140
- package/sources/modules/nodes/identity.js +123 -123
- package/sources/modules/nodes/inbound.js +172 -172
- package/sources/modules/nodes/outbound.js +105 -105
- package/sources/modules/nodes/signing.js +71 -71
- package/sources/modules/rag/embed-worker.js +36 -36
- package/sources/modules/rag/readme.md +70 -70
- package/sources/modules/readme.md +21 -21
- package/sources/modules/sandbox/config.js +74 -74
- package/sources/modules/sandbox/driver.js +100 -100
- package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
- package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
- package/sources/modules/sandbox/manager.js +1089 -1089
- package/sources/modules/sandbox/readme.md +63 -63
- package/sources/modules/sandbox/vnc-proxy.js +296 -296
- package/sources/modules/trainer/halogen.js +354 -100
- package/sources/modules/trainer/huggingface.js +28 -2
- package/sources/modules/trainer/index.js +70 -9
- package/sources/modules/trainer/local-engine.js +400 -167
- package/sources/modules/trainer/worker/local_infer_worker.py +164 -21
- package/sources/readme.md +216 -216
- package/sources/server/access/audit.js +138 -138
- package/sources/server/access/refs.js +106 -106
- package/sources/server/assert-class-id.js +23 -23
- package/sources/server/external-source.js +90 -90
- package/sources/server/index.js +12 -12
- package/sources/server/memory-mark.js +34 -34
- package/sources/server/readme.md +110 -110
- package/sources/server/safe-node-name.js +67 -67
- package/sources/server/upload-mark.js +24 -24
- package/sources/server/zip-guard.js +81 -81
- package/sources/tester.html +54 -54
- package/whitepaper.md +568 -568
|
@@ -1,552 +1,941 @@
|
|
|
1
|
-
ODA({is: 'oda-tabs', imports: 'oda//button',
|
|
1
|
+
ODA({is: 'oda-tabs', imports: 'oda//button, oda//icon, oda//menu-list',
|
|
2
2
|
template: /*html*/`
|
|
3
3
|
<style>
|
|
4
|
-
:host{
|
|
4
|
+
:host {
|
|
5
|
+
@apply --horizontal;
|
|
6
|
+
align-items: center;
|
|
5
7
|
overflow: hidden;
|
|
6
8
|
max-width: 100%;
|
|
7
9
|
max-height: 100%;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
gap: 6px;
|
|
12
|
+
user-select: none;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@apply --shadow;
|
|
16
|
-
transform: scale(.7);
|
|
14
|
+
:host([direction="vertical"]) {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: stretch;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
:host([variant="bar"]) {
|
|
19
|
+
background: var(--subtle-background);
|
|
20
|
+
color: var(--content-color);
|
|
21
|
+
border-bottom: 1px solid var(--subtle-border);
|
|
22
|
+
padding: 4px 8px;
|
|
23
|
+
min-height: 38px;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
:host([variant="rail"]) {
|
|
26
|
+
@apply --accent-invert;
|
|
27
|
+
padding: 4px 8px;
|
|
28
|
+
min-height: 38px;
|
|
29
|
+
}
|
|
30
|
+
:host([variant="pills"]) {
|
|
31
|
+
background: var(--subtle-background);
|
|
32
|
+
color: var(--content-color);
|
|
33
|
+
border: 1px solid var(--subtle-border);
|
|
34
|
+
border-radius: 10px;
|
|
35
|
+
padding: 3px;
|
|
36
|
+
gap: 3px;
|
|
37
|
+
width: fit-content;
|
|
38
|
+
min-height: 34px;
|
|
39
|
+
}
|
|
40
|
+
:host([variant="bar"][compact]),
|
|
41
|
+
:host([variant="rail"][compact]) {
|
|
42
|
+
padding: 3px 6px;
|
|
43
|
+
min-height: 32px;
|
|
44
|
+
}
|
|
45
|
+
:host([variant="pills"][compact]) {
|
|
46
|
+
padding: 2px;
|
|
47
|
+
min-height: 30px;
|
|
48
|
+
}
|
|
49
|
+
:host([hidden]) {
|
|
50
|
+
display: none !important;
|
|
27
51
|
}
|
|
28
52
|
:host([selected]) {
|
|
29
53
|
outline: 2px solid var(--accent-color);
|
|
30
54
|
}
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
.tablist-wrap {
|
|
56
|
+
@apply --horizontal;
|
|
57
|
+
align-items: center;
|
|
58
|
+
flex: 1 1 auto;
|
|
59
|
+
min-width: 0;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
:host([direction="vertical"]) .tablist-wrap {
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
align-items: stretch;
|
|
66
|
+
}
|
|
67
|
+
#scroller {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 4px;
|
|
72
|
+
flex: 1 1 auto;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
overflow-x: auto;
|
|
75
|
+
overflow-y: hidden;
|
|
76
|
+
scrollbar-width: none;
|
|
77
|
+
}
|
|
78
|
+
#scroller::-webkit-scrollbar {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
:host([direction="vertical"]) #scroller {
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
align-items: stretch;
|
|
84
|
+
overflow-x: hidden;
|
|
85
|
+
overflow-y: auto;
|
|
86
|
+
}
|
|
87
|
+
:host([variant="pills"]) #scroller,
|
|
88
|
+
:host([no-shrink]) #scroller {
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
overflow: visible;
|
|
91
|
+
gap: 3px;
|
|
92
|
+
}
|
|
93
|
+
.extra-buttons {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: 4px;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
}
|
|
99
|
+
.list-btn {
|
|
100
|
+
border-radius: 8px !important;
|
|
101
|
+
min-width: 26px;
|
|
102
|
+
width: 26px;
|
|
103
|
+
height: 26px;
|
|
104
|
+
padding: 0 !important;
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
opacity: 0.78;
|
|
107
|
+
transition: background-color var(--duration-fast) var(--easing), opacity var(--duration-fast) var(--easing);
|
|
108
|
+
}
|
|
109
|
+
.list-btn:hover {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
:host([variant="rail"]) .list-btn {
|
|
113
|
+
color: var(--accent-back);
|
|
114
|
+
fill: var(--accent-back);
|
|
115
|
+
}
|
|
116
|
+
:host([variant="rail"]) .list-btn:hover {
|
|
117
|
+
background: color-mix(in oklch, var(--accent-back) 14%, transparent);
|
|
33
118
|
}
|
|
34
119
|
</style>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
aria-label="Tabs"
|
|
47
|
-
:direction="direction === 'vertical' ? 'horizontal' : 'vertical'"
|
|
48
|
-
style="overflow: hidden"
|
|
49
|
-
tabindex="0"
|
|
50
|
-
|
|
51
|
-
@keydown>
|
|
52
|
-
<div style="overflow-x: auto"></div>
|
|
53
|
-
<div id="scroller"
|
|
54
|
-
@resize="_onResize"
|
|
55
|
-
@scroll="_onScroll"
|
|
56
|
-
:direction
|
|
57
|
-
@mousewheel.passive
|
|
58
|
-
@dragover>
|
|
59
|
-
<oda-tabs-tab
|
|
60
|
-
role="tab"
|
|
61
|
-
:aria-selected="$for.index === focusedIndex"
|
|
120
|
+
<slot name="left" class="no-flex horizontal-center"></slot>
|
|
121
|
+
<div class="tablist-wrap" role="tablist" aria-label="Вкладки" tabindex="0" @keydown="_onKeydown">
|
|
122
|
+
<div id="scroller"
|
|
123
|
+
@resize="_onResize"
|
|
124
|
+
@scroll="_onScroll"
|
|
125
|
+
:direction
|
|
126
|
+
@mousewheel.passive="_onMousewheel"
|
|
127
|
+
@dragover="_onDragover">
|
|
128
|
+
<oda-tabs-tab
|
|
129
|
+
role="tab"
|
|
130
|
+
:aria-selected="$for.index === focusedIndex ? 'true' : 'false'"
|
|
62
131
|
:selected="$for.index === selectedIndex && selectedIndex !== focusedIndex"
|
|
63
|
-
:draggable="allowDrag"
|
|
64
|
-
~for="items"
|
|
65
|
-
:item="$for.item"
|
|
132
|
+
:draggable="allowDrag ? 'true' : 'false'"
|
|
133
|
+
~for="items"
|
|
134
|
+
:item="$for.item"
|
|
66
135
|
:index="$for.index">
|
|
67
|
-
</oda-tabs-tab>
|
|
68
|
-
<div flex></div>
|
|
69
|
-
<div style="overflow: hidden; justify-self: end;" :direction>
|
|
70
|
-
<oda-button :icon-size="iconSize * 1.2" style="margin: 8px;"
|
|
71
|
-
role="button"
|
|
72
|
-
~for="buttons"
|
|
73
|
-
~props="$for.item">
|
|
74
|
-
</oda-button>
|
|
75
|
-
</div>
|
|
136
|
+
</oda-tabs-tab>
|
|
76
137
|
</div>
|
|
77
|
-
|
|
78
138
|
</div>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
~if="items?.some(i => typeof i.close === 'function')"
|
|
96
|
-
icon="icons:close"
|
|
97
|
-
title="close all tabs"
|
|
98
|
-
@tap="closeAll">
|
|
139
|
+
<div class="extra-buttons" ~if="buttons?.length">
|
|
140
|
+
<oda-button :icon-size="16"
|
|
141
|
+
role="button"
|
|
142
|
+
~for="buttons"
|
|
143
|
+
~props="$for.item">
|
|
144
|
+
</oda-button>
|
|
145
|
+
</div>
|
|
146
|
+
<slot name="right" class="no-flex horizontal-center"></slot>
|
|
147
|
+
<oda-button
|
|
148
|
+
class="list-btn"
|
|
149
|
+
~if="showListBtn"
|
|
150
|
+
no-flex
|
|
151
|
+
icon="icons:expand-more"
|
|
152
|
+
:icon-size="18"
|
|
153
|
+
title="Список открытых вкладок"
|
|
154
|
+
@tap.stop="openTabsMenu($event)">
|
|
99
155
|
</oda-button>
|
|
100
156
|
`,
|
|
101
|
-
get _directionStyle() {
|
|
102
|
-
return `flex-direction: ${this.align === 'right' || this.align === 'bottom' ? 'row-reverse' : 'row'}`;
|
|
103
|
-
},
|
|
104
157
|
buttons: [],
|
|
158
|
+
items: [],
|
|
105
159
|
_onResize() {
|
|
106
160
|
this.__is_vertical = undefined;
|
|
107
161
|
},
|
|
108
|
-
|
|
109
162
|
_onScroll() {
|
|
110
163
|
this.__is_vertical = undefined;
|
|
111
164
|
},
|
|
112
|
-
|
|
113
165
|
attached() {
|
|
114
166
|
requestAnimationFrame(() => {
|
|
115
|
-
this.focusedTab?.scrollIntoView({
|
|
116
|
-
inline: '
|
|
117
|
-
block: '
|
|
167
|
+
this.focusedTab?.scrollIntoView({
|
|
168
|
+
inline: 'nearest',
|
|
169
|
+
block: 'nearest'
|
|
118
170
|
});
|
|
119
171
|
});
|
|
120
172
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
173
|
+
get showListBtn() {
|
|
174
|
+
if (!this.allowList || this.variant === 'pills')
|
|
175
|
+
return false;
|
|
176
|
+
return Array.isArray(this.items) && this.items.length > 1;
|
|
177
|
+
},
|
|
178
|
+
get hasAnyClosable() {
|
|
179
|
+
if (!Array.isArray(this.items))
|
|
180
|
+
return false;
|
|
181
|
+
return this.items.some(i => i?.closable !== false && (this.allowClose || i?.allowClose || i?.closable));
|
|
182
|
+
},
|
|
183
|
+
isTabClosable(item) {
|
|
184
|
+
if (!item || item.closable === false)
|
|
185
|
+
return false;
|
|
186
|
+
return Boolean(this.allowClose || item.allowClose || item.closable);
|
|
187
|
+
},
|
|
188
|
+
selectTab(index, event = null) {
|
|
189
|
+
const list = this.items || [];
|
|
190
|
+
if (index < 0 || index >= list.length)
|
|
191
|
+
return;
|
|
192
|
+
const item = list[index];
|
|
193
|
+
if (item?.disabled)
|
|
194
|
+
return;
|
|
195
|
+
this.dimmed = false;
|
|
196
|
+
this.focusedIndex = index;
|
|
197
|
+
this.dispatchEvent(new CustomEvent('tab-select', {
|
|
198
|
+
detail: { item, index, event },
|
|
199
|
+
bubbles: true,
|
|
200
|
+
composed: true,
|
|
201
|
+
}));
|
|
202
|
+
},
|
|
203
|
+
requestCloseTab(index, event = null) {
|
|
204
|
+
const list = this.items || [];
|
|
205
|
+
const item = list[index];
|
|
206
|
+
if (!this.isTabClosable(item))
|
|
207
|
+
return;
|
|
208
|
+
const closeEvt = new CustomEvent('tab-close', {
|
|
209
|
+
detail: { item, index, event },
|
|
210
|
+
bubbles: true,
|
|
211
|
+
composed: true,
|
|
212
|
+
cancelable: true,
|
|
213
|
+
});
|
|
214
|
+
this.dispatchEvent(closeEvt);
|
|
215
|
+
this.fire('close', item);
|
|
216
|
+
if (!closeEvt.defaultPrevented && typeof item.close === 'function')
|
|
217
|
+
item.close(item, index);
|
|
218
|
+
},
|
|
219
|
+
async closeOthers(keepIndex) {
|
|
220
|
+
const list = this.items || [];
|
|
221
|
+
const keepItem = list[keepIndex];
|
|
222
|
+
const evt = new CustomEvent('close-others', {
|
|
223
|
+
detail: { item: keepItem, index: keepIndex },
|
|
224
|
+
bubbles: true,
|
|
225
|
+
composed: true,
|
|
226
|
+
cancelable: true,
|
|
227
|
+
});
|
|
228
|
+
this.dispatchEvent(evt);
|
|
229
|
+
if (evt.defaultPrevented)
|
|
230
|
+
return;
|
|
231
|
+
const targets = list.filter((it, idx) => idx !== keepIndex && this.isTabClosable(it));
|
|
232
|
+
for (const it of targets.reverse()) {
|
|
233
|
+
const idx = (this.items || []).indexOf(it);
|
|
234
|
+
if (idx >= 0)
|
|
235
|
+
this.requestCloseTab(idx);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
async closeRight(fromIndex) {
|
|
239
|
+
const list = this.items || [];
|
|
240
|
+
const fromItem = list[fromIndex];
|
|
241
|
+
const evt = new CustomEvent('close-right', {
|
|
242
|
+
detail: { item: fromItem, index: fromIndex },
|
|
243
|
+
bubbles: true,
|
|
244
|
+
composed: true,
|
|
245
|
+
cancelable: true,
|
|
246
|
+
});
|
|
247
|
+
this.dispatchEvent(evt);
|
|
248
|
+
if (evt.defaultPrevented)
|
|
249
|
+
return;
|
|
250
|
+
const targets = list.filter((it, idx) => idx > fromIndex && this.isTabClosable(it));
|
|
251
|
+
for (const it of targets.reverse()) {
|
|
252
|
+
const idx = (this.items || []).indexOf(it);
|
|
253
|
+
if (idx >= 0)
|
|
254
|
+
this.requestCloseTab(idx);
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
async closeAll() {
|
|
258
|
+
const evt = new CustomEvent('close-all', {
|
|
259
|
+
detail: { items: this.items },
|
|
260
|
+
bubbles: true,
|
|
261
|
+
composed: true,
|
|
262
|
+
cancelable: true,
|
|
263
|
+
});
|
|
264
|
+
this.dispatchEvent(evt);
|
|
265
|
+
if (evt.defaultPrevented)
|
|
266
|
+
return;
|
|
267
|
+
const targets = (this.items || []).filter(it => this.isTabClosable(it));
|
|
268
|
+
for (const it of targets.reverse()) {
|
|
269
|
+
const idx = (this.items || []).indexOf(it);
|
|
270
|
+
if (idx >= 0)
|
|
271
|
+
this.requestCloseTab(idx);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
async openTabsMenu(e) {
|
|
275
|
+
const list = this.items || [];
|
|
276
|
+
if (!list.length)
|
|
277
|
+
return;
|
|
278
|
+
const anchor = e?.currentTarget || e?.target || this;
|
|
279
|
+
const menuItems = list.map((item, idx) => ({
|
|
280
|
+
label: (item.dirty ? '● ' : '') + (item.label || item.title || `Вкладка ${idx + 1}`),
|
|
281
|
+
icon: item.icon || this.defaultIcon || 'icons:dashboard',
|
|
282
|
+
value: idx,
|
|
283
|
+
execute: () => this.selectTab(idx),
|
|
284
|
+
}));
|
|
285
|
+
const closables = list.filter(i => this.isTabClosable(i));
|
|
286
|
+
if (closables.length > 0 && list.length > 1) {
|
|
287
|
+
menuItems.push({
|
|
288
|
+
group: 'Действия',
|
|
289
|
+
label: this.closeAllLabel || 'Закрыть все',
|
|
290
|
+
icon: 'icons:close',
|
|
291
|
+
value: '__close_all__',
|
|
292
|
+
execute: () => this.closeAll(),
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
await ODA.showMenu({ items: menuItems, value: this.focusedIndex }, anchor);
|
|
297
|
+
}
|
|
298
|
+
catch { /* отмена */ }
|
|
299
|
+
},
|
|
300
|
+
async _openTabContextMenu(index, e) {
|
|
301
|
+
if (!this.allowContextMenu)
|
|
302
|
+
return;
|
|
303
|
+
const list = this.items || [];
|
|
304
|
+
const item = list[index];
|
|
305
|
+
if (!item)
|
|
306
|
+
return;
|
|
307
|
+
if (!this.hasAnyClosable)
|
|
308
|
+
return;
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
const canCloseThis = this.isTabClosable(item);
|
|
312
|
+
const hasOthers = list.some((it, idx) => idx !== index && this.isTabClosable(it));
|
|
313
|
+
const hasRight = list.some((it, idx) => idx > index && this.isTabClosable(it));
|
|
314
|
+
const hasAny = list.some(it => this.isTabClosable(it)) && list.length > 1;
|
|
315
|
+
const menuItems = [
|
|
316
|
+
{
|
|
317
|
+
label: 'Закрыть',
|
|
318
|
+
icon: 'icons:close',
|
|
319
|
+
disabled: !canCloseThis,
|
|
320
|
+
value: 'close',
|
|
321
|
+
execute: () => this.requestCloseTab(index, e),
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
label: 'Закрыть другие',
|
|
325
|
+
icon: 'icons:clear-all',
|
|
326
|
+
disabled: !hasOthers,
|
|
327
|
+
value: 'others',
|
|
328
|
+
execute: () => this.closeOthers(index),
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
label: 'Закрыть справа',
|
|
332
|
+
icon: 'icons:arrow-forward',
|
|
333
|
+
disabled: !hasRight,
|
|
334
|
+
value: 'right',
|
|
335
|
+
execute: () => this.closeRight(index),
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
group: 'Все вкладки',
|
|
339
|
+
label: this.closeAllLabel || 'Закрыть все',
|
|
340
|
+
icon: 'icons:delete-sweep',
|
|
341
|
+
disabled: !hasAny,
|
|
342
|
+
value: 'all',
|
|
343
|
+
execute: () => this.closeAll(),
|
|
344
|
+
},
|
|
345
|
+
];
|
|
346
|
+
try {
|
|
347
|
+
await ODA.showMenu({ items: menuItems }, e);
|
|
348
|
+
}
|
|
349
|
+
catch { /* отмена */ }
|
|
350
|
+
},
|
|
351
|
+
_onDragover(e) {
|
|
352
|
+
if (!this.allowDrag || !drag.item || drag.host !== this)
|
|
353
|
+
return;
|
|
354
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
355
|
+
e.preventDefault();
|
|
356
|
+
const pos = this.__is_vertical ? e.clientY : e.clientX;
|
|
357
|
+
const delta = pos - drag.start;
|
|
358
|
+
const scroller = this.__scroller;
|
|
359
|
+
if (!scroller)
|
|
360
|
+
return;
|
|
361
|
+
const rect = scroller.getBoundingClientRect();
|
|
362
|
+
const start = this.__is_vertical ? rect.top : rect.left;
|
|
363
|
+
const end = this.__is_vertical ? rect.bottom : rect.right;
|
|
364
|
+
if (pos < start + 24)
|
|
365
|
+
drag.start += this.__scroll(12);
|
|
366
|
+
else if (pos > end - 24)
|
|
367
|
+
drag.start += this.__scroll(-12);
|
|
130
368
|
|
|
131
|
-
|
|
132
|
-
|
|
369
|
+
const tr = 'translate' + (this.__is_vertical ? 'Y' : 'X');
|
|
370
|
+
const dragCenter = pos - drag.pointer + (drag.item[this.offsetSize] / 2);
|
|
371
|
+
let newIndex = drag.fromIndex;
|
|
372
|
+
const children = Array.from(scroller.children).filter(el => el.localName === 'oda-tabs-tab');
|
|
373
|
+
for (const el of children) {
|
|
374
|
+
if (el === drag.item) {
|
|
375
|
+
el.style.transform = `${tr}(${delta}px)`;
|
|
376
|
+
continue;
|
|
133
377
|
}
|
|
134
|
-
|
|
135
|
-
|
|
378
|
+
const r = el.getBoundingClientRect();
|
|
379
|
+
const center = this.__is_vertical ? (r.top + r.height / 2) : (r.left + r.width / 2);
|
|
380
|
+
if (el.index < drag.fromIndex && dragCenter < center) {
|
|
381
|
+
el.style.transform = `${tr}(${drag.item[this.offsetSize] + 4}px)`;
|
|
382
|
+
if (el.index < newIndex)
|
|
383
|
+
newIndex = el.index;
|
|
136
384
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
for (let el of drag.item.parentElement.children){
|
|
142
|
-
if (el[R].states.sleep) continue;
|
|
143
|
-
let el_pos = this.__is_vertical?el.offsetTop:el.offsetLeft - this.__scrollPos;
|
|
144
|
-
if (el === drag.item)
|
|
145
|
-
el.style.transform = tr + `(${delta}px)`;
|
|
146
|
-
else if (el_pos < drag.start && el_pos > drag_start - start - drag.item[this.offsetSize] / 2){
|
|
147
|
-
el.style.transform = tr + `(${drag.item[this.offsetSize]}px)`;
|
|
148
|
-
drag.index = el.index;
|
|
149
|
-
}
|
|
150
|
-
else if (el_pos > drag.start && el_pos + el[this.offsetSize] / 2 < drag_start - start + drag.item[this.offsetSize]){
|
|
151
|
-
el.style.transform = tr + `(${-drag.item[this.offsetSize]}px)`;
|
|
152
|
-
drag.index = el.index;
|
|
153
|
-
}
|
|
154
|
-
else{
|
|
155
|
-
el.style.transform = ''
|
|
156
|
-
}
|
|
385
|
+
else if (el.index > drag.fromIndex && dragCenter > center) {
|
|
386
|
+
el.style.transform = `${tr}(${-(drag.item[this.offsetSize] + 4)}px)`;
|
|
387
|
+
if (el.index > newIndex)
|
|
388
|
+
newIndex = el.index;
|
|
157
389
|
}
|
|
158
|
-
|
|
390
|
+
else {
|
|
391
|
+
el.style.transform = '';
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
drag.toIndex = newIndex;
|
|
159
395
|
},
|
|
160
|
-
get tabs(){
|
|
396
|
+
get tabs() {
|
|
161
397
|
return this;
|
|
162
398
|
},
|
|
163
|
-
_onMousewheel
|
|
164
|
-
this.
|
|
399
|
+
_onMousewheel(e) {
|
|
400
|
+
if (this.variant === 'pills' || this.noShrink)
|
|
401
|
+
return;
|
|
402
|
+
const delta = e.deltaY || -e.wheelDelta || 0;
|
|
403
|
+
if (delta && this.__scroller)
|
|
404
|
+
this.__scroller.scrollLeft += delta;
|
|
165
405
|
},
|
|
166
|
-
__scroll(step){
|
|
406
|
+
__scroll(step) {
|
|
407
|
+
if (!this.__scroller)
|
|
408
|
+
return 0;
|
|
167
409
|
let move = 0;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
move -= this.__scroller.scrollTop;
|
|
178
|
-
break;
|
|
410
|
+
if (this.direction === 'horizontal') {
|
|
411
|
+
move = this.__scroller.scrollLeft;
|
|
412
|
+
this.__scroller.scrollLeft -= step;
|
|
413
|
+
move -= this.__scroller.scrollLeft;
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
move = this.__scroller.scrollTop;
|
|
417
|
+
this.__scroller.scrollTop -= step;
|
|
418
|
+
move -= this.__scroller.scrollTop;
|
|
179
419
|
}
|
|
180
420
|
return move;
|
|
181
421
|
},
|
|
182
|
-
toHome(){
|
|
183
|
-
|
|
422
|
+
toHome() {
|
|
423
|
+
if (this.__scroller)
|
|
424
|
+
this.__scroller.scrollTop = this.__scroller.scrollLeft = 0;
|
|
184
425
|
},
|
|
185
|
-
toEnd(){
|
|
186
|
-
|
|
426
|
+
toEnd() {
|
|
427
|
+
if (this.__scroller)
|
|
428
|
+
this.__scroller.scrollTop = this.__scroller.scrollLeft = 100000000;
|
|
187
429
|
},
|
|
188
|
-
get __scroller(){
|
|
430
|
+
get __scroller() {
|
|
189
431
|
return this.$('#scroller') || undefined;
|
|
190
432
|
},
|
|
191
|
-
get __scrollSize(){
|
|
192
|
-
return this.__is_vertical?this.__scroller?.scrollHeight:this.__scroller?.scrollWidth;
|
|
193
|
-
},
|
|
194
|
-
get __scrollPos(){
|
|
195
|
-
return Math.round(this.__is_vertical?this.__scroller?.scrollTop:this.__scroller?.scrollLeft);
|
|
433
|
+
get __scrollSize() {
|
|
434
|
+
return this.__is_vertical ? this.__scroller?.scrollHeight : this.__scroller?.scrollWidth;
|
|
196
435
|
},
|
|
197
|
-
get
|
|
198
|
-
return this.__is_vertical?this.__scroller?.
|
|
436
|
+
get __scrollPos() {
|
|
437
|
+
return Math.round(this.__is_vertical ? (this.__scroller?.scrollTop || 0) : (this.__scroller?.scrollLeft || 0));
|
|
199
438
|
},
|
|
200
|
-
get
|
|
201
|
-
return this.
|
|
202
|
-
},
|
|
203
|
-
step(stepper = 0) {
|
|
204
|
-
if (!stepper) return;
|
|
205
|
-
this.__scrollPos = undefined; // сбрасываем кэш, что вызовет пересчет beforeTab/afterTab
|
|
206
|
-
const target = stepper < 0 ? this.beforeTab : this.afterTab;
|
|
207
|
-
target?.scrollIntoView({
|
|
208
|
-
inline: 'nearest',
|
|
209
|
-
block: 'nearest'
|
|
210
|
-
});
|
|
211
|
-
if (Math.abs(stepper) > 1) {
|
|
212
|
-
this.step(stepper + (stepper < 0 ? 1 : -1));
|
|
213
|
-
}
|
|
439
|
+
get __scrollerWidth() {
|
|
440
|
+
return this.__is_vertical ? this.__scroller?.offsetHeight : this.__scroller?.offsetWidth;
|
|
214
441
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
get(){
|
|
218
|
-
if (!this.__is_vertical)
|
|
219
|
-
return `height: fit-content`;
|
|
220
|
-
return `width: fit-content`;
|
|
221
|
-
}
|
|
442
|
+
get __buttonSize() {
|
|
443
|
+
return Math.round((this.iconSize || 16) * 0.85);
|
|
222
444
|
},
|
|
223
445
|
$public: {
|
|
446
|
+
variant: {
|
|
447
|
+
$def: 'bar',
|
|
448
|
+
$list: ['bar', 'rail', 'pills'],
|
|
449
|
+
$attr: true,
|
|
450
|
+
},
|
|
451
|
+
compact: {
|
|
452
|
+
$def: false,
|
|
453
|
+
$type: Boolean,
|
|
454
|
+
$attr: true,
|
|
455
|
+
},
|
|
456
|
+
noShrink: {
|
|
457
|
+
$def: false,
|
|
458
|
+
$type: Boolean,
|
|
459
|
+
$attr: true,
|
|
460
|
+
},
|
|
224
461
|
allowDrag: false,
|
|
462
|
+
allowClose: false,
|
|
463
|
+
allowList: true,
|
|
464
|
+
allowContextMenu: true,
|
|
465
|
+
closeAllLabel: 'Закрыть все',
|
|
225
466
|
align: {
|
|
226
467
|
$list: ['left', 'bottom', 'right', 'top'],
|
|
227
|
-
$def: '
|
|
228
|
-
set(
|
|
468
|
+
$def: 'top',
|
|
469
|
+
set() {
|
|
229
470
|
if (!this.__scroller) return;
|
|
230
471
|
requestAnimationFrame(() => {
|
|
231
|
-
for (const el of this.__scroller.children
|
|
232
|
-
el.render(true);
|
|
472
|
+
for (const el of this.__scroller.children) {
|
|
473
|
+
el.render?.(true);
|
|
233
474
|
}
|
|
234
475
|
});
|
|
235
476
|
}
|
|
236
477
|
},
|
|
237
|
-
focusedIndex: {
|
|
478
|
+
focusedIndex: {
|
|
238
479
|
$def: 0,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.selectedIndex = -1; // сбрасываем селектор при установке фокуса
|
|
480
|
+
set() {
|
|
481
|
+
this.selectedIndex = -1;
|
|
242
482
|
this.debounce('focusedIndex', () => {
|
|
243
483
|
this.focusedTab?.scrollIntoView({ inline: 'nearest', block: 'nearest' });
|
|
244
484
|
});
|
|
245
485
|
}
|
|
246
486
|
},
|
|
247
|
-
iconSize:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
dimmed: {
|
|
251
|
-
$def: false,
|
|
252
|
-
$save: true,
|
|
253
|
-
},
|
|
487
|
+
iconSize: 16,
|
|
488
|
+
maxWidth: 230,
|
|
489
|
+
dimmed: false,
|
|
254
490
|
defaultIcon: ''
|
|
255
491
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return this.items?.[this.focusedIndex]; // переименовано с index
|
|
259
|
-
},
|
|
260
|
-
get beforeTab(){
|
|
261
|
-
let item = this.__scroller?.firstChild?.firstChild;
|
|
262
|
-
let pos = this.__scrollPos - 1;
|
|
263
|
-
do{
|
|
264
|
-
let start = item[this.offsetStart]
|
|
265
|
-
if (start < pos && start + item[this.offsetSize] >= pos)
|
|
266
|
-
return item;
|
|
267
|
-
}
|
|
268
|
-
while(item = item.nextElementSibling)
|
|
269
|
-
},
|
|
270
|
-
get afterTab(){
|
|
271
|
-
let item = this.__scroller?.firstChild?.firstChild;
|
|
272
|
-
let pos = this.__scrollPos + this.__scrollerWidth + 1;
|
|
273
|
-
do{
|
|
274
|
-
let start = item[this.offsetStart]
|
|
275
|
-
if (start <= pos && start + item[this.offsetSize] > pos)
|
|
276
|
-
return item;
|
|
277
|
-
}
|
|
278
|
-
while(item = item.nextElementSibling)
|
|
279
|
-
},
|
|
280
|
-
get focusedTab(){
|
|
281
|
-
return this.__scroller?.firstChild?.children[this.focusedIndex] || null; // переименовано с index
|
|
282
|
-
},
|
|
283
|
-
get alignSelf() {
|
|
284
|
-
switch (this.align) {
|
|
285
|
-
case 'left':
|
|
286
|
-
case 'top':
|
|
287
|
-
return 'self-start';
|
|
288
|
-
case 'right':
|
|
289
|
-
case 'bottom':
|
|
290
|
-
return 'self-end';
|
|
291
|
-
}
|
|
492
|
+
get focused() {
|
|
493
|
+
return this.items?.[this.focusedIndex];
|
|
292
494
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
get() {
|
|
296
|
-
switch (this.align) {
|
|
297
|
-
case 'left':
|
|
298
|
-
return 270;
|
|
299
|
-
case 'right':
|
|
300
|
-
return 90;
|
|
301
|
-
case 'top':
|
|
302
|
-
return 0;
|
|
303
|
-
case 'bottom':
|
|
304
|
-
return 180;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
495
|
+
get focusedTab() {
|
|
496
|
+
return this.__scroller?.children?.[this.focusedIndex] || null;
|
|
307
497
|
},
|
|
308
|
-
get __is_vertical(){
|
|
309
|
-
|
|
310
|
-
case 'left':
|
|
311
|
-
case 'right':
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
return false;
|
|
498
|
+
get __is_vertical() {
|
|
499
|
+
return this.align === 'left' || this.align === 'right';
|
|
315
500
|
},
|
|
316
501
|
direction: {
|
|
317
502
|
$type: String,
|
|
318
503
|
$attr: true,
|
|
319
504
|
get() {
|
|
320
|
-
return this.__is_vertical?'vertical':'horizontal';
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
get iconRotate(){
|
|
324
|
-
return this.__is_vertical?90:0;
|
|
325
|
-
},
|
|
326
|
-
async closeAll() {
|
|
327
|
-
await ODA.showConfirm('Close all tabs?');
|
|
328
|
-
this.items.forEach(i => i.close?.());
|
|
329
|
-
},
|
|
330
|
-
get __shapeStyle(){
|
|
331
|
-
switch (this.align){
|
|
332
|
-
case 'top':
|
|
333
|
-
return `max-width: ${this.maxWidth}px;`
|
|
334
|
-
case 'right':
|
|
335
|
-
return `max-height: ${this.maxWidth}px;`
|
|
336
|
-
case 'bottom':
|
|
337
|
-
return `max-width: ${this.maxWidth}px;`
|
|
338
|
-
case 'left':
|
|
339
|
-
return `max-height: ${this.maxWidth}px;`
|
|
505
|
+
return this.__is_vertical ? 'vertical' : 'horizontal';
|
|
340
506
|
}
|
|
341
507
|
},
|
|
342
|
-
get
|
|
343
|
-
return this.__is_vertical?
|
|
508
|
+
get offsetSize() {
|
|
509
|
+
return this.__is_vertical ? 'offsetHeight' : 'offsetWidth';
|
|
344
510
|
},
|
|
345
|
-
get
|
|
346
|
-
return this.__is_vertical?'
|
|
347
|
-
},
|
|
348
|
-
get offsetStart(){
|
|
349
|
-
return this.__is_vertical?'offsetTop':'offsetLeft';
|
|
511
|
+
get offsetStart() {
|
|
512
|
+
return this.__is_vertical ? 'offsetTop' : 'offsetLeft';
|
|
350
513
|
},
|
|
351
514
|
selectedIndex: -1,
|
|
352
515
|
_onKeydown(e) {
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
516
|
+
const len = this.items?.length || 0;
|
|
517
|
+
if (!len)
|
|
518
|
+
return;
|
|
519
|
+
const currentIndex = this.selectedIndex === -1 ? Math.max(0, this.focusedIndex) : this.selectedIndex;
|
|
520
|
+
switch (e.key) {
|
|
356
521
|
case 'Escape':
|
|
357
522
|
this.selectedIndex = -1;
|
|
358
|
-
|
|
359
|
-
this.focusedTab?.scrollIntoView({
|
|
360
|
-
inline: 'center',
|
|
361
|
-
block: 'center'
|
|
362
|
-
});
|
|
363
|
-
});
|
|
523
|
+
this.focusedTab?.scrollIntoView({ inline: 'nearest', block: 'nearest' });
|
|
364
524
|
break;
|
|
365
|
-
|
|
366
|
-
case '':
|
|
525
|
+
case ' ':
|
|
367
526
|
case 'Enter':
|
|
368
527
|
e.preventDefault();
|
|
369
|
-
|
|
370
|
-
this.dimmed = !this.dimmed;
|
|
371
|
-
else
|
|
372
|
-
this.dimmed = false;
|
|
373
|
-
this.focusedIndex = currentIndex;
|
|
374
|
-
// сбрасываем dimmed при установке фокуса
|
|
528
|
+
this.selectTab(currentIndex, e);
|
|
375
529
|
break;
|
|
376
|
-
|
|
377
530
|
case 'ArrowLeft':
|
|
378
531
|
case 'ArrowUp':
|
|
379
532
|
e.preventDefault();
|
|
380
533
|
if (currentIndex > 0) {
|
|
381
|
-
const nextTab = this.__scroller?.firstChild?.children[currentIndex - 1];
|
|
382
|
-
const pos = nextTab[this.offsetStart];
|
|
383
|
-
if (pos <= this.__scrollPos) {
|
|
384
|
-
this.step(-1);
|
|
385
|
-
}
|
|
386
534
|
this.selectedIndex = currentIndex - 1;
|
|
535
|
+
this.__scroller?.children?.[this.selectedIndex]?.scrollIntoView({ inline: 'nearest', block: 'nearest' });
|
|
387
536
|
}
|
|
388
537
|
break;
|
|
389
|
-
|
|
390
538
|
case 'ArrowRight':
|
|
391
539
|
case 'ArrowDown':
|
|
392
540
|
e.preventDefault();
|
|
393
|
-
if (currentIndex <
|
|
394
|
-
const nextTab = this.__scroller?.firstChild?.children[currentIndex + 1];
|
|
395
|
-
const pos = nextTab[this.offsetStart] + nextTab[this.offsetSize];
|
|
396
|
-
if (pos >= this.__scrollPos + this.__scrollerWidth) {
|
|
397
|
-
this.step(1);
|
|
398
|
-
}
|
|
541
|
+
if (currentIndex < len - 1) {
|
|
399
542
|
this.selectedIndex = currentIndex + 1;
|
|
543
|
+
this.__scroller?.children?.[this.selectedIndex]?.scrollIntoView({ inline: 'nearest', block: 'nearest' });
|
|
400
544
|
}
|
|
401
545
|
break;
|
|
402
546
|
case 'Home':
|
|
403
547
|
e.preventDefault();
|
|
404
|
-
this.
|
|
548
|
+
this.selectTab(0, e);
|
|
405
549
|
break;
|
|
406
550
|
case 'End':
|
|
407
551
|
e.preventDefault();
|
|
408
|
-
this.
|
|
552
|
+
this.selectTab(len - 1, e);
|
|
409
553
|
break;
|
|
410
554
|
}
|
|
411
|
-
},
|
|
412
|
-
_onDragStart(e) {
|
|
413
|
-
const tab = e.target.closest('oda-tabs-tab');
|
|
414
|
-
if (!tab) return;
|
|
415
|
-
e.dataTransfer.setData('text/plain', '');
|
|
416
|
-
e.dataTransfer.setDragImage(document.createElement('img'), 0, 0);
|
|
417
|
-
this.dragTab = tab;
|
|
418
|
-
this.dragTab.$pdp.state = 'info';
|
|
419
|
-
},
|
|
420
|
-
_onDragEnd(e) {
|
|
421
|
-
if (this.dragTab) {
|
|
422
|
-
this.dragTab.$pdp.state = '';
|
|
423
|
-
this.dragTab = null;
|
|
424
|
-
}
|
|
425
555
|
}
|
|
426
|
-
})
|
|
427
|
-
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
const drag = {
|
|
559
|
+
item: null,
|
|
560
|
+
host: null,
|
|
561
|
+
fromIndex: -1,
|
|
562
|
+
toIndex: -1,
|
|
563
|
+
pointer: 0,
|
|
564
|
+
start: 0,
|
|
565
|
+
};
|
|
566
|
+
|
|
428
567
|
ODA({
|
|
429
568
|
is: 'oda-tabs-tab',
|
|
430
569
|
template: /*html*/`
|
|
431
570
|
<style>
|
|
432
|
-
:host{
|
|
433
|
-
|
|
434
|
-
|
|
571
|
+
:host {
|
|
572
|
+
display: flex;
|
|
573
|
+
flex: 0 1 auto;
|
|
574
|
+
min-width: 34px;
|
|
575
|
+
max-width: 230px;
|
|
576
|
+
height: 30px;
|
|
577
|
+
border-radius: 9px;
|
|
435
578
|
position: relative;
|
|
436
579
|
overflow: hidden;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
580
|
+
cursor: pointer;
|
|
581
|
+
user-select: none;
|
|
582
|
+
box-sizing: border-box;
|
|
583
|
+
transition: background-color var(--duration-fast) var(--easing),
|
|
584
|
+
box-shadow var(--duration-fast) var(--easing),
|
|
585
|
+
color var(--duration-fast) var(--easing),
|
|
586
|
+
opacity var(--duration-fast) var(--easing),
|
|
587
|
+
transform var(--duration-fast) var(--easing);
|
|
588
|
+
}
|
|
589
|
+
:host([no-icon]) {
|
|
590
|
+
min-width: 56px;
|
|
591
|
+
}
|
|
592
|
+
:host([aria-selected="true"]) {
|
|
593
|
+
flex: 0 0 auto;
|
|
594
|
+
min-width: 88px;
|
|
595
|
+
max-width: 270px;
|
|
596
|
+
z-index: 1;
|
|
597
|
+
}
|
|
598
|
+
:host([no-shrink]) {
|
|
599
|
+
flex: 0 0 auto;
|
|
600
|
+
min-width: max-content;
|
|
601
|
+
max-width: none;
|
|
602
|
+
}
|
|
603
|
+
:host([compact]) {
|
|
604
|
+
height: 26px;
|
|
605
|
+
border-radius: 7px;
|
|
606
|
+
}
|
|
607
|
+
:host([variant="pills"]) {
|
|
608
|
+
flex: 0 0 auto;
|
|
609
|
+
min-width: max-content;
|
|
610
|
+
max-width: none;
|
|
611
|
+
height: 28px;
|
|
612
|
+
border-radius: 7px;
|
|
613
|
+
}
|
|
614
|
+
:host([variant="bar"]) {
|
|
615
|
+
color: var(--content-color);
|
|
616
|
+
fill: var(--content-color);
|
|
617
|
+
opacity: 0.82;
|
|
618
|
+
}
|
|
619
|
+
:host([variant="bar"]:hover) {
|
|
620
|
+
opacity: 1;
|
|
621
|
+
background: color-mix(in oklch, var(--content-color) 6%, transparent);
|
|
622
|
+
}
|
|
623
|
+
:host([variant="bar"][aria-selected="true"]) {
|
|
624
|
+
opacity: 1;
|
|
625
|
+
background: var(--content-background);
|
|
626
|
+
color: var(--accent-color);
|
|
627
|
+
fill: var(--accent-color);
|
|
628
|
+
box-shadow: var(--elevation-2);
|
|
629
|
+
font-weight: 600;
|
|
630
|
+
}
|
|
631
|
+
:host([variant="rail"]) {
|
|
632
|
+
color: var(--accent-back);
|
|
633
|
+
fill: var(--accent-back);
|
|
634
|
+
opacity: 0.88;
|
|
635
|
+
}
|
|
636
|
+
:host([variant="rail"]:hover) {
|
|
637
|
+
opacity: 1;
|
|
638
|
+
background: color-mix(in oklch, var(--accent-back) 14%, transparent);
|
|
639
|
+
}
|
|
640
|
+
:host([variant="rail"][aria-selected="true"]) {
|
|
641
|
+
opacity: 1;
|
|
642
|
+
background: var(--light-background);
|
|
643
|
+
color: var(--light-color);
|
|
644
|
+
fill: var(--light-color);
|
|
645
|
+
box-shadow: 0 2px 6px var(--shadow-color);
|
|
646
|
+
font-weight: 700;
|
|
440
647
|
}
|
|
441
|
-
|
|
648
|
+
:host([variant="pills"]) {
|
|
649
|
+
color: var(--content-color);
|
|
650
|
+
fill: var(--content-color);
|
|
651
|
+
opacity: 0.78;
|
|
652
|
+
}
|
|
653
|
+
:host([variant="pills"]:hover) {
|
|
654
|
+
opacity: 1;
|
|
655
|
+
background: color-mix(in oklch, var(--content-color) 6%, transparent);
|
|
656
|
+
}
|
|
657
|
+
:host([variant="pills"][aria-selected="true"]) {
|
|
658
|
+
opacity: 1;
|
|
659
|
+
background: var(--content-background);
|
|
660
|
+
color: var(--accent-color);
|
|
661
|
+
fill: var(--accent-color);
|
|
662
|
+
box-shadow: var(--elevation-1);
|
|
663
|
+
font-weight: 600;
|
|
664
|
+
}
|
|
665
|
+
:host([selected]) {
|
|
666
|
+
outline: 2px solid var(--focus-ring-color);
|
|
667
|
+
outline-offset: -2px;
|
|
668
|
+
}
|
|
669
|
+
:host([disabled]) {
|
|
670
|
+
opacity: 0.45;
|
|
671
|
+
pointer-events: none;
|
|
672
|
+
}
|
|
673
|
+
.panel {
|
|
674
|
+
display: flex;
|
|
442
675
|
align-items: center;
|
|
443
|
-
|
|
676
|
+
width: 100%;
|
|
677
|
+
min-width: 0;
|
|
678
|
+
height: 100%;
|
|
679
|
+
padding: 0 9px;
|
|
680
|
+
box-sizing: border-box;
|
|
681
|
+
overflow: hidden;
|
|
682
|
+
}
|
|
683
|
+
:host([variant="pills"]) .panel {
|
|
684
|
+
padding: 0 11px;
|
|
685
|
+
}
|
|
686
|
+
.tab-icon {
|
|
687
|
+
flex-shrink: 0;
|
|
688
|
+
}
|
|
689
|
+
.tab-label {
|
|
690
|
+
flex: 1 1 0;
|
|
691
|
+
min-width: 0;
|
|
692
|
+
overflow: hidden;
|
|
693
|
+
text-overflow: ellipsis;
|
|
444
694
|
white-space: nowrap;
|
|
695
|
+
font-size: 13px;
|
|
696
|
+
line-height: 1.25;
|
|
697
|
+
margin-left: 6px;
|
|
698
|
+
}
|
|
699
|
+
:host([no-icon]) .tab-label {
|
|
700
|
+
margin-left: 0;
|
|
701
|
+
}
|
|
702
|
+
:host([variant="pills"]) .tab-label,
|
|
703
|
+
:host([compact]) .tab-label {
|
|
704
|
+
font-size: 12.5px;
|
|
705
|
+
}
|
|
706
|
+
.tab-badge {
|
|
707
|
+
flex-shrink: 0;
|
|
708
|
+
margin-left: 6px;
|
|
709
|
+
font-size: 11px;
|
|
710
|
+
font-weight: 600;
|
|
711
|
+
line-height: 16px;
|
|
712
|
+
min-width: 18px;
|
|
713
|
+
height: 16px;
|
|
714
|
+
padding: 0 5px;
|
|
715
|
+
border-radius: 999px;
|
|
716
|
+
text-align: center;
|
|
717
|
+
box-sizing: border-box;
|
|
718
|
+
background: color-mix(in oklch, currentColor 12%, transparent);
|
|
719
|
+
color: inherit;
|
|
720
|
+
}
|
|
721
|
+
:host([aria-selected="true"]) .tab-badge {
|
|
722
|
+
background: var(--accent-soft);
|
|
723
|
+
color: var(--accent-color);
|
|
724
|
+
}
|
|
725
|
+
:host([variant="rail"][aria-selected="true"]) .tab-badge {
|
|
726
|
+
background: color-mix(in oklch, var(--light-color) 14%, transparent);
|
|
727
|
+
color: var(--light-color);
|
|
728
|
+
}
|
|
729
|
+
.tab-tail {
|
|
730
|
+
display: inline-flex;
|
|
731
|
+
align-items: center;
|
|
732
|
+
justify-content: center;
|
|
733
|
+
flex-shrink: 0;
|
|
734
|
+
width: 0;
|
|
735
|
+
margin-left: 0;
|
|
736
|
+
opacity: 0;
|
|
445
737
|
overflow: hidden;
|
|
738
|
+
transition: width var(--duration-fast) var(--easing),
|
|
739
|
+
opacity var(--duration-fast) var(--easing),
|
|
740
|
+
margin-left var(--duration-fast) var(--easing);
|
|
741
|
+
}
|
|
742
|
+
:host([aria-selected="true"]) .tab-tail.has-tail,
|
|
743
|
+
:host(:hover) .tab-tail.has-tail,
|
|
744
|
+
.tab-tail.is-dirty {
|
|
745
|
+
width: 18px;
|
|
746
|
+
margin-left: 4px;
|
|
747
|
+
opacity: 1;
|
|
446
748
|
}
|
|
447
|
-
|
|
448
|
-
|
|
749
|
+
.dirty-dot {
|
|
750
|
+
width: 7px;
|
|
751
|
+
height: 7px;
|
|
752
|
+
border-radius: 50%;
|
|
753
|
+
background: var(--accent-color);
|
|
754
|
+
display: block;
|
|
449
755
|
}
|
|
450
|
-
:host(:
|
|
451
|
-
|
|
756
|
+
:host([variant="rail"]:not([aria-selected="true"])) .dirty-dot {
|
|
757
|
+
background: var(--accent-back);
|
|
452
758
|
}
|
|
453
|
-
.close{
|
|
454
|
-
|
|
759
|
+
:host(:hover) .tab-tail.can-close .dirty-dot {
|
|
760
|
+
display: none;
|
|
761
|
+
}
|
|
762
|
+
.close-btn {
|
|
763
|
+
display: none;
|
|
764
|
+
align-items: center;
|
|
765
|
+
justify-content: center;
|
|
766
|
+
width: 18px;
|
|
767
|
+
height: 18px;
|
|
455
768
|
border-radius: 50%;
|
|
456
769
|
cursor: pointer;
|
|
457
|
-
|
|
770
|
+
opacity: 0.72;
|
|
771
|
+
transition: background-color var(--duration-fast) var(--easing), opacity var(--duration-fast) var(--easing);
|
|
458
772
|
}
|
|
459
|
-
.close:
|
|
460
|
-
|
|
773
|
+
:host([aria-selected="true"]) .tab-tail.can-close:not(.is-dirty) .close-btn,
|
|
774
|
+
:host(:hover) .tab-tail.can-close .close-btn {
|
|
775
|
+
display: inline-flex;
|
|
461
776
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
oda-icon{
|
|
467
|
-
transition: scale .5s;
|
|
468
|
-
scale: .75;
|
|
469
|
-
margin: auto;
|
|
470
|
-
padding: 2px;
|
|
777
|
+
.close-btn:hover {
|
|
778
|
+
opacity: 1;
|
|
779
|
+
background: color-mix(in oklch, currentColor 14%, transparent);
|
|
471
780
|
}
|
|
472
781
|
</style>
|
|
473
|
-
<div class="panel"
|
|
474
|
-
<oda-icon
|
|
475
|
-
<
|
|
476
|
-
<
|
|
477
|
-
|
|
478
|
-
|
|
782
|
+
<div class="panel" :title="tooltip" @tap="focus($event)">
|
|
783
|
+
<oda-icon class="tab-icon" ~if="hasIcon" :icon="resolvedIcon" :icon-size="resolvedIconSize"></oda-icon>
|
|
784
|
+
<span class="tab-label" ~if="label">{{label}}</span>
|
|
785
|
+
<span class="tab-badge" ~if="showBadge">{{badgeText}}</span>
|
|
786
|
+
<span class="tab-tail" ~class="{ 'has-tail': canClose || isDirty, 'can-close': canClose, 'is-dirty': isDirty }" ~if="canClose || isDirty">
|
|
787
|
+
<span class="dirty-dot" ~if="isDirty" title="Есть несохранённые изменения"></span>
|
|
788
|
+
<span class="close-btn" ~if="canClose" title="Закрыть" @tap.stop="close($event)" @pointerdown.stop>
|
|
789
|
+
<oda-icon icon="icons:close" :icon-size="13"></oda-icon>
|
|
790
|
+
</span>
|
|
791
|
+
</span>
|
|
479
792
|
</div>
|
|
480
793
|
`,
|
|
481
|
-
|
|
482
|
-
|
|
794
|
+
variant: {
|
|
795
|
+
$attr: true,
|
|
796
|
+
get() {
|
|
797
|
+
return this.host?.variant || 'bar';
|
|
798
|
+
}
|
|
483
799
|
},
|
|
484
|
-
|
|
485
|
-
|
|
800
|
+
compact: {
|
|
801
|
+
$attr: true,
|
|
802
|
+
$type: Boolean,
|
|
803
|
+
get() {
|
|
804
|
+
return Boolean(this.host?.compact);
|
|
805
|
+
}
|
|
486
806
|
},
|
|
487
|
-
|
|
488
|
-
|
|
807
|
+
noShrink: {
|
|
808
|
+
$attr: true,
|
|
809
|
+
$type: Boolean,
|
|
810
|
+
get() {
|
|
811
|
+
return Boolean(this.host?.noShrink);
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
noIcon: {
|
|
815
|
+
$attr: true,
|
|
816
|
+
$type: Boolean,
|
|
817
|
+
get() {
|
|
818
|
+
return !this.hasIcon;
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
get hasIcon() {
|
|
822
|
+
return Boolean(this.resolvedIcon);
|
|
823
|
+
},
|
|
824
|
+
get resolvedIcon() {
|
|
825
|
+
return this.item?.icon || this.host?.defaultIcon || '';
|
|
826
|
+
},
|
|
827
|
+
get resolvedIconSize() {
|
|
828
|
+
return this.host?.compact ? 14 : (this.host?.iconSize || 16);
|
|
829
|
+
},
|
|
830
|
+
get canClose() {
|
|
831
|
+
return Boolean(this.host?.isTabClosable?.(this.item));
|
|
832
|
+
},
|
|
833
|
+
get isDirty() {
|
|
834
|
+
return Boolean(this.item?.dirty);
|
|
489
835
|
},
|
|
490
836
|
get label() {
|
|
491
837
|
return this.item?.label || '';
|
|
492
838
|
},
|
|
493
|
-
get
|
|
494
|
-
return this.
|
|
839
|
+
get tooltip() {
|
|
840
|
+
return this.item?.title || this.label || '';
|
|
841
|
+
},
|
|
842
|
+
get showBadge() {
|
|
843
|
+
const c = this.item?.count;
|
|
844
|
+
return c !== undefined && c !== null && c !== '' && c !== 0 && c !== '0' || Boolean(this.item?.showZeroCount && c === 0);
|
|
495
845
|
},
|
|
496
|
-
get
|
|
497
|
-
return this.
|
|
846
|
+
get badgeText() {
|
|
847
|
+
return String(this.item?.count ?? '');
|
|
848
|
+
},
|
|
849
|
+
get disabled() {
|
|
850
|
+
return Boolean(this.item?.disabled);
|
|
498
851
|
},
|
|
499
852
|
$listeners: {
|
|
853
|
+
mousedown(e) {
|
|
854
|
+
if (e.button === 1 && this.canClose)
|
|
855
|
+
e.preventDefault();
|
|
856
|
+
},
|
|
857
|
+
auxclick(e) {
|
|
858
|
+
if (e.button === 1 && this.canClose) {
|
|
859
|
+
e.preventDefault();
|
|
860
|
+
e.stopPropagation();
|
|
861
|
+
this.close(e);
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
contextmenu(e) {
|
|
865
|
+
this.host?._openTabContextMenu?.(this.index, e);
|
|
866
|
+
},
|
|
500
867
|
dragstart(e) {
|
|
868
|
+
if (!this.host?.allowDrag) {
|
|
869
|
+
e.preventDefault();
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
e.dataTransfer.setData('text/plain', String(this.index));
|
|
501
873
|
e.dataTransfer.setDragImage(document.createElement('img'), 0, 0);
|
|
502
|
-
e.dataTransfer.effectAllowed =
|
|
874
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
503
875
|
drag.item = this;
|
|
504
|
-
drag.
|
|
505
|
-
drag.
|
|
506
|
-
drag.
|
|
876
|
+
drag.host = this.host;
|
|
877
|
+
drag.fromIndex = this.index;
|
|
878
|
+
drag.toIndex = this.index;
|
|
507
879
|
drag.pointer = this.host.__is_vertical ? e.offsetY : e.offsetX;
|
|
508
880
|
drag.start = this.host.__is_vertical ? e.clientY : e.clientX;
|
|
881
|
+
this.style.transition = 'none';
|
|
882
|
+
this.style.zIndex = 2;
|
|
883
|
+
this.style.opacity = '0.85';
|
|
509
884
|
},
|
|
510
|
-
dragend(
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
el.style.transform = '';
|
|
885
|
+
dragend() {
|
|
886
|
+
const scroller = this.host?.__scroller;
|
|
887
|
+
if (scroller) {
|
|
888
|
+
for (const el of scroller.children) {
|
|
889
|
+
el.style.transform = '';
|
|
890
|
+
}
|
|
517
891
|
}
|
|
892
|
+
this.style.transform = '';
|
|
893
|
+
this.style.transition = '';
|
|
894
|
+
this.style.zIndex = '';
|
|
895
|
+
this.style.opacity = '';
|
|
896
|
+
drag.item = null;
|
|
897
|
+
drag.host = null;
|
|
898
|
+
drag.fromIndex = -1;
|
|
899
|
+
drag.toIndex = -1;
|
|
518
900
|
},
|
|
519
901
|
drop(e) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
902
|
+
e.preventDefault();
|
|
903
|
+
if (!drag.item || drag.host !== this.host)
|
|
904
|
+
return;
|
|
905
|
+
const fromIndex = drag.fromIndex;
|
|
906
|
+
const toIndex = drag.toIndex >= 0 ? drag.toIndex : this.index;
|
|
907
|
+
const scroller = this.host?.__scroller;
|
|
908
|
+
if (scroller) {
|
|
909
|
+
for (const el of scroller.children) {
|
|
910
|
+
el.style.transform = '';
|
|
911
|
+
}
|
|
527
912
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
913
|
+
if (fromIndex < 0 || toIndex < 0 || fromIndex === toIndex)
|
|
914
|
+
return;
|
|
915
|
+
const next = [...(this.host.items || [])];
|
|
916
|
+
const focusedItem = next[this.host.focusedIndex];
|
|
917
|
+
const [moved] = next.splice(fromIndex, 1);
|
|
918
|
+
next.splice(toIndex, 0, moved);
|
|
919
|
+
this.host.items = next;
|
|
920
|
+
if (focusedItem) {
|
|
921
|
+
const newFocused = next.indexOf(focusedItem);
|
|
922
|
+
if (newFocused >= 0)
|
|
923
|
+
this.host.focusedIndex = newFocused;
|
|
532
924
|
}
|
|
533
|
-
this.host.
|
|
925
|
+
this.host.dispatchEvent(new CustomEvent('reorder', {
|
|
926
|
+
detail: { items: next, fromIndex, toIndex },
|
|
927
|
+
bubbles: true,
|
|
928
|
+
composed: true,
|
|
929
|
+
}));
|
|
534
930
|
}
|
|
535
931
|
},
|
|
536
932
|
index: -1,
|
|
933
|
+
item: null,
|
|
537
934
|
focus(e) {
|
|
538
|
-
this.host
|
|
539
|
-
this.host.focusedIndex = this.index;
|
|
935
|
+
this.host?.selectTab?.(this.index, e);
|
|
540
936
|
},
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
},
|
|
546
|
-
item: null,
|
|
547
|
-
close(e){
|
|
548
|
-
this.$pdp.tabs.fire('close', this.item);
|
|
937
|
+
close(e) {
|
|
938
|
+
e?.stopPropagation?.();
|
|
939
|
+
this.host?.requestCloseTab?.(this.index, e);
|
|
549
940
|
}
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
|
|
941
|
+
});
|