format: apply repo prettier (3.8.1) to the folded skills tree
963 markdown files reformatted with the repository's pinned prettier so pnpm format:check covers the folded tree like every other repo file. The formatter's embedded-language pass also normalized code fences (TS semicolons, closed HTML tags in examples, lowercased CSS hex colors, one renumbered list that skipped an index). Alphanumeric token deltas vs the fold commit were audited file-by-file; all are formatter-equivalent markup normalizations plus the four sanitized skills.
This commit is contained in:
+26
-26
@@ -20,8 +20,8 @@ dependency-injectable.
|
||||
```tsx
|
||||
function ComposerInput() {
|
||||
// Tightly coupled to a specific hook
|
||||
const { input, setInput } = useChannelComposerState()
|
||||
return <TextInput value={input} onChangeText={setInput} />
|
||||
const { input, setInput } = useChannelComposerState();
|
||||
return <TextInput value={input} onChangeText={setInput} />;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -30,27 +30,27 @@ function ComposerInput() {
|
||||
```tsx
|
||||
// Define a GENERIC interface that any provider can implement
|
||||
interface ComposerState {
|
||||
input: string
|
||||
attachments: Attachment[]
|
||||
isSubmitting: boolean
|
||||
input: string;
|
||||
attachments: Attachment[];
|
||||
isSubmitting: boolean;
|
||||
}
|
||||
|
||||
interface ComposerActions {
|
||||
update: (updater: (state: ComposerState) => ComposerState) => void
|
||||
submit: () => void
|
||||
update: (updater: (state: ComposerState) => ComposerState) => void;
|
||||
submit: () => void;
|
||||
}
|
||||
|
||||
interface ComposerMeta {
|
||||
inputRef: React.RefObject<TextInput>
|
||||
inputRef: React.RefObject<TextInput>;
|
||||
}
|
||||
|
||||
interface ComposerContextValue {
|
||||
state: ComposerState
|
||||
actions: ComposerActions
|
||||
meta: ComposerMeta
|
||||
state: ComposerState;
|
||||
actions: ComposerActions;
|
||||
meta: ComposerMeta;
|
||||
}
|
||||
|
||||
const ComposerContext = createContext<ComposerContextValue | null>(null)
|
||||
const ComposerContext = createContext<ComposerContextValue | null>(null);
|
||||
```
|
||||
|
||||
**UI components consume the interface, not the implementation:**
|
||||
@@ -61,7 +61,7 @@ function ComposerInput() {
|
||||
state,
|
||||
actions: { update },
|
||||
meta,
|
||||
} = use(ComposerContext)
|
||||
} = use(ComposerContext);
|
||||
|
||||
// This component works with ANY provider that implements the interface
|
||||
return (
|
||||
@@ -70,7 +70,7 @@ function ComposerInput() {
|
||||
value={state.input}
|
||||
onChangeText={(text) => update((s) => ({ ...s, input: text }))}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -79,9 +79,9 @@ function ComposerInput() {
|
||||
```tsx
|
||||
// Provider A: Local state for ephemeral forms
|
||||
function ForwardMessageProvider({ children }: { children: React.ReactNode }) {
|
||||
const [state, setState] = useState(initialState)
|
||||
const inputRef = useRef(null)
|
||||
const submit = useForwardMessage()
|
||||
const [state, setState] = useState(initialState);
|
||||
const inputRef = useRef(null);
|
||||
const submit = useForwardMessage();
|
||||
|
||||
return (
|
||||
<ComposerContext
|
||||
@@ -93,13 +93,13 @@ function ForwardMessageProvider({ children }: { children: React.ReactNode }) {
|
||||
>
|
||||
{children}
|
||||
</ComposerContext>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Provider B: Global synced state for channels
|
||||
function ChannelProvider({ channelId, children }: Props) {
|
||||
const { state, update, submit } = useGlobalChannel(channelId)
|
||||
const inputRef = useRef(null)
|
||||
const { state, update, submit } = useGlobalChannel(channelId);
|
||||
const inputRef = useRef(null);
|
||||
|
||||
return (
|
||||
<ComposerContext
|
||||
@@ -111,7 +111,7 @@ function ChannelProvider({ channelId, children }: Props) {
|
||||
>
|
||||
{children}
|
||||
</ComposerContext>
|
||||
)
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -165,21 +165,21 @@ function ForwardMessageDialog() {
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</ForwardMessageProvider>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// This button lives OUTSIDE Composer.Frame but can still submit based on its context!
|
||||
function ForwardButton() {
|
||||
const {
|
||||
actions: { submit },
|
||||
} = use(ComposerContext)
|
||||
return <Button onPress={submit}>Forward</Button>
|
||||
} = use(ComposerContext);
|
||||
return <Button onPress={submit}>Forward</Button>;
|
||||
}
|
||||
|
||||
// This preview lives OUTSIDE Composer.Frame but can read composer's state!
|
||||
function MessagePreview() {
|
||||
const { state } = use(ComposerContext)
|
||||
return <Preview message={state.input} attachments={state.attachments} />
|
||||
const { state } = use(ComposerContext);
|
||||
return <Preview message={state.input} attachments={state.attachments} />;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user