@effect.healthcare/messenger 0.3.1
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/.claude/CLAUDE.md +88 -0
- package/.claude/context/composition.md +921 -0
- package/.claude/context/data.md +1036 -0
- package/.claude/context/event.md +686 -0
- package/.claude/context/gesture.md +614 -0
- package/.claude/context/operation.md +596 -0
- package/.claude/context/state.md +864 -0
- package/.claude/context/testing.md +876 -0
- package/.claude/context/validation.md +350 -0
- package/.claude/context/workflow.md +608 -0
- package/.claude/settings.local.json +11 -0
- package/.mcp.json +12 -0
- package/LICENSE +144 -0
- package/README.md +98 -0
- package/dist/.gitkeep +1 -0
- package/dist/component.style.css +6 -0
- package/dist/component.template.html +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/messenger.d.ts +181 -0
- package/dist/messenger.js +295 -0
- package/dist/messenger.meta.d.ts +117 -0
- package/dist/messenger.meta.js +79 -0
- package/dist/messenger.style.css +6 -0
- package/dist/messenger.template.html +1 -0
- package/dist/messenger.validation.d.ts +15 -0
- package/dist/messenger.validation.js +22 -0
- package/package.json +55 -0
- package/src/index.ts +16 -0
- package/src/messenger.meta.ts +131 -0
- package/src/messenger.ts +347 -0
- package/src/messenger.validation.ts +25 -0
- package/web-dev-server.config.mjs +8 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Web Component
|
|
2
|
+
|
|
3
|
+
A web component built on the `@scalable.software/component` framework. The policies in `.claude/context/` govern how component specifications are transformed into solid implementations.
|
|
4
|
+
|
|
5
|
+
## How This Project Works
|
|
6
|
+
|
|
7
|
+
Every component is developed through a specification-driven, test-first pipeline. The specification declares the public contract; the implementation honors it; the tests verify it; the commit history records the transformation.
|
|
8
|
+
|
|
9
|
+
When working on a component, translate the specification into an implementation that conforms to all applicable policies — without inventing structure, behavior, or vocabulary the specification does not declare.
|
|
10
|
+
|
|
11
|
+
## Translation Pipeline
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<component>.specifications.json ← source of truth
|
|
15
|
+
│
|
|
16
|
+
├─→ <component>.meta.ts vocabulary + value-domain types
|
|
17
|
+
├─→ <component>.validation.ts Validate class — runtime enforcement
|
|
18
|
+
├─→ <component>.ts state, operations, events, gestures
|
|
19
|
+
├─→ <component>.template.html realized composition
|
|
20
|
+
└─→ <component>.style.css realized presentation
|
|
21
|
+
|
|
22
|
+
verified by:
|
|
23
|
+
test/unit/<component>.meta.test.ts — vocabulary tests
|
|
24
|
+
test/unit/<component>.validation.test.ts — validator tests
|
|
25
|
+
test/unit/<component>.test.ts — component behavioral tests
|
|
26
|
+
|
|
27
|
+
recorded by:
|
|
28
|
+
FAIL/PASS commit pairs, policy-ordered, one prefix per commit
|
|
29
|
+
DOCUMENTATION → FEATURE closes each feature branch
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Names predictably transform across layers. A state named `visibility` in the specification becomes `Attributes.VISIBILITY` + `State.VISIBILITY` in metadata, `Validate.visibility` in validation, `get visibility()`/`set visibility(...)` on the class, `state(State.VISIBILITY, ...)` in tests, and `STATE: ...` in commits.
|
|
33
|
+
|
|
34
|
+
## Implementation Order
|
|
35
|
+
|
|
36
|
+
Within any behavioral feature, work proceeds top-down through the policy hierarchy:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
COMPOSITION → STATE → VALIDATION → OPERATION → EVENT → STYLE → GESTURE → DOCUMENTATION → FEATURE
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Each layer depends on the layers above. CSS-only features collapse to `STYLE → FEATURE`. See `@context/workflow.md` for the full sequence and per-layer commit format.
|
|
43
|
+
|
|
44
|
+
## Implementation Policies
|
|
45
|
+
|
|
46
|
+
Each policy file opens with a **How to Read This Policy** rubric that classifies its rules as one of three strengths:
|
|
47
|
+
|
|
48
|
+
- **Principles** — non-negotiable; derived from framework correctness or TDD discipline.
|
|
49
|
+
- **Templates** — invariant skeletons with explicit variation points based on declared classification (e.g., attribute-backed vs non-attribute, readonly vs writable, payload-bearing vs payload-free).
|
|
50
|
+
- **Conventions** — canonical defaults that keep implementations readable across components.
|
|
51
|
+
|
|
52
|
+
When a new component's shape conflicts with a rule, classify the rule before reconciling: a principle conflict is a defect; a template conflict means a variation point needs to be made explicit; a convention conflict is a documented deviation.
|
|
53
|
+
|
|
54
|
+
### Specification-driven (per component)
|
|
55
|
+
|
|
56
|
+
@context/composition.md — structural parts and cached references
|
|
57
|
+
@context/data.md — canonical component-owned content
|
|
58
|
+
@context/state.md — runtime mode, visibility, status, persistence
|
|
59
|
+
@context/operation.md — public imperative actions
|
|
60
|
+
@context/event.md — observable semantic outcomes
|
|
61
|
+
@context/gesture.md — interaction inputs
|
|
62
|
+
@context/validation.md — runtime enforcement of declared value domains
|
|
63
|
+
|
|
64
|
+
### Cross-cutting (every component)
|
|
65
|
+
|
|
66
|
+
@context/testing.md — test file structure, BDD vocabulary, coverage contracts
|
|
67
|
+
@context/workflow.md — branching, commit sequencing, TDD discipline
|
|
68
|
+
|
|
69
|
+
## Working Principles
|
|
70
|
+
|
|
71
|
+
- **Test first.** Every behavioral change starts with a failing test. The FAIL commit precedes the PASS commit. No exceptions.
|
|
72
|
+
- **One feature per branch.** Behavioral work is never committed directly to main.
|
|
73
|
+
- **One concern per commit.** Every commit message begins with a canonical prefix.
|
|
74
|
+
- **Trace names across layers.** A specification name reappears unchanged — modulo standard transformations — in metadata, validation, class API, tests, and commits.
|
|
75
|
+
- **Specification is authoritative.** Implementations do not invent structure, behavior, or vocabulary the specification does not declare. If a component's shape does not fit a policy rule, examine the policy's variation points — do not bypass them.
|
|
76
|
+
|
|
77
|
+
## Running the Demo in a Browser (chrome-devtools MCP)
|
|
78
|
+
|
|
79
|
+
For advanced testing or debugging, the live web component can be served and driven through the `chrome-devtools` MCP. This gives access to the rendered component, its shadow DOM, the console, and DOM manipulation.
|
|
80
|
+
|
|
81
|
+
1. **Start the dev server** — `npm run serve`. The `preserve` hook builds first (`src/` → `dist/`), and `web-dev-server.config.mjs` is auto-loaded (`rootDir: "."`, `port: 8000`, `watch: true`). Run it in the background. The server serves the repo root because the demo loads `../importmap` and `./dist` via the import map.
|
|
82
|
+
2. **Navigate the controlled browser** — `mcp__chrome-devtools__navigate_page` to `http://localhost:8000/demo/index.html`. Always use the explicit `/demo/index.html` path; the demo uses relative asset paths and will not resolve at `/`.
|
|
83
|
+
3. **Verify** — `mcp__chrome-devtools__evaluate_script` to inspect the component (e.g. `customElements.get("app-messenger")` is defined; the base framework exposes the shadow root as `el.root`); `mcp__chrome-devtools__list_console_messages` to check for errors.
|
|
84
|
+
4. **Clean up when done** — navigate the page to `about:blank` (the MCP keeps one page alive, so the last page cannot be closed), then stop the dev server process on port 8000.
|
|
85
|
+
|
|
86
|
+
Notes:
|
|
87
|
+
- MCP tool schemas must be loaded via `ToolSearch` (`select:<name>`) before first use each session.
|
|
88
|
+
- If a stale server already holds port 8000, the new one fails to bind — kill the straggler rather than letting it drift to another port.
|