@celljs/ta-web 4.9.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -3
- package/README.md +4 -3
- package/esm/browser/assistant/assistant-chat-list.js +8 -2
- package/esm/browser/assistant/assistant-extension.d.ts +8 -1
- package/esm/browser/assistant/assistant-extension.js +33 -5
- package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
- package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-source.js +2 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
- package/esm/browser/assistant/assistant-task-util.js +13 -3
- package/esm/browser/assistant/assistant-tasks.js +3 -2
- package/esm/browser/assistant/assistant-view.js +81 -56
- package/esm/browser/assistant/assistant.d.ts +30 -1
- package/esm/browser/assistant/assistant.js +89 -6
- package/esm/browser/assistant/task-views.d.ts +40 -6
- package/esm/browser/assistant/task-views.js +73 -21
- package/esm/browser/avatar/dino-avatar.d.ts +3 -4
- package/esm/browser/avatar/dino-avatar.js +4 -178
- package/esm/browser/avatar/dino-face.d.ts +19 -0
- package/esm/browser/avatar/dino-face.js +142 -0
- package/esm/browser/avatar/dino-geometry.d.ts +11 -0
- package/esm/browser/avatar/dino-geometry.js +38 -0
- package/esm/browser/avatar/dino-kinds.d.ts +15 -0
- package/esm/browser/avatar/dino-kinds.js +544 -0
- package/esm/browser/avatar/dino-motion.js +1 -1
- package/esm/browser/avatar/dino-shape.d.ts +80 -0
- package/esm/browser/avatar/dino-shape.js +113 -0
- package/esm/browser/avatar/dino-species.d.ts +1 -61
- package/esm/browser/avatar/dino-species.js +2 -653
- package/esm/browser/chat/chat-packages.d.ts +39 -0
- package/esm/browser/chat/chat-packages.js +70 -0
- package/esm/browser/chat/chat-protocol.d.ts +23 -1
- package/esm/browser/chat/chat-stores.d.ts +59 -0
- package/esm/browser/chat/chat-stores.js +121 -0
- package/esm/browser/chat/chat-util.d.ts +17 -0
- package/esm/browser/chat/chat-util.js +61 -0
- package/esm/browser/chat/chat-view.js +33 -12
- package/esm/browser/chat/chat.d.ts +31 -39
- package/esm/browser/chat/chat.js +226 -175
- package/esm/browser/components/access-view.js +1 -1
- package/esm/browser/components/account-menu.js +1 -1
- package/esm/browser/components/app-nav.d.ts +6 -3
- package/esm/browser/components/app-nav.js +19 -10
- package/esm/browser/components/app-shell-hooks.d.ts +47 -0
- package/esm/browser/components/app-shell-hooks.js +169 -0
- package/esm/browser/components/app-view.js +81 -172
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/chat-list.d.ts +20 -2
- package/esm/browser/components/chat-list.js +138 -22
- package/esm/browser/components/composer-box.d.ts +5 -5
- package/esm/browser/components/composer-box.js +111 -4
- package/esm/browser/components/composer.d.ts +7 -0
- package/esm/browser/components/composer.js +22 -14
- package/esm/browser/components/connection-bar.js +50 -17
- package/esm/browser/components/context-menu.d.ts +30 -4
- package/esm/browser/components/context-menu.js +199 -37
- package/esm/browser/components/conversation-scroll.d.ts +129 -6
- package/esm/browser/components/conversation-scroll.js +429 -109
- package/esm/browser/components/dino.js +1 -1
- package/esm/browser/components/earlier-messages.d.ts +2 -1
- package/esm/browser/components/earlier-messages.js +2 -17
- package/esm/browser/components/editor-area.d.ts +3 -1
- package/esm/browser/components/editor-area.js +6 -5
- package/esm/browser/components/empty-pictures.d.ts +0 -2
- package/esm/browser/components/empty-pictures.js +0 -16
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +30 -9
- package/esm/browser/components/held-talk.d.ts +28 -0
- package/esm/browser/components/held-talk.js +76 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +1 -1
- package/esm/browser/components/icon.d.ts +2 -2
- package/esm/browser/components/icon.js +5 -6
- package/esm/browser/components/image-viewer.d.ts +124 -0
- package/esm/browser/components/image-viewer.js +397 -0
- package/esm/browser/components/lightbox.d.ts +11 -0
- package/esm/browser/components/lightbox.js +24 -0
- package/esm/browser/components/markdown.d.ts +6 -2
- package/esm/browser/components/markdown.js +24 -10
- package/esm/browser/components/media.js +1 -10
- package/esm/browser/components/message-footer.d.ts +16 -2
- package/esm/browser/components/message-footer.js +29 -12
- package/esm/browser/components/message-list.d.ts +24 -3
- package/esm/browser/components/message-list.js +149 -20
- package/esm/browser/components/message-menu.d.ts +3 -1
- package/esm/browser/components/message-menu.js +18 -3
- package/esm/browser/components/nav-places.d.ts +16 -1
- package/esm/browser/components/nav-places.js +12 -3
- package/esm/browser/components/phone-shell.d.ts +4 -1
- package/esm/browser/components/phone-shell.js +3 -1
- package/esm/browser/components/run-status.js +3 -3
- package/esm/browser/components/select-bar.d.ts +9 -0
- package/esm/browser/components/select-bar.js +24 -0
- package/esm/browser/components/session-settings.d.ts +6 -0
- package/esm/browser/components/session-settings.js +14 -1
- package/esm/browser/components/session-view.js +8 -4
- package/esm/browser/components/settings-choices.d.ts +35 -0
- package/esm/browser/components/settings-choices.js +117 -0
- package/esm/browser/components/settings-parts.d.ts +21 -0
- package/esm/browser/components/settings-parts.js +323 -0
- package/esm/browser/components/settings-view.d.ts +0 -6
- package/esm/browser/components/settings-view.js +4 -406
- package/esm/browser/components/swipe-row.d.ts +2 -2
- package/esm/browser/components/swipe-row.js +7 -3
- package/esm/browser/components/tool-view.js +14 -12
- package/esm/browser/components/voice-button.d.ts +1 -1
- package/esm/browser/components/voice-button.js +1 -1
- package/esm/browser/components/voice-talk.d.ts +43 -0
- package/esm/browser/components/voice-talk.js +222 -0
- package/esm/browser/components/workbench-view.js +1 -1
- package/esm/browser/device/device.d.ts +3 -0
- package/esm/browser/device/device.js +11 -1
- package/esm/browser/device/hold.d.ts +42 -0
- package/esm/browser/device/hold.js +136 -0
- package/esm/browser/device/launch-screen.d.ts +1 -1
- package/esm/browser/device/launch-screen.js +1 -1
- package/esm/browser/device/long-press.d.ts +2 -0
- package/esm/browser/device/long-press.js +16 -1
- package/esm/browser/device/pull-down.d.ts +4 -2
- package/esm/browser/device/pull-down.js +64 -76
- package/esm/browser/device/row-swipe.d.ts +35 -10
- package/esm/browser/device/row-swipe.js +149 -71
- package/esm/browser/device/shake-undo.d.ts +16 -0
- package/esm/browser/device/shake-undo.js +59 -0
- package/esm/browser/device/sheet-swipe.d.ts +118 -18
- package/esm/browser/device/sheet-swipe.js +406 -107
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-extension-api.d.ts +135 -2
- package/esm/browser/extension/web-extension-code.d.ts +6 -0
- package/esm/browser/extension/web-extension-code.js +24 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
- package/esm/browser/extension/web-extension-protocol.js +8 -0
- package/esm/browser/extension/web-extensions.d.ts +14 -1
- package/esm/browser/extension/web-extensions.js +128 -24
- package/esm/browser/extension/web-tasks.d.ts +9 -1
- package/esm/browser/extension/web-tasks.js +24 -0
- package/esm/browser/files/files-protocol.d.ts +25 -0
- package/esm/browser/files/files-protocol.js +2 -0
- package/esm/browser/files/files.d.ts +35 -0
- package/esm/browser/files/files.js +119 -0
- package/esm/browser/hooks.d.ts +3 -1
- package/esm/browser/hooks.js +8 -0
- package/esm/browser/i18n/locales.d.ts +29 -2
- package/esm/browser/i18n/messages.d.ts +28 -1
- package/esm/browser/i18n/messages.js +58 -4
- package/esm/browser/index.d.ts +6 -0
- package/esm/browser/index.js +6 -0
- package/esm/browser/notices/notices-protocol.d.ts +9 -1
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +20 -10
- package/esm/browser/offline/device-values.d.ts +55 -0
- package/esm/browser/offline/device-values.js +142 -0
- package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
- package/esm/browser/offline/kept-chats-protocol.js +2 -0
- package/esm/browser/offline/kept-chats.d.ts +47 -0
- package/esm/browser/offline/kept-chats.js +146 -0
- package/esm/browser/offline/offline-reads.d.ts +44 -0
- package/esm/browser/offline/offline-reads.js +107 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +57 -17
- package/esm/browser/style/device.js +43 -4
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +67 -15
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +47 -3
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +2 -0
- package/esm/browser/util/frame.d.ts +5 -4
- package/esm/browser/util/frame.js +5 -4
- package/esm/browser/util/markdown.d.ts +18 -1
- package/esm/browser/util/markdown.js +119 -5
- package/esm/browser/util/process.d.ts +21 -0
- package/esm/browser/util/process.js +45 -1
- package/esm/browser/util/voice.d.ts +5 -2
- package/esm/browser/util/voice.js +6 -3
- package/esm/browser/util/zoom.d.ts +46 -0
- package/esm/browser/util/zoom.js +96 -0
- package/esm/browser/workbench-calls.d.ts +59 -0
- package/esm/browser/workbench-calls.js +141 -0
- package/esm/browser/workbench-protocol.d.ts +5 -1
- package/esm/browser/workbench-util.d.ts +68 -0
- package/esm/browser/workbench-util.js +145 -0
- package/esm/browser/workbench.d.ts +15 -42
- package/esm/browser/workbench.js +53 -167
- package/lib/browser/assistant/assistant-chat-list.js +8 -2
- package/lib/browser/assistant/assistant-extension.d.ts +8 -1
- package/lib/browser/assistant/assistant-extension.js +33 -5
- package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
- package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-source.js +2 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
- package/lib/browser/assistant/assistant-task-util.js +13 -3
- package/lib/browser/assistant/assistant-tasks.js +2 -1
- package/lib/browser/assistant/assistant-view.js +78 -53
- package/lib/browser/assistant/assistant.d.ts +30 -1
- package/lib/browser/assistant/assistant.js +89 -6
- package/lib/browser/assistant/task-views.d.ts +40 -6
- package/lib/browser/assistant/task-views.js +74 -21
- package/lib/browser/avatar/dino-avatar.d.ts +3 -4
- package/lib/browser/avatar/dino-avatar.js +27 -202
- package/lib/browser/avatar/dino-face.d.ts +20 -0
- package/lib/browser/avatar/dino-face.js +148 -0
- package/lib/browser/avatar/dino-geometry.d.ts +12 -0
- package/lib/browser/avatar/dino-geometry.js +47 -0
- package/lib/browser/avatar/dino-kinds.d.ts +16 -0
- package/lib/browser/avatar/dino-kinds.js +547 -0
- package/lib/browser/avatar/dino-motion.js +2 -2
- package/lib/browser/avatar/dino-shape.d.ts +81 -0
- package/lib/browser/avatar/dino-shape.js +126 -0
- package/lib/browser/avatar/dino-species.d.ts +1 -61
- package/lib/browser/avatar/dino-species.js +34 -687
- package/lib/browser/chat/chat-packages.d.ts +40 -0
- package/lib/browser/chat/chat-packages.js +74 -0
- package/lib/browser/chat/chat-protocol.d.ts +23 -1
- package/lib/browser/chat/chat-stores.d.ts +60 -0
- package/lib/browser/chat/chat-stores.js +125 -0
- package/lib/browser/chat/chat-util.d.ts +18 -0
- package/lib/browser/chat/chat-util.js +64 -0
- package/lib/browser/chat/chat-view.js +33 -12
- package/lib/browser/chat/chat.d.ts +31 -39
- package/lib/browser/chat/chat.js +227 -176
- package/lib/browser/components/access-view.js +2 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/app-nav.d.ts +6 -3
- package/lib/browser/components/app-nav.js +17 -8
- package/lib/browser/components/app-shell-hooks.d.ts +48 -0
- package/lib/browser/components/app-shell-hooks.js +211 -0
- package/lib/browser/components/app-view.js +89 -180
- package/lib/browser/components/auth-view.js +3 -3
- package/lib/browser/components/chat-list.d.ts +20 -2
- package/lib/browser/components/chat-list.js +137 -21
- package/lib/browser/components/composer-box.d.ts +5 -5
- package/lib/browser/components/composer-box.js +111 -4
- package/lib/browser/components/composer.d.ts +7 -0
- package/lib/browser/components/composer.js +22 -14
- package/lib/browser/components/connection-bar.js +48 -15
- package/lib/browser/components/context-menu.d.ts +30 -4
- package/lib/browser/components/context-menu.js +198 -36
- package/lib/browser/components/conversation-scroll.d.ts +129 -6
- package/lib/browser/components/conversation-scroll.js +431 -110
- package/lib/browser/components/dino.js +3 -3
- package/lib/browser/components/earlier-messages.d.ts +2 -1
- package/lib/browser/components/earlier-messages.js +2 -17
- package/lib/browser/components/editor-area.d.ts +3 -1
- package/lib/browser/components/editor-area.js +5 -4
- package/lib/browser/components/empty-pictures.d.ts +0 -2
- package/lib/browser/components/empty-pictures.js +0 -17
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +30 -9
- package/lib/browser/components/held-talk.d.ts +29 -0
- package/lib/browser/components/held-talk.js +79 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +5 -5
- package/lib/browser/components/icon.d.ts +2 -2
- package/lib/browser/components/icon.js +7 -6
- package/lib/browser/components/image-viewer.d.ts +125 -0
- package/lib/browser/components/image-viewer.js +435 -0
- package/lib/browser/components/lightbox.d.ts +12 -0
- package/lib/browser/components/lightbox.js +60 -0
- package/lib/browser/components/markdown.d.ts +6 -2
- package/lib/browser/components/markdown.js +24 -10
- package/lib/browser/components/media.js +2 -11
- package/lib/browser/components/message-footer.d.ts +16 -2
- package/lib/browser/components/message-footer.js +31 -12
- package/lib/browser/components/message-list.d.ts +24 -3
- package/lib/browser/components/message-list.js +146 -16
- package/lib/browser/components/message-menu.d.ts +3 -1
- package/lib/browser/components/message-menu.js +17 -2
- package/lib/browser/components/nav-places.d.ts +16 -1
- package/lib/browser/components/nav-places.js +13 -3
- package/lib/browser/components/phone-shell.d.ts +4 -1
- package/lib/browser/components/phone-shell.js +3 -1
- package/lib/browser/components/run-status.js +3 -3
- package/lib/browser/components/select-bar.d.ts +10 -0
- package/lib/browser/components/select-bar.js +61 -0
- package/lib/browser/components/session-settings.d.ts +6 -0
- package/lib/browser/components/session-settings.js +14 -1
- package/lib/browser/components/session-view.js +7 -3
- package/lib/browser/components/settings-choices.d.ts +36 -0
- package/lib/browser/components/settings-choices.js +156 -0
- package/lib/browser/components/settings-parts.d.ts +22 -0
- package/lib/browser/components/settings-parts.js +359 -0
- package/lib/browser/components/settings-view.d.ts +0 -6
- package/lib/browser/components/settings-view.js +2 -405
- package/lib/browser/components/swipe-row.d.ts +2 -2
- package/lib/browser/components/swipe-row.js +7 -3
- package/lib/browser/components/tool-view.js +14 -12
- package/lib/browser/components/voice-button.d.ts +1 -1
- package/lib/browser/components/voice-button.js +1 -1
- package/lib/browser/components/voice-talk.d.ts +44 -0
- package/lib/browser/components/voice-talk.js +260 -0
- package/lib/browser/components/workbench-view.js +3 -3
- package/lib/browser/device/device.d.ts +3 -0
- package/lib/browser/device/device.js +11 -1
- package/lib/browser/device/hold.d.ts +43 -0
- package/lib/browser/device/hold.js +173 -0
- package/lib/browser/device/launch-screen.d.ts +1 -1
- package/lib/browser/device/launch-screen.js +1 -1
- package/lib/browser/device/long-press.d.ts +2 -0
- package/lib/browser/device/long-press.js +16 -1
- package/lib/browser/device/pull-down.d.ts +4 -2
- package/lib/browser/device/pull-down.js +63 -75
- package/lib/browser/device/row-swipe.d.ts +35 -10
- package/lib/browser/device/row-swipe.js +148 -70
- package/lib/browser/device/shake-undo.d.ts +17 -0
- package/lib/browser/device/shake-undo.js +63 -0
- package/lib/browser/device/sheet-swipe.d.ts +118 -18
- package/lib/browser/device/sheet-swipe.js +410 -108
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +135 -2
- package/lib/browser/extension/web-extension-code.d.ts +6 -0
- package/lib/browser/extension/web-extension-code.js +24 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
- package/lib/browser/extension/web-extension-protocol.js +9 -1
- package/lib/browser/extension/web-extensions.d.ts +14 -1
- package/lib/browser/extension/web-extensions.js +125 -21
- package/lib/browser/extension/web-tasks.d.ts +9 -1
- package/lib/browser/extension/web-tasks.js +24 -0
- package/lib/browser/files/files-protocol.d.ts +26 -0
- package/lib/browser/files/files-protocol.js +5 -0
- package/lib/browser/files/files.d.ts +36 -0
- package/lib/browser/files/files.js +122 -0
- package/lib/browser/hooks.d.ts +3 -1
- package/lib/browser/hooks.js +9 -0
- package/lib/browser/i18n/locales.d.ts +29 -2
- package/lib/browser/i18n/messages.d.ts +28 -1
- package/lib/browser/i18n/messages.js +58 -4
- package/lib/browser/index.d.ts +6 -0
- package/lib/browser/index.js +6 -0
- package/lib/browser/notices/notices-protocol.d.ts +9 -1
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +20 -10
- package/lib/browser/offline/device-values.d.ts +56 -0
- package/lib/browser/offline/device-values.js +148 -0
- package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
- package/lib/browser/offline/kept-chats-protocol.js +5 -0
- package/lib/browser/offline/kept-chats.d.ts +48 -0
- package/lib/browser/offline/kept-chats.js +149 -0
- package/lib/browser/offline/offline-reads.d.ts +45 -0
- package/lib/browser/offline/offline-reads.js +111 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +57 -17
- package/lib/browser/style/device.js +43 -4
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +67 -15
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +47 -3
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +2 -0
- package/lib/browser/util/frame.d.ts +5 -4
- package/lib/browser/util/frame.js +5 -4
- package/lib/browser/util/markdown.d.ts +18 -1
- package/lib/browser/util/markdown.js +119 -5
- package/lib/browser/util/process.d.ts +21 -0
- package/lib/browser/util/process.js +46 -2
- package/lib/browser/util/voice.d.ts +5 -2
- package/lib/browser/util/voice.js +6 -3
- package/lib/browser/util/zoom.d.ts +47 -0
- package/lib/browser/util/zoom.js +99 -0
- package/lib/browser/workbench-calls.d.ts +60 -0
- package/lib/browser/workbench-calls.js +145 -0
- package/lib/browser/workbench-protocol.d.ts +5 -1
- package/lib/browser/workbench-util.d.ts +69 -0
- package/lib/browser/workbench-util.js +151 -0
- package/lib/browser/workbench.d.ts +15 -42
- package/lib/browser/workbench.js +74 -189
- package/package.json +10 -10
- package/public/launch.svg +46 -42
|
@@ -38,6 +38,7 @@ exports.Elapsed = Elapsed;
|
|
|
38
38
|
exports.TaskIcon = TaskIcon;
|
|
39
39
|
exports.taskLine = taskLine;
|
|
40
40
|
exports.TaskCards = TaskCards;
|
|
41
|
+
exports.useTaskSelection = useTaskSelection;
|
|
41
42
|
exports.TaskBoardList = TaskBoardList;
|
|
42
43
|
exports.TasksChip = TasksChip;
|
|
43
44
|
exports.AskCard = AskCard;
|
|
@@ -47,6 +48,8 @@ const context_menu_1 = require("../components/context-menu");
|
|
|
47
48
|
const empty_pictures_1 = require("../components/empty-pictures");
|
|
48
49
|
const empty_state_1 = require("../components/empty-state");
|
|
49
50
|
const icon_1 = require("../components/icon");
|
|
51
|
+
const select_bar_1 = require("../components/select-bar");
|
|
52
|
+
const swipe_row_1 = require("../components/swipe-row");
|
|
50
53
|
const web_tasks_1 = require("../extension/web-tasks");
|
|
51
54
|
const use_t_1 = require("../i18n/use-t");
|
|
52
55
|
// The tasks of the double and of extensions, drawn alike: a card in the turn that started it, a row in the lists.
|
|
@@ -109,21 +112,21 @@ function taskLine(task, t) {
|
|
|
109
112
|
const detail = (_a = task.detail) === null || _a === void 0 ? void 0 : _a.trim();
|
|
110
113
|
return detail && detail !== status ? detail : status;
|
|
111
114
|
}
|
|
112
|
-
function menuItems(task) {
|
|
115
|
+
function menuItems(task, more) {
|
|
113
116
|
var _a;
|
|
114
117
|
var _b;
|
|
115
|
-
return
|
|
118
|
+
return [
|
|
119
|
+
...((_b = (_a = task.menu) === null || _a === void 0 ? void 0 : _a.call(task)) !== null && _b !== void 0 ? _b : []).map(section => section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run }))),
|
|
120
|
+
more,
|
|
121
|
+
]
|
|
116
122
|
.filter(section => section.length > 0)
|
|
117
|
-
.flatMap((section, index) => [
|
|
118
|
-
...(index > 0 ? ['-'] : []),
|
|
119
|
-
...section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run })),
|
|
120
|
-
]);
|
|
123
|
+
.flatMap((section, index) => [...(index > 0 ? ['-'] : []), ...section]);
|
|
121
124
|
}
|
|
122
|
-
/** A held finger or a right click opens its …; so does the button that shows on hover. */
|
|
123
|
-
function useTaskMenu(task) {
|
|
125
|
+
/** A held finger or a right click opens its …; so does the button that shows on hover. `more`: what the list adds, last. */
|
|
126
|
+
function useTaskMenu(task, more = []) {
|
|
124
127
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
125
128
|
const open = (event) => {
|
|
126
|
-
const items = menuItems(task);
|
|
129
|
+
const items = menuItems(task, more);
|
|
127
130
|
if (items.length > 0) {
|
|
128
131
|
openMenu(event, items);
|
|
129
132
|
}
|
|
@@ -155,12 +158,18 @@ function TaskCards({ tasks }) {
|
|
|
155
158
|
}
|
|
156
159
|
return (React.createElement("div", { className: "ta-task-cards" }, tasks.map(task => (React.createElement(exports.TaskCard, { key: task.key, task: task })))));
|
|
157
160
|
}
|
|
158
|
-
/**
|
|
159
|
-
|
|
161
|
+
/**
|
|
162
|
+
* A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
|
|
163
|
+
* Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
|
|
164
|
+
*/
|
|
165
|
+
exports.TaskRow = React.memo(function TaskRow({ task, actions, selecting = false, checked = false }) {
|
|
160
166
|
const t = (0, use_t_1.useT)();
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
const removable = !!task.remove && !!actions;
|
|
168
|
+
const [menu, openMenu] = useTaskMenu(task, removable ? [{ label: t('ta.tasks.select'), run: () => actions === null || actions === void 0 ? void 0 : actions.select(task.key) }] : []);
|
|
169
|
+
const swipe = removable && !selecting ? [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => actions === null || actions === void 0 ? void 0 : actions.remove(task) }] : undefined;
|
|
170
|
+
return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-task-row ta-task-${task.status}${selecting ? ' ta-selecting' : ''}`, actions: swipe, overlay: menu, onContextMenu: selecting ? undefined : openMenu },
|
|
171
|
+
React.createElement("button", { type: "button", className: "ta-task-row-main", "aria-pressed": selecting ? checked : undefined, disabled: selecting && !removable, onClick: selecting ? () => actions === null || actions === void 0 ? void 0 : actions.toggle(task.key) : () => task.open() },
|
|
172
|
+
selecting && React.createElement(select_bar_1.SelectCheck, { checked: checked, disabled: !removable }),
|
|
164
173
|
React.createElement(TaskIcon, { task: task, size: 28 }),
|
|
165
174
|
React.createElement("span", { className: "ta-task-row-text" },
|
|
166
175
|
React.createElement("span", { className: "ta-task-row-title" }, task.title),
|
|
@@ -168,29 +177,73 @@ exports.TaskRow = React.memo(function TaskRow({ task }) {
|
|
|
168
177
|
React.createElement("span", { className: `ta-status ta-status-${exports.TASK_DOT[task.status]}` }),
|
|
169
178
|
React.createElement("span", null, taskLine(task, t)))),
|
|
170
179
|
React.createElement(Elapsed, { task: task })),
|
|
171
|
-
task.menu && React.createElement(icon_1.IconButton, { icon: lucide_react_1.MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu })
|
|
172
|
-
menu));
|
|
180
|
+
(task.menu || removable) && !selecting && React.createElement(icon_1.IconButton, { icon: lucide_react_1.MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu })));
|
|
173
181
|
});
|
|
174
182
|
const ENDED_SHOWN = 8;
|
|
175
|
-
/**
|
|
176
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
|
|
185
|
+
* swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
|
|
186
|
+
* gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
|
|
187
|
+
*/
|
|
188
|
+
function useTaskSelection(tasks, remove) {
|
|
189
|
+
const [chosen, setChosen] = React.useState();
|
|
190
|
+
const removable = React.useMemo(() => tasks.filter(task => task.remove), [tasks]);
|
|
191
|
+
const selected = chosen ? removable.filter(task => chosen.has(task.key)) : [];
|
|
192
|
+
const selecting = !!chosen && removable.length > 0;
|
|
193
|
+
React.useEffect(() => {
|
|
194
|
+
if (chosen && removable.length === 0) {
|
|
195
|
+
setChosen(undefined);
|
|
196
|
+
}
|
|
197
|
+
}, [chosen, removable.length]);
|
|
198
|
+
const actions = React.useMemo(() => ({
|
|
199
|
+
remove: task => void remove([task]),
|
|
200
|
+
select: key => setChosen(new Set([key])),
|
|
201
|
+
toggle: key => setChosen(before => {
|
|
202
|
+
const next = new Set(before);
|
|
203
|
+
if (!next.delete(key)) {
|
|
204
|
+
next.add(key);
|
|
205
|
+
}
|
|
206
|
+
return next;
|
|
207
|
+
}),
|
|
208
|
+
}), [remove]);
|
|
209
|
+
return {
|
|
210
|
+
actions,
|
|
211
|
+
selecting,
|
|
212
|
+
isChosen: (task) => !!(chosen === null || chosen === void 0 ? void 0 : chosen.has(task.key)),
|
|
213
|
+
selected,
|
|
214
|
+
removable,
|
|
215
|
+
selectAll: (all) => setChosen(new Set(all ? removable.map(task => task.key) : [])),
|
|
216
|
+
done: () => setChosen(undefined),
|
|
217
|
+
/** Deletes those chosen once the user agrees, and stops selecting. */
|
|
218
|
+
removeSelected: async () => {
|
|
219
|
+
if (await remove(selected)) {
|
|
220
|
+
setChosen(undefined);
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
|
|
226
|
+
function TaskBoardList({ tasks, onRemove }) {
|
|
177
227
|
const t = (0, use_t_1.useT)();
|
|
178
228
|
const [all, setAll] = React.useState(false);
|
|
179
229
|
const groups = React.useMemo(() => web_tasks_1.WebTaskUtil.groups(tasks), [tasks]);
|
|
230
|
+
const selection = useTaskSelection(tasks, onRemove);
|
|
180
231
|
if (tasks.length === 0) {
|
|
181
232
|
return React.createElement(empty_state_1.EmptyState, { picture: React.createElement(empty_pictures_1.TasksPicture, null), title: t('ta.assistant.noTasks'), hint: t('ta.assistant.noTasksHint') });
|
|
182
233
|
}
|
|
183
|
-
|
|
234
|
+
// Selecting, every row shows: Select all chooses what the user sees.
|
|
235
|
+
const ended = all || selection.selecting ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
|
|
184
236
|
const group = (title, list, more) => list.length > 0 && (React.createElement("section", { className: "ta-task-group" },
|
|
185
237
|
React.createElement("div", { className: "ta-task-group-title" },
|
|
186
238
|
React.createElement("span", null, t(title)),
|
|
187
239
|
React.createElement("span", { className: "ta-task-group-count" }, list === ended ? groups.ended.length : list.length)),
|
|
188
|
-
React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(exports.TaskRow, { key: task.key, task: task })))),
|
|
240
|
+
React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(exports.TaskRow, { key: task.key, task: task, actions: selection.actions, selecting: selection.selecting, checked: selection.isChosen(task) })))),
|
|
189
241
|
more));
|
|
190
242
|
return (React.createElement(React.Fragment, null,
|
|
191
243
|
group('ta.tasks.waiting', groups.waiting),
|
|
192
244
|
group('ta.tasks.running', groups.running),
|
|
193
|
-
group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length }))))
|
|
245
|
+
group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && !selection.selecting && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length })))),
|
|
246
|
+
selection.selecting && (React.createElement(select_bar_1.SelectBar, { count: selection.selected.length, total: selection.removable.length, onSelectAll: selection.selectAll, onDone: selection.done, actions: [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => void selection.removeSelected() }] }))));
|
|
194
247
|
}
|
|
195
248
|
/** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
|
|
196
249
|
function TasksChip({ tasks, onOpen }) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Matrix } from './dino-geometry';
|
|
2
|
+
import { type Bone, type Point } from './dino-shape';
|
|
3
|
+
import { DinoSpecies } from './dino-species';
|
|
2
4
|
/** What ta is doing, as its face and pose show it. */
|
|
3
5
|
export type Mood = 'idle' | 'listening' | 'thinking' | 'working' | 'speaking' | 'attention' | 'done' | 'sleeping';
|
|
4
6
|
export declare const MOODS: Mood[];
|
|
@@ -39,8 +41,6 @@ export interface Pose {
|
|
|
39
41
|
wing: number;
|
|
40
42
|
}
|
|
41
43
|
export declare const REST: Pose;
|
|
42
|
-
/** A 2D affine transform [a, b, c, d, e, f], as in SVG's matrix(). */
|
|
43
|
-
export type Matrix = [number, number, number, number, number, number];
|
|
44
44
|
/**
|
|
45
45
|
* How many pieces the rounded side of the head and body is made of, from the far side to the near one.
|
|
46
46
|
* Between two pieces the outline is swept, not stacked, so the side is smooth at every angle.
|
|
@@ -70,7 +70,6 @@ export declare function rig(pose: Pose, species?: DinoSpecies): Rig;
|
|
|
70
70
|
export declare function skin(r: Rig): string;
|
|
71
71
|
/** Where the middle of the head is in a pose, in the coordinates of the drawing; the eyes follow what is around it from there. */
|
|
72
72
|
export declare function headAt(pose: Pose, species?: DinoSpecies): Point;
|
|
73
|
-
export declare function matrix(m: Matrix): string;
|
|
74
73
|
/** The transforms and the outline a pose draws, ready for the attributes of the drawing. */
|
|
75
74
|
export interface Frame {
|
|
76
75
|
skin: string;
|
|
@@ -4,18 +4,14 @@ exports.DinoAvatar = exports.DEPTH = exports.REST = exports.AVATAR_VIEWBOX = exp
|
|
|
4
4
|
exports.rig = rig;
|
|
5
5
|
exports.skin = skin;
|
|
6
6
|
exports.headAt = headAt;
|
|
7
|
-
exports.matrix = matrix;
|
|
8
7
|
exports.frame = frame;
|
|
8
|
+
const dino_face_1 = require("./dino-face");
|
|
9
|
+
const dino_geometry_1 = require("./dino-geometry");
|
|
10
|
+
const dino_shape_1 = require("./dino-shape");
|
|
9
11
|
const dino_species_1 = require("./dino-species");
|
|
10
12
|
exports.MOODS = ['idle', 'listening', 'thinking', 'working', 'speaking', 'attention', 'done', 'sleeping'];
|
|
11
13
|
/** The viewBox of assets/logo.svg with a little room around it for the marks. */
|
|
12
14
|
exports.AVATAR_VIEWBOX = '-8 -8 272 272';
|
|
13
|
-
/** The eye of the logo: the eye of every kind is drawn here, then moved and scaled onto its own. */
|
|
14
|
-
const EYE = { x: 141.3, y: 44.6, r: 10.9 };
|
|
15
|
-
const DARK = '#06281d';
|
|
16
|
-
const WHITE = '#fff';
|
|
17
|
-
/** The cheeks of a close-up, as the faces of the agents blush. */
|
|
18
|
-
const BLUSH = 'rgba(255, 128, 160, 0.7)';
|
|
19
15
|
exports.REST = {
|
|
20
16
|
x: 0,
|
|
21
17
|
y: 0,
|
|
@@ -36,27 +32,6 @@ exports.REST = {
|
|
|
36
32
|
arm: 0,
|
|
37
33
|
wing: 0,
|
|
38
34
|
};
|
|
39
|
-
function multiply(m, n) {
|
|
40
|
-
return [
|
|
41
|
-
m[0] * n[0] + m[2] * n[1],
|
|
42
|
-
m[1] * n[0] + m[3] * n[1],
|
|
43
|
-
m[0] * n[2] + m[2] * n[3],
|
|
44
|
-
m[1] * n[2] + m[3] * n[3],
|
|
45
|
-
m[0] * n[4] + m[2] * n[5] + m[4],
|
|
46
|
-
m[1] * n[4] + m[3] * n[5] + m[5],
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
/** Turn by `degrees` around `at`, scaling by `sx`, `sy` there. */
|
|
50
|
-
function around(at, degrees, sx = 1, sy = 1) {
|
|
51
|
-
const a = (degrees * Math.PI) / 180;
|
|
52
|
-
const cos = Math.cos(a);
|
|
53
|
-
const sin = Math.sin(a);
|
|
54
|
-
const m = [cos * sx, sin * sx, -sin * sy, cos * sy, 0, 0];
|
|
55
|
-
m[4] = at.x - m[0] * at.x - m[2] * at.y;
|
|
56
|
-
m[5] = at.y - m[1] * at.x - m[3] * at.y;
|
|
57
|
-
return m;
|
|
58
|
-
}
|
|
59
|
-
const move = (x, y) => [1, 0, 0, 1, x, y];
|
|
60
35
|
const SKINS = new Map();
|
|
61
36
|
function skinOf(species) {
|
|
62
37
|
var _a;
|
|
@@ -234,43 +209,43 @@ const vector = (m, x, y) => [m[0] * x + m[2] * y, m[1] * x + m[3] * y];
|
|
|
234
209
|
function rig(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT)) {
|
|
235
210
|
var _a, _b, _c;
|
|
236
211
|
const { feet, neck, jaw, tail, tip, hip } = species.joints;
|
|
237
|
-
const place = multiply(move(pose.x, pose.y), multiply(facing(feet.x, pose.face), around(feet, pose.lean * ((_a = species.leans) !== null && _a !== void 0 ? _a : 1), pose.sx, pose.sy)));
|
|
238
|
-
const within = (m) => multiply(place, m);
|
|
212
|
+
const place = (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(pose.x, pose.y), (0, dino_geometry_1.multiply)(facing(feet.x, pose.face), (0, dino_geometry_1.around)(feet, pose.lean * ((_a = species.leans) !== null && _a !== void 0 ? _a : 1), pose.sx, pose.sy)));
|
|
213
|
+
const within = (m) => (0, dino_geometry_1.multiply)(place, m);
|
|
239
214
|
const yaw = (pose.turn * ((_b = species.turns) !== null && _b !== void 0 ? _b : 1) * YAW * Math.PI) / 180;
|
|
240
215
|
const spin = pose.spin * ((_c = species.spins) !== null && _c !== void 0 ? _c : 1);
|
|
241
216
|
const sin = Math.sin(yaw);
|
|
242
|
-
const turned = around(neck, pose.head);
|
|
243
|
-
const head = multiply(turned, around(species.head.axis, 0, Math.cos(yaw), 1));
|
|
244
|
-
const tailBone = around(tail, pose.tail);
|
|
217
|
+
const turned = (0, dino_geometry_1.around)(neck, pose.head);
|
|
218
|
+
const head = (0, dino_geometry_1.multiply)(turned, (0, dino_geometry_1.around)(species.head.axis, 0, Math.cos(yaw), 1));
|
|
219
|
+
const tailBone = (0, dino_geometry_1.around)(tail, pose.tail);
|
|
245
220
|
const headSide = vector(within(turned), -species.head.depth * sin, 0);
|
|
246
221
|
const bodySide = vector(place, -species.body.depth * spin, 0);
|
|
247
222
|
// The eye of the logo, moved and scaled onto the eye of the kind.
|
|
248
|
-
const k = species.eye.r / EYE.r;
|
|
249
|
-
const fit = [k, 0, 0, k, species.eye.x - k * EYE.x, species.eye.y - k * EYE.y];
|
|
223
|
+
const k = species.eye.r / dino_face_1.EYE.r;
|
|
224
|
+
const fit = [k, 0, 0, k, species.eye.x - k * dino_face_1.EYE.x, species.eye.y - k * dino_face_1.EYE.y];
|
|
250
225
|
// The eye sits on the near side of the head, moving with it; seen at a slant it narrows less than the head does.
|
|
251
|
-
const slant = around(species.eye, 0, (1 - 0.3 * sin) / Math.cos(yaw), 1);
|
|
226
|
+
const slant = (0, dino_geometry_1.around)(species.eye, 0, (1 - 0.3 * sin) / Math.cos(yaw), 1);
|
|
252
227
|
// The sides of the head draw in toward its middle as it turns (outline()); its eyes with them.
|
|
253
|
-
const rounded = around(species.head.center, 0, 1 - ROUND_HEAD * sin, 1 - ROUND_HEAD * sin);
|
|
254
|
-
const eye = within(multiply(head, multiply(rounded, multiply(slant, fit))));
|
|
228
|
+
const rounded = (0, dino_geometry_1.around)(species.head.center, 0, 1 - ROUND_HEAD * sin, 1 - ROUND_HEAD * sin);
|
|
229
|
+
const eye = within((0, dino_geometry_1.multiply)(head, (0, dino_geometry_1.multiply)(rounded, (0, dino_geometry_1.multiply)(slant, fit))));
|
|
255
230
|
// A leg swings as far as the logo's does, whatever its length: a long one by a smaller angle, so its foot goes as far.
|
|
256
|
-
const swing = (angle, joint) => angle * Math.min(1.6, Math.max(0.45,
|
|
257
|
-
const sides = (k, m) => multiply(move(k * (headSide[0] + bodySide[0]), k * (headSide[1] + bodySide[1])), m);
|
|
231
|
+
const swing = (angle, joint) => angle * Math.min(1.6, Math.max(0.45, dino_shape_1.LEG / Math.max(20, feet.y - joint.y)));
|
|
232
|
+
const sides = (k, m) => (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(k * (headSide[0] + bodySide[0]), k * (headSide[1] + bodySide[1])), m);
|
|
258
233
|
return {
|
|
259
234
|
species,
|
|
260
235
|
bones: {
|
|
261
236
|
body: place,
|
|
262
237
|
head: within(head),
|
|
263
|
-
jaw: within(multiply(head, around(jaw, pose.jaw))),
|
|
238
|
+
jaw: within((0, dino_geometry_1.multiply)(head, (0, dino_geometry_1.around)(jaw, pose.jaw))),
|
|
264
239
|
tail: within(tailBone),
|
|
265
|
-
tip: within(multiply(tailBone, around(tip, pose.tip))),
|
|
266
|
-
back: within(multiply(move(0, -pose.backLift), around(hip, swing(pose.back, hip)))),
|
|
240
|
+
tip: within((0, dino_geometry_1.multiply)(tailBone, (0, dino_geometry_1.around)(tip, pose.tip))),
|
|
241
|
+
back: within((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(0, -pose.backLift), (0, dino_geometry_1.around)(hip, swing(pose.back, hip)))),
|
|
267
242
|
},
|
|
268
243
|
// The parts move with their sides: the far ones away from you, the near ones toward you.
|
|
269
244
|
parts: species.parts.map(part => {
|
|
270
245
|
const side = part.far ? -1 : 1;
|
|
271
246
|
const lift = part.lift ? pose[part.lift] : 0;
|
|
272
247
|
const angle = part.lift ? swing(pose[part.swing], part.joint) : pose[part.swing];
|
|
273
|
-
return multiply(move(side * bodySide[0], side * bodySide[1]), within(multiply(move(0, -lift), around(part.joint, angle))));
|
|
248
|
+
return (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(side * bodySide[0], side * bodySide[1]), within((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(0, -lift), (0, dino_geometry_1.around)(part.joint, angle))));
|
|
274
249
|
}),
|
|
275
250
|
eye: sides(1, eye),
|
|
276
251
|
head: headSide,
|
|
@@ -280,7 +255,6 @@ function rig(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSp
|
|
|
280
255
|
};
|
|
281
256
|
}
|
|
282
257
|
const r1 = (n) => Math.round(n * 10) / 10;
|
|
283
|
-
const round = (n) => Math.round(n * 100) / 100;
|
|
284
258
|
/**
|
|
285
259
|
* The points of the outline in a pose, each moved by its bones blended by its weights: `side` 1 for
|
|
286
260
|
* the side you see, -1 for the far side, and in between for the inside of the solid; `eye` with the
|
|
@@ -383,142 +357,6 @@ function headAt(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.Din
|
|
|
383
357
|
const { center } = species.head;
|
|
384
358
|
return { x: m[0] * center.x + m[2] * center.y + m[4], y: m[1] * center.x + m[3] * center.y + m[5] };
|
|
385
359
|
}
|
|
386
|
-
function matrix(m) {
|
|
387
|
-
return `matrix(${m.map(n => Math.round(n * 1000) / 1000).join(' ')})`;
|
|
388
|
-
}
|
|
389
|
-
const EYES = {
|
|
390
|
-
idle: 'open',
|
|
391
|
-
listening: 'wide',
|
|
392
|
-
thinking: 'up',
|
|
393
|
-
working: 'down',
|
|
394
|
-
speaking: 'open',
|
|
395
|
-
attention: 'wide',
|
|
396
|
-
done: 'happy',
|
|
397
|
-
sleeping: 'closed',
|
|
398
|
-
};
|
|
399
|
-
/** Where the slit of the pupil looks, and how low the brow comes down over the eye (its back, its front over the snout). */
|
|
400
|
-
const GAZE = {
|
|
401
|
-
open: { dx: 2.4, dy: 0.8, brow: [34, 43] },
|
|
402
|
-
wide: { dx: 1.2, dy: 0, brow: [32, 39] },
|
|
403
|
-
up: { dx: -0.4, dy: -2.4, brow: [33, 41] },
|
|
404
|
-
down: { dx: 3.4, dy: 2.6, brow: [35.5, 45] },
|
|
405
|
-
};
|
|
406
|
-
const IRIS = '<stop offset="0" stop-color="#FEF08A"/><stop offset="0.35" stop-color="#FACC15"/><stop offset="0.75" stop-color="#F97316"/><stop offset="1" stop-color="#B91C1C"/>';
|
|
407
|
-
/** A closed eye: a heavy line cut out of the skin, frowning, or curved and content in a close-up. */
|
|
408
|
-
function shut(skin, content) {
|
|
409
|
-
const { x, y, r } = EYE;
|
|
410
|
-
const line = content ? `M${x - 8} ${y - 1} Q${x} ${y + 6} ${x + 8} ${y - 1}` : `M${x - 9} ${y - 3} Q${x} ${y + 3} ${x + 9} ${y + 2}`;
|
|
411
|
-
return `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="${line}" fill="none" stroke="${DARK}" stroke-width="3.6" stroke-linecap="round"/>`;
|
|
412
|
-
}
|
|
413
|
-
/** When the lids of a drawing blink: each drawing at its own moment and pace, so the dinosaurs of a page never blink together. */
|
|
414
|
-
function blink(id) {
|
|
415
|
-
let hash = 0;
|
|
416
|
-
for (const char of id) {
|
|
417
|
-
hash = (hash * 31 + char.charCodeAt(0)) | 0;
|
|
418
|
-
}
|
|
419
|
-
const at = Math.abs(hash % 97) / 97;
|
|
420
|
-
return ` style="animation-delay:-${(at * 5).toFixed(2)}s;animation-duration:${(4.4 + at * 2.4).toFixed(2)}s"`;
|
|
421
|
-
}
|
|
422
|
-
/** The fierce eye of a whole dinosaur: a slit pupil in a yellow-red iris under a low brow. */
|
|
423
|
-
function eye(kind, id, species) {
|
|
424
|
-
const { x, y, r } = EYE;
|
|
425
|
-
const { skin, ridge } = species.colors;
|
|
426
|
-
if (kind === 'closed') {
|
|
427
|
-
return shut(skin, false);
|
|
428
|
-
}
|
|
429
|
-
const defs = `<radialGradient id="${id}-iris" cx="0.4" cy="0.6" r="0.62">${IRIS}</radialGradient>` +
|
|
430
|
-
`<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>`;
|
|
431
|
-
const ball = `<circle cx="${x}" cy="${y}" r="${r + 1}" fill="url(#${id}-iris)"/>`;
|
|
432
|
-
if (kind === 'happy') {
|
|
433
|
-
// Pleased with itself: a smug, narrowed eye, the lower lid pushed up under the brow.
|
|
434
|
-
return (defs +
|
|
435
|
-
`<g clip-path="url(#${id}-eye)">${ball}<ellipse cx="${x + 2.4}" cy="${y}" rx="1.4" ry="6" fill="${DARK}"/>` +
|
|
436
|
-
`<path d="M${x - r - 1} ${y - r - 1} H${x + r + 1} V${y - 1} L${x - r - 1} ${y - 6}Z" fill="${skin}"/>` +
|
|
437
|
-
`<path d="M${x - r - 1} ${y + r + 1} V${y + 3} Q${x} ${y - 2} ${x + r + 1} ${y + 3} V${y + r + 1}Z" fill="${skin}"/></g>` +
|
|
438
|
-
brow(ridge, x - r - 4, y - 7, x + r + 5, y - 2));
|
|
439
|
-
}
|
|
440
|
-
const gaze = GAZE[kind];
|
|
441
|
-
const px = x + gaze.dx;
|
|
442
|
-
const py = y + gaze.dy;
|
|
443
|
-
const [back, front] = gaze.brow;
|
|
444
|
-
return (defs +
|
|
445
|
-
`<g clip-path="url(#${id}-eye)">${ball}` +
|
|
446
|
-
`<g class="ta-dino-pupil"><path d="M${px} ${py - 8.6} Q${px + 2.6} ${py} ${px} ${py + 8.6} Q${px - 2.6} ${py} ${px} ${py - 8.6}Z" fill="${DARK}"/><circle cx="${px - 3.4}" cy="${py - 3}" r="1.2" fill="${WHITE}" opacity="0.9"/></g>` +
|
|
447
|
-
// The upper lid comes down to the brow, lowest over the snout, so it glares; the lower lid narrows it from below.
|
|
448
|
-
`<path d="M${x - r - 1} ${y - r - 2} H${x + r + 1} V${front} L${x - r - 1} ${back}Z" fill="${skin}"/>` +
|
|
449
|
-
`<path d="M${x - r - 1} ${y + r + 1} V${y + 6} Q${x} ${y + 9.5} ${x + r + 1} ${y + 8} V${y + r + 1}Z" fill="${skin}"/>` +
|
|
450
|
-
`<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>` +
|
|
451
|
-
brow(ridge, x - r - 4, back - 1.6, x + r + 5, front + 0.4));
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* The eye of a close-up, the dinosaur at its sweetest: round and dark with two glints, a blush below it;
|
|
455
|
-
* the glints follow the pointer. Pleased (done, or poked), it squeezes shut into an arc.
|
|
456
|
-
*/
|
|
457
|
-
function cuteEye(kind, id, species) {
|
|
458
|
-
const { x, y, r } = EYE;
|
|
459
|
-
const { skin } = species.colors;
|
|
460
|
-
const cheek = `<ellipse cx="${x + 3}" cy="${y + r + 6}" rx="${round(r * 0.8)}" ry="${round(r * 0.42)}" fill="${BLUSH}"/>`;
|
|
461
|
-
const joy = `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="M${x - 7.5} ${y + 3} Q${x} ${y - 7} ${x + 7.5} ${y + 3}" fill="none" stroke="${DARK}" stroke-width="3.4" stroke-linecap="round"/>`;
|
|
462
|
-
// A close-up has bigger eyes than the whole dinosaur.
|
|
463
|
-
const big = (inner) => `<g transform="translate(${x} ${y}) scale(1.2) translate(${-x} ${-y})">${inner}</g>`;
|
|
464
|
-
if (kind === 'closed') {
|
|
465
|
-
return big(shut(skin, true)) + cheek;
|
|
466
|
-
}
|
|
467
|
-
if (kind === 'happy') {
|
|
468
|
-
return big(joy) + cheek;
|
|
469
|
-
}
|
|
470
|
-
const look = `<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>` +
|
|
471
|
-
`<g clip-path="url(#${id}-eye)"><circle cx="${x}" cy="${y}" r="${r + 1}" fill="${DARK}"/>` +
|
|
472
|
-
`<g class="ta-dino-pupil"><circle cx="${x + 2.6}" cy="${y - 3.2}" r="${round(r * 0.36)}" fill="${WHITE}"/><circle cx="${x - 3.6}" cy="${y + 3.6}" r="${round(r * 0.16)}" fill="${WHITE}" opacity="0.85"/></g>` +
|
|
473
|
-
`<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>`;
|
|
474
|
-
// Poked, the round eye gives way to the pleased one for a moment (a class on the drawing, set as it plays).
|
|
475
|
-
return big(`<g class="ta-dino-look">${look}</g><g class="ta-dino-joy">${joy}</g>`) + cheek;
|
|
476
|
-
}
|
|
477
|
-
/** The ridge of the brow over the lid: a wedge, thin at the back, thick and low over the snout. */
|
|
478
|
-
function brow(color, x1, y1, x2, y2) {
|
|
479
|
-
const p = (x, y) => `${round(x)} ${round(y)}`;
|
|
480
|
-
return `<path class="ta-dino-brow" d="M${p(x1, y1 - 1)} Q${p((x1 + x2) / 2, (y1 + y2) / 2 - 4.4)} ${p(x2 + 1, y2 - 3.6)} Q${p(x2 + 3, y2 + 1.4)} ${p(x2 - 1, y2 + 2.2)} L${p(x1 + 1, y1 + 1.4)} Q${p(x1 - 1.4, y1 + 0.6)} ${p(x1, y1 - 1)}Z" fill="${color}"/>`;
|
|
481
|
-
}
|
|
482
|
-
/** A round mark above the back, ringed in the color of the page so it stands off the dinosaur. */
|
|
483
|
-
function badge(at, color, inner) {
|
|
484
|
-
return `<g transform="translate(${at.x} ${at.y}) scale(1.3)"><g class="ta-dino-badge"><circle r="23" fill="${color}" stroke="var(--ta-main, #fff)" stroke-width="5"/>${inner}</g></g>`;
|
|
485
|
-
}
|
|
486
|
-
function mark(mood, species) {
|
|
487
|
-
const at = species.badge;
|
|
488
|
-
switch (mood) {
|
|
489
|
-
case 'attention':
|
|
490
|
-
return badge(at, '#F59E0B', `<path d="M0 -11 L0 2.5" stroke="${WHITE}" stroke-width="5.4" stroke-linecap="round"/><circle cy="10" r="3.2" fill="${WHITE}"/>`);
|
|
491
|
-
case 'working':
|
|
492
|
-
return badge(at, '#3B82F6', [-9, 0, 9].map(x => `<circle class="ta-dino-dot" cx="${x}" r="3.4" fill="${WHITE}"/>`).join(''));
|
|
493
|
-
case 'listening':
|
|
494
|
-
return badge(at, '#8B5CF6', `<rect x="-5" y="-12" width="10" height="16" rx="5" fill="${WHITE}"/><path d="M-9.5 -1 Q-9.5 9 0 9 Q9.5 9 9.5 -1 M0 9 L0 13" fill="none" stroke="${WHITE}" stroke-width="3.2" stroke-linecap="round"/>`);
|
|
495
|
-
case 'thinking':
|
|
496
|
-
// Bubbles rising from the head to where the mark goes.
|
|
497
|
-
return [
|
|
498
|
-
[48, -10, 6],
|
|
499
|
-
[24, -24, 8.5],
|
|
500
|
-
[-6, -30, 12],
|
|
501
|
-
]
|
|
502
|
-
.map(([x, y, r]) => `<circle class="ta-dino-bubble" cx="${at.x + x}" cy="${at.y + y}" r="${r}" fill="var(--ta-muted, #8e8e93)"/>`)
|
|
503
|
-
.join('');
|
|
504
|
-
case 'sleeping':
|
|
505
|
-
return [
|
|
506
|
-
[32, 0, 0.9],
|
|
507
|
-
[0, -22, 1.35],
|
|
508
|
-
]
|
|
509
|
-
.map(([x, y, s]) => `<path class="ta-dino-z" transform="translate(${at.x + x} ${at.y + y}) scale(${s})" d="M-8 -8 L8 -8 L-8 8 L8 8" fill="none" stroke="var(--ta-muted, #8e8e93)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>`)
|
|
510
|
-
.join('');
|
|
511
|
-
case 'speaking': {
|
|
512
|
-
// Waves from the snout.
|
|
513
|
-
const { x, y } = species.snout;
|
|
514
|
-
return [12, 22]
|
|
515
|
-
.map(r => `<path class="ta-dino-wave" d="M${x + r * 0.3} ${y - r} Q${x + r} ${y} ${x + r * 0.3} ${y + r}" fill="none" stroke="${species.colors.skin}" stroke-width="4.5" stroke-linecap="round"/>`)
|
|
516
|
-
.join('');
|
|
517
|
-
}
|
|
518
|
-
default:
|
|
519
|
-
return '';
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
360
|
const fixed = (n) => String(Math.round(n * 100) / 100);
|
|
523
361
|
/**
|
|
524
362
|
* What a pose draws. `fine` for a large drawing; a small one (a few dozen pixels) is swept in fewer
|
|
@@ -543,30 +381,17 @@ function frame(pose, fine = true, species = dino_species_1.DinoSpecies.of(dino_s
|
|
|
543
381
|
skin: near,
|
|
544
382
|
far: path(species, pieces[0]),
|
|
545
383
|
wall: solid ? wall(pieces, fine ? FLAT : 1) : '',
|
|
546
|
-
eye: matrix(r.eye),
|
|
384
|
+
eye: (0, dino_geometry_1.matrix)(r.eye),
|
|
547
385
|
nostrils: [nostril(0.5), nostril(-0.5)],
|
|
548
|
-
front: fixed(smoothstep((Math.max(r.turn, r.spin) - 0.12) / 0.38)),
|
|
549
|
-
parts: r.parts.map(matrix),
|
|
386
|
+
front: fixed((0, dino_geometry_1.smoothstep)((Math.max(r.turn, r.spin) - 0.12) / 0.38)),
|
|
387
|
+
parts: r.parts.map(dino_geometry_1.matrix),
|
|
550
388
|
decor: ((_a = species.decor) !== null && _a !== void 0 ? _a : []).map(({ depth: deep }) => [
|
|
551
|
-
matrix(multiply(move(-deep * across[0], -deep * across[1]), m)),
|
|
552
|
-
matrix(multiply(move(deep * across[0], deep * across[1]), m)),
|
|
389
|
+
(0, dino_geometry_1.matrix)((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(-deep * across[0], -deep * across[1]), m)),
|
|
390
|
+
(0, dino_geometry_1.matrix)((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(deep * across[0], deep * across[1]), m)),
|
|
553
391
|
]),
|
|
554
392
|
shadow: { cx: fixed(feet.x + (middle - feet.x) * pose.face + pose.x), rx: fixed(width), opacity: fixed(1 - Math.min(0.7, lifted / 32)) },
|
|
555
393
|
};
|
|
556
394
|
}
|
|
557
|
-
function smoothstep(x) {
|
|
558
|
-
const t = Math.min(1, Math.max(0, x));
|
|
559
|
-
return t * t * (3 - 2 * t);
|
|
560
|
-
}
|
|
561
|
-
/** A color of six hex digits mixed toward another by `k` (0 to 1). */
|
|
562
|
-
function mix(color, toward, k) {
|
|
563
|
-
const channel = (hex, i) => Number.parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
|
|
564
|
-
return `#${[0, 1, 2]
|
|
565
|
-
.map(i => Math.round(channel(color, i) + (channel(toward, i) - channel(color, i)) * k)
|
|
566
|
-
.toString(16)
|
|
567
|
-
.padStart(2, '0'))
|
|
568
|
-
.join('')}`;
|
|
569
|
-
}
|
|
570
395
|
/**
|
|
571
396
|
* The body of a kind in a pose, with the eye `eyes` draws. `detail` for a drawing
|
|
572
397
|
* large enough to show it: its shadow on the ground, and a gap of the page between the body and the legs and arms
|
|
@@ -581,7 +406,7 @@ function body(species, pose, eyes, id, detail) {
|
|
|
581
406
|
const gradient = (name, [top, bottom]) => `<linearGradient id="${id}-${name}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${top}"/><stop offset="1" stop-color="${bottom}"/></linearGradient>`;
|
|
582
407
|
// The mask covers everywhere it walks to (pose.x), or what walks out of it would be cut off.
|
|
583
408
|
const gaps = detail ? species.parts.map((part, i) => (part.gap ? i : -1)).filter(i => i >= 0) : [];
|
|
584
|
-
const defs = (sheen ? gradient('sheen', sheen) + gradient('lit', [mix(sheen[0], '#ffffff', 0.3), mix(sheen[1], '#ffffff', 0.3)]) : '') +
|
|
409
|
+
const defs = (sheen ? gradient('sheen', sheen) + gradient('lit', [(0, dino_geometry_1.mix)(sheen[0], '#ffffff', 0.3), (0, dino_geometry_1.mix)(sheen[1], '#ffffff', 0.3)]) : '') +
|
|
585
410
|
(gaps.length
|
|
586
411
|
? `<mask id="${id}-gap" maskUnits="userSpaceOnUse" x="-400" y="-200" width="1056" height="656"><rect x="-400" y="-200" width="1056" height="656" fill="#fff"/>${gaps
|
|
587
412
|
.map(i => `<path class="ta-dino-gap-${i}" d="${species.parts[i].d}" transform="${f.parts[i]}" fill="#000" stroke="#000" stroke-width="5" stroke-linejoin="round"/>`)
|
|
@@ -631,12 +456,12 @@ var DinoAvatar;
|
|
|
631
456
|
DinoAvatar.markText = markText;
|
|
632
457
|
/** The whole dinosaur, with the mark of its mood; `detail` for a drawing large enough to show its shadow and the gaps by its legs. */
|
|
633
458
|
function render(mood, id = 'ta', pose = exports.REST, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT), detail = false) {
|
|
634
|
-
return body(species, pose, eye(EYES[mood], id, species), id, detail) + mark(mood, species);
|
|
459
|
+
return body(species, pose, (0, dino_face_1.eye)(dino_face_1.EYES[mood], id, species), id, detail) + (0, dino_face_1.mark)(mood, species);
|
|
635
460
|
}
|
|
636
461
|
DinoAvatar.render = render;
|
|
637
462
|
/** A close-up of its head, sweet rather than fierce: for a figure as small as that of the account. */
|
|
638
463
|
function face(mood, id = 'ta', pose = exports.REST, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT)) {
|
|
639
|
-
return body(species, pose, cuteEye(EYES[mood], id, species), id, false);
|
|
464
|
+
return body(species, pose, (0, dino_face_1.cuteEye)(dino_face_1.EYES[mood], id, species), id, false);
|
|
640
465
|
}
|
|
641
466
|
DinoAvatar.face = face;
|
|
642
467
|
/** The viewBox of a close-up. */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Mood } from './dino-avatar';
|
|
2
|
+
import type { DinoSpecies } from './dino-species';
|
|
3
|
+
/** The eye of the logo: the eye of every kind is drawn here, then moved and scaled onto its own. */
|
|
4
|
+
export declare const EYE: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
r: number;
|
|
8
|
+
};
|
|
9
|
+
type Eyes = 'open' | 'wide' | 'up' | 'down' | 'happy' | 'closed';
|
|
10
|
+
export declare const EYES: Record<Mood, Eyes>;
|
|
11
|
+
/** The fierce eye of a whole dinosaur: a slit pupil in a yellow-red iris under a low brow. */
|
|
12
|
+
export declare function eye(kind: Eyes, id: string, species: DinoSpecies): string;
|
|
13
|
+
/**
|
|
14
|
+
* The eye of a close-up, the dinosaur at its sweetest: round and dark with two glints, a blush below it;
|
|
15
|
+
* the glints follow the pointer. Pleased (done, or poked), it squeezes shut into an arc.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cuteEye(kind: Eyes, id: string, species: DinoSpecies): string;
|
|
18
|
+
export declare function mark(mood: Mood, species: DinoSpecies): string;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=dino-face.d.ts.map
|