@goodandready/dsh-subscriptions 0.2.9 → 0.2.11
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 +38 -5
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -15,8 +15,8 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
'.dsub-headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}' +
|
|
16
16
|
'.dsub-name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}' +
|
|
17
17
|
'.dsub-description{color:var(--dsw-alias-label-secondary);font-size:13px}' +
|
|
18
|
-
'.dsub-
|
|
19
|
-
'.dsub-
|
|
18
|
+
'.dsub-chev{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}' +
|
|
19
|
+
'.dsub-chevOpen{transform:rotate(180deg)}' +
|
|
20
20
|
'.dsub-body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}' +
|
|
21
21
|
// existing dsub classes kept for SubsSection internals
|
|
22
22
|
'.dsub-wrap{display:flex;flex-direction:column;gap:22px;padding:4px 0;max-width:760px}' +
|
|
@@ -124,7 +124,22 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
124
124
|
|
|
125
125
|
// Карточка во вкладке «Плагины» рисует свой заголовок и сворачивание:
|
|
126
126
|
// ядро даёт только рамку списка.
|
|
127
|
-
|
|
127
|
+
// Ядровый значок раскрытия. Без защищённого require вместо IconChevronDownOutline14 может упасть вся клиентская половина.
|
|
128
|
+
let ChevronIcon = null
|
|
129
|
+
try {
|
|
130
|
+
const primitives = require('@deepseek-ai/dsh-client-ui-primitives')
|
|
131
|
+
ChevronIcon = primitives && primitives.IconChevronDownOutline14
|
|
132
|
+
} catch (noPrimitives) {
|
|
133
|
+
ChevronIcon = null
|
|
134
|
+
}
|
|
135
|
+
function FallbackChevron(props) {
|
|
136
|
+
return React.createElement('svg', { className: props.className, width: 14, height: 14, viewBox: '0 0 14 14', fill: 'none' },
|
|
137
|
+
React.createElement('path', { d: 'M3.5 5.25L7 8.75l3.5-3.5', stroke: 'currentColor', 'stroke-width': 1.5, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }),
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
const Chevron = ChevronIcon || FallbackChevron
|
|
141
|
+
|
|
142
|
+
function PluginCard(props) {
|
|
128
143
|
const t = (props && props.t) || ((key) => key)
|
|
129
144
|
const [open, setOpen] = React.useState(false)
|
|
130
145
|
return React.createElement('div', { className: 'dsub-block' },
|
|
@@ -404,7 +419,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
404
419
|
React.createElement('div', { className: 'dsub-description' }, t('cardIntro')),
|
|
405
420
|
),
|
|
406
421
|
React.createElement('svg', {
|
|
407
|
-
className: 'dsub-
|
|
422
|
+
className: 'dsub-chev' + (open ? ' dsub-chevOpen' : ''),
|
|
408
423
|
width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
|
|
409
424
|
},
|
|
410
425
|
React.createElement('path', {
|
|
@@ -420,7 +435,25 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
420
435
|
}
|
|
421
436
|
|
|
422
437
|
function registerSettings(ctx) {
|
|
423
|
-
|
|
438
|
+
// Язык может принести не только плагин: словарные пакеты объявляют
|
|
439
|
+
// русский для чужих пространств. Ядро на повторное объявление той же
|
|
440
|
+
// пары «пространство + язык» бросает исключение, и незащищённый вызов
|
|
441
|
+
// уносил с собой весь плагин — в интерфейсе это выглядело как «Failed to
|
|
442
|
+
// load plugins» с перечнем ни в чём не повинных соседей.
|
|
443
|
+
//
|
|
444
|
+
// Поэтому каждый язык объявляется отдельно и по-хорошему: заняли до нас —
|
|
445
|
+
// уступаем, свой английский при этом всё равно встаёт на место.
|
|
446
|
+
const addLocale = (locale, dictionary) => {
|
|
447
|
+
try {
|
|
448
|
+
return ctx.locale.register(NS, locale, dictionary)
|
|
449
|
+
} catch (alreadyTaken) {
|
|
450
|
+
return () => {}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
ctx.effect(() => {
|
|
454
|
+
const undo = [addLocale('en', en), addLocale('ru', ru)]
|
|
455
|
+
return () => { for (const off of undo) off() }
|
|
456
|
+
}, 'dsh-subscriptions: словари')
|
|
424
457
|
// Подписи вне компонента берут переводчик, привязанный к namespace.
|
|
425
458
|
const t = ctx.locale.bind(NS)
|
|
426
459
|
// Штатное место — вкладка «Плагины»: карточка со своим заголовком и
|
package/package.json
CHANGED