@webitel/styleguide 26.8.3 → 26.8.5
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/package.json +5 -2
- package/src/lib/styleguide/styleguide.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/Dark.tokens.json +4219 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/Light.tokens.json +4231 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/app-header/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/colors/unknown-user/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/colors/unknown-user/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/colors/unknown-user/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/avatar/sizes/unknown-user/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/action-bar/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/action-bar/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/action-bar/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/active/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/active/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/active/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/hold/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/hold/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/hold/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/floating-call-widget/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/sizes/action-bar/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/sizes/floating-call-widget/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/sizes/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-dock/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/members-item/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/members-item/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/members-item/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/call-details-drawer/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/top-bar/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/top-bar/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/colors/top-bar/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/call-details-drawer/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/call-details-drawer/members-item/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/call-details-drawer/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/call-page/sizes/top-bar/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/active/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/active/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/active/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/closed/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/closed/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/closed/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/snoozed/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/snoozed/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/colors/snoozed/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-card/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/floating-chat-widget/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/floating-chat-widget/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/floating-chat-widget/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/header/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/header/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/header/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/sizes/floating-chat-widget/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/sizes/header/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-dock/sizes/index.css +8 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/chat-search-item/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/chat-search-item/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/chat-search-item/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/history-card/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/history-card/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/history-card/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/history-item/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/members-item/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/members-item/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/members-item/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/chat-details-drawer/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/top-bar/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/top-bar/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/colors/top-bar/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/chat-search-item/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/history-item/history-card/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/history-item/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/members-item/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/chat-details-drawer/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-page/sizes/top-bar/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/chat-end-reason-indicator/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/chat-end-reason-indicator/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/chat-end-reason-indicator/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/control-panel/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/control-panel/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/control-panel/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/read/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/read/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/read/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/unread/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/unread/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/agent/unread/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/read/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/read/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/read/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/unread/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/unread/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/client/unread/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/last-message-text/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/sizes/chat-end-reason-indicator/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/sizes/control-panel/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/sizes/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/sizes/last-message-text/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-queue-pannel/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/agent/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/agent/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/agent/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/client/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/client/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/client/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/chat-message/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/message-item/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/sizes/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/sizes/message-item/chat-message/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/sizes/message-item/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/chat-window/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/client-identity-block/sizes/root/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/conversation-tray/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/error/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/error/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/error/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/secondary/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/secondary/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/secondary/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/success/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/success/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/success/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/warning/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/warning/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/call-status-indicator/warning/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/connection-feedback-block/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/numpad/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/numpad/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/numpad/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/sizes/connection-feedback-block/call-status-indicator/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/sizes/connection-feedback-block/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/sizes/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/sizes/numpad/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/dialer/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/incoming-interaction-preview/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/index.css +23 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/colors/root/dark/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/colors/root/light/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/layout/sizes/root/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/colors/root/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/colors/root/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/colors/root/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/message-composer/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/page-toolbar/colors/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/page-toolbar/colors/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/page-toolbar/colors/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/page-toolbar/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/page-toolbar/sizes/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/inbound/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/inbound/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/inbound/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/missed/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/missed/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/missed/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/outbound/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/outbound/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/colors/outbound/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/semantic/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/filled/dark/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/filled/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/filled/light/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/outlined/dark/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/outlined/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/outlined/light/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/text/dark/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/text/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/button/text/light/index.css +5 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/colors/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/sizes/index.css +1 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/sidebar-menu/sizes/root/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/card/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/card/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/card/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/icon-box/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/icon-box/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/icon-box/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/row/dark/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/row/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/colors/row/light/index.css +4 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/sizes/card/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/sizes/icon-box/icon/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/sizes/icon-box/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/sizes/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/widgets/sizes/row/index.css +6 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/wrap-up-timer/colors/dark/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/wrap-up-timer/colors/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/wrap-up-timer/colors/light/index.css +3 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/wrap-up-timer/index.css +2 -0
- package/src/lib/styleguide/token-generation/apps/agent-workspace-app/dist/ws/wrap-up-timer/sizes/index.css +7 -0
- package/src/lib/styleguide/token-generation/apps/index.css +1 -0
- package/src/lib/styleguide/token-generation/index.css +1 -0
- package/src/lib/styleguide/token-generation/script/check-css-imports.ts +79 -0
- package/src/lib/styleguide/token-generation/script/console-colors.ts +12 -0
- package/src/lib/styleguide/token-generation/script/discover-sources.ts +68 -0
- package/src/lib/styleguide/token-generation/script/generate.ts +200 -0
- package/src/lib/styleguide/token-generation/script/index.ts +82 -0
- package/src/lib/styleguide/token-generation/script/output/write-css.ts +74 -0
- package/src/lib/styleguide/token-generation/script/output/write-glue-css.ts +70 -0
- package/src/lib/styleguide/token-generation/script/transform/collect-variables.ts +65 -0
- package/src/lib/styleguide/token-generation/script/transform/format-value.ts +86 -0
- package/src/lib/styleguide/token-generation/script/transform/slugify.ts +16 -0
- package/src/lib/styleguide/token-generation/script/transform/token-refs.ts +21 -0
- package/src/lib/styleguide/token-generation/script/types.ts +75 -0
- package/src/lib/styleguide/token-generation/script/validation/css-var-names.ts +40 -0
- package/src/lib/styleguide/token-generation/script/validation/errors.ts +47 -0
- package/src/lib/styleguide/token-generation/script/validation/parity.ts +73 -0
- package/src/lib/styleguide/token-generation/script/validation/references.ts +95 -0
- package/src/lib/styleguide/token-generation/script/validation/theme-file.ts +15 -0
- package/src/lib/styleguide/token-generation/script/validation/tree.ts +194 -0
- package/src/lib/styleguide/token-generation/script/validation/typo-detection.ts +64 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { red } from './console-colors';
|
|
4
|
+
import {
|
|
5
|
+
buildCssFile,
|
|
6
|
+
buildIndex,
|
|
7
|
+
cleanOutputDir,
|
|
8
|
+
writeFile,
|
|
9
|
+
} from './output/write-css';
|
|
10
|
+
import {
|
|
11
|
+
collectVariables,
|
|
12
|
+
groupByFolder,
|
|
13
|
+
isColorsFolder,
|
|
14
|
+
} from './transform/collect-variables';
|
|
15
|
+
import { slugify } from './transform/slugify';
|
|
16
|
+
import type {
|
|
17
|
+
Folder,
|
|
18
|
+
GenerateResult,
|
|
19
|
+
ThemeConfig,
|
|
20
|
+
TokenSource,
|
|
21
|
+
TokenTree,
|
|
22
|
+
Variable,
|
|
23
|
+
} from './types';
|
|
24
|
+
import { validateCssVarNames } from './validation/css-var-names';
|
|
25
|
+
import { validateThemeParity } from './validation/parity';
|
|
26
|
+
import { validateThemeFile } from './validation/theme-file';
|
|
27
|
+
|
|
28
|
+
/** Read and JSON-parse a theme's input file, with a clear error if it's missing/invalid. */
|
|
29
|
+
function readThemeRoot(inputDir: string, theme: ThemeConfig): TokenTree | null {
|
|
30
|
+
const inputPath = path.join(inputDir, theme.file);
|
|
31
|
+
if (!fs.existsSync(inputPath)) return null;
|
|
32
|
+
|
|
33
|
+
let raw: string;
|
|
34
|
+
try {
|
|
35
|
+
raw = fs.readFileSync(inputPath, 'utf8');
|
|
36
|
+
} catch (err) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Не вдалося прочитати вхідний файл "${inputPath}": ${(err as Error).message}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(raw) as TokenTree;
|
|
43
|
+
} catch (err) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Вхідний файл "${inputPath}" містить некоректний JSON: ${(err as Error).message}`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Generate the CSS output tree for a single token source (an app or lib/). Reports
|
|
51
|
+
* validation errors to the console and returns wroteOutput=false if validation failed
|
|
52
|
+
* or the source produced no variables - the caller decides whether that should stop
|
|
53
|
+
* the whole run, and uses wroteOutput to know which sources to wire up in the glue
|
|
54
|
+
* CSS files that import each source's dist/index.css. */
|
|
55
|
+
export function generate(
|
|
56
|
+
source: TokenSource,
|
|
57
|
+
themes: ThemeConfig[],
|
|
58
|
+
): GenerateResult {
|
|
59
|
+
const fail = (): GenerateResult => ({
|
|
60
|
+
source,
|
|
61
|
+
succeeded: false,
|
|
62
|
+
wroteOutput: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const rootsByTheme: Record<string, TokenTree> = {};
|
|
66
|
+
for (const theme of themes) {
|
|
67
|
+
const root = readThemeRoot(source.inputDir, theme);
|
|
68
|
+
if (root) rootsByTheme[theme.name] = root;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const missingThemes = themes.filter((theme) => !(theme.name in rootsByTheme));
|
|
72
|
+
if (missingThemes.length > 0) {
|
|
73
|
+
console.error(
|
|
74
|
+
red(
|
|
75
|
+
`[${source.label}] Зупинено: відсутні файли тем: ${missingThemes.map((t) => t.file).join(', ')}.`,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
return fail();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Validate each theme file's structure/leaves/references, then cross-theme parity.
|
|
82
|
+
// Collect every failure across all checks before reporting, so a single run surfaces
|
|
83
|
+
// everything wrong instead of stopping at the first error.
|
|
84
|
+
const collectors = themes.map((theme) =>
|
|
85
|
+
validateThemeFile(
|
|
86
|
+
rootsByTheme[theme.name],
|
|
87
|
+
`${source.label}/${theme.file}`,
|
|
88
|
+
),
|
|
89
|
+
);
|
|
90
|
+
collectors.push(validateThemeParity(rootsByTheme));
|
|
91
|
+
|
|
92
|
+
const failedCollectors = collectors.filter((c) => c.hasErrors);
|
|
93
|
+
if (failedCollectors.length > 0) {
|
|
94
|
+
for (const collector of failedCollectors) collector.report();
|
|
95
|
+
const totalErrors = failedCollectors.reduce(
|
|
96
|
+
(sum, c) => sum + c.errors.length,
|
|
97
|
+
0,
|
|
98
|
+
);
|
|
99
|
+
console.error(
|
|
100
|
+
red(
|
|
101
|
+
`[${source.label}] Зупинено: знайдено помилок перевірки - ${totalErrors}. Жодного файлу не було записано.`,
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
return fail();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// theme.name -> Map<folderKey, Folder>
|
|
108
|
+
const foldersByTheme = new Map<string, Map<string, Folder>>();
|
|
109
|
+
|
|
110
|
+
for (const theme of themes) {
|
|
111
|
+
const root = rootsByTheme[theme.name];
|
|
112
|
+
const variables: Variable[] = [];
|
|
113
|
+
collectVariables(root, root, [], variables);
|
|
114
|
+
|
|
115
|
+
const varNameCollector = validateCssVarNames(
|
|
116
|
+
variables,
|
|
117
|
+
`${source.label}/${theme.file}`,
|
|
118
|
+
);
|
|
119
|
+
if (varNameCollector.hasErrors) {
|
|
120
|
+
varNameCollector.report();
|
|
121
|
+
console.error(
|
|
122
|
+
red(
|
|
123
|
+
`[${source.label}] Зупинено: перевірку назв CSS-змінних не пройдено. Жодного файлу не було записано.`,
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
return fail();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
foldersByTheme.set(theme.name, groupByFolder(variables));
|
|
130
|
+
console.log(
|
|
131
|
+
`[${source.label}:${theme.name}] оброблено змінних: ${variables.length}`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const allFolderKeys = new Set<string>();
|
|
136
|
+
for (const folders of foldersByTheme.values()) {
|
|
137
|
+
for (const key of folders.keys()) allFolderKeys.add(key);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// All validation passed - safe to wipe the previous output now, so tokens removed
|
|
141
|
+
// from Figma since the last generation don't linger as stale CSS variables.
|
|
142
|
+
cleanOutputDir(source.outputDir);
|
|
143
|
+
|
|
144
|
+
let flatFileCount = 0;
|
|
145
|
+
let themeFileCount = 0;
|
|
146
|
+
|
|
147
|
+
for (const folderKey of allFolderKeys) {
|
|
148
|
+
const folderSegments = themes
|
|
149
|
+
.map(
|
|
150
|
+
(theme) =>
|
|
151
|
+
foldersByTheme.get(theme.name)?.get(folderKey)?.folderSegments,
|
|
152
|
+
)
|
|
153
|
+
.find((segments): segments is string[] => segments != null);
|
|
154
|
+
if (!folderSegments) continue;
|
|
155
|
+
const dirPath = path.join(source.outputDir, ...folderSegments.map(slugify));
|
|
156
|
+
|
|
157
|
+
if (isColorsFolder(folderSegments)) {
|
|
158
|
+
// "Colors" folder: theme-aware, one file per theme.
|
|
159
|
+
for (const theme of themes) {
|
|
160
|
+
const folderVariables =
|
|
161
|
+
foldersByTheme.get(theme.name)?.get(folderKey)?.variables ?? [];
|
|
162
|
+
if (folderVariables.length === 0) continue;
|
|
163
|
+
const filePath = path.join(dirPath, theme.name, 'index.css');
|
|
164
|
+
writeFile(filePath, buildCssFile(theme.selector, folderVariables));
|
|
165
|
+
themeFileCount += 1;
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
// Any other folder: theme-invariant, take values from the first theme's export
|
|
169
|
+
// (arbitrary choice - values are expected to be identical across themes here).
|
|
170
|
+
const [primaryTheme] = themes;
|
|
171
|
+
const primaryVariables =
|
|
172
|
+
foldersByTheme.get(primaryTheme.name)?.get(folderKey)?.variables ?? [];
|
|
173
|
+
if (primaryVariables.length > 0) {
|
|
174
|
+
const filePath = path.join(dirPath, 'index.css');
|
|
175
|
+
writeFile(filePath, buildCssFile(':root', primaryVariables));
|
|
176
|
+
flatFileCount += 1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
console.log(
|
|
182
|
+
`[${source.label}] Записано звичайних файлів index.css: ${flatFileCount}, темозалежних файлів: ${themeFileCount}`,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
let wroteOutput = false;
|
|
186
|
+
if (fs.existsSync(source.outputDir)) {
|
|
187
|
+
wroteOutput = buildIndex(source.outputDir);
|
|
188
|
+
if (wroteOutput) {
|
|
189
|
+
console.log(
|
|
190
|
+
`[${source.label}] Записано dist/index.css (кореневу точку входу)`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
source,
|
|
197
|
+
succeeded: true,
|
|
198
|
+
wroteOutput,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts Figma variable export files (Light.tokens.json / Dark.tokens.json)
|
|
5
|
+
* into a tree of CSS files mirroring the token folder structure.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npm run generate:design-tokens
|
|
9
|
+
*
|
|
10
|
+
* Input files are discovered under this directory's siblings:
|
|
11
|
+
* ../apps/<app-name>/{Light,Dark}.tokens.json - one source per app
|
|
12
|
+
* ../lib/{Light,Dark}.tokens.json - shared/library tokens
|
|
13
|
+
*
|
|
14
|
+
* Each source is generated independently into its own colocated dist/ folder:
|
|
15
|
+
* ../apps/<app-name>/dist/...
|
|
16
|
+
* ../lib/dist/...
|
|
17
|
+
*
|
|
18
|
+
* A folder is theme-aware if it or any ancestor folder is literally named "Colors"
|
|
19
|
+
* (case-insensitive) - its direct leaf variables are written to light/index.css and
|
|
20
|
+
* dark/index.css. Every other folder is treated as theme-invariant: its direct leaf
|
|
21
|
+
* variables are written to a single index.css with plain :root rules, resolved from
|
|
22
|
+
* the light export (values are expected to be identical across themes there).
|
|
23
|
+
*
|
|
24
|
+
* Output per token folder (relative to a source's dist/):
|
|
25
|
+
* <Group>/<...path>/index.css - folders outside any "Colors" ancestor
|
|
26
|
+
* <Group>/<...path>/light/index.css - folders under a "Colors" ancestor, light theme
|
|
27
|
+
* <Group>/<...path>/dark/index.css - "Colors" folders, dark theme
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
import { checkCssImports } from './check-css-imports';
|
|
32
|
+
import { red } from './console-colors';
|
|
33
|
+
import { discoverSources } from './discover-sources';
|
|
34
|
+
import { generate } from './generate';
|
|
35
|
+
import { writeGlueCss } from './output/write-glue-css';
|
|
36
|
+
import type { GenerateResult, ThemeConfig } from './types';
|
|
37
|
+
|
|
38
|
+
const TOKEN_GENERATION_ROOT = path.join(__dirname, '..');
|
|
39
|
+
|
|
40
|
+
const THEMES: ThemeConfig[] = [
|
|
41
|
+
{
|
|
42
|
+
name: 'light',
|
|
43
|
+
file: 'Light.tokens.json',
|
|
44
|
+
selector: ':root',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'dark',
|
|
48
|
+
file: 'Dark.tokens.json',
|
|
49
|
+
selector: ':root.theme--dark',
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
function run(): void {
|
|
54
|
+
const sources = discoverSources(TOKEN_GENERATION_ROOT, THEMES);
|
|
55
|
+
|
|
56
|
+
if (sources.length === 0) {
|
|
57
|
+
console.error(
|
|
58
|
+
red(
|
|
59
|
+
'Зупинено: не знайдено жодного джерела токенів (apps/* або lib/ з файлами тем).',
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const results: GenerateResult[] = sources.map((source) =>
|
|
66
|
+
generate(source, THEMES),
|
|
67
|
+
);
|
|
68
|
+
const allSucceeded = results.every((r) => r.succeeded);
|
|
69
|
+
|
|
70
|
+
// Rewrite the glue CSS files (apps/index.css, lib/index.css, index.css) so they only
|
|
71
|
+
// ever import sources that actually produced output - even when some sources failed
|
|
72
|
+
// validation this run, so the ones that succeeded still wire up correctly.
|
|
73
|
+
writeGlueCss(TOKEN_GENERATION_ROOT, results);
|
|
74
|
+
|
|
75
|
+
const importsOk = checkCssImports(TOKEN_GENERATION_ROOT);
|
|
76
|
+
|
|
77
|
+
if (!allSucceeded || !importsOk) {
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
run();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { Variable } from '../types';
|
|
4
|
+
|
|
5
|
+
export function buildCssFile(selector: string, variables: Variable[]): string {
|
|
6
|
+
const lines = variables.map((v) => ` ${v.cssVarName}: ${v.cssValue};`);
|
|
7
|
+
return `${selector} {\n${lines.join('\n')}\n}\n`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Remove a source's previous output directory (if any), so tokens that were removed
|
|
11
|
+
* from Figma don't linger as stale CSS variables from a prior generation. */
|
|
12
|
+
export function cleanOutputDir(dirPath: string): void {
|
|
13
|
+
fs.rmSync(dirPath, {
|
|
14
|
+
recursive: true,
|
|
15
|
+
force: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function writeFile(filePath: string, content: string): void {
|
|
20
|
+
fs.mkdirSync(path.dirname(filePath), {
|
|
21
|
+
recursive: true,
|
|
22
|
+
});
|
|
23
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Recursively builds/extends an index.css in every directory under dirPath so it
|
|
28
|
+
* imports each subdirectory's index.css. A directory may already have its own
|
|
29
|
+
* index.css with :root rules (written directly for sizes/light/dark leaf
|
|
30
|
+
* folders) - in that case, @import lines for its subfolders are prepended before the
|
|
31
|
+
* existing rules (CSS requires @import to precede other rules to be valid), so a
|
|
32
|
+
* folder can have both its own variables and nested subfolders (e.g. a "sizes"
|
|
33
|
+
* bucket for theme-invariant vars that also happens to contain a real "Sizes"
|
|
34
|
+
* token subgroup).
|
|
35
|
+
* Returns true if this directory ends up with an index.css.
|
|
36
|
+
*/
|
|
37
|
+
export function buildIndex(dirPath: string): boolean {
|
|
38
|
+
const entries = fs.readdirSync(dirPath, {
|
|
39
|
+
withFileTypes: true,
|
|
40
|
+
});
|
|
41
|
+
const subdirs = entries
|
|
42
|
+
.filter((e) => e.isDirectory())
|
|
43
|
+
.map((e) => e.name)
|
|
44
|
+
.sort();
|
|
45
|
+
const ownIndexPath = path.join(dirPath, 'index.css');
|
|
46
|
+
const ownIndexEntry = entries.find(
|
|
47
|
+
(e) => e.isFile() && e.name === 'index.css',
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const childDirsWithIndex = subdirs.filter((name) =>
|
|
51
|
+
buildIndex(path.join(dirPath, name)),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const importLines = childDirsWithIndex.map(
|
|
55
|
+
(name) => `@import "./${name}/index.css";`,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (ownIndexEntry) {
|
|
59
|
+
if (importLines.length > 0) {
|
|
60
|
+
const existing = fs.readFileSync(ownIndexPath, 'utf8');
|
|
61
|
+
fs.writeFileSync(
|
|
62
|
+
ownIndexPath,
|
|
63
|
+
`${importLines.join('\n')}\n${existing.trimStart()}`,
|
|
64
|
+
'utf8',
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (importLines.length === 0) return false;
|
|
71
|
+
|
|
72
|
+
fs.writeFileSync(ownIndexPath, `${importLines.join('\n')}\n`, 'utf8');
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { GenerateResult } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* (Re)writes the top-level "glue" CSS files that wire generated token output into the
|
|
7
|
+
* rest of the styleguide build - these are NOT hand-maintained: every run rewrites them
|
|
8
|
+
* from scratch based on which sources actually produced output, so they can never drift
|
|
9
|
+
* from what's on disk (e.g. importing a dist/index.css that doesn't exist because that
|
|
10
|
+
* app's tokens failed validation or were removed).
|
|
11
|
+
*
|
|
12
|
+
* Writes, relative to tokenGenerationRoot:
|
|
13
|
+
* apps/index.css - @import for each app that wrote output
|
|
14
|
+
* lib/index.css - @import for lib/dist/index.css, if lib wrote output
|
|
15
|
+
* index.css - @import for apps/index.css and/or lib/index.css,
|
|
16
|
+
* whichever actually have content
|
|
17
|
+
*/
|
|
18
|
+
export function writeGlueCss(
|
|
19
|
+
tokenGenerationRoot: string,
|
|
20
|
+
results: GenerateResult[],
|
|
21
|
+
): void {
|
|
22
|
+
const appResults = results.filter(
|
|
23
|
+
(r) => r.source.kind === 'app' && r.wroteOutput,
|
|
24
|
+
);
|
|
25
|
+
const libResult = results.find(
|
|
26
|
+
(r) => r.source.kind === 'lib' && r.wroteOutput,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const appsIndexPath = path.join(tokenGenerationRoot, 'apps', 'index.css');
|
|
30
|
+
const libIndexPath = path.join(tokenGenerationRoot, 'lib', 'index.css');
|
|
31
|
+
const rootIndexPath = path.join(tokenGenerationRoot, 'index.css');
|
|
32
|
+
|
|
33
|
+
const rootImports: string[] = [];
|
|
34
|
+
|
|
35
|
+
if (appResults.length > 0) {
|
|
36
|
+
const appImportLines = appResults
|
|
37
|
+
.map((r) => `@import "./${r.source.appName}/dist/index.css";`)
|
|
38
|
+
.join('\n');
|
|
39
|
+
writeGlueFile(appsIndexPath, appImportLines);
|
|
40
|
+
rootImports.push('@import "./apps/index.css";');
|
|
41
|
+
} else {
|
|
42
|
+
removeGlueFile(appsIndexPath);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (libResult) {
|
|
46
|
+
writeGlueFile(libIndexPath, '@import "./dist/index.css";');
|
|
47
|
+
rootImports.push('@import "./lib/index.css";');
|
|
48
|
+
} else {
|
|
49
|
+
removeGlueFile(libIndexPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (rootImports.length > 0) {
|
|
53
|
+
writeGlueFile(rootIndexPath, rootImports.join('\n'));
|
|
54
|
+
} else {
|
|
55
|
+
removeGlueFile(rootIndexPath);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function writeGlueFile(filePath: string, content: string): void {
|
|
60
|
+
fs.mkdirSync(path.dirname(filePath), {
|
|
61
|
+
recursive: true,
|
|
62
|
+
});
|
|
63
|
+
fs.writeFileSync(filePath, `${content}\n`, 'utf8');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function removeGlueFile(filePath: string): void {
|
|
67
|
+
fs.rmSync(filePath, {
|
|
68
|
+
force: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Folder, TokenNode, TokenTree, Variable } from '../types';
|
|
2
|
+
import { formatValue, resolveValue } from './format-value';
|
|
3
|
+
import { slugify, toCssVarName } from './slugify';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Walk the token tree, collecting leaf variables into `out`.
|
|
7
|
+
* Each top-level group is walked as part of the same tree - callers group the flat
|
|
8
|
+
* result by folder afterwards (see groupByFolder).
|
|
9
|
+
*/
|
|
10
|
+
export function collectVariables(
|
|
11
|
+
root: TokenTree,
|
|
12
|
+
node: TokenNode,
|
|
13
|
+
pathSegments: string[],
|
|
14
|
+
out: Variable[],
|
|
15
|
+
): void {
|
|
16
|
+
if (node && typeof node === 'object' && '$type' in node) {
|
|
17
|
+
let resolved: ReturnType<typeof resolveValue>;
|
|
18
|
+
let cssValue: string;
|
|
19
|
+
try {
|
|
20
|
+
resolved = resolveValue(root, node);
|
|
21
|
+
cssValue = formatValue(resolved.type, resolved.value);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Не вдалося розв'язати токен "${pathSegments.join('.')}": ${(err as Error).message}`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
out.push({
|
|
28
|
+
pathSegments: pathSegments.slice(),
|
|
29
|
+
cssVarName: toCssVarName(pathSegments),
|
|
30
|
+
type: resolved.type,
|
|
31
|
+
cssValue,
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (node && typeof node === 'object') {
|
|
36
|
+
for (const [key, child] of Object.entries(
|
|
37
|
+
node as Record<string, TokenNode>,
|
|
38
|
+
)) {
|
|
39
|
+
if (key.startsWith('$')) continue;
|
|
40
|
+
collectVariables(root, child, pathSegments.concat(key), out);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Whether a folder is theme-aware: itself or any ancestor is literally named "Colors". */
|
|
46
|
+
export function isColorsFolder(folderSegments: string[]): boolean {
|
|
47
|
+
return folderSegments.some((segment) => segment.toLowerCase() === 'colors');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Group a flat variable list (single theme) by folder (all path segments except the last). */
|
|
51
|
+
export function groupByFolder(variables: Variable[]): Map<string, Folder> {
|
|
52
|
+
const folders = new Map<string, Folder>();
|
|
53
|
+
for (const variable of variables) {
|
|
54
|
+
const folderSegments = variable.pathSegments.slice(0, -1);
|
|
55
|
+
const folderKey = folderSegments.map(slugify).join('/');
|
|
56
|
+
if (!folders.has(folderKey)) {
|
|
57
|
+
folders.set(folderKey, {
|
|
58
|
+
folderSegments,
|
|
59
|
+
variables: [],
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
folders.get(folderKey)?.variables.push(variable);
|
|
63
|
+
}
|
|
64
|
+
return folders;
|
|
65
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FigmaColorValue,
|
|
3
|
+
TokenLeaf,
|
|
4
|
+
TokenNode,
|
|
5
|
+
TokenTree,
|
|
6
|
+
TokenType,
|
|
7
|
+
TokenValue,
|
|
8
|
+
} from '../types';
|
|
9
|
+
import { getNodeByPath, parseRef } from './token-refs';
|
|
10
|
+
|
|
11
|
+
/** Round a float to a sane precision and format as a px string. */
|
|
12
|
+
export function toPx(value: number): string {
|
|
13
|
+
const rounded = Math.round(value * 1000) / 1000;
|
|
14
|
+
return `${rounded}px`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Convert a Figma color object ({colorSpace, components, alpha, hex}) to a hex/hex-alpha string. */
|
|
18
|
+
export function colorToHex(value: TokenValue): string {
|
|
19
|
+
if (typeof value === 'string') return value;
|
|
20
|
+
if (
|
|
21
|
+
value &&
|
|
22
|
+
typeof value === 'object' &&
|
|
23
|
+
typeof (value as FigmaColorValue).hex === 'string'
|
|
24
|
+
) {
|
|
25
|
+
const colorValue = value as FigmaColorValue;
|
|
26
|
+
const hex = colorValue.hex;
|
|
27
|
+
const alpha = typeof colorValue.alpha === 'number' ? colorValue.alpha : 1;
|
|
28
|
+
if (alpha >= 1) return hex;
|
|
29
|
+
const alphaHex = Math.round(alpha * 255)
|
|
30
|
+
.toString(16)
|
|
31
|
+
.padStart(2, '0');
|
|
32
|
+
return `${hex}${alphaHex}`;
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`Нерозпізнане значення кольору: ${JSON.stringify(value)}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ResolvedValue {
|
|
38
|
+
type: TokenType;
|
|
39
|
+
value: TokenValue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Resolve a token's final value, following alias chains, and return { type, value }. */
|
|
43
|
+
export function resolveValue(
|
|
44
|
+
root: TokenTree,
|
|
45
|
+
node: TokenNode,
|
|
46
|
+
seenRefs: string[] = [],
|
|
47
|
+
): ResolvedValue {
|
|
48
|
+
const leaf = node as TokenLeaf;
|
|
49
|
+
const rawValue = leaf.$value;
|
|
50
|
+
if (typeof rawValue === 'string') {
|
|
51
|
+
const refPath = parseRef(rawValue);
|
|
52
|
+
if (refPath) {
|
|
53
|
+
const refKey = refPath.join('.');
|
|
54
|
+
if (seenRefs.includes(refKey)) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Виявлено циклічне посилання: ${seenRefs.concat(refKey).join(' -> ')}`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const target = getNodeByPath(root, refPath);
|
|
60
|
+
if (!target || typeof target !== 'object' || !('$value' in target)) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Неможливо розв'язати посилання "${rawValue}" (шлях: ${refPath.join('.')})`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return resolveValue(root, target, seenRefs.concat(refKey));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
type: leaf.$type as TokenType,
|
|
70
|
+
value: rawValue,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Format a resolved value according to its $type. */
|
|
75
|
+
export function formatValue(type: TokenType, value: TokenValue): string {
|
|
76
|
+
switch (type) {
|
|
77
|
+
case 'color':
|
|
78
|
+
return colorToHex(value);
|
|
79
|
+
case 'number':
|
|
80
|
+
return toPx(value as number);
|
|
81
|
+
case 'string':
|
|
82
|
+
return String(value);
|
|
83
|
+
default:
|
|
84
|
+
throw new Error(`Непідтримуваний $type токена: ${type}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Convert an arbitrary path segment (may contain spaces/mixed case) to kebab-case. */
|
|
2
|
+
export function slugify(segment: string): string {
|
|
3
|
+
return String(segment)
|
|
4
|
+
.trim()
|
|
5
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2') // camelCase -> camel-Case
|
|
6
|
+
.replace(/[\s_]+/g, '-')
|
|
7
|
+
.toLowerCase()
|
|
8
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
9
|
+
.replace(/-+/g, '-')
|
|
10
|
+
.replace(/^-|-$/g, '');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Build the full CSS custom property name from a token path, e.g. ["WT","Buttons","Primary","background"] -> --wt-wt-buttons-primary-background */
|
|
14
|
+
export function toCssVarName(pathSegments: string[]): string {
|
|
15
|
+
return `--wt-${pathSegments.map(slugify).join('-')}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TokenNode, TokenTree } from '../types';
|
|
2
|
+
|
|
3
|
+
/** Parse a Figma alias reference string like "{Border radius.lg}" into its dot-separated path segments. */
|
|
4
|
+
export function parseRef(value: string): string[] | null {
|
|
5
|
+
const match = /^\{(.+)\}$/.exec(value);
|
|
6
|
+
if (!match) return null;
|
|
7
|
+
return match[1].split('.');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Look up a token node by its top-level-group path (as produced by parseRef). */
|
|
11
|
+
export function getNodeByPath(
|
|
12
|
+
root: TokenTree,
|
|
13
|
+
segments: string[],
|
|
14
|
+
): TokenNode | undefined {
|
|
15
|
+
let node: TokenNode | undefined = root;
|
|
16
|
+
for (const segment of segments) {
|
|
17
|
+
if (node == null || typeof node !== 'object') return undefined;
|
|
18
|
+
node = (node as Record<string, TokenNode>)[segment];
|
|
19
|
+
}
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Raw Figma "Design Tokens" export shape (a recursive tree of groups and leaf tokens). */
|
|
2
|
+
export type TokenType = 'color' | 'number' | 'string';
|
|
3
|
+
|
|
4
|
+
export interface FigmaColorValue {
|
|
5
|
+
colorSpace?: string;
|
|
6
|
+
components?: number[];
|
|
7
|
+
alpha?: number;
|
|
8
|
+
hex: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type TokenValue =
|
|
12
|
+
| string
|
|
13
|
+
| number
|
|
14
|
+
| FigmaColorValue
|
|
15
|
+
| Record<string, unknown>;
|
|
16
|
+
|
|
17
|
+
export interface TokenLeaf {
|
|
18
|
+
$type: string;
|
|
19
|
+
$value: TokenValue;
|
|
20
|
+
$extensions?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type TokenNode =
|
|
24
|
+
| TokenLeaf
|
|
25
|
+
| {
|
|
26
|
+
[key: string]: TokenNode;
|
|
27
|
+
}
|
|
28
|
+
| Record<string, unknown>;
|
|
29
|
+
|
|
30
|
+
export type TokenTree = Record<string, TokenNode>;
|
|
31
|
+
|
|
32
|
+
/** One theme variant to generate CSS for (e.g. light/dark). */
|
|
33
|
+
export interface ThemeConfig {
|
|
34
|
+
name: string;
|
|
35
|
+
file: string;
|
|
36
|
+
selector: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A single source of token files: either an app under apps/<app-name>/ or the shared lib/. */
|
|
40
|
+
export interface TokenSource {
|
|
41
|
+
/** Human-readable label used in log/error messages, e.g. "apps/agent-workspace-app" or "lib". */
|
|
42
|
+
label: string;
|
|
43
|
+
/** Absolute path to the directory containing the theme input files. */
|
|
44
|
+
inputDir: string;
|
|
45
|
+
/** Absolute path to the directory the generated CSS tree should be written to. */
|
|
46
|
+
outputDir: string;
|
|
47
|
+
/** Whether this source is an app under apps/<app-name>/ or the shared lib/. */
|
|
48
|
+
kind: 'app' | 'lib';
|
|
49
|
+
/** The app's directory name, e.g. "agent-workspace-app". Only set when kind is 'app'. */
|
|
50
|
+
appName?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Outcome of generating a single token source. */
|
|
54
|
+
export interface GenerateResult {
|
|
55
|
+
source: TokenSource;
|
|
56
|
+
/** Whether validation passed for this source. */
|
|
57
|
+
succeeded: boolean;
|
|
58
|
+
/** Whether a dist/index.css entry point was actually written (false if validation
|
|
59
|
+
* failed, or if the source produced zero variables). */
|
|
60
|
+
wroteOutput: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A resolved leaf variable ready to be emitted as a CSS custom property. */
|
|
64
|
+
export interface Variable {
|
|
65
|
+
pathSegments: string[];
|
|
66
|
+
cssVarName: string;
|
|
67
|
+
type: TokenType;
|
|
68
|
+
cssValue: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Variables grouped by their containing folder (all path segments except the last). */
|
|
72
|
+
export interface Folder {
|
|
73
|
+
folderSegments: string[];
|
|
74
|
+
variables: Variable[];
|
|
75
|
+
}
|