@goodandready/dsh-subscriptions 0.2.7 → 0.2.9
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 +69 -21
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -6,27 +6,41 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
const React = require('react')
|
|
7
7
|
|
|
8
8
|
const CSS =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
// card — same structure as core PluginCard (bash, agent-loop, web-search)
|
|
10
|
+
'.dsub-card{list-style:none;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;transition:border-color .16s,background .16s}' +
|
|
11
|
+
'.dsub-card:hover{border-color:var(--dsw-alias-label-dimmed)}' +
|
|
12
|
+
'.dsub-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}' +
|
|
13
|
+
'.dsub-header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}' +
|
|
14
|
+
'.dsub-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}' +
|
|
15
|
+
'.dsub-headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}' +
|
|
16
|
+
'.dsub-name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}' +
|
|
17
|
+
'.dsub-description{color:var(--dsw-alias-label-secondary);font-size:13px}' +
|
|
18
|
+
'.dsub-chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}' +
|
|
19
|
+
'.dsub-chevronOpen{transform:rotate(180deg)}' +
|
|
20
|
+
'.dsub-body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}' +
|
|
21
|
+
// existing dsub classes kept for SubsSection internals
|
|
22
|
+
'.dsub-wrap{display:flex;flex-direction:column;gap:22px;padding:4px 0;max-width:760px}' +
|
|
23
|
+
'.dsub-block{display:flex;flex-direction:column;gap:10px}' +
|
|
24
|
+
'.dsub-h{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}' +
|
|
25
|
+
'.dsub-sub{font-size:12px;color:var(--dsw-alias-label-secondary)}' +
|
|
26
|
+
'.dsub-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}' +
|
|
27
|
+
'.dsub-row input,.dsub-field input,.dsub-row select{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:6px 8px;font-size:13px}' +
|
|
28
|
+
'.dsub-grow{flex:1;min-width:180px}' +
|
|
29
|
+
'.dsub-field{display:flex;flex-direction:column;gap:6px;padding:12px 0}' +
|
|
30
|
+
'.dsub-input{height:34px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px}' +
|
|
31
|
+
'.dsub-mini{border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);border-radius:6px;height:28px;padding:0 8px;cursor:pointer}' +
|
|
32
|
+
'.dsub-foot{border-top:1px solid var(--dsw-alias-border-l2);display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px}' +
|
|
33
|
+
'.dsub-save{appearance:none;font:inherit;cursor:pointer;border:1px solid transparent;border-radius:8px;padding:5px 14px;font-size:13px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}' +
|
|
34
|
+
'.dsub-ok{font-size:12px;color:var(--dsw-alias-state-success-primary)}' +
|
|
35
|
+
'.dsub-bad{font-size:12px;color:var(--dsw-alias-state-error-primary)}' +
|
|
36
|
+
'.dsub-badge{font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap}' +
|
|
37
|
+
'.dsub-badge-on{color:var(--dsw-alias-state-success-primary);border-color:currentColor}' +
|
|
38
|
+
'.dsub-badge-warn{color:var(--dsw-alias-state-warning-primary);border-color:currentColor}' +
|
|
39
|
+
'.dsub-link{background:none;border:none;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;padding:0}' +
|
|
40
|
+
'.dsub-verify{font-size:12px;color:var(--dsw-alias-state-warning-primary)}' +
|
|
41
|
+
'.dsub-verify a{color:var(--dsw-alias-brand-primary)}'
|
|
28
42
|
|
|
29
|
-
|
|
43
|
+
const cssId = 'dsh-subscriptions/settings.module.css'
|
|
30
44
|
if (typeof document !== 'undefined' && !document.querySelector('style[data-plugin-css="' + cssId + '"]')) {
|
|
31
45
|
const tag = document.createElement('style')
|
|
32
46
|
tag.textContent = CSS
|
|
@@ -360,7 +374,7 @@ window.__ModuleLoader__.load({
|
|
|
360
374
|
}, t('addAccount')),
|
|
361
375
|
)
|
|
362
376
|
}),
|
|
363
|
-
React.createElement('div', { className: 'dsub-
|
|
377
|
+
React.createElement('div', { className: 'dsub-foot' },
|
|
364
378
|
React.createElement('button', {
|
|
365
379
|
type: 'button', className: 'dsub-save',
|
|
366
380
|
onClick: () => save().catch((e) => setErr(String(e.message || e))),
|
|
@@ -371,6 +385,40 @@ window.__ModuleLoader__.load({
|
|
|
371
385
|
)
|
|
372
386
|
}
|
|
373
387
|
|
|
388
|
+
// Карточка во вкладке «Плагины» — как карточки bash/agent-loop/web-search:
|
|
389
|
+
// заголовок с именем, описанием и шевроном, сворачивание, каёмка.
|
|
390
|
+
function PluginCard(props) {
|
|
391
|
+
const t = (props && props.t) || ((key) => key)
|
|
392
|
+
const [open, setOpen] = React.useState(false)
|
|
393
|
+
return React.createElement('li', {
|
|
394
|
+
className: 'dsub-card' + (open ? ' dsub-cardOpen' : ''),
|
|
395
|
+
},
|
|
396
|
+
React.createElement('button', {
|
|
397
|
+
type: 'button',
|
|
398
|
+
className: 'dsub-header',
|
|
399
|
+
onClick: () => setOpen(!open),
|
|
400
|
+
'aria-expanded': open,
|
|
401
|
+
},
|
|
402
|
+
React.createElement('div', { className: 'dsub-headText' },
|
|
403
|
+
React.createElement('div', { className: 'dsub-name' }, t('title')),
|
|
404
|
+
React.createElement('div', { className: 'dsub-description' }, t('cardIntro')),
|
|
405
|
+
),
|
|
406
|
+
React.createElement('svg', {
|
|
407
|
+
className: 'dsub-chevron' + (open ? ' dsub-chevronOpen' : ''),
|
|
408
|
+
width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
|
|
409
|
+
},
|
|
410
|
+
React.createElement('path', {
|
|
411
|
+
d: 'M4 6l4 4 4-4', stroke: 'currentColor', 'stroke-width': 1.5,
|
|
412
|
+
'stroke-linecap': 'round', 'stroke-linejoin': 'round',
|
|
413
|
+
}),
|
|
414
|
+
),
|
|
415
|
+
),
|
|
416
|
+
open ? React.createElement('div', { className: 'dsub-body' },
|
|
417
|
+
React.createElement(SubsSection, props),
|
|
418
|
+
) : null,
|
|
419
|
+
)
|
|
420
|
+
}
|
|
421
|
+
|
|
374
422
|
function registerSettings(ctx) {
|
|
375
423
|
ctx.effect(() => ctx.locale.register(NS, { en, ru }), 'dsh-subscriptions: словари')
|
|
376
424
|
// Подписи вне компонента берут переводчик, привязанный к namespace.
|
package/package.json
CHANGED