@metamorph-labs/polymorph 1.0.18 → 1.0.19
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/CHANGELOG.md +242 -0
- package/dist/design/systems/desktop.json +1 -1
- package/dist/design/systems/dew.json +1 -1
- package/dist/design/systems/flint.json +1 -1
- package/dist/design/systems/glassmorphic.json +1 -1
- package/dist/design/systems/harbor.json +1 -1
- package/dist/design/systems/journal.json +1 -1
- package/dist/design/systems/pastel.json +1 -1
- package/dist/design/systems/pebble.json +1 -1
- package/dist/design/systems/plain.json +1 -1
- package/dist/design/systems/pop.json +1 -1
- package/dist/design/systems/press.json +1 -1
- package/dist/packages/angular-ui/src/ai/ArtifactPane.ts +15 -4
- package/dist/packages/angular-ui/src/ai/PromptInput.ts +3 -1
- package/dist/packages/angular-ui/src/archetypes/Dashboard.ts +38 -20
- package/dist/packages/angular-ui/src/archetypes/dashboard.states.ts +52 -0
- package/dist/packages/angular-ui/src/controls/ColorInput.ts +62 -34
- package/dist/packages/angular-ui/src/controls/Combobox.ts +28 -7
- package/dist/packages/angular-ui/src/controls/DatePicker.ts +12 -11
- package/dist/packages/angular-ui/src/controls/DateRangePicker.ts +22 -17
- package/dist/packages/angular-ui/src/controls/DateRangePickerRangeCalendar.ts +3 -2
- package/dist/packages/angular-ui/src/controls/FileUpload.ts +18 -12
- package/dist/packages/angular-ui/src/controls/FileUploadRow.ts +24 -4
- package/dist/packages/angular-ui/src/controls/MultiSelect.ts +49 -12
- package/dist/packages/angular-ui/src/controls/NumberInput.ts +27 -3
- package/dist/packages/angular-ui/src/controls/PhoneInput.ts +9 -5
- package/dist/packages/angular-ui/src/controls/Select.ts +36 -7
- package/dist/packages/angular-ui/src/controls/TagInput.ts +61 -7
- package/dist/packages/angular-ui/src/controls/TimeInput.ts +15 -1
- package/dist/packages/angular-ui/src/controls/select.states.ts +79 -58
- package/dist/packages/angular-ui/src/overlays/Command.ts +50 -13
- package/dist/packages/angular-ui/src/overlays/CommandPanel.ts +11 -7
- package/dist/packages/angular-ui/src/overlays/ToastViewport.ts +1 -1
- package/dist/packages/angular-ui/src/structure/CodeBlock.ts +18 -4
- package/dist/packages/angular-ui/src/structure/Stat.ts +295 -84
- package/dist/packages/angular-ui/src/structure/stat.states.ts +116 -0
- package/dist/packages/cli/src/agents.js +4 -3
- package/dist/packages/cli/src/apply.js +43 -18
- package/dist/packages/cli/src/check.js +4 -0
- package/dist/packages/cli/src/cli.js +6 -2
- package/dist/packages/cli/src/elements.js +12 -2
- package/dist/packages/cli/src/emit.js +43 -8
- package/dist/packages/cli/src/readings.js +29 -3
- package/dist/packages/cli/src/skills/bridge.js +1197 -0
- package/dist/packages/cli/src/skills/facts.js +190 -0
- package/dist/packages/cli/src/skills/native.js +1580 -0
- package/dist/packages/cli/src/skills/rules.js +199 -0
- package/dist/packages/cli/src/skills/runtime.js +1020 -0
- package/dist/packages/cli/src/skills/screen-charts.js +334 -0
- package/dist/packages/cli/src/skills/screen-chat.js +247 -0
- package/dist/packages/cli/src/skills/screen-code.js +565 -0
- package/dist/packages/cli/src/skills/screen-rich-text.js +305 -0
- package/dist/packages/cli/src/skills/screen.js +378 -0
- package/dist/packages/cli/src/skills/setup-packages.js +307 -0
- package/dist/packages/cli/src/skills/setup.js +125 -0
- package/dist/packages/cli/src/skills/theme-documents.js +351 -0
- package/dist/packages/cli/src/skills/theme.js +208 -0
- package/dist/packages/cli/src/skills.js +13 -794
- package/dist/packages/cli/src/theme.js +42 -1
- package/dist/packages/cli/src/tool-verbs.js +19 -4
- package/dist/packages/cli/src/verbs.js +28 -2
- package/dist/packages/elements-ui/dist/cdn/chunks/{AppShellUserCard-0eCCnnN_.js → AppShellUserCard-XT4br4fr.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{AreaChart-DftfzLG0.js → AreaChart-CXNFfbJ8.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/ArtifactPane-Pr9_K2uM.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{Avatar-DcdMgxgY.js → Avatar-3WXoBPLv.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Avatar-DcuvZwe7.js → Avatar-BKqjM8qW.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{AvatarButton-D5XKVduu.js → AvatarButton-BasMQCSM.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{AvatarGroup-DgFwJUNO.js → AvatarGroup-COch2-O0.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{BarChart-myuR0aHc.js → BarChart-ugae8zfr.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{ChatMessage-CgQ1h_JP.js → ChatMessage-Bx4yrF2x.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-B_e5ma3K.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-Fgtr48Vb.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/ColorInput-CD7rsWRp.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/Combobox-CUw7z6TS.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{Combobox-DB2FT7so.js → Combobox-hWIFU9X_.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Command-BXgqRd3I.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{ConfirmDialog-BtQOAHY2.js → ConfirmDialog-CAaBRKxl.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Dashboard-ChMPH4_Q.js → Dashboard-DwNw5Wnd.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/DatePicker-DjqtswQR.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/DateRangePicker-LsXFHOzm.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{DonutChart-BEK89BeL.js → DonutChart-DYXx6eTe.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/FileUpload-3gbZTSSx.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{FormField-PlLLDKqc.js → FormField-Bvw4cLBc.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{FormField-C6L3vYp4.js → FormField-DzhcinED.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{FunnelChart-DVQz_gad.js → FunnelChart-D24XhrGw.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Heading-fAcu6Vrw.js → Heading-Cvfyu8pc.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Heading-CgzEi9OQ.js → Heading-XDJzlwt9.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Heatmap-BRwR-n-V.js → Heatmap-BQoUS6gY.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Hero-CV2YWeb4.js → Hero-CXuuFceS.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Histogram-CCYwlinB.js → Histogram-DW_ZPHpR.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{LineChart-BH6Pq1P1.js → LineChart-kf-zlNWe.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Markdown-DmZEch4i.js → Markdown-C3rjhIbt.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/ModeSwitch-DQ86CK9h.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/MultiSelect-DbSx9QtV.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/NumberInput-B4ZZOGLl.js +7 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/PhoneInput-BsMfbNi6.js +210 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/PromptInput-l_-zAXSZ.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{RadarChart-Coje7Sb0.js → RadarChart-CwJAWRki.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{RichTextContent-CufjptHF.js → RichTextContent-D51UfuWk.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{RichTextInput-Dz7yBFUA.js → RichTextInput-B32fN_p9.js} +3 -3
- package/dist/packages/elements-ui/dist/cdn/chunks/{ScatterChart-Do5tQTC5.js → ScatterChart-Mps7l5-i.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Select-CpsRP0NR.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/Stat-CXR6bP7X.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/Stat-DGcx2ZZq.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/TagInput-BhkLU4gE.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/TimeInput-r2jNTOLN.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{Toast-CAYGbn7g.js → Toast-BTfcZn0I.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{ToastViewport-CFslglYc.js → ToastViewport-BBQMRCQT.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{ToolCall-DUCoKsoE.js → ToolCall-DNU5kk9_.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{Treemap-Bh3ruYGJ.js → Treemap-BV8TlZHB.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/agent-DfOqpL9c.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/api-DJBiUXxK.js +4 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/avatar.module-D4YdFevY.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/cap-DA71oFHt.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/{cartesian-I5uPfyqv.js → cartesian-CEn2lJCc.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/{chart-annotations.module-xUExw4pu.js → chart-annotations.module-hA_KO_Pe.js} +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/chart-brush.module-C_8txUW5.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/chart-twin.module-BpfyTQ9R.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/check-CHvc4yHL.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/css-vars-DeZ4TCna.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/draw-BiQ3Of6N.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/drawing-nhJNBahV.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/field-labels-Df5HuYC5.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/frame-CtTY4oCn.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/on-call-YKLF3-FH.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/runtime-QRQ3CjZg.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/series-uUg6_JtL.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/src-XnWjGSDr.js +67 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/toast-pwGvxH2T.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/urls-Qks0KJ_p.js +6 -0
- package/dist/packages/elements-ui/dist/cdn/chunks/webmcp-Dro53ATH.js +1 -0
- package/dist/packages/elements-ui/dist/cdn/polymorph-all.js +52 -50
- package/dist/packages/elements-ui/dist/cdn/polymorph.css +1 -1
- package/dist/packages/elements-ui/dist/cdn/polymorph.js +1 -1
- package/dist/packages/elements-ui/dist/cdn/prepaint.js +1 -1
- package/dist/packages/elements-ui/dist/cdn/themes/desktop.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/dew.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/flint.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/glassmorphic.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/harbor.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/journal.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/pastel.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/pebble.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/plain.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/pop.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/press.css +5 -4
- package/dist/packages/elements-ui/dist/cdn/themes/terminal.css +5 -4
- package/dist/packages/elements-ui/src/ai/ArtifactPane.ts +2 -0
- package/dist/packages/elements-ui/src/archetypes/dashboard.states.ts +9 -0
- package/dist/packages/elements-ui/src/controls/ColorInput.ts +2 -0
- package/dist/packages/elements-ui/src/controls/NumberInput.ts +2 -0
- package/dist/packages/elements-ui/src/controls/TagInput.ts +4 -0
- package/dist/packages/elements-ui/src/controls/TimeInput.ts +2 -0
- package/dist/packages/elements-ui/src/controls/select.states.ts +10 -0
- package/dist/packages/elements-ui/src/overlays/Command.ts +2 -0
- package/dist/packages/elements-ui/src/structure/CodeBlock.ts +5 -2
- package/dist/packages/elements-ui/src/structure/Stat.ts +6 -0
- package/dist/packages/elements-ui/src/structure/stat.states.ts +33 -0
- package/dist/packages/mcp/src/propose.js +92 -15
- package/dist/packages/mcp/src/server.js +19 -8
- package/dist/packages/mcp/src/tools.js +80 -5
- package/dist/packages/mcp/src/write.js +95 -13
- package/dist/packages/react-ui/src/ai/ArtifactPane.tsx +5 -2
- package/dist/packages/react-ui/src/ai/PromptInput.tsx +5 -2
- package/dist/packages/react-ui/src/archetypes/dashboard.states.tsx +28 -0
- package/dist/packages/react-ui/src/controls/ColorInput.tsx +69 -13
- package/dist/packages/react-ui/src/controls/Combobox.tsx +13 -5
- package/dist/packages/react-ui/src/controls/DatePicker.tsx +3 -0
- package/dist/packages/react-ui/src/controls/DateRangePicker.tsx +22 -5
- package/dist/packages/react-ui/src/controls/FileUpload.tsx +2 -0
- package/dist/packages/react-ui/src/controls/MultiSelect.tsx +30 -6
- package/dist/packages/react-ui/src/controls/NumberInput.tsx +19 -1
- package/dist/packages/react-ui/src/controls/PhoneInput.tsx +3 -3
- package/dist/packages/react-ui/src/controls/Select.tsx +59 -23
- package/dist/packages/react-ui/src/controls/TagInput.tsx +43 -10
- package/dist/packages/react-ui/src/controls/TimeInput.tsx +10 -0
- package/dist/packages/react-ui/src/controls/date-segments.tsx +16 -0
- package/dist/packages/react-ui/src/controls/select.states.tsx +13 -0
- package/dist/packages/react-ui/src/overlays/Command.tsx +23 -2
- package/dist/packages/react-ui/src/overlays/Toaster.tsx +2 -2
- package/dist/packages/react-ui/src/structure/CodeBlock.tsx +7 -3
- package/dist/packages/react-ui/src/structure/Stat.tsx +90 -13
- package/dist/packages/react-ui/src/structure/stat.states.tsx +68 -0
- package/dist/packages/recipes/src/ai/artifact-pane.module.css +4 -4
- package/dist/packages/recipes/src/controls/rich-text-input.module.css +1 -1
- package/dist/packages/recipes/src/structure/avatar.module.css +3 -1
- package/dist/packages/recipes/src/structure/heading.module.css +5 -4
- package/dist/packages/recipes/src/structure/hero.module.css +3 -1
- package/dist/packages/recipes/src/structure/stat.module.css +7 -0
- package/dist/packages/registry/src/card.js +4 -3
- package/dist/packages/registry/src/frameworks.js +28 -1
- package/dist/packages/registry/src/runtime-card.js +300 -0
- package/dist/packages/registry/src/runtime-members.js +176 -0
- package/dist/packages/registry/src/screen-table.js +166 -0
- package/dist/packages/rules/package.js +1 -1
- package/dist/packages/solid-ui/src/ai/ArtifactPane.tsx +11 -3
- package/dist/packages/solid-ui/src/ai/PromptInput.tsx +3 -1
- package/dist/packages/solid-ui/src/archetypes/Dashboard.tsx +3 -0
- package/dist/packages/solid-ui/src/archetypes/dashboard.states.tsx +39 -0
- package/dist/packages/solid-ui/src/controls/ColorInput.tsx +38 -17
- package/dist/packages/solid-ui/src/controls/Combobox.tsx +27 -6
- package/dist/packages/solid-ui/src/controls/DatePicker.tsx +12 -11
- package/dist/packages/solid-ui/src/controls/DateRangePicker.tsx +21 -16
- package/dist/packages/solid-ui/src/controls/DateRangePickerRangeCalendar.tsx +3 -4
- package/dist/packages/solid-ui/src/controls/FileUpload.tsx +1 -0
- package/dist/packages/solid-ui/src/controls/FileUploadRow.tsx +6 -0
- package/dist/packages/solid-ui/src/controls/MultiSelect.tsx +51 -11
- package/dist/packages/solid-ui/src/controls/NumberInput.tsx +21 -2
- package/dist/packages/solid-ui/src/controls/PhoneInput.tsx +8 -4
- package/dist/packages/solid-ui/src/controls/Select.tsx +37 -6
- package/dist/packages/solid-ui/src/controls/TagInput.tsx +26 -5
- package/dist/packages/solid-ui/src/controls/TimeInput.tsx +10 -1
- package/dist/packages/solid-ui/src/controls/select.states.tsx +18 -0
- package/dist/packages/solid-ui/src/overlays/Command.tsx +15 -2
- package/dist/packages/solid-ui/src/overlays/CommandPanel.tsx +7 -7
- package/dist/packages/solid-ui/src/overlays/ToastViewport.tsx +1 -1
- package/dist/packages/solid-ui/src/structure/CodeBlock.tsx +9 -5
- package/dist/packages/solid-ui/src/structure/Stat.tsx +86 -25
- package/dist/packages/solid-ui/src/structure/stat.states.tsx +73 -0
- package/dist/packages/svelte-ui/src/ai/ArtifactPane.svelte +8 -2
- package/dist/packages/svelte-ui/src/ai/PromptInput.svelte +3 -1
- package/dist/packages/svelte-ui/src/archetypes/Dashboard.svelte +3 -0
- package/dist/packages/svelte-ui/src/archetypes/dashboard.states.svelte +2 -0
- package/dist/packages/svelte-ui/src/controls/ColorInput.svelte +29 -8
- package/dist/packages/svelte-ui/src/controls/Combobox.svelte +26 -5
- package/dist/packages/svelte-ui/src/controls/DatePicker.svelte +7 -5
- package/dist/packages/svelte-ui/src/controls/DateRangePicker.svelte +15 -9
- package/dist/packages/svelte-ui/src/controls/DateRangePickerRangeCalendar.svelte +3 -2
- package/dist/packages/svelte-ui/src/controls/FileUpload.svelte +1 -0
- package/dist/packages/svelte-ui/src/controls/FileUploadRow.svelte +8 -1
- package/dist/packages/svelte-ui/src/controls/MultiSelect.svelte +36 -10
- package/dist/packages/svelte-ui/src/controls/NumberInput.svelte +14 -1
- package/dist/packages/svelte-ui/src/controls/PhoneInput.svelte +3 -3
- package/dist/packages/svelte-ui/src/controls/Select.svelte +20 -6
- package/dist/packages/svelte-ui/src/controls/TagInput.svelte +21 -3
- package/dist/packages/svelte-ui/src/controls/TimeInput.svelte +11 -1
- package/dist/packages/svelte-ui/src/controls/select.states.svelte +26 -24
- package/dist/packages/svelte-ui/src/overlays/Command.svelte +13 -1
- package/dist/packages/svelte-ui/src/overlays/CommandPanel.svelte +11 -6
- package/dist/packages/svelte-ui/src/overlays/ToastViewport.svelte +1 -1
- package/dist/packages/svelte-ui/src/structure/CodeBlock.svelte +7 -2
- package/dist/packages/svelte-ui/src/structure/Stat.svelte +70 -17
- package/dist/packages/svelte-ui/src/structure/stat.states.svelte +27 -0
- package/dist/packages/theme/src/admit.js +6 -3
- package/dist/packages/theme/src/color/resolve.js +19 -2
- package/dist/packages/theme/src/derive.js +13 -6
- package/dist/packages/theme/src/emit.js +1 -1
- package/dist/packages/theme/src/runtime.js +58 -0
- package/dist/packages/theme/src/seeds.js +30 -4
- package/dist/packages/theme/src/systems.js +1 -1
- package/dist/packages/theme/src/tokens.js +15 -6
- package/dist/packages/vue-ui/src/ai/ArtifactPane.vue +11 -2
- package/dist/packages/vue-ui/src/ai/PromptInput.vue +3 -1
- package/dist/packages/vue-ui/src/archetypes/Dashboard.vue +3 -0
- package/dist/packages/vue-ui/src/archetypes/dashboard.states.ts +49 -0
- package/dist/packages/vue-ui/src/controls/ColorInput.vue +33 -12
- package/dist/packages/vue-ui/src/controls/Combobox.vue +26 -5
- package/dist/packages/vue-ui/src/controls/DatePicker.vue +12 -11
- package/dist/packages/vue-ui/src/controls/DateRangePicker.vue +20 -15
- package/dist/packages/vue-ui/src/controls/DateRangePickerRangeCalendar.vue +3 -4
- package/dist/packages/vue-ui/src/controls/FileUpload.vue +1 -0
- package/dist/packages/vue-ui/src/controls/FileUploadRow.vue +6 -0
- package/dist/packages/vue-ui/src/controls/MultiSelect.vue +37 -10
- package/dist/packages/vue-ui/src/controls/NumberInput.vue +17 -1
- package/dist/packages/vue-ui/src/controls/PhoneInput.vue +7 -3
- package/dist/packages/vue-ui/src/controls/Select.vue +22 -7
- package/dist/packages/vue-ui/src/controls/TagInput.vue +21 -3
- package/dist/packages/vue-ui/src/controls/TimeInput.vue +10 -1
- package/dist/packages/vue-ui/src/controls/select.states.ts +17 -0
- package/dist/packages/vue-ui/src/overlays/Command.vue +13 -1
- package/dist/packages/vue-ui/src/overlays/CommandPanel.vue +7 -7
- package/dist/packages/vue-ui/src/overlays/ToastViewport.vue +1 -1
- package/dist/packages/vue-ui/src/structure/CodeBlock.vue +7 -2
- package/dist/packages/vue-ui/src/structure/Stat.vue +71 -18
- package/dist/packages/vue-ui/src/structure/stat.states.ts +67 -0
- package/dist/platforms/android/ui/src/generated/kotlin/dev/polymorph/ui/Contracts.kt +144 -33
- package/dist/platforms/android/ui/src/generated/kotlin/dev/polymorph/ui/Members.kt +17 -7
- package/dist/platforms/ios/Sources/PolymorphUI/Generated/Contracts.swift +204 -31
- package/dist/registry/registry.json +371 -75
- package/dist/screen/assets/{screen-CuQbskb8.css → screen-B22PTPwF.css} +1 -1
- package/dist/screen/assets/screen-Cpbh7XMb.js +372 -0
- package/dist/screen/screen.html +3 -3
- package/package.json +1 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/ArtifactPane-DsmRlr6d.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-BqP8HZKM.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-D8VARz0a.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/ColorInput-BrzZOVeL.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Combobox-BiUq0h-w.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Command-hmxVRdFg.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/DatePicker-C8prGbJ2.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/DateRangePicker-CO1ioqwN.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/FileUpload-HPQe-ttb.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/ModeSwitch-CerqbGv3.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/MultiSelect-CQq7jPgI.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/NumberInput-Dre9GwBy.js +0 -7
- package/dist/packages/elements-ui/dist/cdn/chunks/PhoneInput-D6_J6Es_.js +0 -210
- package/dist/packages/elements-ui/dist/cdn/chunks/PromptInput-BXcsUQ5W.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Select-DxGQgv2q.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Stat-FsMUWigK.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/Stat-WS8v6BQv.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/TagInput-D-uIQEGS.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/TimeInput-Dho571vA.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/agent-DBDk4wLH.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/api-B9sGZiYn.js +0 -4
- package/dist/packages/elements-ui/dist/cdn/chunks/avatar.module-CQwnWhWo.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/cap-Ct4k7zNC.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/chart-brush.module-DycBfben.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/chart-twin.module-Cks7VwS5.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/check-dOfCSYFA.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/draw-DclRgiWM.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/drawing-DjkZr0z8.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/frame-BSvl4y47.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/on-call-Jk1sYJc_.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/receivers-BpRfF6dV.js +0 -4
- package/dist/packages/elements-ui/dist/cdn/chunks/series-C_1TNd2n.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/src-Bub3C9YP.js +0 -67
- package/dist/packages/elements-ui/dist/cdn/chunks/toast-AarMGYJn.js +0 -1
- package/dist/packages/elements-ui/dist/cdn/chunks/webmcp-eEPzSqph.js +0 -1
- package/dist/screen/assets/screen-Clj2u6_s.js +0 -372
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { paletteJsonSchema, systemJsonSchema } from "../../../theme/src/admit.js";
|
|
2
|
+
import { DEFAULT_SYSTEM } from "../plan.js";
|
|
3
|
+
import { Facts, SkillFactError, all, commands } from "./facts.js";
|
|
4
|
+
//#region ../cli/src/skills/theme-documents.ts
|
|
5
|
+
/** The node at a dotted path below a schema's properties, which must exist. */
|
|
6
|
+
function at(schema, path) {
|
|
7
|
+
let node = schema;
|
|
8
|
+
for (const key of path.split(".")) {
|
|
9
|
+
const next = node.properties?.[key];
|
|
10
|
+
if (next === void 0) throw new SkillFactError(`the theme schema has no field ${path}`);
|
|
11
|
+
node = next;
|
|
12
|
+
}
|
|
13
|
+
return node;
|
|
14
|
+
}
|
|
15
|
+
/** What a field accepts, in a few words, read from the schema. */
|
|
16
|
+
function accepts(schema, path) {
|
|
17
|
+
const node = at(schema, path);
|
|
18
|
+
if (node.enum !== void 0) return node.enum.map((value) => `\`${String(value)}\``).join(", ");
|
|
19
|
+
if (node.minimum !== void 0 && node.maximum !== void 0) return `${node.minimum} to ${node.maximum}`;
|
|
20
|
+
if (node.pattern === "^#[0-9a-fA-F]{6}$") return "`#rrggbb`";
|
|
21
|
+
return node.type ?? "";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* JSON as a person writes a document: two-space indents, and an object that holds no other object
|
|
25
|
+
* on one line when that line fits in 80 characters.
|
|
26
|
+
*/
|
|
27
|
+
function pretty(value) {
|
|
28
|
+
return JSON.stringify(value, null, 2).replace(/^( *)(.*)\{\n([^{}]*?)\n *\}/gm, (whole, indent, head, inner) => {
|
|
29
|
+
const line = `${indent}${head}{ ${inner.trim().split(/,\n */).join(", ")} }`;
|
|
30
|
+
return line.length <= 80 ? line : whole;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** What each design axis decides. An axis this list lacks is listed with its values only. */
|
|
34
|
+
var AXES = {
|
|
35
|
+
geometry: "corner radii",
|
|
36
|
+
depth: "how surfaces separate: shadows, borders, translucent panes",
|
|
37
|
+
density: "space, control heights and the type ratio",
|
|
38
|
+
contrastTemperament: "how strong edges and supporting text are",
|
|
39
|
+
typePersonality: "weights, tracking, icon stroke and a font slot’s fallback (below)",
|
|
40
|
+
colorStrategy: "`tinted` washes surfaces with the neutral hue",
|
|
41
|
+
motionTemperament: "durations and springs; `none` stops motion",
|
|
42
|
+
ornament: "halos and page texture"
|
|
43
|
+
};
|
|
44
|
+
/** The system's amendments a hand edit usually makes, with what each changes. */
|
|
45
|
+
var OVERRIDES = [
|
|
46
|
+
[
|
|
47
|
+
"type.base",
|
|
48
|
+
"px",
|
|
49
|
+
"the paragraph size; every step not set derives from it"
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"type.ratio",
|
|
53
|
+
"",
|
|
54
|
+
"the step between text sizes"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"type.sm",
|
|
58
|
+
"px",
|
|
59
|
+
"controls, table cells, menus and labels"
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"type.xs",
|
|
63
|
+
"px",
|
|
64
|
+
"captions and badges"
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"type.titleWeight",
|
|
68
|
+
"",
|
|
69
|
+
"the title steps, in hundreds"
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"type.displayWeight",
|
|
73
|
+
"",
|
|
74
|
+
"the display steps, in hundreds"
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"radius.md",
|
|
78
|
+
"px",
|
|
79
|
+
"one corner step; `sm` and `lg` likewise"
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"space.5",
|
|
83
|
+
"px",
|
|
84
|
+
"one spacing step at standard density; steps 1 to 10 likewise"
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"controlHeight.md",
|
|
88
|
+
"px",
|
|
89
|
+
"one control height; `sm` and `lg` likewise"
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"focus.width",
|
|
93
|
+
"px",
|
|
94
|
+
"the focus ring"
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"focus.offset",
|
|
98
|
+
"px",
|
|
99
|
+
"minus the width keeps the ring inside the edge; 0 to 4 moves it outside"
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"hover.unfilled",
|
|
103
|
+
"",
|
|
104
|
+
"`none` takes the hover wash off outline and ghost Buttons"
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"numeric.align",
|
|
108
|
+
"",
|
|
109
|
+
"which side numeric table columns sit on"
|
|
110
|
+
]
|
|
111
|
+
];
|
|
112
|
+
/** The palette's fields, with what each holds. */
|
|
113
|
+
var PALETTE = [
|
|
114
|
+
["accentHue", "the accent hue in OKLCH degrees; the first chart colour follows it"],
|
|
115
|
+
["gradientHue", "optional: a second hue for the two gradient roles; absent, they are solid"],
|
|
116
|
+
["neutralHue", "optional: the hue of the greys; absent, the accent hue"],
|
|
117
|
+
["neutralTint", "how much hue the greys carry"],
|
|
118
|
+
["chromaBudget", "how loud colour is; `none` makes the accent ink"],
|
|
119
|
+
["pins", "optional: exact colours for a few roles, per mode (below)"],
|
|
120
|
+
["moreContrast", "optional: the palette a reader who asks for more contrast gets (below)"]
|
|
121
|
+
];
|
|
122
|
+
/**
|
|
123
|
+
* What a system and a palette document hold, for a model editing one by hand:
|
|
124
|
+
* each field a hand edit usually touches, pins, the more-contrast partner, the
|
|
125
|
+
* laws a guest pairing answers to, and each refusal with its answer. Ranges
|
|
126
|
+
* and pinnable roles are read from the documents' JSON Schemas, and the axes
|
|
127
|
+
* from the registry, so the text follows the schema.
|
|
128
|
+
*/
|
|
129
|
+
function documentsReference(registry, run) {
|
|
130
|
+
const f = new Facts(registry);
|
|
131
|
+
const system = systemJsonSchema();
|
|
132
|
+
const palette = paletteJsonSchema();
|
|
133
|
+
const plain = registry.theme.systems.find((entry) => entry.name === DEFAULT_SYSTEM);
|
|
134
|
+
if (plain === void 0) throw new SkillFactError(`no system called ${DEFAULT_SYSTEM}`);
|
|
135
|
+
const family = (role) => {
|
|
136
|
+
const found = plain.fonts.find((font) => font.roles.includes(role));
|
|
137
|
+
if (found === void 0) throw new SkillFactError(`${DEFAULT_SYSTEM} has no ${role} font`);
|
|
138
|
+
return found.family;
|
|
139
|
+
};
|
|
140
|
+
const serif = registry.theme.systems.find((entry) => entry.axes["typePersonality"] === "editorial")?.fonts.find((font) => font.roles.includes("display"))?.family;
|
|
141
|
+
if (serif === void 0) throw new SkillFactError("no editorial system has a display face");
|
|
142
|
+
const example = {
|
|
143
|
+
$schema: "./system.schema.json",
|
|
144
|
+
name: "acme",
|
|
145
|
+
axes: plain.axes,
|
|
146
|
+
fonts: {
|
|
147
|
+
body: { family: family("body") },
|
|
148
|
+
display: {
|
|
149
|
+
family: serif,
|
|
150
|
+
fallback: "serif"
|
|
151
|
+
},
|
|
152
|
+
mono: { family: family("mono") }
|
|
153
|
+
},
|
|
154
|
+
defaultPalette: "acme-blue",
|
|
155
|
+
defaultMode: "system",
|
|
156
|
+
kind: "designed",
|
|
157
|
+
overrides: {
|
|
158
|
+
type: {
|
|
159
|
+
base: 14,
|
|
160
|
+
sm: 13,
|
|
161
|
+
xs: 12
|
|
162
|
+
},
|
|
163
|
+
radius: { md: 10 }
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const axes = registry.theme.axes.map((axis) => `| \`${axis.name}\` | ${axis.values.map((value) => `\`${value}\``).join(", ")} | ${AXES[axis.name] ?? ""} |`);
|
|
167
|
+
const overrides = OVERRIDES.map(([path, unit, changes]) => {
|
|
168
|
+
return `| \`overrides.${path}\` | ${accepts(at(system, "overrides"), path)}${unit === "" ? "" : ` ${unit}`} | ${changes} |`;
|
|
169
|
+
});
|
|
170
|
+
const fields = PALETTE.map(([field, holds]) => {
|
|
171
|
+
return `| \`${field}\` | ${at(palette, field).properties === void 0 ? accepts(palette, field) : "object"} | ${holds} |`;
|
|
172
|
+
});
|
|
173
|
+
const fills = {
|
|
174
|
+
"accent.bg": "#1f4fd8",
|
|
175
|
+
"accent.bgHover": "#1744cd",
|
|
176
|
+
"accent.bgActive": "#0f39c2",
|
|
177
|
+
"accent.contrast": "#ffffff"
|
|
178
|
+
};
|
|
179
|
+
const brand = {
|
|
180
|
+
$schema: "./palette.schema.json",
|
|
181
|
+
name: "acme-blue",
|
|
182
|
+
accentHue: 265,
|
|
183
|
+
neutralTint: .006,
|
|
184
|
+
chromaBudget: "high",
|
|
185
|
+
pins: {
|
|
186
|
+
light: fills,
|
|
187
|
+
dark: fills
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
if (registry.theme.palettes.find((entry) => entry.name === plain.defaultPalette)?.chromaBudget !== "none") throw new SkillFactError(`${plain.defaultPalette} no longer has a chromaBudget of none`);
|
|
191
|
+
const pinnable = Object.keys(at(palette, "pins.light").properties ?? {});
|
|
192
|
+
if (pinnable.length === 0) throw new SkillFactError("the palette schema pins no role");
|
|
193
|
+
const roles = Object.keys(registry.theme.colorRoles);
|
|
194
|
+
return `
|
|
195
|
+
# The system and palette documents
|
|
196
|
+
|
|
197
|
+
A theme is two JSON documents. This file covers the fields a hand edit usually touches. The JSON
|
|
198
|
+
Schema is the whole contract. Write it beside the documents, and an editor checks each field of a
|
|
199
|
+
document whose \`$schema\` names it. \`theme validate\` and the Vite plugin ignore that key:
|
|
200
|
+
|
|
201
|
+
${commands(run, "theme schema system --out src/theme/system.schema.json", "theme schema palette --out src/theme/palette.schema.json")}
|
|
202
|
+
|
|
203
|
+
Check every edit with \`theme validate\` (the skill's step 5).
|
|
204
|
+
|
|
205
|
+
## The system
|
|
206
|
+
|
|
207
|
+
\`\`\`json
|
|
208
|
+
${pretty(example)}
|
|
209
|
+
\`\`\`
|
|
210
|
+
|
|
211
|
+
\`name\` is kebab-case and becomes \`data-system\`. \`defaultPalette\` is the palette worn with the
|
|
212
|
+
system unless another is chosen. \`defaultMode\` (\`light\`, \`dark\` or \`system\`) is the mode of a
|
|
213
|
+
reader who has not chosen one: a first visit on the web opens in it, and on iOS and Android it is
|
|
214
|
+
the theme's preferred mode. \`light\` and \`dark\` are that mode, and \`system\` follows the device.
|
|
215
|
+
A reader's own choice is stored and wins. \`kind\` is
|
|
216
|
+
\`designed\`. A system holds no colour: a colour seed
|
|
217
|
+
in it is refused.
|
|
218
|
+
|
|
219
|
+
| Axis | Values | Decides |
|
|
220
|
+
| --- | --- | --- |
|
|
221
|
+
${axes.join("\n")}
|
|
222
|
+
|
|
223
|
+
\`fonts\` has four slots, \`body\`, \`heading\`, \`display\` and \`mono\`, each
|
|
224
|
+
\`{ family, fallback?, style? }\`. \`heading\` is optional and the other three are required.
|
|
225
|
+
|
|
226
|
+
| Slot | Draws |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| \`body\` | the body steps, \`text.xs\` to \`text.md\`: paragraphs, controls, labels, table cells |
|
|
229
|
+
| \`heading\` | the heading steps, \`text.lg\` to \`text.3xl\`: every ${f.m("Heading")} level, ${f.m("PageHeader")}'s and ${f.m("Dialog")}'s titles, ${f.m("Stat")}'s value. Left out, they draw in \`body\` |
|
|
230
|
+
| \`display\` | only the display steps, which ${f.m("Hero")}'s title uses |
|
|
231
|
+
| \`mono\` | code |
|
|
232
|
+
|
|
233
|
+
A serif for headings is therefore a serif \`heading\` slot, and it leaves paragraphs in \`body\`.
|
|
234
|
+
A serif \`display\` changes ${f.m("Hero")}'s title only, and a serif \`body\` changes every
|
|
235
|
+
paragraph, and every heading too while the system has no \`heading\` slot. Say which one the
|
|
236
|
+
request gets.
|
|
237
|
+
|
|
238
|
+
\`typePersonality\` picks no typeface. It sets the weights (\`editorial\` draws titles at 700), the
|
|
239
|
+
tracking, the icon stroke, and the fallback of a \`body\`, \`heading\` or \`display\` slot that
|
|
240
|
+
names none: serif under \`editorial\`, sans under the others. Give a serif slot
|
|
241
|
+
\`"fallback": "serif"\`, so the page shows a serif while the font loads. A system's
|
|
242
|
+
\`overrides.type.titleWeight\` is drawn in the \`heading\` slot's family, so that family must ship
|
|
243
|
+
the weight.
|
|
244
|
+
|
|
245
|
+
\`family\` is a Fontsource family name: \`Inter Variable\` is the package
|
|
246
|
+
\`@fontsource-variable/inter\`, and a name that does not end in Variable is \`@fontsource/<name>\`. \`fallback\`
|
|
247
|
+
is \`sans\`, \`serif\` or \`mono\`, and \`style\` \`italic\` applies to \`display\` only.
|
|
248
|
+
\`theme validate\` names each package. Install them: the Vite plugin imports them. A typeface
|
|
249
|
+
Fontsource does not publish has no lawful way to load, so report it to whoever owns the design
|
|
250
|
+
system rather than writing an \`@font-face\`.
|
|
251
|
+
|
|
252
|
+
\`overrides\` changes the value a derived step resolves to. Every field is optional, and each
|
|
253
|
+
scale's law is checked on the result.
|
|
254
|
+
|
|
255
|
+
| Field | Accepts | Changes |
|
|
256
|
+
| --- | --- | --- |
|
|
257
|
+
${overrides.join("\n")}
|
|
258
|
+
|
|
259
|
+
## The palette
|
|
260
|
+
|
|
261
|
+
"One brand colour in both modes", below, is a whole palette document.
|
|
262
|
+
|
|
263
|
+
| Field | Accepts | Holds |
|
|
264
|
+
| --- | --- | --- |
|
|
265
|
+
${fields.join("\n")}
|
|
266
|
+
|
|
267
|
+
A shipped palette also carries \`chartCaps\`, a record its own laws measure. Leave it out of a
|
|
268
|
+
palette the app owns.
|
|
269
|
+
|
|
270
|
+
## Colour roles, the two modes and the chart colours
|
|
271
|
+
|
|
272
|
+
A palette holds seeds, not colours. The engine derives every colour role (${all(roles.map((role) => `\`${role}\``))}) twice, once for light mode and once for dark, and holds every text and
|
|
273
|
+
focus colour to its contrast floor in both. There is no dark palette and no colour field per role:
|
|
274
|
+
\`axes --properties\` lists the \`--pm-*\` properties a theme emits, and no app sets one.
|
|
275
|
+
|
|
276
|
+
The eight chart series colours rotate with \`accentHue\`, and a \`chromaBudget\` of \`none\` or
|
|
277
|
+
\`ink\` keeps the reference hues. The sequential ramp takes the first series colour's hue, and the
|
|
278
|
+
diverging pair is the same in every palette. No field sets a chart colour.
|
|
279
|
+
\`theme validate\` prints the chart cap: how many series ${f.m("ScatterChart")} and
|
|
280
|
+
${f.m("RadarChart")} can tell apart.
|
|
281
|
+
|
|
282
|
+
## Pins
|
|
283
|
+
|
|
284
|
+
A pin replaces one derived colour with an exact one, in one mode. Pins are for a brand that states
|
|
285
|
+
its main button or its focus ring by value. They live in the palette's \`pins\`, as
|
|
286
|
+
\`{ "light": { … }, "dark": { … } }\`, and take these roles: ${all(pinnable.map((role) => `\`${role}\``))}.
|
|
287
|
+
|
|
288
|
+
- A value is an opaque \`#rrggbb\`. \`border.focus\` may be \`rgb(r g b / a)\`.
|
|
289
|
+
- A mode the palette does not name keeps every derived colour.
|
|
290
|
+
- The contrast law holds a pin and never moves it. A pinned fill answers to the label on it:
|
|
291
|
+
\`accent.contrast\` reaches Lc 60 on \`accent.bg\`, \`accent.bgHover\` and \`accent.bgActive\`, in
|
|
292
|
+
each mode. A pinned focus colour answers to its floor on each surface. No law reads a pin's hue,
|
|
293
|
+
or how far apart the three fills are.
|
|
294
|
+
- \`accent.gradientTo\` is the gradient's second stop. Pin it when a refusal names the \`'to'\`
|
|
295
|
+
stop. A palette that derives no second stop (no \`gradientHue\`, or \`chromaBudget\` \`none\`)
|
|
296
|
+
pins it in both modes or in neither.
|
|
297
|
+
|
|
298
|
+
### One brand colour in both modes
|
|
299
|
+
|
|
300
|
+
The brand's blue \`#1F4FD8\` on the main button, in light and dark mode. \`theme validate\` admits
|
|
301
|
+
this palette:
|
|
302
|
+
|
|
303
|
+
\`\`\`json
|
|
304
|
+
${pretty(brand)}
|
|
305
|
+
\`\`\`
|
|
306
|
+
|
|
307
|
+
- Pin the three fills together. Hover and pressed derive from \`accentHue\`, not from the pin, so
|
|
308
|
+
they keep the lightness its ladder gives them: beside \`#1F4FD8\` they are lighter. The derived fills step OKLCH lightness down
|
|
309
|
+
by about 0.03 (0.62, 0.588, 0.556): \`#1744cd\` and \`#0f39c2\` are \`#1F4FD8\` with its lightness
|
|
310
|
+
0.032 and 0.064 lower.
|
|
311
|
+
- Pin \`accent.contrast\` when the brand states the label's colour. Unpinned, it is chosen against
|
|
312
|
+
the pinned \`accent.bg\`.
|
|
313
|
+
- Pin the same values in \`dark\`. The engine draws a hued accent fill the same in both modes, and a
|
|
314
|
+
mode with no pins draws the fill \`accentHue\` derives, not the brand's.
|
|
315
|
+
- Set \`accentHue\` to the colour's OKLCH hue in whole degrees, which
|
|
316
|
+
\`${run} theme hue "#1F4FD8"\` prints: \`#1F4FD8\` is \`oklch(0.491 0.216 264.5)\`, and its
|
|
317
|
+
\`accentHue\` is 265. \`accentHue\` colours what surrounds the button: the washes, links,
|
|
318
|
+
selection, focus ring and chart colours.
|
|
319
|
+
- Under \`chromaBudget\` \`none\`, which \`${plain.defaultPalette}\` has, the pins hold and the links,
|
|
320
|
+
washes and focus ring stay grey. Raise it for them to take the hue.
|
|
321
|
+
|
|
322
|
+
## The more-contrast partner
|
|
323
|
+
|
|
324
|
+
\`moreContrast\` names another palette document. Its colours replace this palette's for a reader
|
|
325
|
+
whose system asks for more contrast or forces colours. The system's other tokens stay. Give it to
|
|
326
|
+
\`theme validate\` and \`theme emit\` as the third path, or save it as \`<name>.json\` beside the
|
|
327
|
+
palette. In \`vite.config\`, list it among \`palettes\`. It reaches web pages only.
|
|
328
|
+
|
|
329
|
+
## A guest pairing
|
|
330
|
+
|
|
331
|
+
A system or palette the app wrote is a guest. It answers to the laws a shipped pairing answers to:
|
|
332
|
+
\`schema\`, \`resolution\`, \`coherence\`, \`contrast\`, \`gradient\`, and \`glass\` when
|
|
333
|
+
\`depth\` is \`glass\`, in both modes and on the partner too. \`theme validate\` lists as
|
|
334
|
+
\`exempt\` the catalogue's own laws, which keep the shipped systems and palettes apart, and adds a
|
|
335
|
+
\`note\` when a name is also a shipped one: rename it, because names are attributes on the page.
|
|
336
|
+
|
|
337
|
+
## Refusals and their answers
|
|
338
|
+
|
|
339
|
+
| The message says | Change |
|
|
340
|
+
| --- | --- |
|
|
341
|
+
| \`system.axes.density: Invalid option: expected one of …\` | Use one of the values it lists. |
|
|
342
|
+
| \`system: Unrecognized key: "accentHue"\` | Move the key to the other document, or remove it. |
|
|
343
|
+
| \`the merged ladder puts xs at 9.5px, under the 10px floor — set type.xs\` | Set the field the message names. |
|
|
344
|
+
| \`text.2xl is 20.5px at weight 300 … set a heavier titleWeight, or raise type.base or type.ratio\` | Take one of the two answers it gives. |
|
|
345
|
+
| \`accent.contrast on accent.bgHover reached Lc 34.0, floor is 60. … which the palette pins in light mode\` | Pin \`accent.bgHover\` and \`accent.bgActive\` near the pinned fill. |
|
|
346
|
+
| \`accent.contrast on accent.gradient reached Lc 29.2 at its 'to' stop\` | Pin \`accent.gradientTo\` near the fill, or drop \`gradientHue\`. |
|
|
347
|
+
| \`moreContrast: … admission was not given that palette\` | Pass the partner as the third path, or put it beside the palette. |
|
|
348
|
+
`.trimStart();
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
export { documentsReference };
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { DEFAULT_SYSTEM, ELEMENTS_DIR, ELEMENTS_THEME_SHEET } from "../plan.js";
|
|
2
|
+
import { Facts, SkillFactError, all, commands, skill } from "./facts.js";
|
|
3
|
+
import { documentsReference } from "./theme-documents.js";
|
|
4
|
+
//#region ../cli/src/skills/theme.ts
|
|
5
|
+
function themeSkill(registry, run) {
|
|
6
|
+
const f = new Facts(registry);
|
|
7
|
+
const pairings = registry.theme.systems.slice(0, 3).map((system) => `\`${system.name}/${system.defaultPalette}\``).join(", ");
|
|
8
|
+
const plain = registry.theme.systems.find((system) => system.name === DEFAULT_SYSTEM);
|
|
9
|
+
const basis = `${DEFAULT_SYSTEM}/${plain?.defaultPalette ?? ""}`.replace(/\/$/, "");
|
|
10
|
+
const geometry = registry.theme.axes.find((axis) => axis.name === "geometry")?.values ?? [];
|
|
11
|
+
const held = plain?.axes["geometry"] ?? "";
|
|
12
|
+
const roundest = geometry.at(-1) ?? "";
|
|
13
|
+
if (geometry.indexOf(held) !== geometry.length - 2) throw new SkillFactError(`${DEFAULT_SYSTEM}'s geometry is no longer one step under ${roundest}`);
|
|
14
|
+
const exact = geometry[1] ?? "";
|
|
15
|
+
if (exact === held || exact === roundest) throw new SkillFactError(`geometry has no value apart from ${held} and ${roundest} to name`);
|
|
16
|
+
const fixedModes = registry.theme.systems.filter((system) => system.defaultMode !== "system").map((system) => `${system.name} opens ${system.defaultMode}`);
|
|
17
|
+
const fixed = fixedModes.length === 0 ? "Every catalogue system says `system`." : `In the catalogue, ${all(fixedModes)}, and every other system says \`system\`.`;
|
|
18
|
+
const plugin = f.x("polymorphTheme", "@polymorph/engine/vite");
|
|
19
|
+
const call = `\`${plugin.slice(1, -1)}({ systems, palettes })\``;
|
|
20
|
+
const body = `
|
|
21
|
+
# Change the theme
|
|
22
|
+
|
|
23
|
+
In polymorph, how an app looks is two JSON documents. A **system** decides how the product is
|
|
24
|
+
built: its design axes (${all(f.axes().map((axis) => `\`${axis}\``))}), its fonts and its
|
|
25
|
+
defaults. A **palette** decides its colours, in a light and a dark mode. One system worn with one
|
|
26
|
+
palette is a **pairing**, chosen by \`data-system\` and \`data-palette\` on \`<html>\`. The members
|
|
27
|
+
read every value from the theme as \`--pm-*\` tokens, so the look changes when the documents change
|
|
28
|
+
and in no other way. Application code never writes a colour, a length, a font or a duration.
|
|
29
|
+
|
|
30
|
+
Every command in this skill starts with the same words, the polymorph tools run from a shell. An
|
|
31
|
+
MCP server named \`polymorph\` gives the same answers through \`get_theme_axes\`, \`propose_theme\`
|
|
32
|
+
and \`save_theme\`.
|
|
33
|
+
|
|
34
|
+
## 1. Find the app's theme
|
|
35
|
+
|
|
36
|
+
- An app \`init\` wrote: \`src/theme/<system>.json\` and \`src/theme/<palette>.json\`, named in
|
|
37
|
+
\`vite.config\` by ${call}, which compiles them when the app
|
|
38
|
+
builds and again on each edit in development.
|
|
39
|
+
- A vendoring project: \`src/polymorph/themes/systems/\` and \`src/polymorph/themes/palettes/\`,
|
|
40
|
+
compiled by \`add\` into the sheets beside them. After a hand edit, run \`update\`: it keeps the
|
|
41
|
+
edited file and compiles the sheet from it. \`update --force\` puts the shipped document back and
|
|
42
|
+
compiles from that.
|
|
43
|
+
- A page with no build: \`${ELEMENTS_DIR}/${ELEMENTS_THEME_SHEET}\`, compiled from a catalogue
|
|
44
|
+
system.
|
|
45
|
+
|
|
46
|
+
## 2. See what can move
|
|
47
|
+
|
|
48
|
+
${commands(run, "axes", "axes --values")}
|
|
49
|
+
|
|
50
|
+
\`axes\` lists the axes and their values, the shipped systems and palettes, the colour roles and the
|
|
51
|
+
scales. \`--values\` adds each system's token values with its own palette.
|
|
52
|
+
|
|
53
|
+
## 3. Propose a theme from words
|
|
54
|
+
|
|
55
|
+
${commands(run, "theme propose \"calmer, warmer paper, more editorial\"", `theme propose "denser and cooler" --based-on ${basis}`, `theme propose "geometry=${exact} denser" --based-on ${basis}`, "theme propose \"denser and cooler\" --save --dir design")}
|
|
56
|
+
|
|
57
|
+
The answer lists what each word moved, the words that moved nothing, and the verdict of the
|
|
58
|
+
theme's laws. Each move is a proposal: check it against the axis's values in \`axes\`.
|
|
59
|
+
|
|
60
|
+
- A word for a direction, such as denser, airier, calmer or bolder, moves its axes one step each,
|
|
61
|
+
along the order \`axes\` prints. The same word again moves one more step, until the end.
|
|
62
|
+
- A word for a place, such as rounder, sharper, flat or stark, sets the axis to that value, often
|
|
63
|
+
its end: rounder is \`${roundest}\`, the roundest geometry.
|
|
64
|
+
- \`<axis>=<value>\` sets an axis to one of the values \`axes\` lists for it: \`geometry=${exact}\`.
|
|
65
|
+
Use it for an exact value, and wherever a word would overshoot. An axis or a value \`axes\` does
|
|
66
|
+
not list moves nothing, and the answer names the lawful ones.
|
|
67
|
+
- A word of degree (slightly, somewhat, a bit, a little, very, much, less) moves nothing, and the
|
|
68
|
+
answer lists it under "not read" with why: "slightly rounded" moves geometry to
|
|
69
|
+
\`${roundest}\` and reports "slightly". Name the value meant instead. "More" is read as the word
|
|
70
|
+
after it: "more editorial" is "editorial".
|
|
71
|
+
- Words apply in the order written, so of two that set one axis, the later one wins.
|
|
72
|
+
- The starting pairing's own value may already be the answer. \`${DEFAULT_SYSTEM}\` has \`${held}\`
|
|
73
|
+
geometry, one step under \`${roundest}\`.
|
|
74
|
+
|
|
75
|
+
A typeface the app chooses and an exact colour are hand edits (step 4).
|
|
76
|
+
|
|
77
|
+
\`--based-on\` starts from a shipped pairing, such as ${pairings}; either half may be left out. It
|
|
78
|
+
takes a shipped name, not the app's own document: a change to a document the app already has is a
|
|
79
|
+
hand edit. \`--save\` writes the two documents into
|
|
80
|
+
\`<dir>/systems/\` and \`<dir>/palettes/\` (the directory \`design\` when \`--dir\` is left out), and
|
|
81
|
+
\`--overwrite\` replaces files already saved under the same names. \`--save\` writes only in a
|
|
82
|
+
project: a directory with a \`package.json\` or a \`polymorph.json\`. Then point the app at them: in an
|
|
83
|
+
app \`init\` wrote, name the two files in ${plugin} in \`vite.config\`.
|
|
84
|
+
|
|
85
|
+
## 4. Edit a document by hand
|
|
86
|
+
|
|
87
|
+
[references/documents.md](references/documents.md) has every field a hand edit touches, with the
|
|
88
|
+
values each takes.
|
|
89
|
+
|
|
90
|
+
| To change | Edit |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| Corners, shadows, density, contrast, type voice, tinted surfaces, motion, ornament | the system's \`axes\` |
|
|
93
|
+
| Typefaces | the system's \`fonts\`: \`body\` draws text, \`heading\` the headings and titles from \`text.lg\` up (in \`body\` when the system has no \`heading\`), and \`display\` only ${f.m("Hero")}'s title |
|
|
94
|
+
| Text sizes, heading weights, one radius, space or control height step | the system's \`overrides\` |
|
|
95
|
+
| The accent hue, a gradient, the tint of the greys, how loud colour is | the palette's \`accentHue\`, \`gradientHue\`, \`neutralHue\`, \`neutralTint\`, \`chromaBudget\` |
|
|
96
|
+
| The exact colour of the main button, its label or the focus ring | the palette's \`pins\`, per mode |
|
|
97
|
+
| Colours for a reader who asks for more contrast | a second palette, named by \`moreContrast\` |
|
|
98
|
+
| Chart colours | the palette's \`accentHue\`: chart colours have no field |
|
|
99
|
+
| Dark mode | nothing: every palette derives both modes (step 7) |
|
|
100
|
+
|
|
101
|
+
A brand colour gives the palette its \`accentHue\`. \`theme hue\` reads the colour in OKLCH, the
|
|
102
|
+
space the engine derives every colour in, and prints the hue in whole degrees as \`accentHue\`
|
|
103
|
+
takes it:
|
|
104
|
+
|
|
105
|
+
${commands(run, "theme hue \"#1F4FD8\"")}
|
|
106
|
+
|
|
107
|
+
Quote the colour, because a shell reads \`#\` as the start of a comment. A grey has no hue, so the
|
|
108
|
+
answer names no \`accentHue\` for it, and a palette whose \`chromaBudget\` is \`none\` draws its
|
|
109
|
+
accent from the greys. The hue alone does not put the brand's colour on the main button, because
|
|
110
|
+
the engine derives the fill's lightness and chroma: pin it (the reference has the whole palette).
|
|
111
|
+
|
|
112
|
+
A system or palette the app writes for itself, not from the catalogue, is a guest. It answers to
|
|
113
|
+
the laws every shipped pairing answers to, and the reference lists them.
|
|
114
|
+
|
|
115
|
+
## 5. Check it, and answer a refusal
|
|
116
|
+
|
|
117
|
+
${commands(run, "theme validate src/theme/<system>.json src/theme/<palette>.json", "theme emit src/theme/<system>.json src/theme/<palette>.json --out theme.css", "theme schema system --out src/theme/system.schema.json")}
|
|
118
|
+
|
|
119
|
+
\`theme validate\` admits a system and a palette under the laws every shipped pairing passes, in
|
|
120
|
+
both modes. A lawful pair prints \`lawful\`, the chart cap, the font packages to install and the
|
|
121
|
+
catalogue laws a guest is exempt from. Install each font package it names with the app's package
|
|
122
|
+
manager: the build imports them. A third path is the more-contrast partner the palette names;
|
|
123
|
+
without it, the partner is read from \`<name>.json\` beside the palette. \`theme emit\` prints the
|
|
124
|
+
stylesheet the pair compiles to, or writes it with \`--out\`, to read or hand to someone. It is not
|
|
125
|
+
how the app wears a theme: the build compiles the documents (step 1), and a copied sheet stops
|
|
126
|
+
following them. \`theme schema\` writes the JSON Schema of a system or a palette, for an editor,
|
|
127
|
+
which checks a document whose \`$schema\` key names it. \`theme validate\` and the Vite plugin
|
|
128
|
+
accept that key in either document and ignore it.
|
|
129
|
+
|
|
130
|
+
A refusal exits 1 and lists each fault with its law:
|
|
131
|
+
|
|
132
|
+
\`\`\`text
|
|
133
|
+
unlawful — 2 fault(s):
|
|
134
|
+
[contrast] acme/acme-blue (light): accent.contrast on accent.bgHover reached Lc 35.8, floor is 60. accent.contrast is chosen against accent.bg, which the palette pins in light mode.
|
|
135
|
+
[contrast] acme/acme-blue (light): accent.contrast on accent.bgActive reached Lc 31.3, floor is 60. accent.contrast is chosen against accent.bg, which the palette pins in light mode.
|
|
136
|
+
\`\`\`
|
|
137
|
+
|
|
138
|
+
This palette pins a pale \`accent.bg\` and leaves its hover and pressed fills derived. Pinning
|
|
139
|
+
\`accent.bgHover\` and \`accent.bgActive\` near the pinned fill makes it lawful.
|
|
140
|
+
|
|
141
|
+
| Law | What failed | Change |
|
|
142
|
+
| --- | --- | --- |
|
|
143
|
+
| \`schema\` | A value off its range, a key the document does not take, a missing partner | The field the message names, as it says |
|
|
144
|
+
| \`contrast\`, \`gradient\`, \`glass\` | A text or focus colour under its floor in one mode | The seed or pin the message names |
|
|
145
|
+
| \`coherence\`, \`resolution\` | The derived values contradict an axis, or no colour reaches the floor | The axis or seed the message names |
|
|
146
|
+
|
|
147
|
+
The Vite plugin fails the build, and \`add\` fails, with the same messages. Answer a refusal in the
|
|
148
|
+
documents. A stylesheet or a \`--pm-*\` property written by the app is checked by no theme law, and
|
|
149
|
+
the red rules refuse it.
|
|
150
|
+
|
|
151
|
+
## 6. Wear a shipped theme
|
|
152
|
+
|
|
153
|
+
${commands(run, "add theme:pastel --framework <framework>", "add palette:orchid --framework <framework>")}
|
|
154
|
+
|
|
155
|
+
\`<framework>\` is the app's framework, as the \`polymorph-setup\` skill tells it. In a vendoring
|
|
156
|
+
project, \`add theme:<system>\` installs a shipped system with its own palette and its fonts, and
|
|
157
|
+
\`add palette:<name>\` a palette alone, which any installed system can wear. In a page with no
|
|
158
|
+
build, \`add theme:<system>\` compiles it into the theme sheet.
|
|
159
|
+
|
|
160
|
+
An app that compiles its theme with the Vite plugin wears the documents \`vite.config\` names. To
|
|
161
|
+
wear a shipped pairing there, save it as two documents of the app's own: words the table does not
|
|
162
|
+
know move nothing, so the proposal holds the shipped pairing's axes, fonts and colour seeds. Both
|
|
163
|
+
documents are saved under a name of their own, \`<system>-variant.json\`. Then name the two saved
|
|
164
|
+
files in ${plugin}.
|
|
165
|
+
|
|
166
|
+
${commands(run, "theme propose \"as shipped\" --based-on journal/umber --save --dir src/theme")}
|
|
167
|
+
|
|
168
|
+
## 7. Light and dark
|
|
169
|
+
|
|
170
|
+
Every pairing has a light and a dark mode, both derived from the one palette, so there is no dark
|
|
171
|
+
palette to write. The mode is \`data-mode\` on \`<html>\`, which the pre-paint script sets
|
|
172
|
+
before the first paint: to the reader's stored choice, or on a first visit to the system's
|
|
173
|
+
\`defaultMode\`. \`light\` and \`dark\` open a first visit in that mode whatever the operating
|
|
174
|
+
system's mode, and \`system\` follows the operating system's mode as it changes. Hydration applies
|
|
175
|
+
the same default and does not store it, so the reader wears it until they choose a mode. To open
|
|
176
|
+
an app dark, set \`defaultMode\` to \`dark\` in the system document; the Vite plugin and \`add\`
|
|
177
|
+
build the pre-paint script from it. ${fixed}
|
|
178
|
+
|
|
179
|
+
- A light and dark toggle is ${f.m("ModeSwitch")}: \`<ModeSwitch label="Appearance" />\` offers
|
|
180
|
+
light, dark and system, and applies and stores the choice itself. It sits in a toolbar, a menu's
|
|
181
|
+
header or a settings row: in an ${f.m("AppShell")}, the \`trailing\` slot of its ${f.p("AppShell", "topbar")},
|
|
182
|
+
not ${f.m("PageHeader")}'s ${f.p("PageHeader", "actions")}, which hold the page's own actions. In a
|
|
183
|
+
page with no build it is \`<poly-mode-switch label="Appearance">\`.
|
|
184
|
+
- From code, ${f.x("setMode", "@polymorph/engine/runtime")} from \`@polymorph/engine/runtime\`
|
|
185
|
+
applies \`'light'\`, \`'dark'\` or \`'system'\`, which follows the operating system again.
|
|
186
|
+
${f.x("useMode", "@polymorph/react")}, from the framework's foundation package, reads the current
|
|
187
|
+
choice.
|
|
188
|
+
- One region in the opposite mode is ${f.m("ToneScope")} with ${f.v("ToneScope", "value", "inverse")}.
|
|
189
|
+
|
|
190
|
+
## What not to do
|
|
191
|
+
|
|
192
|
+
- No colour, length, font or duration in application code, and no \`--pm-*\` property declared by
|
|
193
|
+
the app. A value the theme does not derive belongs in the system or palette document.
|
|
194
|
+
- No stylesheet that overrides a member, and no sheet from \`theme emit\` installed as the theme. A
|
|
195
|
+
member's look is the documents'.
|
|
196
|
+
- No branching on which theme or mode is active. A subtree that needs another density or the
|
|
197
|
+
inverse tone uses ${f.m("DensityScope")} or ${f.m("ToneScope")} (the \`polymorph-rules\` skill).
|
|
198
|
+
`;
|
|
199
|
+
return [{
|
|
200
|
+
path: "polymorph-theme/SKILL.md",
|
|
201
|
+
contents: skill("polymorph-theme", "Change how an app built with polymorph looks, its colours, type, density, shape, motion or overall feel, or how it offers light and dark mode. Use when asked to restyle or rebrand a polymorph app, to make it calmer, denser, warmer, darker or more editorial, to pick or adjust a theme, system or palette, to set an exact brand colour or turn a brand's hex colour into a palette's accentHue, to set a font or a type size, to add a dark mode toggle or a more-contrast palette, to edit a system or palette JSON document, when polymorph theme validate or the build reports a theme law, or when tempted to write a colour, font or length in application code. Proposes a theme from plain words, checks it against the theme laws and saves it.", body)
|
|
202
|
+
}, {
|
|
203
|
+
path: "polymorph-theme/references/documents.md",
|
|
204
|
+
contents: documentsReference(registry, run)
|
|
205
|
+
}];
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { themeSkill };
|