@goodandready/dsh-moa 0.2.17 → 0.2.18
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/lib/client.js +25 -9
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -18,6 +18,10 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
var exports = module.exports
|
|
19
19
|
const React = require('react')
|
|
20
20
|
const NS = 'dsh-moa'
|
|
21
|
+
// Plugins page row seat (DSH 0.1.6-alpha.2): key = '<package name>#<row id>'.
|
|
22
|
+
const PKG = '@goodandready/dsh-moa'
|
|
23
|
+
const ROW_ID = 'dsh-moa'
|
|
24
|
+
const ROW_CONFIG_KEY = PKG + '#' + ROW_ID
|
|
21
25
|
const TITLE = 'Mixture of Agents (MoA)'
|
|
22
26
|
const SUBTITLE = 'Ensemble parallel candidate generation with judge synthesis via /moa.'
|
|
23
27
|
|
|
@@ -1827,16 +1831,24 @@ window.__ModuleLoader__.load({
|
|
|
1827
1831
|
function MoACard(props) {
|
|
1828
1832
|
ensureStyles()
|
|
1829
1833
|
const state = useMoASettings(props)
|
|
1830
|
-
const
|
|
1834
|
+
const page = !!(props && props.view === 'page')
|
|
1835
|
+
const [open, setOpen] = React.useState(!!page)
|
|
1836
|
+
|
|
1837
|
+
// Row seat (plugins.row.config): the host page draws title/icon/crumb and the
|
|
1838
|
+
// padding, so the summary is a one-liner and the page drops our card chrome.
|
|
1839
|
+
if (props && props.view === 'summary') {
|
|
1840
|
+
return React.createElement('div', { className: 'moa-sub' }, state.t('description') || SUBTITLE)
|
|
1841
|
+
}
|
|
1831
1842
|
|
|
1832
1843
|
return React.createElement(
|
|
1833
|
-
'li',
|
|
1834
|
-
{ className: 'moa-card' },
|
|
1844
|
+
page ? 'div' : 'li',
|
|
1845
|
+
{ className: page ? 'moa-page' : 'moa-card' },
|
|
1835
1846
|
React.createElement(
|
|
1836
1847
|
'button',
|
|
1837
1848
|
{
|
|
1838
1849
|
type: 'button',
|
|
1839
1850
|
className: 'moa-head',
|
|
1851
|
+
style: page ? { display: 'none' } : undefined,
|
|
1840
1852
|
'aria-expanded': open,
|
|
1841
1853
|
onClick: () => setOpen(!open),
|
|
1842
1854
|
},
|
|
@@ -1908,12 +1920,12 @@ window.__ModuleLoader__.load({
|
|
|
1908
1920
|
}
|
|
1909
1921
|
|
|
1910
1922
|
if (ctx.slots) {
|
|
1911
|
-
const registerCard = () => {
|
|
1923
|
+
const registerCard = (slotName, key) => () => {
|
|
1912
1924
|
try {
|
|
1913
1925
|
ctx.slots.register(
|
|
1914
1926
|
{
|
|
1915
|
-
name:
|
|
1916
|
-
key
|
|
1927
|
+
name: slotName,
|
|
1928
|
+
key,
|
|
1917
1929
|
order: 35,
|
|
1918
1930
|
locale: NS,
|
|
1919
1931
|
inject: () => ({ ctx }),
|
|
@@ -1921,14 +1933,18 @@ window.__ModuleLoader__.load({
|
|
|
1921
1933
|
(props) => React.createElement(MoAErrorBoundary, null, React.createElement(MoACard, props))
|
|
1922
1934
|
)
|
|
1923
1935
|
} catch (err) {
|
|
1924
|
-
console.warn('[dsh-moa] Failed to register
|
|
1936
|
+
console.warn('[dsh-moa] Failed to register ' + slotName + ':', err)
|
|
1925
1937
|
}
|
|
1926
1938
|
}
|
|
1927
1939
|
|
|
1928
1940
|
if (typeof ctx.slots.inject === 'function') {
|
|
1929
|
-
|
|
1941
|
+
// Row seat first (the seat the current core renders), legacy seat kept as a
|
|
1942
|
+
// fallback for older cores.
|
|
1943
|
+
ctx.slots.inject('plugins.row.config', registerCard('plugins.row.config', ROW_CONFIG_KEY))
|
|
1944
|
+
ctx.slots.inject('settings.plugin.item', registerCard('settings.plugin.item', NS))
|
|
1930
1945
|
} else {
|
|
1931
|
-
registerCard()
|
|
1946
|
+
registerCard('plugins.row.config', ROW_CONFIG_KEY)()
|
|
1947
|
+
registerCard('settings.plugin.item', NS)()
|
|
1932
1948
|
}
|
|
1933
1949
|
}
|
|
1934
1950
|
|