@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,307 @@
|
|
|
1
|
+
import { FRAMEWORKS, FRAMEWORK_FOUNDATION, FRAMEWORK_VOCABULARY } from "../../../registry/src/frameworks.js";
|
|
2
|
+
import { PUBLISHED_NAMES, PUBLISHED_REGISTRY } from "../../../registry/src/install.js";
|
|
3
|
+
import { ANGULAR_TOOLING } from "../init-angular.js";
|
|
4
|
+
import { SVELTE_TOOLING } from "../init-svelte.js";
|
|
5
|
+
import { VUE_TOOLING } from "../init-vue.js";
|
|
6
|
+
import { frameworkRanges } from "../vue.js";
|
|
7
|
+
import { DEFAULT_SYSTEM } from "../plan.js";
|
|
8
|
+
import { Facts, SkillFactError, commands } from "./facts.js";
|
|
9
|
+
import { APP_TOOLING, REACT_RANGE } from "../init.js";
|
|
10
|
+
/**
|
|
11
|
+
* The packages route of the setup skill, for a model adding polymorph to an app that already
|
|
12
|
+
* exists: what to install and under which alias, the reference app `init` writes to copy exact
|
|
13
|
+
* files from, the Vite theme plugin, the entry, the red rules, and how to check the result. Then
|
|
14
|
+
* what differs for Next.js, which `pnpm gate:next` builds, and what no check covers.
|
|
15
|
+
*
|
|
16
|
+
* Every range is the release's, read from the registry, and every line is one `init` writes or the
|
|
17
|
+
* Next.js fixture (`scripts/next-app/`) holds, so the text cannot name a release or a file the
|
|
18
|
+
* tools do not write.
|
|
19
|
+
*/
|
|
20
|
+
function packagesReference(registry, run) {
|
|
21
|
+
const f = new Facts(registry);
|
|
22
|
+
const range = registry.packages["@polymorph/engine"];
|
|
23
|
+
if (range === void 0) throw new SkillFactError("the registry has no range for @polymorph/engine");
|
|
24
|
+
const published = (name) => {
|
|
25
|
+
const found = PUBLISHED_NAMES[name];
|
|
26
|
+
if (found === void 0) throw new SkillFactError(`${name} is not published`);
|
|
27
|
+
return found;
|
|
28
|
+
};
|
|
29
|
+
for (const web of FRAMEWORKS.filter((name) => name !== "elements")) for (const name of [FRAMEWORK_FOUNDATION[web], FRAMEWORK_VOCABULARY[web]]) if (frameworkRanges(registry, web)[name] !== range) throw new SkillFactError(`${name} is not at ${range}`);
|
|
30
|
+
if (registry.packages["@polymorph/rules"] !== range) throw new SkillFactError(`@polymorph/rules is not at ${range}`);
|
|
31
|
+
const alias = (name) => `${name}@npm:${published(name)}@${range}`;
|
|
32
|
+
const scope = published("@polymorph/engine").split("/")[0];
|
|
33
|
+
const framework = (name) => `${name.replace("@polymorph/react", "@polymorph/<framework>")}@npm:${published(name).replace("polymorph-react", "polymorph-<framework>")}@${range}`;
|
|
34
|
+
const lintTools = (tooling) => Object.entries(tooling).filter(([name]) => name.includes("eslint")).map(([name, version]) => `\`${name}@${version}\``).join(", ");
|
|
35
|
+
const system = registry.theme.systems.find((entry) => entry.name === DEFAULT_SYSTEM);
|
|
36
|
+
if (system === void 0) throw new SkillFactError(`no system called ${DEFAULT_SYSTEM}`);
|
|
37
|
+
const palette = system.defaultPalette;
|
|
38
|
+
const fonts = system.fonts.map((font) => `\`${font.package}\``).join(" and ");
|
|
39
|
+
const lint = ["eslint", "stylelint"].map((name) => `\`${name}@${APP_TOOLING[name]}\``).join(" and ");
|
|
40
|
+
const themeModule = "packages/cli/src/emit.ts";
|
|
41
|
+
return `
|
|
42
|
+
# The packages route, step by step
|
|
43
|
+
|
|
44
|
+
The app installs the vocabulary as packages and owns no member source. Every \`@polymorph/<name>\`
|
|
45
|
+
package is installed under that name, as an npm alias of \`@metamorph-labs/polymorph-<name>\`, at
|
|
46
|
+
\`${range}\`: the release these skills come from. Every package carries the same version.
|
|
47
|
+
|
|
48
|
+
| The app builds with | Do |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| Vite (\`vite.config.*\`), in React, Vue, Svelte, Solid or Angular | Steps 1 to 9 |
|
|
51
|
+
| Next.js (\`next.config.*\`), in React | Step 2, then "Next.js" below, then steps 7 to 9 |
|
|
52
|
+
| Anything else | "Other builds" below |
|
|
53
|
+
|
|
54
|
+
\`<framework>\` is \`react\`, \`vue\`, \`svelte\`, \`solid\` or \`angular\`. A page with no build is not
|
|
55
|
+
this route: it is \`init\` with \`--framework elements\`.
|
|
56
|
+
|
|
57
|
+
## 1. Write a reference app to copy from
|
|
58
|
+
|
|
59
|
+
${commands(run, "init ../polymorph-reference --framework <framework> --no-install")}
|
|
60
|
+
|
|
61
|
+
\`init\` writes a whole app, in the app's framework, into a new directory beside the project, and
|
|
62
|
+
\`--no-install\` installs nothing. Copy from it only \`src/theme/*.json\` (step 3) and
|
|
63
|
+
\`polymorph.eslint.js\` and \`polymorph.stylelint.js\` (step 6). Read its \`package.json\` and
|
|
64
|
+
\`vite.config.ts\` for the lines steps 2 and 4 name. Copy nothing else: the app keeps its own
|
|
65
|
+
\`tsconfig.json\`, \`.prettierrc.json\`, \`index.html\`, \`src/vite-env.d.ts\` and screens, and step 7
|
|
66
|
+
writes the agent files. \`--system <name>\` writes another catalogue system than
|
|
67
|
+
\`${DEFAULT_SYSTEM}\`, and \`${run} axes\` lists them. Delete \`../polymorph-reference\` when the app
|
|
68
|
+
is set up.
|
|
69
|
+
|
|
70
|
+
## 2. Install the packages
|
|
71
|
+
|
|
72
|
+
\`\`\`sh
|
|
73
|
+
npm install ${alias("@polymorph/engine")} \\
|
|
74
|
+
${framework("@polymorph/react")} \\
|
|
75
|
+
${framework("@polymorph/react-ui")}
|
|
76
|
+
npm install -D ${alias("@polymorph/rules")}
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
\`pnpm add\`, \`yarn add\` and \`bun add\` take the same arguments. Install as well:
|
|
80
|
+
|
|
81
|
+
- the font packages the reference app's \`package.json\` lists, which its system names: ${fonts}
|
|
82
|
+
for \`${DEFAULT_SYSTEM}\`;
|
|
83
|
+
- ${lint} as dev dependencies, if the app has neither;
|
|
84
|
+
- the parser the red rules read the framework's files with, as a dev dependency: ${lintTools(VUE_TOOLING)} for Vue,
|
|
85
|
+
${lintTools(SVELTE_TOOLING)} for Svelte, ${lintTools(ANGULAR_TOOLING)} for Angular, and none for
|
|
86
|
+
React and Solid.
|
|
87
|
+
|
|
88
|
+
The install checks the packages' peer ranges: \`vite\` 6 or later for the engine's plugin, and the
|
|
89
|
+
framework's own, \`react@${REACT_RANGE}\` for React. The app's \`vite\`, its framework and the
|
|
90
|
+
framework's Vite plugin (\`@vitejs/plugin-react\` for React) stay at the versions the app has when
|
|
91
|
+
the install reports no peer conflict. The reference app's versions are what a new app starts on, not
|
|
92
|
+
a requirement.
|
|
93
|
+
|
|
94
|
+
npmjs.com holds every release, with no configuration and no token. To install from GitHub Packages
|
|
95
|
+
instead, add these lines to the project's \`.npmrc\`, and set \`NODE_AUTH_TOKEN\` to a GitHub token
|
|
96
|
+
with \`read:packages\` (\`gh auth refresh -s read:packages\`, then
|
|
97
|
+
\`export NODE_AUTH_TOKEN=$(gh auth token)\`). Never write the token into the file.
|
|
98
|
+
|
|
99
|
+
\`\`\`ini
|
|
100
|
+
${scope}:registry=${PUBLISHED_REGISTRY}
|
|
101
|
+
${PUBLISHED_REGISTRY.replace(/^https?:/, "")}/:_authToken=\${NODE_AUTH_TOKEN}
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
## 3. Copy the theme documents
|
|
105
|
+
|
|
106
|
+
\`\`\`sh
|
|
107
|
+
mkdir -p src/theme && cp ../polymorph-reference/src/theme/*.json src/theme/
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
They are the app's system and palette (\`src/theme/${DEFAULT_SYSTEM}.json\` and
|
|
111
|
+
\`src/theme/${palette}.json\` for \`${DEFAULT_SYSTEM}\`), changed through the \`polymorph-theme\` skill.
|
|
112
|
+
|
|
113
|
+
## 4. Add the theme plugin to the Vite config
|
|
114
|
+
|
|
115
|
+
\`\`\`ts
|
|
116
|
+
import { polymorphTheme } from '@polymorph/engine/vite'
|
|
117
|
+
import react from '@vitejs/plugin-react'
|
|
118
|
+
import { defineConfig } from 'vite'
|
|
119
|
+
|
|
120
|
+
export default defineConfig({
|
|
121
|
+
plugins: [
|
|
122
|
+
react(),
|
|
123
|
+
polymorphTheme({
|
|
124
|
+
systems: ['src/theme/${DEFAULT_SYSTEM}.json'],
|
|
125
|
+
palettes: ['src/theme/${palette}.json'],
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
resolve: { dedupe: ['react', 'react-dom'] },
|
|
129
|
+
})
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
The framework's own plugin stays first, and the theme plugin follows it. \`dedupe\` names the
|
|
133
|
+
framework's packages, so the app has one copy of them: \`vue\`, \`svelte\`, \`solid-js\`, or Angular's
|
|
134
|
+
\`@angular/core\`, \`@angular/common\` and \`@angular/platform-browser\`. The reference app's
|
|
135
|
+
\`vite.config.ts\` has the lines for its framework.
|
|
136
|
+
|
|
137
|
+
${f.x("polymorphTheme", "@polymorph/engine/vite")} compiles the two documents when the app builds,
|
|
138
|
+
and again in dev when one changes. A pairing that breaks a theme law fails the build with the law's
|
|
139
|
+
message. It writes \`data-system\`, \`data-palette\` and the pre-paint script into \`index.html\`, so the
|
|
140
|
+
first paint wears the theme in the system's \`defaultMode\`. Do not write them by hand.
|
|
141
|
+
|
|
142
|
+
## 5. Import the theme first in the entry
|
|
143
|
+
|
|
144
|
+
\`\`\`ts
|
|
145
|
+
// The first line of src/main.ts or src/main.tsx, before the framework renders.
|
|
146
|
+
import 'virtual:polymorph/theme'
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
An Angular entry imports \`@polymorph/angular-ui/base.css\` on the next line. Then add this line to
|
|
150
|
+
\`src/vite-env.d.ts\`, which types the module, and create the file if the app has none:
|
|
151
|
+
|
|
152
|
+
\`\`\`ts
|
|
153
|
+
/// <reference types="@polymorph/engine/vite-env" />
|
|
154
|
+
\`\`\`
|
|
155
|
+
|
|
156
|
+
Keep the app's \`vite/client\` reference, in that file or in its \`tsconfig\`'s \`types\`: the
|
|
157
|
+
reference app's file lacks it. \`tsconfig.json\` needs no change while each config the app has sets
|
|
158
|
+
\`moduleResolution\` to \`bundler\`, as Vite's templates do, or to \`node16\` or \`nodenext\`. The
|
|
159
|
+
packages declare their types only in \`exports\`, which \`node\` resolution does not read.
|
|
160
|
+
|
|
161
|
+
The root also mounts the toast viewport, and in React a ${f.x("TooltipProvider", "@polymorph/react-ui")}.
|
|
162
|
+
The \`polymorph-screen\` skill's \`references/app.md\` has those lines.
|
|
163
|
+
|
|
164
|
+
## 6. Link the red rules into the lint configs
|
|
165
|
+
|
|
166
|
+
\`\`\`sh
|
|
167
|
+
cp ../polymorph-reference/polymorph.eslint.js ../polymorph-reference/polymorph.stylelint.js .
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
\`\`\`js
|
|
171
|
+
// eslint.config.js: the fragment first, the project's own blocks after it
|
|
172
|
+
import polymorph from './polymorph.eslint.js'
|
|
173
|
+
|
|
174
|
+
export default [...polymorph]
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
\`\`\`js
|
|
178
|
+
// stylelint.config.js
|
|
179
|
+
export default { extends: ['./polymorph.stylelint.js'] }
|
|
180
|
+
\`\`\`
|
|
181
|
+
|
|
182
|
+
The fragments hold the rules, the parser for the framework's files and the theme's token values,
|
|
183
|
+
which a report names the nearest token by. They read every file the lint is given, so lint the
|
|
184
|
+
app's source: the reference app's \`lint\` script is \`eslint src && stylelint "src/**/*.css"
|
|
185
|
+
--allow-empty-input\`. Never turn a polymorph rule off in a config.
|
|
186
|
+
|
|
187
|
+
The token values in \`polymorph.eslint.js\` are those of \`${DEFAULT_SYSTEM}\` with \`${palette}\`, the
|
|
188
|
+
reference app's theme. They choose only which token a report names as nearest a raw value, never what a rule refuses. No
|
|
189
|
+
command rewrites them in this route, so after a rebrand a report can name a colour, radius, size or
|
|
190
|
+
duration token that is not the nearest in the app's theme.
|
|
191
|
+
|
|
192
|
+
## 7. Write the agent files
|
|
193
|
+
|
|
194
|
+
${commands(run, "agents")}
|
|
195
|
+
|
|
196
|
+
## 8. Check the result
|
|
197
|
+
|
|
198
|
+
${commands(run, "check src", "card --framework <framework>")}
|
|
199
|
+
|
|
200
|
+
\`check\` runs the red rules with no lint config and exits 1 on any violation. The card lists the
|
|
201
|
+
framework's members. Then run the project's lint, typecheck and build, and start it: a member
|
|
202
|
+
renders in the theme's fonts and colours.
|
|
203
|
+
|
|
204
|
+
## 9. Brand it
|
|
205
|
+
|
|
206
|
+
The \`polymorph-theme\` skill changes the look. In this route:
|
|
207
|
+
|
|
208
|
+
- Replace the two copied documents in \`src/theme/\` with the app's own system and palette. The
|
|
209
|
+
system's \`defaultPalette\` names the palette.
|
|
210
|
+
- Name both files in ${f.x("polymorphTheme", "@polymorph/engine/vite")} in \`vite.config\`, the
|
|
211
|
+
system in \`systems\` and the palette in \`palettes\`. The build fails when a system's
|
|
212
|
+
\`defaultPalette\` is not among \`palettes\`.
|
|
213
|
+
- \`${run} theme validate src/theme/<system>.json src/theme/<palette>.json\` names the font packages
|
|
214
|
+
the system needs. Install them, and remove the font packages no document names any more.
|
|
215
|
+
|
|
216
|
+
In an app whose theme \`add\` compiled (Next.js, or React on another bundler), the documents are
|
|
217
|
+
under \`src/polymorph/themes/\`. Edit them in place and run \`${run} update\`, which compiles the sheet
|
|
218
|
+
again and rewrites the lint fragments' values from it.
|
|
219
|
+
|
|
220
|
+
## Next.js
|
|
221
|
+
|
|
222
|
+
Next.js runs the React packages in the App Router, with Turbopack or webpack. The Vite plugin does
|
|
223
|
+
not run there, so the theme is compiled into the repository when it is installed:
|
|
224
|
+
|
|
225
|
+
${commands(run, `add theme:${DEFAULT_SYSTEM} --framework react`)}
|
|
226
|
+
|
|
227
|
+
\`add\` writes the compiled theme, a theme module and the pre-paint script built for the installed
|
|
228
|
+
systems (\`prepaint.ts\`) under \`src/polymorph/themes/\`, adds the system's fonts to
|
|
229
|
+
\`package.json\`, and writes and links the lint fragments. It vendors no member
|
|
230
|
+
and keeps the aliases step 2 wrote. It reports that it found no entry and no \`index.html\`: the
|
|
231
|
+
root layout does those two jobs.
|
|
232
|
+
|
|
233
|
+
\`\`\`tsx
|
|
234
|
+
// app/layout.tsx
|
|
235
|
+
import type { ReactNode } from 'react'
|
|
236
|
+
|
|
237
|
+
import { TooltipProvider } from '@polymorph/react-ui'
|
|
238
|
+
|
|
239
|
+
import { PREPAINT_SCRIPT } from '../src/polymorph/themes/prepaint'
|
|
240
|
+
import { Theme } from './theme'
|
|
241
|
+
|
|
242
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
243
|
+
return (
|
|
244
|
+
<html lang="en" data-system="${DEFAULT_SYSTEM}" data-palette="${palette}" suppressHydrationWarning>
|
|
245
|
+
<head>
|
|
246
|
+
<script dangerouslySetInnerHTML={{ __html: PREPAINT_SCRIPT }} />
|
|
247
|
+
</head>
|
|
248
|
+
<body>
|
|
249
|
+
<Theme />
|
|
250
|
+
<TooltipProvider>{children}</TooltipProvider>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
\`\`\`
|
|
256
|
+
|
|
257
|
+
\`\`\`tsx
|
|
258
|
+
// app/theme.tsx
|
|
259
|
+
'use client'
|
|
260
|
+
|
|
261
|
+
import { useEffect } from 'react'
|
|
262
|
+
|
|
263
|
+
import { installThemes } from '../src/polymorph/themes'
|
|
264
|
+
|
|
265
|
+
export function Theme() {
|
|
266
|
+
useEffect(installThemes, [])
|
|
267
|
+
return null
|
|
268
|
+
}
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
- ${f.x("PREPAINT_SCRIPT", themeModule)}, from the \`prepaint.ts\` that \`add\` writes, applies the
|
|
272
|
+
reader's stored choice before the first paint, and for a reader with no stored mode the system's
|
|
273
|
+
\`defaultMode\`. \`<html>\` may therefore differ from the server's markup, which
|
|
274
|
+
\`suppressHydrationWarning\` allows. It imports nothing, so the server layout can import it.
|
|
275
|
+
- ${f.x("installThemes", themeModule)} imports the compiled sheet, the base layer and the fonts. Never
|
|
276
|
+
import a stylesheet in \`app/layout.tsx\`: \`polymorph/no-app-css\` reports it.
|
|
277
|
+
- A member that takes a function (a handler, \`onNavigate\`, a column's \`cell\`) is rendered from a
|
|
278
|
+
\`'use client'\` component. A server component may pass text, data and elements.
|
|
279
|
+
- With webpack, list the vocabulary in \`next.config.ts\`, or every page loads all of it:
|
|
280
|
+
\`experimental: { optimizePackageImports: ['@polymorph/react-ui'] }\`.
|
|
281
|
+
- Keep Next.js's output out of the lint:
|
|
282
|
+
\`export default [...polymorph, { ignores: ['.next/', 'next-env.d.ts'] }]\`.
|
|
283
|
+
|
|
284
|
+
## Other builds
|
|
285
|
+
|
|
286
|
+
No check builds these. Tell the person so, and set them up only as far as below.
|
|
287
|
+
|
|
288
|
+
- **React on another bundler** (webpack, Rsbuild, Parcel): after step 2,
|
|
289
|
+
\`${run} add theme:${DEFAULT_SYSTEM} --framework react\` compiles the theme, calls
|
|
290
|
+
${f.x("installThemes", themeModule)} from the entry it finds and puts the pre-paint script in a root \`index.html\`.
|
|
291
|
+
It names each one it could not find: call \`installThemes()\` before the app mounts, and put the
|
|
292
|
+
pre-paint script from \`prepaint.ts\` first in \`<head>\`, as the Next.js layout does.
|
|
293
|
+
- **Nuxt, SvelteKit, SolidStart, Astro** run Vite but write their own document, which the plugin's
|
|
294
|
+
\`index.html\` step does not reach. Steps 1 to 6 apply, and the document takes the pairing's
|
|
295
|
+
attributes and the pre-paint script first in \`<head>\`. Build the script with
|
|
296
|
+
${f.x("prepaintScript", "@polymorph/engine/runtime")} from \`@polymorph/engine/runtime\`, given each
|
|
297
|
+
system's \`defaultMode\` as \`modes\` and the default system as \`system\`, so a system that opens
|
|
298
|
+
dark does not paint light first. SvelteKit renders the routes that
|
|
299
|
+
hold members in the browser alone (\`export const ssr = false\`): the Svelte members do not
|
|
300
|
+
hydrate.
|
|
301
|
+
- **The Angular CLI** compiles no stylesheet a module imports, so its app lists
|
|
302
|
+
\`@polymorph/angular-ui/base.css\` in \`angular.json\`'s \`styles\`. A check holds only the
|
|
303
|
+
Vite build that \`init\` writes for Angular.
|
|
304
|
+
`.trimStart();
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
export { packagesReference };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { FRAMEWORKS } from "../../../registry/src/frameworks.js";
|
|
2
|
+
import { DEFAULT_SYSTEM } from "../plan.js";
|
|
3
|
+
import { commands, either, skill } from "./facts.js";
|
|
4
|
+
import { packagesReference } from "./setup-packages.js";
|
|
5
|
+
//#region ../cli/src/skills/setup.ts
|
|
6
|
+
function setupSkill(registry, run) {
|
|
7
|
+
const frameworks = either(FRAMEWORKS.map((framework) => `\`${framework}\``));
|
|
8
|
+
const systems = registry.theme.systems.map((system) => `\`${system.name}\``).join(", ");
|
|
9
|
+
const body = `
|
|
10
|
+
# Set up polymorph
|
|
11
|
+
|
|
12
|
+
Polymorph is a design system: a closed vocabulary of interface components for React, Vue, Svelte,
|
|
13
|
+
Solid and Angular, and as custom elements for an HTML page with no build, with a theme engine and
|
|
14
|
+
lint rules (the red rules) that keep design decisions out of application code. Its tools are one
|
|
15
|
+
npm package, \`@metamorph-labs/polymorph\`, which every command here runs. Always run that scoped
|
|
16
|
+
name: the unscoped \`polymorph\` package on npm is someone else's.
|
|
17
|
+
|
|
18
|
+
## Which route the repository is on
|
|
19
|
+
|
|
20
|
+
| You find | The route |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| No app yet | A new app: \`init\` |
|
|
23
|
+
| \`@polymorph/*\` packages in \`package.json\`, often as npm aliases of \`@metamorph-labs/polymorph-*\` | Packages: the app installs the vocabulary |
|
|
24
|
+
| \`polymorph.json\` with \`files\`, and member source under its \`dir\` (\`src/polymorph/\`) | Vendoring: the members are copied into the repository as source the team owns |
|
|
25
|
+
| \`polymorph.json\` with \`"framework": "elements"\` | A page with no build: the elements are copied into a static directory |
|
|
26
|
+
| An app with none of these | An existing app without polymorph: packages or vendoring, by the table below |
|
|
27
|
+
| \`Package.swift\` or an Xcode project with PolymorphUI, a Gradle build with \`dev.polymorph\` or \`com.github.metamorph-labs.polymorph\`, or a \`pubspec.yaml\` that names polymorph_tokens | A native app: the \`polymorph-native\` skill |
|
|
28
|
+
|
|
29
|
+
An existing app takes one of two routes:
|
|
30
|
+
|
|
31
|
+
| The team wants | Route |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| No member source in the repository, with fixes taken by raising the packages' version | Packages: a few manual steps |
|
|
34
|
+
| The members as source it can read and edit, with upstream changes taken by \`update\` | Vendoring: one command |
|
|
35
|
+
|
|
36
|
+
## A new app
|
|
37
|
+
|
|
38
|
+
${commands(run, "init my-app", "init my-app --framework vue", `init my-app --system ${DEFAULT_SYSTEM} --no-install`, "init my-site --framework elements")}
|
|
39
|
+
|
|
40
|
+
\`init\` writes a new Vite app into an empty directory: the packages, a theme from a catalogue system
|
|
41
|
+
(${systems}), the red rules wired into ESLint and Stylelint, a first screen written as a spec and
|
|
42
|
+
emitted, the agent files (\`AGENTS.md\`, the skills, the MCP entries) and the system card. Then it
|
|
43
|
+
installs the packages with the package manager that ran it. \`--framework\` takes
|
|
44
|
+
${frameworks}. \`--framework elements\` writes a page with no build that loads the elements from copied files, and
|
|
45
|
+
installs nothing.
|
|
46
|
+
|
|
47
|
+
## An existing app: vendoring
|
|
48
|
+
|
|
49
|
+
${commands(run, "plan button dialog theme:pastel --framework <framework>", "add button dialog theme:pastel --framework <framework>", "diff", "update")}
|
|
50
|
+
|
|
51
|
+
\`<framework>\` is the app's framework: the one \`polymorph.json\` records, or, in an app with no
|
|
52
|
+
\`polymorph.json\` yet, the one its \`package.json\` depends on (\`vue\` for a Vue app). Name it on
|
|
53
|
+
every \`plan\` and \`add\`. The first \`add\` records the framework in \`polymorph.json\`, and with no
|
|
54
|
+
\`--framework\` it records \`react\` and copies React members, whatever the app is written in.
|
|
55
|
+
|
|
56
|
+
\`plan\` prints what \`add\` would copy and install, and writes nothing. \`add\` copies the members you
|
|
57
|
+
name, and every member they need, as source into \`src/polymorph/\` (\`--dir\` changes it), installs a
|
|
58
|
+
theme (\`theme:<system>\`, or \`palette:<name>\` for a palette alone), adds the packages the members
|
|
59
|
+
import to \`package.json\`, and links the red rules into the project's ESLint and Stylelint configs.
|
|
60
|
+
Install the new dependencies afterwards with the project's package manager. \`polymorph.json\`
|
|
61
|
+
records each file with a hash of what was written.
|
|
62
|
+
|
|
63
|
+
\`diff\` lists the files you have edited and the files that changed upstream. \`update\` copies again
|
|
64
|
+
the files you have not edited and keeps the ones you have; \`--force\` takes upstream's copy.
|
|
65
|
+
|
|
66
|
+
## An existing app: packages
|
|
67
|
+
|
|
68
|
+
The packages route installs \`@polymorph/engine\`, the framework's foundation and vocabulary, and
|
|
69
|
+
\`@polymorph/rules\` as npm aliases of their published names, adds the theme plugin to
|
|
70
|
+
\`vite.config\`, and spreads the red rules into the lint configs.
|
|
71
|
+
[references/packages.md](references/packages.md) has each step with the exact lines. \`init\` writes
|
|
72
|
+
the same files for a new app, so an app it wrote is a working example.
|
|
73
|
+
|
|
74
|
+
## The agent's files
|
|
75
|
+
|
|
76
|
+
${commands(run, "agents", "agents --harness claude,codex", "agents --dry-run")}
|
|
77
|
+
|
|
78
|
+
\`agents\` writes what a coding agent reads in this repository: a marked block in \`AGENTS.md\` (and a
|
|
79
|
+
\`CLAUDE.md\` that includes it), these skills in \`.claude/skills/\` and \`.agents/skills/\`, the MCP
|
|
80
|
+
server's entry for each harness (\`.mcp.json\`, \`.cursor/mcp.json\`, \`.codex/config.toml\`), and the
|
|
81
|
+
system card in \`polymorph/system-card.md\`. \`--harness\` takes \`claude\`, \`codex\`, \`cursor\`,
|
|
82
|
+
\`generic\` or \`all\`. It records what it wrote in \`polymorph/agents.json\`.
|
|
83
|
+
|
|
84
|
+
Run it again at any time, in a project that has these files already. Each file, block or server
|
|
85
|
+
entry is written where it is absent and replaced where it is as \`agents\` recorded writing it. One
|
|
86
|
+
someone edited, or one \`agents\` did not write, is kept and named as \`kept yours\`, and
|
|
87
|
+
\`--force\` replaces it. \`unchanged\` counts the parts already as this release writes them. Text
|
|
88
|
+
outside its block in \`AGENTS.md\` and other servers in an MCP config are left as they are.
|
|
89
|
+
\`--remove <harness>\` stops writing for a harness and removes the files only it reads that nobody
|
|
90
|
+
edited. An older release refuses to write over a newer one's files.
|
|
91
|
+
|
|
92
|
+
With Codex among the harnesses, the report ends with a \`codex mcp add\` line. It is for the
|
|
93
|
+
person to run once in their own shell: Codex reads \`.codex/config.toml\` only in a project it
|
|
94
|
+
trusts, and the line gives the server to Codex in every project. The project's files are complete
|
|
95
|
+
without it.
|
|
96
|
+
|
|
97
|
+
Each MCP entry runs \`${run} mcp --project <path>\`, which starts the server over stdio for the
|
|
98
|
+
harness's client. Run it by hand only to see that it starts. With \`--read-only\` in place of the
|
|
99
|
+
project it offers no tool that writes a file.
|
|
100
|
+
|
|
101
|
+
## Moving to a newer release
|
|
102
|
+
|
|
103
|
+
Every command in this skill names the release it runs. To move to a newer one, run the same
|
|
104
|
+
commands with the newer version in place of this one's. In every project, \`agents\` rewrites the
|
|
105
|
+
agent files and the card for that release. In a vendoring project, \`update\` copies the new
|
|
106
|
+
members. In a packages project, raise the ranges of the \`@polymorph/*\` aliases and of
|
|
107
|
+
\`@metamorph-labs/polymorph\` in \`package.json\`, and install.
|
|
108
|
+
|
|
109
|
+
## Check the setup
|
|
110
|
+
|
|
111
|
+
${commands(run, "check src", "card --framework <framework>")}
|
|
112
|
+
|
|
113
|
+
\`check\` runs the red rules over a directory with no lint config and exits 1 on any violation. The
|
|
114
|
+
card should list the members the app uses.
|
|
115
|
+
`;
|
|
116
|
+
return [{
|
|
117
|
+
path: "polymorph-setup/SKILL.md",
|
|
118
|
+
contents: skill("polymorph-setup", "Add the polymorph design system to a project, or set up the files a coding agent reads to work with it. Use when asked to start a new app with polymorph, add polymorph to an existing React, Vue, Svelte, Solid or Angular app or to an HTML page, vendor polymorph components into a repository, move to a newer polymorph release, or write the AGENTS.md block, skills and MCP configuration for Claude Code, Codex, Cursor or another agent. It tells a new app, the packages route and the vendoring route apart.", body)
|
|
119
|
+
}, {
|
|
120
|
+
path: "polymorph-setup/references/packages.md",
|
|
121
|
+
contents: packagesReference(registry, run)
|
|
122
|
+
}];
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { setupSkill };
|