Add wippy/wc-content-kit module — auto-registered mermaid / markdown / chartjs web components#52
Open
AndrewKirkovski wants to merge 1 commit intomasterfrom
Open
Add wippy/wc-content-kit module — auto-registered mermaid / markdown / chartjs web components#52AndrewKirkovski wants to merge 1 commit intomasterfrom
AndrewKirkovski wants to merge 1 commit intomasterfrom
Conversation
…s web components
Adds `wippy/wc-content-kit` — a self-contained framework module that
auto-registers three Wippy web components for content rendering in
chat / artifacts / pages:
• <wippy-mermaid> — any Mermaid v11 diagram via `definition` attr
• <wippy-markdown> — GFM rendered through markdown-it + sanitize-html
• <wippy-chartjs> — universal Chart.js v4 wrapper supporting all 8
chart types from a single tag
Integrators add the dependency once (`kind: ns.dependency`,
`component: wippy/wc-content-kit`) and the tags become available
everywhere chat content is rendered — no copy-paste, no per-app wiring.
Mermaid + markdown source carried over byte-identical from the
battle-tested `app-template/frontend/web-components/{mermaid,markdown}/`
templates. Chartjs extended from `chart-circle/` (single-purpose
doughnut) into a universal Chart.js wrapper that registers all
controllers, scales, and elements at module load and falls back to
the host CSS palette when datasets omit colors.
Module contents:
wippy.yaml — org/module/embed declaration
_index.yaml — ns.requirement (server) + http.static
(/wippy/wc-content-kit/) + 3× registry.entry
with full props schemas + AI-ready descriptions
Makefile — build / clean / per-component targets
README.md — 7-section reference: integration snippet,
per-tag attribute tables and 8-9 examples each,
AI prompting notes, build instructions
frontend/{name}/ — Vue 3 + Vite source for each component
public/{name}/ — pre-built bundles (committed; ship-ready)
Live integration test verified in real Wippy host:
- GET /api/public/components/list exposes all three tags with
auto_register=true and correct base_urls under /wippy/wc-content-kit
- All bundles serve HTTP 200 from http.static
- Custom elements registered, mounted in Shadow DOM, render expected
content (SVGs / canvases / sanitized HTML)
- Theme palette inheritance works for chartjs (--p-primary-500 etc.)
- Error path produces inline error banner instead of crashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new framework module
wippy/wc-content-kitthat ships three auto-registered Wippy web components for content rendering in chat / artifacts / pages:<wippy-mermaid>— any Mermaid v11 diagram via thedefinitionattribute (flowchart, sequence, class, state, ER, gantt, pie, mindmap, gitGraph, +12 more)<wippy-markdown>— GitHub-Flavored Markdown rendered through markdown-it + sanitize-html<wippy-chartjs>— universal Chart.js v4 wrapper supporting all 8 chart types (line / bar / doughnut / pie / radar / polarArea / scatter / bubble) from a single tagAn integrator drops the dependency in once and gets all three tags auto-registered everywhere chat content is rendered — no copy-paste, no per-app wiring:
Why this module exists
Today every Wippy-hosted app that wants Mermaid diagrams, rich Markdown, or Chart.js charts in chat content has to copy-paste three component packages out of
app-template/frontend/web-components/and wire them into its own static-build pipeline. Every version bump means re-syncing each integrator. The components themselves are stable, generic, and reusable — they just lived in the wrong place.This is the first of an expected
wc-*-kitfamily pattern (next likely siblings:wc-form-kit,wc-data-kit, …) — each kit groups related web components by domain, distinguished from backend modules by thewc-prefix.What's in the module
Mermaid + markdown source carried over byte-identical from the battle-tested
app-template/frontend/web-components/{mermaid,markdown}/templates. Chartjs extended fromchart-circle/(single-purpose doughnut) into a universal Chart.js wrapper that:Chart.register(...registerables)(with idempotency guard)--p-primary-500,--p-danger-500,--p-warn-500,--p-secondary-500,--p-accent-500+ 300 tones) when datasets omitbackgroundColordocument.documentElement)responsive: true+maintainAspectRatio: falseso charts fill host-sized wrappersHow auto-registration works
After the module is consumed via
ns.dependency, on the next host start:GET /api/public/components/list?auto_register=trueincludes the three new entries<script type=\"module\" src=\".../wippy/wc-content-kit/{name}/index.js?declare-tag=wippy-{name}\">per component at bootdefine(import.meta.url, …)reads the?declare-tag=query and callscustomElements.define(…)Verification (live integration test)
Verified end-to-end in a real Wippy host running app-template:
GET /api/public/components/listwithauto_register: trueand correct base URLs under/wippy/wc-content-kit/{name}/http.staticentrybackgroundColor: '#hex',rgba(...)for transparency, per-data-point color arrays)data='not-json'→Invalid data JSON: ...)Build
Build outputs land in
public/{name}/. Thehttp.staticentry serves them at/wippy/wc-content-kit/{name}/.