dev(doc): Align API modules and strengthen Connect/registry contract …#48
Merged
Conversation
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
Aligns imperative API documentation patterns, removes duplicated TreeView API implementations, and adds ExUnit contract tests so registry ↔ Connect ↔ hook wiring stays consistent. Moduledoc Flagpack examples now use
String.to_existing_atom/1instead ofString.to_atom/1; e2e demo snippets were updated to match doc parity.Changes
lib/components/tree_view.exset_expanded_value,set_selected_value,value,expanded_value) delegates toCorex.TreeView.Apiinstead of duplicatingJS.dispatch/push_eventin the component modulevalue/expanded_valueuse thin wrappers where arity or guards differ fromApilib/components/accordion.eximport Corex.Api.Doc@doc type: :apiblocks withapi_doc(...)/""")(same pattern as other components)Moduledoc examples (
String.to_existing_atom)lib/components/select.exlib/components/combobox.exlib/components/listbox.exE2e doc parity
e2e/lib/e2e_web/demos/select_demo.ex(extended_code,extended_grouped_code)e2e/lib/e2e_web/demos/combobox_demo.ex(extended_code,extended_grouped_code)Tests
test/corex/api_modules_contract_test.exs: no raw@doc type: :api; API modules useCorex.Api.DocorCorex.Api.Imports; Checkbox/TreeView delegateset_*to*.Apitest/corex/connect_registry_contract_test.exs: hooked components have loadableconnect_modulewithprops/1orgroup/1(Toast); naming conventionCorex.<Component>.Connect; wire JSON ids match registryWhy
Checkbox already split imperative API into
*.Api+defdelegate; TreeView had a full duplicate intree_view.exandtree_view/api.ex. Accordion was the only component still using hand-written@doc type: :api. Contract tests catch registry/Connect drift early (complements existing hooks export and Vitest contract tests). ModuledocString.to_atomon user-controlled values is a footgun; examples now show the safer pattern.Breaking changes
None. Public API and runtime behavior unchanged.
Test plan
mix test test/corex/api_modules_contract_test.exs test/corex/connect_registry_contract_test.exsmix lint(doc parity 25/25, Credo, Sobelow)