monomind 2.5.1 → 2.5.3
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.md +1 -1
- package/package.json +2 -1
- package/packages/@monomind/cli/.claude/agents/design/design-monodesign.md +6 -6
- package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +3 -3
- package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +2 -2
- package/packages/@monomind/cli/.claude/agents/specialists/integration-architect.md +4 -4
- package/packages/@monomind/cli/.claude/commands/github/repo-architect.md +4 -4
- package/packages/@monomind/cli/.claude/commands/github/sync-coordinator.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +4 -4
- package/packages/@monomind/cli/.claude/commands/mastermind/approvev1.md +4 -4
- package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/brain.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/build.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/content.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +4 -4
- package/packages/@monomind/cli/.claude/commands/mastermind/createtask.md +3 -3
- package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/design.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/do.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/execute.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/finance.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/finish.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/ideate.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/marketing.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/master.md +54 -54
- package/packages/@monomind/cli/.claude/commands/mastermind/ops.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/orgs.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/orgstatus.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/receive-review.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/release.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/research.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/review.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +4 -4
- package/packages/@monomind/cli/.claude/commands/mastermind/runorgv1.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/sales.md +6 -6
- package/packages/@monomind/cli/.claude/commands/mastermind/skill-builder.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +3 -3
- package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/techport.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/worktree.md +5 -5
- package/packages/@monomind/cli/.claude/helpers/control-start.cjs +30 -0
- package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +2 -2
- package/packages/@monomind/cli/.claude/helpers/extras-registry.json +1 -1
- package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +2 -2
- package/packages/@monomind/cli/.claude/helpers/handlers/edit-handler.cjs +2 -2
- package/packages/@monomind/cli/.claude/helpers/handlers/gates-handler.cjs +1 -1
- package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +1 -1
- package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +1 -1
- package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +11 -11
- package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +2 -2
- package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +8 -8
- package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +44 -12
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/access.md → mastermind-access/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/activity.md → mastermind-activity/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/adapter-manager.md → mastermind-adapter-manager/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/adapters.md → mastermind-adapters/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/agent-detail.md → mastermind-agent-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/agents.md → mastermind-agents/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/approval-detail.md → mastermind-approval-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/approvev1.md → mastermind-approvev1/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/architect.md → mastermind-architect/SKILL.md} +7 -7
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/autodev.md → mastermind-autodev/SKILL.md} +10 -10
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/backup.md → mastermind-backup/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/bootstrap.md → mastermind-bootstrap/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/budgets.md → mastermind-budgets/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/build.md → mastermind-build/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/companies.md → mastermind-companies/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/content.md → mastermind-content/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/costs.md → mastermind-costs/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/createorg.md → mastermind-createorg/SKILL.md} +3 -3
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/debug.md → mastermind-debug/SKILL.md} +4 -4
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/_delegation.md → mastermind-delegation/SKILL.md} +1 -1
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/design.md → mastermind-design/SKILL.md} +9 -9
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/diagnose.md → mastermind-diagnose/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/env.md → mastermind-env/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/environments.md → mastermind-environments/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/execute.md → mastermind-execute/SKILL.md} +10 -10
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/export.md → mastermind-export/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/finance.md → mastermind-finance/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/goal-detail.md → mastermind-goal-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/goals.md → mastermind-goals/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/heartbeatv1.md → mastermind-heartbeatv1/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/idea.md → mastermind-idea/SKILL.md} +7 -7
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/import.md → mastermind-import/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/inbox.md → mastermind-inbox/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/instance.md → mastermind-instance/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/instance-settings.md → mastermind-instance-settings/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/invite-landing.md → mastermind-invite-landing/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/invites.md → mastermind-invites/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/issue-detail.md → mastermind-issue-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/issues.md → mastermind-issues/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/join-queue.md → mastermind-join-queue/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/liveness.md → mastermind-liveness/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/marketing.md → mastermind-marketing/SKILL.md} +8 -8
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/memory.md → mastermind-memory/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/monitor.md → mastermind-monitor/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/my-issues.md → mastermind-my-issues/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/new-agent.md → mastermind-new-agent/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/ops.md → mastermind-ops/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/org-chart.md → mastermind-org-chart/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/org-settings.md → mastermind-org-settings/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/orgs.md → mastermind-orgs/SKILL.md} +1 -1
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/orgstatus.md → mastermind-orgstatus/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/plan.md → mastermind-plan/SKILL.md} +7 -7
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/plan-to-tasks.md → mastermind-plan-to-tasks/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/plugin-manager.md → mastermind-plugin-manager/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/plugin-settings.md → mastermind-plugin-settings/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/plugins.md → mastermind-plugins/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/profile.md → mastermind-profile/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/project-detail.md → mastermind-project-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/project-workspace.md → mastermind-project-workspace/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/projects.md → mastermind-projects/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/_protocol.md → mastermind-protocol/SKILL.md} +3 -3
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/release.md → mastermind-release/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/_repeat.md → mastermind-repeat/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/research.md → mastermind-research/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/review.md → mastermind-review/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/routine-detail.md → mastermind-routine-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/routines.md → mastermind-routines/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/runorgv1.md → mastermind-runorgv1/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/sales.md → mastermind-sales/SKILL.md} +5 -5
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/search.md → mastermind-search/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/secrets.md → mastermind-secrets/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/skill-builder.md → mastermind-skill-builder/SKILL.md} +16 -14
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/{skills.md → SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/stoporg.md → mastermind-stoporg/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/taskdev.md → mastermind-taskdev/SKILL.md} +6 -6
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-taskdev}/implementer-prompt.md +1 -1
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/tasks.md → mastermind-tasks/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/tdd.md → mastermind-tdd/SKILL.md} +4 -4
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/techport.md → mastermind-techport/SKILL.md} +6 -6
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/threads.md → mastermind-threads/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/tree-control.md → mastermind-tree-control/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/verify.md → mastermind-verify/SKILL.md} +1 -1
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/wiki.md → mastermind-wiki/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/workspace-detail.md → mastermind-workspace-detail/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/{mastermind-skills/workspaces.md → mastermind-workspaces/SKILL.md} +2 -2
- package/packages/@monomind/cli/.claude/skills/monodesign/SKILL.md +114 -190
- package/packages/@monomind/cli/.claude/skills/monodesign/adapt.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-asset-producer.md +4 -4
- package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +103 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/audit.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/craft.md +2 -2
- package/packages/@monomind/cli/.claude/skills/monodesign/critique.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/init.md +30 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/layout.md +36 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/live.md +19 -44
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.md +122 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.native.md +58 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/android.md +40 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/animate.md +39 -11
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/antipatterns-catalog.md +67 -16
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.md +5 -3
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.native.md +139 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/bolder.md +71 -64
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/brand.md +12 -18
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/clarify.md +114 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/codex.md +4 -6
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/colorize.md +108 -5
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/craft.md +70 -143
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/critique.md +635 -68
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/delight.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/distill.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +24 -22
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/extract.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/hooks.md +22 -29
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/init.md +221 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/interaction-design.md +0 -6
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/ios.md +45 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/layout.md +57 -13
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +159 -71
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/overdrive.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/personas.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/polish.md +16 -8
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/pre-delivery-checklist.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/product.md +1 -3
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/quieter.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/shape.md +27 -13
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/teach.md +6 -152
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/typeset.md +180 -3
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/command-metadata.json +94 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context-signals.mjs +260 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context.mjs +1061 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/critique-storage.mjs +416 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect-csp.mjs +198 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect.mjs +33 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +1962 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/cli/main.mjs +321 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/design-system.mjs +814 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +5601 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +50 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +259 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +258 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +636 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +1015 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +253 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +198 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/findings.mjs +12 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +181 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +373 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/index.mjs +426 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +198 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +166 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +563 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +2995 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/color.mjs +124 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +101 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +30 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/page.mjs +7 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-admin.mjs +661 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-before-edit.mjs +516 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-lib.mjs +1776 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook.mjs +61 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/design-parser.mjs +842 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/is-generated.mjs +69 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +640 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +129 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/provider.mjs +4 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/target-args.mjs +42 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +50 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/completion.mjs +19 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/event-validation.mjs +137 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/insert-ui.mjs +458 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-apply.mjs +939 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +357 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +152 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/session-store.mjs +293 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/svelte-component.mjs +826 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +274 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/ui-core.mjs +180 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/vocabulary.mjs +36 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-accept.mjs +812 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-dom.js +146 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-session.js +123 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser.js +11240 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +1241 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-complete.mjs +75 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +683 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +51 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-inject.mjs +583 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-insert.mjs +272 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +363 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-poll.mjs +384 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-resume.mjs +94 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-server.mjs +1137 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-status.mjs +61 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-target.mjs +30 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-wrap.mjs +894 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live.mjs +297 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +14 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/palette.mjs +633 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/scripts/pin.mjs +221 -0
- package/packages/@monomind/cli/.claude/skills/monodesign/teach.md +7 -58
- package/packages/@monomind/cli/README.md +1 -1
- package/packages/@monomind/cli/dist/src/commands/design-detect.d.ts +7 -1
- package/packages/@monomind/cli/dist/src/commands/design-detect.js +131 -38
- package/packages/@monomind/cli/dist/src/commands/design-palette.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/commands/design-palette.js +2 -3
- package/packages/@monomind/cli/dist/src/commands/doc.js +72 -15
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +5 -1
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +24 -1
- package/packages/@monomind/cli/dist/src/commands/doctor.js +3 -3
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +8 -8
- package/packages/@monomind/cli/dist/src/commands/init.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/org.js +109 -9
- package/packages/@monomind/cli/dist/src/index.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/index.js +3 -3
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +5 -5
- package/packages/@monomind/cli/dist/src/init/executor.js +17 -6
- package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.d.ts +2 -0
- package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +4 -1
- package/packages/@monomind/cli/dist/src/mcp-server.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.js +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.js +38 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +8 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +193 -31
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +166 -17
- package/packages/@monomind/cli/dist/src/memory/memory-kg.d.ts +186 -0
- package/packages/@monomind/cli/dist/src/memory/memory-kg.js +450 -0
- package/packages/@monomind/cli/dist/src/memory/query-router.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/memory/query-router.js +113 -0
- package/packages/@monomind/cli/dist/src/orgrt/daemon.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/orgrt/daemon.js +249 -12
- package/packages/@monomind/cli/dist/src/orgrt/migrate.js +7 -0
- package/packages/@monomind/cli/dist/src/orgrt/policy.js +7 -0
- package/packages/@monomind/cli/dist/src/orgrt/session.d.ts +24 -1
- package/packages/@monomind/cli/dist/src/orgrt/session.js +18 -3
- package/packages/@monomind/cli/dist/src/orgrt/templates.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/orgrt/templates.js +9 -4
- package/packages/@monomind/cli/dist/src/orgrt/types.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/orgrt/types.js +2 -0
- package/packages/@monomind/cli/dist/src/routing/embed-worker.js +1 -1
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +1 -1
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +1 -1
- package/packages/@monomind/cli/dist/src/ui/dashboard.html +176 -26
- package/packages/@monomind/cli/dist/src/ui/orgs.html +24 -0
- package/packages/@monomind/cli/dist/src/ui/server.mjs +162 -12
- package/packages/@monomind/cli/dist/src/update/checker.js +3 -3
- package/packages/@monomind/cli/package.json +8 -6
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/_agent-select.md → mastermind-agent-select/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/finish.md → mastermind-finish/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/_intake.md → mastermind-intake/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-marketing}/references/copywriting-frameworks.md +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-marketing}/references/persuasion-psychology.md +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/monotask.md → mastermind-monotask/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/receive-review.md → mastermind-receive-review/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/runorg.md → mastermind-runorg/SKILL.md} +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-taskdev}/code-quality-reviewer-prompt.md +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-taskdev}/final-reviewer-prompt.md +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills → mastermind-taskdev}/spec-reviewer-prompt.md +0 -0
- /package/packages/@monomind/cli/.claude/skills/{mastermind-skills/worktree.md → mastermind-worktree/SKILL.md} +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { GENERIC_FONTS, OVERUSED_FONTS } from '../../shared/constants.mjs';
|
|
5
|
+
import {
|
|
6
|
+
checkSourceDesignSystem,
|
|
7
|
+
collectStaticDesignSystemFindings,
|
|
8
|
+
mergeDesignSystemFindings,
|
|
9
|
+
} from '../../design-system.mjs';
|
|
10
|
+
import { isFullPage } from '../../shared/page.mjs';
|
|
11
|
+
import { applyInlineIgnores } from '../../shared/inline-ignores.mjs';
|
|
12
|
+
import { finding } from '../../findings.mjs';
|
|
13
|
+
import { profileFindings, profileStep, profileStepAsync } from '../../profile/profiler.mjs';
|
|
14
|
+
import {
|
|
15
|
+
checkElementBorders,
|
|
16
|
+
checkElementClippedOverflow,
|
|
17
|
+
checkElementColors,
|
|
18
|
+
checkElementGlow,
|
|
19
|
+
checkElementGptBorderShadow,
|
|
20
|
+
checkElementHeroEyebrow,
|
|
21
|
+
checkElementIconTile,
|
|
22
|
+
checkElementItalicSerif,
|
|
23
|
+
checkElementMotion,
|
|
24
|
+
checkElementOversizedH1,
|
|
25
|
+
checkElementQuality,
|
|
26
|
+
checkCreamPalette,
|
|
27
|
+
checkHtmlPatterns,
|
|
28
|
+
checkPageLayout,
|
|
29
|
+
checkPageQualityFromDoc,
|
|
30
|
+
checkRepeatedSectionKickersFromDoc,
|
|
31
|
+
checkElementImageDimensions,
|
|
32
|
+
checkElementSmallTouchTarget,
|
|
33
|
+
checkFocusVisible,
|
|
34
|
+
checkHoverOnlyAffordance,
|
|
35
|
+
checkDarkSchemeContrast,
|
|
36
|
+
resolveBackground,
|
|
37
|
+
resolveBorderRadiusPx,
|
|
38
|
+
} from '../../rules/checks.mjs';
|
|
39
|
+
import { filterByProviders } from '../../registry/antipatterns.mjs';
|
|
40
|
+
import { detectText, runTextContentAnalyzers } from '../regex/detect-text.mjs';
|
|
41
|
+
import {
|
|
42
|
+
StaticDocument,
|
|
43
|
+
buildStaticStyleMap,
|
|
44
|
+
buildStaticWindow,
|
|
45
|
+
collectStaticCssText,
|
|
46
|
+
} from './css-cascade.mjs';
|
|
47
|
+
|
|
48
|
+
function checkStaticPageTypography(document, window) {
|
|
49
|
+
const findings = [];
|
|
50
|
+
const fonts = new Set();
|
|
51
|
+
const overusedFound = new Set();
|
|
52
|
+
for (const el of document.querySelectorAll('p, h1, h2, h3, h4, h5, h6, li, td, th, dd, blockquote, figcaption, a, button, label, span, div')) {
|
|
53
|
+
const hasText = el.childNodes.some(n => n.nodeType === 3 && n.textContent.trim().length > 0);
|
|
54
|
+
if (!hasText) continue;
|
|
55
|
+
const ff = window.getComputedStyle(el).fontFamily || '';
|
|
56
|
+
const stack = ff.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
|
|
57
|
+
const primary = stack.find(f => f && !GENERIC_FONTS.has(f));
|
|
58
|
+
if (!primary) continue;
|
|
59
|
+
fonts.add(primary);
|
|
60
|
+
if (OVERUSED_FONTS.has(primary)) overusedFound.add(primary);
|
|
61
|
+
}
|
|
62
|
+
for (const font of overusedFound) {
|
|
63
|
+
findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
|
|
64
|
+
}
|
|
65
|
+
if (fonts.size === 1 && document.querySelectorAll('*').length >= 20) {
|
|
66
|
+
findings.push({ id: 'single-font', snippet: `only font used is ${[...fonts][0]}` });
|
|
67
|
+
}
|
|
68
|
+
const sizes = new Set();
|
|
69
|
+
for (const el of document.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div')) {
|
|
70
|
+
const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
|
|
71
|
+
if (fontSize >= 8 && fontSize < 200) sizes.add(Math.round(fontSize * 10) / 10);
|
|
72
|
+
}
|
|
73
|
+
if (sizes.size >= 3) {
|
|
74
|
+
const sorted = [...sizes].sort((a, b) => a - b);
|
|
75
|
+
const ratio = sorted[sorted.length - 1] / sorted[0];
|
|
76
|
+
if (ratio < 2.0) {
|
|
77
|
+
findings.push({ id: 'flat-type-hierarchy', snippet: `Sizes: ${sorted.map(s => s + 'px').join(', ')} (ratio ${ratio.toFixed(1)}:1)` });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return findings;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function checkElementBrokenImage(el) {
|
|
84
|
+
const src = (el.getAttribute && el.getAttribute('src')) ?? el.attribs?.src;
|
|
85
|
+
// Missing src attribute entirely
|
|
86
|
+
if (src === undefined || src === null) {
|
|
87
|
+
return [{ id: 'broken-image', snippet: '<img> with no src attribute' }];
|
|
88
|
+
}
|
|
89
|
+
const trimmed = String(src).trim();
|
|
90
|
+
// Empty or placeholder-only src values
|
|
91
|
+
if (trimmed === '' || trimmed === '#') {
|
|
92
|
+
return [{ id: 'broken-image', snippet: `<img src="${src}">` }];
|
|
93
|
+
}
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const STATIC_ELEMENT_RULES = [
|
|
98
|
+
{ id: 'border-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementBorders(tag, style, null, resolveBorderRadiusPx(el, style, parseFloat(style.width) || 0, window)) },
|
|
99
|
+
{ id: 'color-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementColors(el, style, tag, window, customPropMap, false) },
|
|
100
|
+
{ id: 'dark-glow', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementGlow(tag, style, resolveBackground(el.parentElement || el, window, customPropMap)) },
|
|
101
|
+
{ id: 'motion-rules', selector: '*', run: (el, tag, style) => checkElementMotion(tag, style) },
|
|
102
|
+
{ id: 'icon-tile-stack', selector: 'h1,h2,h3,h4,h5,h6', run: (el, tag, _style, window) => checkElementIconTile(el, tag, window) },
|
|
103
|
+
{ id: 'italic-serif-display', selector: 'h1,h2', run: (el, tag, style) => checkElementItalicSerif(el, style, tag) },
|
|
104
|
+
{ id: 'hero-eyebrow-chip', selector: 'h1', run: (el, tag, style, window, customPropMap) => checkElementHeroEyebrow(el, style, tag, window, customPropMap) },
|
|
105
|
+
{ id: 'broken-image', selector: 'img', run: (el) => checkElementBrokenImage(el) },
|
|
106
|
+
{ id: 'quality-rules', selector: '*', run: (el, tag, style, window) => checkElementQuality(el, style, tag, window) },
|
|
107
|
+
{ id: 'oversized-h1', selector: 'h1', run: (el, tag, style, window) => checkElementOversizedH1(el, style, tag, window) },
|
|
108
|
+
{ id: 'clipped-overflow-container', selector: '*', run: (el, tag, style, window) => checkElementClippedOverflow(el, style, tag, window) },
|
|
109
|
+
{ id: 'gpt-thin-border-wide-shadow', selector: '*', run: (el, tag, style) => checkElementGptBorderShadow(el, style) },
|
|
110
|
+
{ id: 'image-missing-dimensions', selector: 'img', run: (el, tag, style) => checkElementImageDimensions(el, style) },
|
|
111
|
+
{ id: 'small-touch-target', selector: 'a,button,input,select,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=switch]', run: (el, tag, style) => checkElementSmallTouchTarget(el, style, tag) },
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
async function detectHtml(filePath, options = {}) {
|
|
115
|
+
const profile = options?.profile;
|
|
116
|
+
const html = profileStep(profile, {
|
|
117
|
+
engine: 'static-html',
|
|
118
|
+
phase: 'setup',
|
|
119
|
+
ruleId: 'read-html',
|
|
120
|
+
target: filePath,
|
|
121
|
+
}, () => fs.readFileSync(filePath, 'utf-8'));
|
|
122
|
+
|
|
123
|
+
let modules;
|
|
124
|
+
try {
|
|
125
|
+
modules = await profileStepAsync(profile, {
|
|
126
|
+
engine: 'static-html',
|
|
127
|
+
phase: 'setup',
|
|
128
|
+
ruleId: 'import-static-parser',
|
|
129
|
+
target: filePath,
|
|
130
|
+
}, async () => {
|
|
131
|
+
const [htmlparser2, cssSelect, csstree, domutils] = await Promise.all([
|
|
132
|
+
import('htmlparser2'),
|
|
133
|
+
import('css-select'),
|
|
134
|
+
import('css-tree'),
|
|
135
|
+
import('domutils'),
|
|
136
|
+
]);
|
|
137
|
+
return {
|
|
138
|
+
parseDocument: htmlparser2.parseDocument,
|
|
139
|
+
selectAll: cssSelect.selectAll,
|
|
140
|
+
selectOne: cssSelect.selectOne,
|
|
141
|
+
is: cssSelect.is,
|
|
142
|
+
csstree,
|
|
143
|
+
domutils,
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
} catch {
|
|
147
|
+
return detectText(html, filePath, options);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const resolvedPath = path.resolve(filePath);
|
|
151
|
+
const fileDir = path.dirname(resolvedPath);
|
|
152
|
+
const root = profileStep(profile, {
|
|
153
|
+
engine: 'static-html',
|
|
154
|
+
phase: 'parse-html',
|
|
155
|
+
ruleId: 'parse-document',
|
|
156
|
+
target: filePath,
|
|
157
|
+
}, () => modules.parseDocument(html, { lowerCaseAttributeNames: false, lowerCaseTags: true }));
|
|
158
|
+
|
|
159
|
+
const cssText = collectStaticCssText(root, fileDir, profile, filePath, modules);
|
|
160
|
+
const document = new StaticDocument(root, modules);
|
|
161
|
+
buildStaticStyleMap(root, document, cssText, modules, profile, filePath);
|
|
162
|
+
const window = buildStaticWindow(document);
|
|
163
|
+
|
|
164
|
+
const customPropMap = null;
|
|
165
|
+
|
|
166
|
+
const findings = [];
|
|
167
|
+
const runElementCheck = (ruleId, callback) => profile
|
|
168
|
+
? profileFindings(profile, { engine: 'static-html', phase: 'element', ruleId, target: filePath }, callback)
|
|
169
|
+
: callback();
|
|
170
|
+
|
|
171
|
+
const visitedByRule = new Map();
|
|
172
|
+
for (const rule of STATIC_ELEMENT_RULES) {
|
|
173
|
+
const elements = document.querySelectorAll(rule.selector);
|
|
174
|
+
visitedByRule.set(rule.id, elements.length);
|
|
175
|
+
for (const el of elements) {
|
|
176
|
+
const tag = el.tagName.toLowerCase();
|
|
177
|
+
const style = window.getComputedStyle(el);
|
|
178
|
+
for (const f of runElementCheck(rule.id, () => rule.run(el, tag, style, window, customPropMap))) {
|
|
179
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (options?.designSystem) {
|
|
185
|
+
const sourceDesignFindings = profileFindings(profile, {
|
|
186
|
+
engine: 'static-html',
|
|
187
|
+
phase: 'source',
|
|
188
|
+
ruleId: 'design-system',
|
|
189
|
+
target: filePath,
|
|
190
|
+
}, () => checkSourceDesignSystem(html, filePath, { designSystem: options.designSystem }));
|
|
191
|
+
const staticDesignFindings = profileFindings(profile, {
|
|
192
|
+
engine: 'static-html',
|
|
193
|
+
phase: 'page',
|
|
194
|
+
ruleId: 'design-system',
|
|
195
|
+
target: filePath,
|
|
196
|
+
}, () => collectStaticDesignSystemFindings(document, window, filePath, options.designSystem));
|
|
197
|
+
findings.push(...mergeDesignSystemFindings(staticDesignFindings, sourceDesignFindings));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (isFullPage(html)) {
|
|
201
|
+
const runPageCheck = (ruleId, callback) => profile
|
|
202
|
+
? profileFindings(profile, { engine: 'static-html', phase: 'page', ruleId, target: filePath }, callback)
|
|
203
|
+
: callback();
|
|
204
|
+
for (const f of runPageCheck('typography-rules', () => checkStaticPageTypography(document, window))) {
|
|
205
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
206
|
+
}
|
|
207
|
+
for (const f of runPageCheck('repeated-section-kickers', () => checkRepeatedSectionKickersFromDoc(document, window))) {
|
|
208
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
209
|
+
}
|
|
210
|
+
for (const f of runPageCheck('layout-rules', () => checkPageLayout(document, window))) {
|
|
211
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
212
|
+
}
|
|
213
|
+
for (const f of runPageCheck('cream-palette', () => checkCreamPalette(document, window))) {
|
|
214
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
215
|
+
}
|
|
216
|
+
for (const f of runPageCheck('skipped-heading', () => checkPageQualityFromDoc(document))) {
|
|
217
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
218
|
+
}
|
|
219
|
+
// Stylesheet-level accessibility rules operate on the concatenated CSS
|
|
220
|
+
// text (<style> blocks + linked sheets) — :hover / :focus-visible /
|
|
221
|
+
// prefers-color-scheme conditions can't be read off a resting element.
|
|
222
|
+
for (const f of runPageCheck('missing-focus-visible', () => checkFocusVisible(cssText))) {
|
|
223
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
224
|
+
}
|
|
225
|
+
for (const f of runPageCheck('hover-only-affordance', () => checkHoverOnlyAffordance(cssText))) {
|
|
226
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
227
|
+
}
|
|
228
|
+
for (const f of runPageCheck('dark-scheme-contrast-blindspot', () => checkDarkSchemeContrast(cssText))) {
|
|
229
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
230
|
+
}
|
|
231
|
+
for (const f of runPageCheck('html-patterns', () => checkHtmlPatterns(html).filter(item =>
|
|
232
|
+
item.id !== 'bounce-easing' && item.id !== 'layout-transition'
|
|
233
|
+
))) {
|
|
234
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
235
|
+
}
|
|
236
|
+
// Text-content analyzers (em-dash overuse, marketing buzzwords,
|
|
237
|
+
// numbered section markers, aphoristic cadence) live in the regex
|
|
238
|
+
// engine. Call them from here so .html files get the same coverage
|
|
239
|
+
// as .css/.tsx files. These are scoped to text content only and
|
|
240
|
+
// don't overlap with static-html's element/page rules.
|
|
241
|
+
for (const f of runPageCheck('text-content', () => runTextContentAnalyzers(html, filePath, options))) {
|
|
242
|
+
findings.push(finding(f.antipattern, filePath, f.snippet));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const byProvider = filterByProviders(findings, options.providers);
|
|
247
|
+
// Static-HTML findings carry no line number, so only whole-file
|
|
248
|
+
// `monodesign-disable` directives apply here — exactly the standalone-document
|
|
249
|
+
// waiver this primitive targets. Bypassed by `--no-config` / `--no-inline-ignores`.
|
|
250
|
+
return options?.inlineIgnores === false ? byProvider : applyInlineIgnores(byProvider, html);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { checkStaticPageTypography, STATIC_ELEMENT_RULES, detectHtml };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Visual-contrast pixel fallback. `page` is the driver page abstraction from
|
|
3
|
+
// ../browser/drivers.mjs (a raw puppeteer Page also satisfies it): it only
|
|
4
|
+
// needs `evaluate(fn, arg)` roundtrips and `screenshot({ encoding: 'base64',
|
|
5
|
+
// clip, captureBeyondViewport })` returning a base64 PNG string. The logic is
|
|
6
|
+
// driver-agnostic: hide the glyphs via CSS, screenshot the clip twice, and
|
|
7
|
+
// diff the pixels in-page on a canvas. Both the monobrowse (CDP
|
|
8
|
+
// Page.captureScreenshot + Runtime.evaluate) and puppeteer drivers support
|
|
9
|
+
// this fully.
|
|
10
|
+
function sanitizeScreenshotClip(clip, viewport) {
|
|
11
|
+
if (!clip) return null;
|
|
12
|
+
const x = Math.max(0, Math.floor(clip.x || 0));
|
|
13
|
+
const y = Math.max(0, Math.floor(clip.y || 0));
|
|
14
|
+
const width = Math.min(
|
|
15
|
+
Math.max(1, Math.ceil(clip.width || 0)),
|
|
16
|
+
Math.max(1, viewport?.width || 1600),
|
|
17
|
+
);
|
|
18
|
+
const height = Math.min(
|
|
19
|
+
Math.max(1, Math.ceil(clip.height || 0)),
|
|
20
|
+
320,
|
|
21
|
+
);
|
|
22
|
+
if (width < 1 || height < 1) return null;
|
|
23
|
+
return { x, y, width, height };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function compareScreenshotContrast(page, beforeBase64, afterBase64, candidate) {
|
|
27
|
+
return page.evaluate(async ({ beforeBase64, afterBase64, candidate }) => {
|
|
28
|
+
const loadImage = (base64) => new Promise((resolve, reject) => {
|
|
29
|
+
const img = new Image();
|
|
30
|
+
img.onload = () => resolve(img);
|
|
31
|
+
img.onerror = () => reject(new Error('Could not decode contrast screenshot'));
|
|
32
|
+
img.src = `data:image/png;base64,${base64}`;
|
|
33
|
+
});
|
|
34
|
+
const [before, after] = await Promise.all([loadImage(beforeBase64), loadImage(afterBase64)]);
|
|
35
|
+
const width = Math.min(before.width, after.width);
|
|
36
|
+
const height = Math.min(before.height, after.height);
|
|
37
|
+
if (width < 1 || height < 1) return null;
|
|
38
|
+
|
|
39
|
+
const canvas = document.createElement('canvas');
|
|
40
|
+
canvas.width = width;
|
|
41
|
+
canvas.height = height;
|
|
42
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
43
|
+
if (!ctx) return null;
|
|
44
|
+
|
|
45
|
+
ctx.drawImage(before, 0, 0, width, height);
|
|
46
|
+
const beforePixels = ctx.getImageData(0, 0, width, height).data;
|
|
47
|
+
ctx.clearRect(0, 0, width, height);
|
|
48
|
+
ctx.drawImage(after, 0, 0, width, height);
|
|
49
|
+
const afterPixels = ctx.getImageData(0, 0, width, height).data;
|
|
50
|
+
|
|
51
|
+
const luminance = ({ r, g, b }) => {
|
|
52
|
+
const convert = c => {
|
|
53
|
+
const v = c / 255;
|
|
54
|
+
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
55
|
+
};
|
|
56
|
+
return 0.2126 * convert(r) + 0.7152 * convert(g) + 0.0722 * convert(b);
|
|
57
|
+
};
|
|
58
|
+
const ratio = (a, b) => {
|
|
59
|
+
const l1 = luminance(a);
|
|
60
|
+
const l2 = luminance(b);
|
|
61
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const cssTextColor = candidate.textColor && !candidate.preferRenderedForeground
|
|
65
|
+
? {
|
|
66
|
+
r: candidate.textColor.r,
|
|
67
|
+
g: candidate.textColor.g,
|
|
68
|
+
b: candidate.textColor.b,
|
|
69
|
+
}
|
|
70
|
+
: null;
|
|
71
|
+
const ratios = [];
|
|
72
|
+
let glyphPixels = 0;
|
|
73
|
+
let strongestDelta = 0;
|
|
74
|
+
for (let i = 0; i < beforePixels.length; i += 4) {
|
|
75
|
+
const delta = Math.abs(beforePixels[i] - afterPixels[i])
|
|
76
|
+
+ Math.abs(beforePixels[i + 1] - afterPixels[i + 1])
|
|
77
|
+
+ Math.abs(beforePixels[i + 2] - afterPixels[i + 2])
|
|
78
|
+
+ Math.abs(beforePixels[i + 3] - afterPixels[i + 3]);
|
|
79
|
+
strongestDelta = Math.max(strongestDelta, delta);
|
|
80
|
+
if (delta < 10) continue;
|
|
81
|
+
glyphPixels++;
|
|
82
|
+
const fg = cssTextColor || {
|
|
83
|
+
r: beforePixels[i],
|
|
84
|
+
g: beforePixels[i + 1],
|
|
85
|
+
b: beforePixels[i + 2],
|
|
86
|
+
};
|
|
87
|
+
const bg = {
|
|
88
|
+
r: afterPixels[i],
|
|
89
|
+
g: afterPixels[i + 1],
|
|
90
|
+
b: afterPixels[i + 2],
|
|
91
|
+
};
|
|
92
|
+
ratios.push(ratio(fg, bg));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (ratios.length < 8) {
|
|
96
|
+
return {
|
|
97
|
+
glyphPixels,
|
|
98
|
+
strongestDelta,
|
|
99
|
+
worstRatio: null,
|
|
100
|
+
p10Ratio: null,
|
|
101
|
+
medianRatio: null,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
ratios.sort((a, b) => a - b);
|
|
106
|
+
const pick = pct => ratios[Math.min(ratios.length - 1, Math.max(0, Math.floor((pct / 100) * ratios.length)))];
|
|
107
|
+
return {
|
|
108
|
+
glyphPixels,
|
|
109
|
+
strongestDelta,
|
|
110
|
+
worstRatio: ratios[0],
|
|
111
|
+
p10Ratio: pick(10),
|
|
112
|
+
medianRatio: pick(50),
|
|
113
|
+
};
|
|
114
|
+
}, { beforeBase64, afterBase64, candidate });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function captureVisualContrastCandidate(page, candidate, viewport) {
|
|
118
|
+
const clip = sanitizeScreenshotClip(candidate.clip, viewport);
|
|
119
|
+
if (!clip) return null;
|
|
120
|
+
|
|
121
|
+
const beforeBase64 = await page.screenshot({
|
|
122
|
+
encoding: 'base64',
|
|
123
|
+
clip,
|
|
124
|
+
captureBeyondViewport: true,
|
|
125
|
+
});
|
|
126
|
+
const token = `monodesign-contrast-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
127
|
+
const applied = await page.evaluate(({ selector, token, backgroundClipText }) => {
|
|
128
|
+
let el;
|
|
129
|
+
try {
|
|
130
|
+
el = document.querySelector(selector);
|
|
131
|
+
} catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
if (!el) return false;
|
|
135
|
+
let style = document.getElementById('monodesign-visual-contrast-hide-style');
|
|
136
|
+
if (!style) {
|
|
137
|
+
style = document.createElement('style');
|
|
138
|
+
style.id = 'monodesign-visual-contrast-hide-style';
|
|
139
|
+
style.textContent = [
|
|
140
|
+
'[data-monodesign-visual-contrast-target] {',
|
|
141
|
+
' color: transparent !important;',
|
|
142
|
+
' -webkit-text-fill-color: transparent !important;',
|
|
143
|
+
' text-shadow: none !important;',
|
|
144
|
+
'}',
|
|
145
|
+
'[data-monodesign-visual-contrast-target][data-monodesign-bgclip-text="true"] {',
|
|
146
|
+
' background-image: none !important;',
|
|
147
|
+
'}',
|
|
148
|
+
].join('\n');
|
|
149
|
+
document.head.appendChild(style);
|
|
150
|
+
}
|
|
151
|
+
el.setAttribute('data-monodesign-visual-contrast-target', token);
|
|
152
|
+
if (backgroundClipText) el.setAttribute('data-monodesign-bgclip-text', 'true');
|
|
153
|
+
return true;
|
|
154
|
+
}, {
|
|
155
|
+
selector: candidate.selector,
|
|
156
|
+
token,
|
|
157
|
+
backgroundClipText: candidate.backgroundClipText,
|
|
158
|
+
});
|
|
159
|
+
if (!applied) return null;
|
|
160
|
+
|
|
161
|
+
let afterBase64;
|
|
162
|
+
try {
|
|
163
|
+
afterBase64 = await page.screenshot({
|
|
164
|
+
encoding: 'base64',
|
|
165
|
+
clip,
|
|
166
|
+
captureBeyondViewport: true,
|
|
167
|
+
});
|
|
168
|
+
} finally {
|
|
169
|
+
await page.evaluate(({ selector }) => {
|
|
170
|
+
try {
|
|
171
|
+
const el = document.querySelector(selector);
|
|
172
|
+
if (el) {
|
|
173
|
+
el.removeAttribute('data-monodesign-visual-contrast-target');
|
|
174
|
+
el.removeAttribute('data-monodesign-bgclip-text');
|
|
175
|
+
}
|
|
176
|
+
} catch {
|
|
177
|
+
// Ignore invalid or stale selectors during cleanup.
|
|
178
|
+
}
|
|
179
|
+
}, { selector: candidate.selector }).catch(() => {});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const metrics = await compareScreenshotContrast(page, beforeBase64, afterBase64, candidate);
|
|
183
|
+
if (!metrics || !Number.isFinite(metrics.p10Ratio) || metrics.glyphPixels < 8) return null;
|
|
184
|
+
const measuredRatio = metrics.p10Ratio;
|
|
185
|
+
if (measuredRatio >= candidate.threshold) return null;
|
|
186
|
+
const textLabel = candidate.text ? ` "${candidate.text}"` : '';
|
|
187
|
+
const reasonLabel = (candidate.reasons || []).slice(0, 3).join(', ') || 'visual background';
|
|
188
|
+
return {
|
|
189
|
+
id: 'low-contrast',
|
|
190
|
+
snippet: `pixel contrast ${measuredRatio.toFixed(1)}:1 median ${metrics.medianRatio.toFixed(1)}:1 (need ${candidate.threshold}:1) on ${reasonLabel}${textLabel}`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export {
|
|
195
|
+
sanitizeScreenshotClip,
|
|
196
|
+
compareScreenshotContrast,
|
|
197
|
+
captureVisualContrastCandidate,
|
|
198
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getAntipattern } from './registry/antipatterns.mjs';
|
|
2
|
+
|
|
3
|
+
function getAP(id) {
|
|
4
|
+
return getAntipattern(id);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function finding(id, filePath, snippet, line = 0) {
|
|
8
|
+
const ap = getAP(id);
|
|
9
|
+
return { antipattern: id, name: ap.name, description: ap.description, severity: ap.severity || 'warning', file: filePath, line, snippet };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { getAP, finding };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS region extraction and declaration scanning for the auto-fix engine.
|
|
3
|
+
*
|
|
4
|
+
* Fixers never parse a full DOM — they operate on the raw source text of the
|
|
5
|
+
* "CSS-shaped" regions of a file:
|
|
6
|
+
* - whole file for .css/.scss/.sass/.less
|
|
7
|
+
* - <style> blocks and style="" attributes for HTML-family files
|
|
8
|
+
* - styled-components / emotion template literals for JS/TS files
|
|
9
|
+
*
|
|
10
|
+
* All offsets returned here are absolute within the original file content, so
|
|
11
|
+
* edits computed against a region can be applied directly to the file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const CSS_EXTENSIONS = new Set(['.css', '.scss', '.sass', '.less']);
|
|
15
|
+
const HTML_FAMILY_EXTENSIONS = new Set(['.html', '.htm', '.vue', '.svelte', '.astro']);
|
|
16
|
+
const JS_EXTENSIONS = new Set(['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs']);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A region of file content that can be scanned as CSS declarations.
|
|
20
|
+
* kind:
|
|
21
|
+
* 'css' — full stylesheet syntax (selectors + blocks)
|
|
22
|
+
* 'style-attr' — a bare declaration list from a style="" attribute;
|
|
23
|
+
* selectorHint carries the owning tag name
|
|
24
|
+
*/
|
|
25
|
+
function extractCssRegions(content, ext) {
|
|
26
|
+
ext = (ext || '').toLowerCase();
|
|
27
|
+
if (CSS_EXTENSIONS.has(ext)) {
|
|
28
|
+
return [{ start: 0, end: content.length, text: content, kind: 'css', selectorHint: null }];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const regions = [];
|
|
32
|
+
if (HTML_FAMILY_EXTENSIONS.has(ext)) {
|
|
33
|
+
const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
34
|
+
let m;
|
|
35
|
+
while ((m = styleBlockRe.exec(content)) !== null) {
|
|
36
|
+
const start = m.index + m[0].indexOf(m[1]);
|
|
37
|
+
regions.push({ start, end: start + m[1].length, text: m[1], kind: 'css', selectorHint: null });
|
|
38
|
+
}
|
|
39
|
+
const styleAttrRe = /<([a-zA-Z][\w-]*)\b[^>]*?\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi;
|
|
40
|
+
while ((m = styleAttrRe.exec(content)) !== null) {
|
|
41
|
+
const value = m[3] !== undefined ? m[3] : m[4];
|
|
42
|
+
if (!value) continue;
|
|
43
|
+
const start = m.index + m[0].length - value.length - 1; // inside the closing quote
|
|
44
|
+
regions.push({
|
|
45
|
+
start,
|
|
46
|
+
end: start + value.length,
|
|
47
|
+
text: value,
|
|
48
|
+
kind: 'style-attr',
|
|
49
|
+
selectorHint: m[1].toLowerCase(),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return regions;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (JS_EXTENSIONS.has(ext)) {
|
|
56
|
+
const cssInJsRe = /(?:styled(?:\.\w+|\([^)]+\))|css)\s*`([\s\S]*?)`/g;
|
|
57
|
+
let m;
|
|
58
|
+
while ((m = cssInJsRe.exec(content)) !== null) {
|
|
59
|
+
const start = m.index + m[0].indexOf('`') + 1;
|
|
60
|
+
regions.push({ start, end: start + m[1].length, text: m[1], kind: 'css', selectorHint: null });
|
|
61
|
+
}
|
|
62
|
+
return regions;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return regions;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Find every `prop: value` declaration in a CSS-shaped text. Returns local
|
|
70
|
+
* offsets (relative to the given text):
|
|
71
|
+
* { declStart, valueStart, valueEnd, value, terminator }
|
|
72
|
+
* `value` is the raw trimmed value text (may include !important).
|
|
73
|
+
* `terminator` is the index just past the trailing `;` when present,
|
|
74
|
+
* otherwise valueEnd.
|
|
75
|
+
*/
|
|
76
|
+
function findDeclarations(text, prop) {
|
|
77
|
+
const re = new RegExp(`(^|[{;])(\\s*)(${prop})\\s*:\\s*([^;{}]*)`, 'gi');
|
|
78
|
+
const results = [];
|
|
79
|
+
let m;
|
|
80
|
+
while ((m = re.exec(text)) !== null) {
|
|
81
|
+
const declStart = m.index + m[1].length + m[2].length;
|
|
82
|
+
const rawValue = m[4];
|
|
83
|
+
const trimmed = rawValue.replace(/\s+$/, '');
|
|
84
|
+
const valueStart = m.index + m[0].length - rawValue.length;
|
|
85
|
+
const valueEnd = valueStart + trimmed.length;
|
|
86
|
+
const terminator = text[m.index + m[0].length] === ';'
|
|
87
|
+
? m.index + m[0].length + 1
|
|
88
|
+
: valueEnd;
|
|
89
|
+
results.push({ declStart, valueStart, valueEnd, value: trimmed.trim(), terminator });
|
|
90
|
+
}
|
|
91
|
+
return results;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The enclosing `{ ... }` block for a declaration at `index`, with its
|
|
96
|
+
* selector text. For bare declaration lists (style attributes) there is no
|
|
97
|
+
* block — the whole text is the body and selector is null.
|
|
98
|
+
*/
|
|
99
|
+
function declBlockInfo(text, index) {
|
|
100
|
+
let i = index - 1;
|
|
101
|
+
let depth = 0;
|
|
102
|
+
while (i >= 0) {
|
|
103
|
+
const ch = text[i];
|
|
104
|
+
if (ch === '}') depth++;
|
|
105
|
+
else if (ch === '{') {
|
|
106
|
+
if (depth === 0) break;
|
|
107
|
+
depth--;
|
|
108
|
+
}
|
|
109
|
+
i--;
|
|
110
|
+
}
|
|
111
|
+
if (i < 0) {
|
|
112
|
+
return { bodyStart: 0, bodyEnd: text.length, body: text, selector: null };
|
|
113
|
+
}
|
|
114
|
+
const braceIdx = i;
|
|
115
|
+
let s = braceIdx - 1;
|
|
116
|
+
while (s >= 0 && !'};{'.includes(text[s])) s--;
|
|
117
|
+
const selector = text.slice(s + 1, braceIdx).trim();
|
|
118
|
+
let j = braceIdx + 1;
|
|
119
|
+
let d = 0;
|
|
120
|
+
while (j < text.length) {
|
|
121
|
+
const ch = text[j];
|
|
122
|
+
if (ch === '{') d++;
|
|
123
|
+
else if (ch === '}') {
|
|
124
|
+
if (d === 0) break;
|
|
125
|
+
d--;
|
|
126
|
+
}
|
|
127
|
+
j++;
|
|
128
|
+
}
|
|
129
|
+
return { bodyStart: braceIdx + 1, bodyEnd: j, body: text.slice(braceIdx + 1, j), selector };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Parse a single CSS length/number value, tolerating !important. */
|
|
133
|
+
function parseCssValue(raw) {
|
|
134
|
+
const important = /!\s*important/i.test(raw);
|
|
135
|
+
const cleaned = raw.replace(/!\s*important/i, '').trim();
|
|
136
|
+
const m = cleaned.match(/^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i);
|
|
137
|
+
if (!m) return null;
|
|
138
|
+
return { num: parseFloat(m[1]), unit: (m[2] || '').toLowerCase(), important };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Resolve a block's font-size to px when statically computable, else null. */
|
|
142
|
+
function blockFontSizePx(body) {
|
|
143
|
+
const decls = findDeclarations(body, 'font-size');
|
|
144
|
+
if (decls.length === 0) return null;
|
|
145
|
+
const parsed = parseCssValue(decls[decls.length - 1].value);
|
|
146
|
+
if (!parsed) return null;
|
|
147
|
+
if (parsed.unit === 'px') return parsed.num;
|
|
148
|
+
if (parsed.unit === 'rem') return parsed.num * 16;
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Split a CSS value list on top-level commas (paren-aware, for cubic-bezier). */
|
|
153
|
+
function splitTopLevel(value) {
|
|
154
|
+
const parts = [];
|
|
155
|
+
let depth = 0;
|
|
156
|
+
let current = '';
|
|
157
|
+
for (const ch of value) {
|
|
158
|
+
if (ch === '(') depth++;
|
|
159
|
+
else if (ch === ')') depth--;
|
|
160
|
+
if (ch === ',' && depth === 0) {
|
|
161
|
+
parts.push(current.trim());
|
|
162
|
+
current = '';
|
|
163
|
+
} else {
|
|
164
|
+
current += ch;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (current.trim()) parts.push(current.trim());
|
|
168
|
+
return parts;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
CSS_EXTENSIONS,
|
|
173
|
+
HTML_FAMILY_EXTENSIONS,
|
|
174
|
+
JS_EXTENSIONS,
|
|
175
|
+
extractCssRegions,
|
|
176
|
+
findDeclarations,
|
|
177
|
+
declBlockInfo,
|
|
178
|
+
parseCssValue,
|
|
179
|
+
blockFontSizePx,
|
|
180
|
+
splitTopLevel,
|
|
181
|
+
};
|