@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,305 @@
|
|
|
1
|
+
import { Facts } from "./facts.js";
|
|
2
|
+
//#region ../cli/src/skills/screen-rich-text.ts
|
|
3
|
+
/** The module the document's functions come from. It has no DOM, so a server runs it. */
|
|
4
|
+
var DOCUMENT = "@polymorph/engine/rich-text";
|
|
5
|
+
/**
|
|
6
|
+
* Formatted text a person writes: the field, the member that shows a
|
|
7
|
+
* document, the document's JSON, mentions, comments anchored to words, and
|
|
8
|
+
* what a server does with what a client sent. The screen skill sends a model
|
|
9
|
+
* here for a comment, a description or a note with formatting.
|
|
10
|
+
*/
|
|
11
|
+
function richTextReference(registry) {
|
|
12
|
+
const f = new Facts(registry);
|
|
13
|
+
const x = (name) => f.x(name, DOCUMENT);
|
|
14
|
+
const input = (prop) => f.p("RichTextInput", prop);
|
|
15
|
+
const content = (prop) => f.p("RichTextContent", prop);
|
|
16
|
+
const entity = (name) => f.field("RichTextEntitySource", name);
|
|
17
|
+
return `
|
|
18
|
+
# Formatted text a person writes
|
|
19
|
+
|
|
20
|
+
## 1. Choose the member
|
|
21
|
+
|
|
22
|
+
| The text | The member |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| A person writes it with formatting: a comment, a description, a note | ${f.m("RichTextInput")} |
|
|
25
|
+
| A document a person wrote is shown | ${f.m("RichTextContent")} |
|
|
26
|
+
| A model wrote it, as Markdown | ${f.m("Markdown")} |
|
|
27
|
+
| A person writes it with no formatting | ${f.m("Textarea")} |
|
|
28
|
+
| It is the message to a model | ${f.m("PromptInput")} |
|
|
29
|
+
|
|
30
|
+
Do not bring in an editor library, and do not store or render HTML. The field's value is a JSON
|
|
31
|
+
document, and ${f.m("RichTextContent")} draws it through the vocabulary, so a stored document
|
|
32
|
+
cannot inject markup.
|
|
33
|
+
|
|
34
|
+
## 2. The document
|
|
35
|
+
|
|
36
|
+
\`\`\`json
|
|
37
|
+
{
|
|
38
|
+
"format": "polymorph-rich-text/1",
|
|
39
|
+
"blocks": [
|
|
40
|
+
{
|
|
41
|
+
"type": "paragraph",
|
|
42
|
+
"content": [
|
|
43
|
+
{ "type": "text", "text": "Thanks to " },
|
|
44
|
+
{ "type": "entity", "kind": "user", "id": "u_17", "label": "@Ada Lovelace" },
|
|
45
|
+
{ "type": "text", "text": " for the " },
|
|
46
|
+
{ "type": "text", "text": "fix", "marks": [{ "type": "bold" }] }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
- Blocks: \`paragraph\`, \`heading\` (\`level\` 1 to 3), \`list\` (\`ordered\`, \`items\` of
|
|
54
|
+
\`listItem\`), \`blockquote\` and \`codeBlock\` (\`text\`, \`language\`).
|
|
55
|
+
- Inline nodes: \`text\`, \`break\` and \`entity\` (\`kind\`, \`id\`, \`label\`).
|
|
56
|
+
- Marks on text: \`bold\`, \`italic\`, \`strike\`, \`code\`, \`link\` (\`href\`) and \`annotation\`
|
|
57
|
+
(\`id\`).
|
|
58
|
+
|
|
59
|
+
Store the value as it is, in a JSON column or as a string. Do not convert it to HTML or Markdown to
|
|
60
|
+
store it. Start an empty field from ${x("emptyRichText")}\`()\`, and make a document from plain text
|
|
61
|
+
with ${x("richTextFromText")}.
|
|
62
|
+
|
|
63
|
+
## 3. The field
|
|
64
|
+
|
|
65
|
+
\`\`\`tsx
|
|
66
|
+
import { useState } from 'react'
|
|
67
|
+
import { emptyRichText } from '@polymorph/engine/rich-text'
|
|
68
|
+
import { FormField, RichTextInput } from '@polymorph/react-ui'
|
|
69
|
+
|
|
70
|
+
import { save } from './comments'
|
|
71
|
+
|
|
72
|
+
export function CommentField() {
|
|
73
|
+
const [body, setBody] = useState(emptyRichText())
|
|
74
|
+
return (
|
|
75
|
+
<FormField label="Comment">
|
|
76
|
+
<RichTextInput
|
|
77
|
+
value={body}
|
|
78
|
+
onChange={setBody}
|
|
79
|
+
placeholder="Write a comment"
|
|
80
|
+
formats={['bold', 'italic', 'code', 'link']}
|
|
81
|
+
maxLength={2000}
|
|
82
|
+
submitLabel="Comment"
|
|
83
|
+
onSubmit={async (value, editor) => {
|
|
84
|
+
await save(value)
|
|
85
|
+
editor.clear()
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</FormField>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
- ${input("value")} with ${input("onChange")} controls the field. ${input("defaultValue")} leaves
|
|
94
|
+
the document to the field. ${input("name")} adds a hidden input that holds the document as a
|
|
95
|
+
string, for a form that posts.
|
|
96
|
+
- ${input("formats")} lists what the field allows. A document given to the field, and what a person
|
|
97
|
+
pastes, is cut down to those formats. Leave it out to allow every format.
|
|
98
|
+
- The footer has three forms. ${input("submitLabel")} with ${input("onSubmit")}, and
|
|
99
|
+
${input("cancelLabel")} with ${input("onCancel")}, draw the default one. ${input("footer")} draws
|
|
100
|
+
the app's own. With none of them there is no footer, which suits a form with its own buttons.
|
|
101
|
+
Set ${input("pending")} while the app saves.
|
|
102
|
+
- ${input("maxLength")} is a soft limit. A person can type past it, the count shows how far, and the
|
|
103
|
+
default submit control is disabled. The server enforces the limit (step 7).
|
|
104
|
+
- ${input("onFiles")} receives files a person pasted or dropped. The field inserts nothing for them
|
|
105
|
+
and uploads nothing.
|
|
106
|
+
- The field shows no message after a save. The app shows a ${f.m("Toast")}.
|
|
107
|
+
- ${input("toolbarPlacement")} set to \`selection\` draws the format controls at the selected words
|
|
108
|
+
in place of the fixed row, which suits a long document.
|
|
109
|
+
|
|
110
|
+
## 4. Mentions
|
|
111
|
+
|
|
112
|
+
\`\`\`tsx
|
|
113
|
+
<RichTextInput
|
|
114
|
+
value={body}
|
|
115
|
+
onChange={setBody}
|
|
116
|
+
entities={[
|
|
117
|
+
{ kind: 'user', trigger: '@', label: 'People', options: people.map((person) => ({ id: person.id, label: person.name })) },
|
|
118
|
+
{ kind: 'issue', trigger: '#', label: 'Issues', filter: false, options: issues, loading: searching, onQueryChange: setIssueQuery },
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
\`\`\`
|
|
122
|
+
|
|
123
|
+
The app supplies each kind's ${entity("options")}, and the field never fetches. With
|
|
124
|
+
${entity("filter")} set to \`false\` the app searches: it reads the query from
|
|
125
|
+
${entity("onQueryChange")} and passes ${entity("loading")}, ${entity("options")} and
|
|
126
|
+
${entity("error")} back. ${entity("error")} is the app's sentence for a search that failed. An
|
|
127
|
+
option is an \`id\` and a \`label\`, and \`component RichTextInput\` prints the rest of both shapes
|
|
128
|
+
under \`## Types\`. The app waits for a pause in typing before it searches, and drops the answer to
|
|
129
|
+
a query that is no longer the latest: the field calls ${entity("onQueryChange")} on every change.
|
|
130
|
+
|
|
131
|
+
The document stores the entity's \`kind\`, \`id\` and \`label\`, so it still reads when the thing
|
|
132
|
+
it names is gone.
|
|
133
|
+
|
|
134
|
+
## 5. Show a document
|
|
135
|
+
|
|
136
|
+
\`\`\`tsx
|
|
137
|
+
<RichTextContent
|
|
138
|
+
value={comment.body}
|
|
139
|
+
headingLevel={3}
|
|
140
|
+
onNavigate={(href) => router.push(href)}
|
|
141
|
+
entity={(entity) => (entity.kind === 'user' ? <Link href={\`/people/\${entity.id}\`}>{entity.label}</Link> : undefined)}
|
|
142
|
+
/>
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
${content("headingLevel")} is the page level of the document's first heading level.
|
|
146
|
+
${content("onNavigate")} receives a press on a link inside the site, for the app's router.
|
|
147
|
+
${content("entity")} replaces the drawing of an entity, and an entity it returns nothing for is
|
|
148
|
+
drawn as its label.
|
|
149
|
+
|
|
150
|
+
## 6. Comments on words
|
|
151
|
+
|
|
152
|
+
The app owns the threads: who wrote what, which are resolved, who may see them. The document holds
|
|
153
|
+
only an anchor, an \`annotation\` mark with the thread's id, which moves with its words through
|
|
154
|
+
every edit. Both members take ${input("annotations")} (the ids to highlight; leave a resolved
|
|
155
|
+
thread's id out), ${input("activeAnnotation")} and ${input("onAnnotationSelect")}.
|
|
156
|
+
|
|
157
|
+
In the field, the app's control in ${input("selectionActions")} anchors a new thread to the
|
|
158
|
+
selection through the handle it receives:
|
|
159
|
+
|
|
160
|
+
\`\`\`tsx
|
|
161
|
+
<RichTextInput
|
|
162
|
+
value={body}
|
|
163
|
+
onChange={setBody}
|
|
164
|
+
annotations={openThreads.map((thread) => thread.id)}
|
|
165
|
+
activeAnnotation={activeThread}
|
|
166
|
+
onAnnotationSelect={setActiveThread}
|
|
167
|
+
selectionActions={(editor) => (
|
|
168
|
+
<Button variant="ghost" label="Comment" onClick={() => editor.annotate(createThread(editor.selection.text).id)} />
|
|
169
|
+
)}
|
|
170
|
+
/>
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
On a page that only shows the document, ${f.m("RichTextContent")}'s
|
|
174
|
+
${content("selectionActions")} receives \`{ range, text }\`: the selected stretch and its words.
|
|
175
|
+
The app makes the thread, anchors it and saves the document:
|
|
176
|
+
|
|
177
|
+
\`\`\`tsx
|
|
178
|
+
<RichTextContent
|
|
179
|
+
value={description}
|
|
180
|
+
annotations={openThreads.map((thread) => thread.id)}
|
|
181
|
+
activeAnnotation={activeThread}
|
|
182
|
+
onAnnotationSelect={setActiveThread}
|
|
183
|
+
selectionActions={({ range, text }) => (
|
|
184
|
+
<Button
|
|
185
|
+
variant="ghost"
|
|
186
|
+
label="Comment"
|
|
187
|
+
onClick={() => {
|
|
188
|
+
const thread = createThread(text)
|
|
189
|
+
saveDescription(annotateRichText(description, range, thread.id))
|
|
190
|
+
setActiveThread(thread.id)
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
/>
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
A range is \`{ start, end }\`, counted in code points of the document's plain text with nothing
|
|
198
|
+
between blocks, and \`end\` is not included. Every function here returns a new document and leaves
|
|
199
|
+
the one it was given as it was. Without ${content("onAnnotationSelect")} a highlight takes no press.
|
|
200
|
+
|
|
201
|
+
The thread is the app's to show: a ${f.m("CommentThread")} for the id in
|
|
202
|
+
${content("activeAnnotation")}, beside the document or in a ${f.m("Drawer")}.
|
|
203
|
+
|
|
204
|
+
A reviewer that has only the text, a person or a model, anchors a comment by quoting words:
|
|
205
|
+
${x("richTextFindText")}\`(doc, words)\` gives the ranges and ${x("annotateRichText")} anchors one.
|
|
206
|
+
${x("richTextAnnotations")} lists each annotation with the text it covers. An annotation whose words
|
|
207
|
+
were deleted is gone from that list, which is how the app finds a thread that lost its anchor.
|
|
208
|
+
${x("removeRichTextAnnotation")} removes one.
|
|
209
|
+
|
|
210
|
+
## 7. On the server
|
|
211
|
+
|
|
212
|
+
Every function is in \`${DOCUMENT}\`. It has no DOM, takes any JSON value or JSON string, and never
|
|
213
|
+
throws. A client can send any JSON, so before storing a document:
|
|
214
|
+
|
|
215
|
+
1. Refuse a document for which ${x("isRichTextNewer")} is true. This reader cannot check what it
|
|
216
|
+
cannot read.
|
|
217
|
+
2. Read it with ${x("parseRichText")}, which returns \`{ value, faults }\`. \`value\` is always a
|
|
218
|
+
usable document in normal form, and each fault has a \`code\`, a \`path\` and a \`message\`. The
|
|
219
|
+
field writes no faults, so a document with one came from another client. Refuse it, or store
|
|
220
|
+
\`value\`: the product decides.
|
|
221
|
+
3. Hold it to the formats the field allows with ${x("restrictRichText")}, which never refuses. It
|
|
222
|
+
returns the document cut down: a heading or a list that is not allowed becomes paragraphs, a
|
|
223
|
+
mark that is not allowed is dropped, and the words stay. Store the cut document, or refuse one
|
|
224
|
+
the cut changed, as the example does. The format names are the ones the
|
|
225
|
+
field's ${input("formats")} takes, and ${x("RICH_TEXT_FORMATS")} holds every one.
|
|
226
|
+
4. Check ${x("richTextLength")} against the limit. It counts code points of the text a person sees.
|
|
227
|
+
5. Check each entity ${x("richTextEntities")} lists: that its \`id\` names something the author may
|
|
228
|
+
mention, and that its \`label\` is the name the server knows. The same list, by \`kind\`, is who
|
|
229
|
+
was mentioned.
|
|
230
|
+
|
|
231
|
+
\`\`\`ts
|
|
232
|
+
import {
|
|
233
|
+
isRichTextNewer,
|
|
234
|
+
parseRichText,
|
|
235
|
+
restrictRichText,
|
|
236
|
+
richTextEntities,
|
|
237
|
+
richTextEquals,
|
|
238
|
+
richTextLength,
|
|
239
|
+
type RichTextDocument,
|
|
240
|
+
type RichTextFormat,
|
|
241
|
+
} from '@polymorph/engine/rich-text'
|
|
242
|
+
|
|
243
|
+
const FORMATS: RichTextFormat[] = ['bold', 'italic', 'code', 'link']
|
|
244
|
+
const LIMIT = 5000
|
|
245
|
+
|
|
246
|
+
type Read =
|
|
247
|
+
| { ok: true; body: RichTextDocument }
|
|
248
|
+
| { ok: false; reason: 'newer' | 'malformed' | 'format' | 'length' }
|
|
249
|
+
|
|
250
|
+
/** A comment a client sent, as the document to store or the reason it is refused. */
|
|
251
|
+
export function readComment(sent: unknown): Read {
|
|
252
|
+
if (isRichTextNewer(sent)) return { ok: false, reason: 'newer' }
|
|
253
|
+
const { value, faults } = parseRichText(sent)
|
|
254
|
+
if (faults.length > 0) return { ok: false, reason: 'malformed' }
|
|
255
|
+
const body = restrictRichText(value, FORMATS)
|
|
256
|
+
if (!richTextEquals(body, value)) return { ok: false, reason: 'format' }
|
|
257
|
+
if (richTextLength(body) > LIMIT) return { ok: false, reason: 'length' }
|
|
258
|
+
return { ok: true, body }
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** The ids of the people a stored comment mentions, each once. */
|
|
262
|
+
export function mentioned(body: RichTextDocument): string[] {
|
|
263
|
+
const people = richTextEntities(body).filter((entity) => entity.kind === 'user')
|
|
264
|
+
return [...new Set(people.map((entity) => entity.id))]
|
|
265
|
+
}
|
|
266
|
+
\`\`\`
|
|
267
|
+
|
|
268
|
+
Every function takes \`unknown\`, so the same code reads a parsed body or a string from a column.
|
|
269
|
+
${x("RichTextDocument")} and ${x("RichTextFormat")} are types of the same module.
|
|
270
|
+
|
|
271
|
+
| For | Use |
|
|
272
|
+
| --- | --- |
|
|
273
|
+
| Search, a notification, text for a model | ${x("richTextPlainText")} |
|
|
274
|
+
| The first words on one line, for a list row | ${x("richTextExcerpt")} |
|
|
275
|
+
| Whether there is anything to save | ${x("isRichTextEmpty")} |
|
|
276
|
+
| Whether two documents are the same | ${x("richTextEquals")} |
|
|
277
|
+
| The string to store | ${x("serializeRichText")} |
|
|
278
|
+
|
|
279
|
+
## 8. Other frameworks and native
|
|
280
|
+
|
|
281
|
+
The members and props have the same names in Vue, Svelte, Solid, Angular and as elements. The
|
|
282
|
+
function props that receive the field's handle (${input("toolbar")}, ${input("selectionActions")},
|
|
283
|
+
${input("footer")}) and ${f.m("RichTextContent")}'s ${content("entity")} and
|
|
284
|
+
${content("selectionActions")} are each framework's own slot:
|
|
285
|
+
|
|
286
|
+
| Framework | How it is written |
|
|
287
|
+
| --- | --- |
|
|
288
|
+
| React, Solid | A function prop: \`toolbar={(editor) => …}\` |
|
|
289
|
+
| Vue | A scoped slot: \`<template #toolbar="editor">\` |
|
|
290
|
+
| Svelte | A snippet: \`{#snippet toolbar(editor)}\` |
|
|
291
|
+
| Angular | A template: \`<ng-template #tools let-editor>\`, given as \`[toolbar]="tools"\` |
|
|
292
|
+
| Elements | A property set from script: a function that returns a node or a list of nodes |
|
|
293
|
+
|
|
294
|
+
In Angular and as an element, \`submit\` carries the document alone, and the handle reaches the app
|
|
295
|
+
through those slots.
|
|
296
|
+
|
|
297
|
+
SwiftUI and Compose draw ${f.m("RichTextContent")} from the same JSON. ${f.m("RichTextInput")} is a
|
|
298
|
+
web member. A phone app that needs formatted input shows a web view, or collects plain text and
|
|
299
|
+
stores ${x("richTextFromText")} of it.
|
|
300
|
+
|
|
301
|
+
Two people editing one document at the same time is not part of this.
|
|
302
|
+
`.trimStart();
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
export { richTextReference };
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { DEFAULT_SYSTEM } from "../plan.js";
|
|
2
|
+
import { Facts, all, commands, either, frameworkTable, skill } from "./facts.js";
|
|
3
|
+
import { chartsReference } from "./screen-charts.js";
|
|
4
|
+
import { chatReference } from "./screen-chat.js";
|
|
5
|
+
import { appReference, codeReference } from "./screen-code.js";
|
|
6
|
+
import { richTextReference } from "./screen-rich-text.js";
|
|
7
|
+
//#region ../cli/src/skills/screen.ts
|
|
8
|
+
function screenSkill(registry, run) {
|
|
9
|
+
const f = new Facts(registry);
|
|
10
|
+
const spacing = all(f.shared([
|
|
11
|
+
"Stack",
|
|
12
|
+
"Inline",
|
|
13
|
+
"Grid"
|
|
14
|
+
], [
|
|
15
|
+
"gap",
|
|
16
|
+
"p",
|
|
17
|
+
"px",
|
|
18
|
+
"py"
|
|
19
|
+
]));
|
|
20
|
+
const pages = f.tier("archetypes").filter((name) => name.endsWith("Page")).slice(0, 3).map((name) => f.m(name));
|
|
21
|
+
const body = `
|
|
22
|
+
# Build a screen with polymorph
|
|
23
|
+
|
|
24
|
+
Polymorph is a closed vocabulary of interface components, called members, and a set of lint rules,
|
|
25
|
+
the red rules, that keep design decisions out of application code. The theme decides every colour,
|
|
26
|
+
size, font and motion. A screen composes members, sets their props and binds content to them.
|
|
27
|
+
|
|
28
|
+
You reach the tools from a shell. Every command in this skill starts with the same words:
|
|
29
|
+
|
|
30
|
+
${commands(run, "card --framework <framework>")}
|
|
31
|
+
|
|
32
|
+
If the session also has an MCP server named \`polymorph\`, its tools do the same jobs:
|
|
33
|
+
\`get_system_card\` for \`card\`, \`search_components\` for \`search\`, \`get_component\` for
|
|
34
|
+
\`component\`, \`validate\`, \`fix\`, \`emit_screen\` for \`emit\` and \`render_screen\` for \`render\`.
|
|
35
|
+
Pass the app's framework as \`framework\` to every one that takes it. \`--json\` on a verb prints the
|
|
36
|
+
tool's answer as JSON and nothing else, for a script that reads it. A server started for no
|
|
37
|
+
project, as a plugin's is, cannot read the framework from the project, and reads code as React's.
|
|
38
|
+
|
|
39
|
+
## 1. Find the framework and how the app writes screens
|
|
40
|
+
|
|
41
|
+
Read \`package.json\` and \`polymorph.json\` at the project root. A package may be listed under its
|
|
42
|
+
published name, \`@metamorph-labs/polymorph-<name>\`.
|
|
43
|
+
|
|
44
|
+
${frameworkTable()}
|
|
45
|
+
|
|
46
|
+
That is \`<framework>\` in every command below. A project that vendors members has their source under
|
|
47
|
+
the \`dir\` that \`polymorph.json\` names, usually \`src/polymorph/\`, and imports them from there.
|
|
48
|
+
Those files are the vocabulary: do not edit them to make a screen work.
|
|
49
|
+
|
|
50
|
+
Then look for screen specs: JSON files with \`"spec": "polymorph-screen/1"\`, usually in
|
|
51
|
+
\`src/screens/\`, each beside the component emitted from it. If the app has them, write the new
|
|
52
|
+
screen as a spec (step 4). Otherwise write it in the framework's own code (step 5).
|
|
53
|
+
|
|
54
|
+
## 2. Read the card
|
|
55
|
+
|
|
56
|
+
${commands(run, "card --framework <framework>")}
|
|
57
|
+
|
|
58
|
+
The card lists every member with its props, the variants and tones each takes, its compound parts
|
|
59
|
+
(such as ${f.part("Table", "Row")}), the icon roles, the token families, the red rules and the
|
|
60
|
+
exception ladder. \`polymorph/system-card.md\` holds the card as it was when the project was set up.
|
|
61
|
+
The command answers for the release it names. Read it once when the work starts. For one member
|
|
62
|
+
after that, \`component\` is shorter and has more.
|
|
63
|
+
|
|
64
|
+
A member or a prop that is not in the card does not exist. Do not invent one, and do not bring in
|
|
65
|
+
components from another interface library.
|
|
66
|
+
|
|
67
|
+
## 3. Choose the members
|
|
68
|
+
|
|
69
|
+
${commands(run, "search date picker --framework <framework>", "component DatePicker --framework <framework>")}
|
|
70
|
+
|
|
71
|
+
\`search\` takes plain words and finds members by name, purpose, prop or variant. With no words it
|
|
72
|
+
lists every member. \`component\` prints one member: each prop with its type and default, the
|
|
73
|
+
lawful variant and tone pairs, its states, its parts and what it depends on. A wrong name is
|
|
74
|
+
answered with suggestions and exit code 1.
|
|
75
|
+
|
|
76
|
+
- Lay out with ${f.m("Stack")}, ${f.m("Inline")} and ${f.m("Grid")} and their spacing props
|
|
77
|
+
(${spacing}), which take steps of the space scale, never lengths.
|
|
78
|
+
- Start a page from a page archetype, such as ${either(pages)}, or from ${f.m("PageHeader")}.
|
|
79
|
+
- Show an icon with ${f.m("Icon")}, its ${f.roleProp("Icon")} one of the card's icon roles.
|
|
80
|
+
- Put text in ${f.m("Text")}, whose ${f.p("Text", "tone")} and ${f.p("Text", "size")} take the
|
|
81
|
+
place of a colour or a font size, and a heading in ${f.m("Heading")}, whose
|
|
82
|
+
${f.p("Heading", "level")} sets its rank.
|
|
83
|
+
|
|
84
|
+
Some screens have a procedure of their own. Read its file before you write the screen:
|
|
85
|
+
|
|
86
|
+
| The screen | Read |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| Is written in code, or is the container of an emitted spec | [references/code.md](references/code.md) |
|
|
89
|
+
| Needs the app around it: the root's providers, the router, the mode, a form, a toast, a dialog, navigation | [references/app.md](references/app.md) |
|
|
90
|
+
| Holds a conversation with a model | [references/chat.md](references/chat.md) |
|
|
91
|
+
| Draws a chart | [references/charts.md](references/charts.md) |
|
|
92
|
+
| Takes or shows formatted text, mentions or comments on words | [references/rich-text.md](references/rich-text.md) |
|
|
93
|
+
|
|
94
|
+
Three jobs are another skill's: a screen a model writes while the product runs
|
|
95
|
+
(\`polymorph-runtime-screen\`), an agent on the page that reads and operates the members
|
|
96
|
+
(\`polymorph-agent-bridge\`), and a SwiftUI or Compose screen (\`polymorph-native\`).
|
|
97
|
+
|
|
98
|
+
## 4. Write a spec, then emit it
|
|
99
|
+
|
|
100
|
+
The format is in [references/screen-spec.md](references/screen-spec.md). Check the spec, then
|
|
101
|
+
compile it into a component:
|
|
102
|
+
|
|
103
|
+
${commands(run, "validate src/screens/inbox.json --framework <framework>", "emit src/screens/inbox.json <out> --framework <framework>")}
|
|
104
|
+
|
|
105
|
+
\`validate\` lists each fault at its path, such as \`$.root.children[1]\`, with suggestions for a
|
|
106
|
+
wrong name, and exits 0 when the spec is lawful. \`emit\` validates again, compiles the spec, checks
|
|
107
|
+
the output against the red rules, and writes nothing when either fails. \`<out>\` is the component
|
|
108
|
+
to write, with the framework's extension: \`.tsx\` for React and Solid, \`.vue\`, \`.svelte\`, and
|
|
109
|
+
\`.ts\` for an Angular standalone component.
|
|
110
|
+
|
|
111
|
+
The emitted component holds no state and no logic. A container you write renders it, owns the
|
|
112
|
+
state, and passes the data and the callbacks the spec declares as \`inputs\`.
|
|
113
|
+
[references/code.md](references/code.md) shows one. Never edit an emitted
|
|
114
|
+
file: change the spec and emit it again.
|
|
115
|
+
|
|
116
|
+
## 5. Or write the screen in code
|
|
117
|
+
|
|
118
|
+
Import members from the framework's vocabulary package, or from the vendored directory in a project
|
|
119
|
+
that vendors. [references/code.md](references/code.md) has the import line for each framework and
|
|
120
|
+
a worked screen, and [references/app.md](references/app.md) what the app wires around it. Then
|
|
121
|
+
check the file:
|
|
122
|
+
|
|
123
|
+
${commands(run, "validate src/pages/Settings.tsx --framework <framework>")}
|
|
124
|
+
|
|
125
|
+
\`validate\` takes several files. For a whole directory, use \`check\`, which reads each file in its
|
|
126
|
+
own framework:
|
|
127
|
+
|
|
128
|
+
${commands(run, "check src")}
|
|
129
|
+
|
|
130
|
+
The red rules do not read an HTML page. In an \`elements\` project, check a page by reading it
|
|
131
|
+
against the card.
|
|
132
|
+
|
|
133
|
+
## 6. Fix every violation
|
|
134
|
+
|
|
135
|
+
Each violation is a line with the file, the position, the rule and its message. Under it are the
|
|
136
|
+
lawful answers:
|
|
137
|
+
|
|
138
|
+
- \`fix\`: a rewrite with exactly one lawful answer. The \`fix\` command below applies them.
|
|
139
|
+
- \`use\`: the members, props or tokens the message names. A colour, size or spacing becomes a prop
|
|
140
|
+
of a member, as \`component\` lists them. A clickable \`<div>\` becomes a ${f.m("Button")}. A
|
|
141
|
+
glyph from an icon set becomes ${f.m("Icon")} with a role as its ${f.roleProp("Icon")}.
|
|
142
|
+
- \`climb\`: the rungs of the exception ladder that answer the rule. When no member, variant or prop
|
|
143
|
+
fits, follow the \`polymorph-rules\` skill.
|
|
144
|
+
|
|
145
|
+
Apply every rewrite that has one answer, then work through what is left:
|
|
146
|
+
|
|
147
|
+
${commands(run, "fix src/pages/Settings.tsx --framework <framework>")}
|
|
148
|
+
|
|
149
|
+
With \`--dry-run\`, \`fix\` prints the fixed code and writes nothing. Never add an \`eslint-disable\`
|
|
150
|
+
comment for a polymorph rule. Run \`validate\` again until it exits 0.
|
|
151
|
+
|
|
152
|
+
## 7. Look at the screen
|
|
153
|
+
|
|
154
|
+
${commands(run, `render src/screens/inbox.json --system ${DEFAULT_SYSTEM}`, `render src/screens/inbox.json --system ${DEFAULT_SYSTEM} --data src/screens/inbox.data.json`)}
|
|
155
|
+
|
|
156
|
+
\`render\` draws a spec in a browser at a phone width (375 by 812) and a desktop width (1440 by
|
|
157
|
+
900), and lists the layout faults it measured in each. It writes the pictures into a directory
|
|
158
|
+
beside the spec, \`src/screens/inbox.render/\`, named for what it drew and the width:
|
|
159
|
+
|
|
160
|
+
| Drawn | Pictures |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| No data: each input sampled from its type, a list as empty | \`sampled-phone.png\`, \`sampled-desktop.png\` |
|
|
163
|
+
| \`--data <file>\`: the file's value for each input | \`populated-phone.png\`, \`populated-desktop.png\` |
|
|
164
|
+
| \`--empty <file>\`: its values laid over \`--data\`'s, a second drawing | \`empty-phone.png\`, \`empty-desktop.png\` |
|
|
165
|
+
|
|
166
|
+
The \`--data\` file is sample data for the pictures, which the app never reads: a JSON object keyed
|
|
167
|
+
by input name, kept beside the spec (\`src/screens/inbox.data.json\`). A callback input takes no
|
|
168
|
+
value there, because the page stubs it.
|
|
169
|
+
|
|
170
|
+
\`render\` draws with the shipped themes only. \`--system\` names a shipped system, \`--palette\` a
|
|
171
|
+
shipped palette (the system's own when left out) and \`--mode\` \`light\` or \`dark\` (the system's
|
|
172
|
+
default when left out); \`axes\` lists them. It reads no theme document of the app's and not
|
|
173
|
+
\`vite.config\`. Name the shipped pair the app's theme started from: \`init\` copies them into
|
|
174
|
+
\`src/theme/\` under their shipped names. A change the app made to its theme does not reach the
|
|
175
|
+
pictures.
|
|
176
|
+
|
|
177
|
+
Open the pictures and look at them, then read the faults:
|
|
178
|
+
|
|
179
|
+
| Fault | What to change |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| \`sideways-scroll\` | Something is wider than the window. Let an ${f.m("Inline")} wrap (${f.p("Inline", "wrap")}), move actions into a menu, or use a member built to scroll. |
|
|
182
|
+
| \`clipped-text\` | Text does not fit its box. Shorten it, or give its container room. |
|
|
183
|
+
| \`small-target\` | Controls are too small or too close together. Use a larger size or more space between them. |
|
|
184
|
+
| \`cut-off\` | Content lies where nothing scrolls to it. Change the composition. |
|
|
185
|
+
| \`no-gap\` | Two members touch. Put them in a ${f.m("Stack")} or ${f.m("Inline")} with a ${f.p("Stack", "gap")}. |
|
|
186
|
+
| \`unseen-focus\` | A control's focus mark is hidden. Do not put the control in a box that clips it. |
|
|
187
|
+
|
|
188
|
+
Change the composition or a prop to fix a fault, never a style. The first \`render\` on a machine
|
|
189
|
+
may answer that its browser is missing, with the command that downloads it. Run that command once,
|
|
190
|
+
then render again.
|
|
191
|
+
|
|
192
|
+
\`render\` draws specs only. For a screen written in code, run the app and look at it in a browser
|
|
193
|
+
when the session can.
|
|
194
|
+
|
|
195
|
+
## 8. Run the checks
|
|
196
|
+
|
|
197
|
+
${commands(run, "check src")}
|
|
198
|
+
|
|
199
|
+
\`check\` runs the red rules over the directory whatever the project's lint config holds, and exits 1
|
|
200
|
+
on any violation. \`check\` and \`validate\` read the red rules and not a prop's type: a value no
|
|
201
|
+
member takes, such as a tone it does not have, passes both and fails the typecheck. So run the
|
|
202
|
+
project's own lint and typecheck, as \`package.json\` names them. Its lint runs the red rules too
|
|
203
|
+
only when its ESLint config loads them: it imports \`@polymorph/rules\` or spreads the fragment
|
|
204
|
+
\`polymorph.eslint.js\` that \`init\` and \`add\` write.
|
|
205
|
+
|
|
206
|
+
## What application code may not contain
|
|
207
|
+
|
|
208
|
+
- CSS files, \`<style>\` blocks, CSS-in-JS, or a stylesheet import other than a font package's.
|
|
209
|
+
- A \`style\`, \`className\` or \`css\` prop, on a member or a plain element, and a \`class\` on either
|
|
210
|
+
in a framework that writes one. A declared zone lifts this for a plain element (the
|
|
211
|
+
\`polymorph-rules\` skill).
|
|
212
|
+
- A colour (\`#7c3aed\`, \`rgb()\`, \`oklch()\`) or a length (\`12px\`, \`1.5rem\`) in a string.
|
|
213
|
+
- A raw \`<button>\`, \`<input>\`, \`<select>\`, \`<textarea>\` or \`<option>\`, or a click, key or pointer
|
|
214
|
+
handler on a \`<div>\`, \`<span>\`, \`<li>\` or \`<a>\`.
|
|
215
|
+
- An import from an icon set, a motion library or a chart library, or an inline \`<svg>\`.
|
|
216
|
+
- A \`--pm-*\` custom property declared by the app.
|
|
217
|
+
- An \`eslint-disable\` comment for a polymorph rule.
|
|
218
|
+
`;
|
|
219
|
+
return [
|
|
220
|
+
{
|
|
221
|
+
path: "polymorph-screen/SKILL.md",
|
|
222
|
+
contents: skill("polymorph-screen", "Build or change a screen, page, form, dialog or layout in an app that uses the polymorph design system, in React, Vue, Svelte, Solid, Angular or an HTML page. Use for any UI work in a repository whose package.json depends on a @polymorph/* or @metamorph-labs/polymorph-* package, or that has a polymorph.json or polymorph/system-card.md. Covers reading the system card, choosing members, writing a screen spec or framework code, validating it against the red rules, fixing violations, emitting a spec, and rendering it at phone and desktop width to read its layout faults. Its references cover a screen written in code and its container, an AI chat or assistant screen, charts and dashboards, and rich text with mentions and comments.", body)
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
path: "polymorph-screen/references/screen-spec.md",
|
|
226
|
+
contents: specReference(registry)
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
path: "polymorph-screen/references/code.md",
|
|
230
|
+
contents: codeReference(registry, run)
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
path: "polymorph-screen/references/app.md",
|
|
234
|
+
contents: appReference(registry, run)
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
path: "polymorph-screen/references/chat.md",
|
|
238
|
+
contents: chatReference(registry)
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
path: "polymorph-screen/references/charts.md",
|
|
242
|
+
contents: chartsReference(registry, run)
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
path: "polymorph-screen/references/rich-text.md",
|
|
246
|
+
contents: richTextReference(registry)
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
/** The spec format's outline, which does not change with the vocabulary. */
|
|
251
|
+
function specReference(registry) {
|
|
252
|
+
const f = new Facts(registry);
|
|
253
|
+
const rungs = registry.exceptions.ladder.filter((rung) => rung.declaredAs !== null && rung.declaredAs !== "patch").map((rung) => rung.rung);
|
|
254
|
+
return `# The screen spec: \`polymorph-screen/1\`
|
|
255
|
+
|
|
256
|
+
A screen spec is a JSON document that describes one screen: which members it composes, the value of
|
|
257
|
+
each prop, and the inputs its content is bound to. It has no field for a style and no expression
|
|
258
|
+
language. \`validate\` checks it against the vocabulary, and \`emit\` compiles it for the app's
|
|
259
|
+
framework.
|
|
260
|
+
|
|
261
|
+
\`\`\`json
|
|
262
|
+
{
|
|
263
|
+
"spec": "polymorph-screen/1",
|
|
264
|
+
"name": "KeysView",
|
|
265
|
+
"purpose": "The API keys an integration uses, with a way to make another.",
|
|
266
|
+
"inputs": [
|
|
267
|
+
{ "name": "count", "type": "string", "doc": "How many keys exist, already formatted." },
|
|
268
|
+
{ "name": "onCreate", "type": "() => void" }
|
|
269
|
+
],
|
|
270
|
+
"root": {
|
|
271
|
+
"component": "Stack",
|
|
272
|
+
"props": { "gap": 5 },
|
|
273
|
+
"children": [
|
|
274
|
+
{ "component": "Heading", "children": ["API keys"] },
|
|
275
|
+
{ "component": "Text", "props": { "tone": "secondary" }, "children": [{ "$": "count" }] },
|
|
276
|
+
{
|
|
277
|
+
"component": "Button",
|
|
278
|
+
"props": { "variant": "solid", "tone": "accent", "label": "Create key", "onClick": { "$": "onCreate" } }
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
## Fields
|
|
286
|
+
|
|
287
|
+
| Field | Meaning |
|
|
288
|
+
| --- | --- |
|
|
289
|
+
| \`spec\` | Always \`polymorph-screen/1\`. |
|
|
290
|
+
| \`name\` | PascalCase: the name of the component \`emit\` writes. |
|
|
291
|
+
| \`purpose\` | One sentence. It becomes the emitted file's doc comment. |
|
|
292
|
+
| \`inputs\` | What the screen is handed: \`{ "name", "type", "doc"? }\`. \`type\` is one TypeScript type, such as \`string\`, \`Ticket[]\` or \`(id: string) => void\`. Every binding names one of these, a callback included. |
|
|
293
|
+
| \`types\` | Optional. A module mapped to the type names the inputs use, emitted as \`import type\` lines. |
|
|
294
|
+
| \`root\` | One element: the screen's tree. Write it last. |
|
|
295
|
+
|
|
296
|
+
## Elements and values
|
|
297
|
+
|
|
298
|
+
An element is \`{ "component", "props"?, "children"?, "exception"? }\`. \`component\` is a member or
|
|
299
|
+
one of its parts (such as ${f.part("Table", "Row")}), as the card lists them for the
|
|
300
|
+
app's framework.
|
|
301
|
+
|
|
302
|
+
A value, as a prop or a child, is a string, a number, a boolean, \`null\`, an element, a list, a
|
|
303
|
+
binding \`{ "$": "inputName" }\`, or a structured object \`{ "$object": { … } }\` for data a prop
|
|
304
|
+
takes.
|
|
305
|
+
|
|
306
|
+
A prop whose type is a node, such as ${f.m("Dashboard")}'s ${f.p("Dashboard", "actions")} and
|
|
307
|
+
${f.p("Dashboard", "primary")}, takes an element as its value, or a list of elements, which \`emit\`
|
|
308
|
+
writes as a fragment. This \`root\` is a dashboard whose action goes to another page and whose main
|
|
309
|
+
column is one ${f.part("Dashboard", "Panel")} holding a chart. Its spec declares the inputs
|
|
310
|
+
\`byDay\`, \`loading\` and \`onNavigate\`:
|
|
311
|
+
|
|
312
|
+
\`\`\`json
|
|
313
|
+
{
|
|
314
|
+
"component": "Dashboard",
|
|
315
|
+
"props": {
|
|
316
|
+
"title": "Support",
|
|
317
|
+
"actions": {
|
|
318
|
+
"component": "Link",
|
|
319
|
+
"props": { "href": "/tickets/new", "variant": "button", "buttonVariant": "solid", "onNavigate": { "$": "onNavigate" } },
|
|
320
|
+
"children": ["New ticket"]
|
|
321
|
+
},
|
|
322
|
+
"primary": {
|
|
323
|
+
"component": "Dashboard.Panel",
|
|
324
|
+
"props": { "title": "Opened and resolved" },
|
|
325
|
+
"children": [
|
|
326
|
+
{
|
|
327
|
+
"component": "LineChart",
|
|
328
|
+
"props": {
|
|
329
|
+
"label": "Tickets opened and resolved by day",
|
|
330
|
+
"data": { "$": "byDay" },
|
|
331
|
+
"loading": { "$": "loading" },
|
|
332
|
+
"series": [
|
|
333
|
+
{ "$object": { "key": "opened", "label": "Opened" } },
|
|
334
|
+
{ "$object": { "key": "resolved", "label": "Resolved" } }
|
|
335
|
+
],
|
|
336
|
+
"x": { "$object": { "key": "day", "scale": "time", "label": "Day" } }
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
\`\`\`
|
|
344
|
+
|
|
345
|
+
A binding names a declared input, or a dotted path into one (\`draft.subject\`). It is never an
|
|
346
|
+
expression: no call, operator or index. A value the screen needs computed, such as a count or a
|
|
347
|
+
filtered list, is computed by the container and passed in as an input of its own.
|
|
348
|
+
|
|
349
|
+
A spec has no condition. Every element is rendered whenever the screen is. Content that is
|
|
350
|
+
sometimes absent is a prop bound to an input that is empty while there is nothing to show, on a
|
|
351
|
+
member that draws nothing when it is given nothing.
|
|
352
|
+
|
|
353
|
+
## Exceptions
|
|
354
|
+
|
|
355
|
+
An element may declare a rung of the exception ladder (rungs ${rungs.join(" and ")} on a
|
|
356
|
+
primitive, and rung 3 as a \`patch\` prop) with the reason:
|
|
357
|
+
|
|
358
|
+
\`\`\`json
|
|
359
|
+
{
|
|
360
|
+
"component": "DensityScope",
|
|
361
|
+
"props": { "value": "compact" },
|
|
362
|
+
"exception": { "rung": 2, "because": "A queue is scanned, so more rows per screen is worth more here." },
|
|
363
|
+
"children": []
|
|
364
|
+
}
|
|
365
|
+
\`\`\`
|
|
366
|
+
|
|
367
|
+
## The loop
|
|
368
|
+
|
|
369
|
+
1. Write the spec from the card and the members \`component\` describes.
|
|
370
|
+
2. \`validate\` it. Each fault names its path and, for a wrong name, the nearest real ones.
|
|
371
|
+
3. Correct and validate again until it is lawful.
|
|
372
|
+
4. \`render\` it and read the pictures and the layout faults. Correct the composition and render
|
|
373
|
+
again.
|
|
374
|
+
5. \`emit\` it into the app, and write or update the container that renders it.
|
|
375
|
+
`;
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
export { screenSkill };
|