MCPcopy
hub / github.com/tinyplex/tinybase / useEditable

Function useEditable

src/ui-solid-inspector/index.tsx:114–131  ·  view source on GitHub ↗
(
  uniqueId: Id,
  s: Store,
)

Source from the content-addressed store, hash-verified

112type ChildrenProp = {readonly children?: JSXElement};
113
114const useEditable = (
115 uniqueId: Id,
116 s: Store,
117): [Accessor<boolean>, (event: MouseEvent) => void] => {
118 const storedEditable = useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s);
119 const [editable, setEditable] = createSignal(false);
120 createEffect(() => setEditable(!!storedEditable()));
121 return [
122 editable,
123 (event) => {
124 event.preventDefault();
125 event.stopPropagation();
126 const nextEditable = !editable();
127 setEditable(nextEditable);
128 s.setCell(STATE_TABLE, uniqueId, EDITABLE_CELL, nextEditable);
129 },
130 ];
131};
132
133const useHasTableCallback = (storeOrStoreId: StoreOrStoreId | undefined) => {
134 const store = useStoreOrStoreById(storeOrStoreId);

Callers 5

ValuesViewFunction · 0.70
TableViewFunction · 0.70
TablesViewFunction · 0.70
SliceViewFunction · 0.70
RelationshipViewFunction · 0.70

Calls 3

useCellFunction · 0.90
setCellMethod · 0.65
editableFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…