mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-09 02:40:45 +08:00
Stop requiring dsh-client-store in the Plugins card bundle.
Shipped dsh web seed has no client-store entry; use a private snapshot store and only externalize platform seed modules. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e45657b1ee
commit
69a4820369
6 changed files with 78 additions and 25 deletions
|
|
@ -3,8 +3,8 @@
|
|||
* Self-contained (cannot value-import ui-settings-plugins — client bundle purity).
|
||||
*/
|
||||
|
||||
import { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import type { SettingsScope, SettingsScopeSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
|
||||
import { createSnapshotStore, type SnapshotStore } from './snapshot-store.ts'
|
||||
|
||||
export type FieldWrite = { kind: 'set'; value: unknown } | { kind: 'clear' }
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
||||
import type {} from '@deepseek-ai/dsh-api-remotes/client'
|
||||
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import type { SettingsScope, SettingsScopeSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
|
||||
import type { SnapshotStore } from './snapshot-store.ts'
|
||||
import {
|
||||
CardForm, textField,
|
||||
type CardActions, type CardFieldState, type CardShell,
|
||||
|
|
|
|||
34
src/client/snapshot-store.ts
Normal file
34
src/client/snapshot-store.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Minimal snapshot store for the Plugins card.
|
||||
*
|
||||
* Shipped DSH web (`@deepseek-ai/dsh` ≤0.1.1-rc.2) seeds only react / cordis /
|
||||
* ui-slots / ui-primitives — not `@deepseek-ai/dsh-client-store`. Keep this
|
||||
* private so the client bundle does not require that package.
|
||||
*/
|
||||
|
||||
export interface SnapshotStore<T> {
|
||||
getSnapshot: () => T
|
||||
subscribe: (listener: () => void) => () => void
|
||||
set: (next: T) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a synchronous snapshot store (same-tick notify for controlled inputs).
|
||||
* @param init - initial snapshot.
|
||||
* @returns the store.
|
||||
*/
|
||||
export function createSnapshotStore<T>(init: T): SnapshotStore<T> {
|
||||
let state = init
|
||||
const listeners = new Set<() => void>()
|
||||
return {
|
||||
getSnapshot: () => state,
|
||||
subscribe: (listener) => {
|
||||
listeners.add(listener)
|
||||
return () => { listeners.delete(listener) }
|
||||
},
|
||||
set: (next) => {
|
||||
state = next
|
||||
for (const listener of [...listeners]) listener()
|
||||
},
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue