@dsh-plus/image-studio 0.1.35 → 0.1.36

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.
@@ -559,29 +559,6 @@ export const imageStudioCss = `
559
559
 
560
560
  /* ── 配置卡片附加件(imsc- 基础类由 cardCss('imsc') 生成)── */
561
561
  .imsc-loading{padding:14px 16px;margin:0;font-size:13px;color:var(--dsw-alias-label-tertiary)}
562
- .imsc-groupTitle { margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
563
- .imsc-presetBox {
564
- border-top: 1px solid var(--dsw-alias-border-l3);
565
- padding: 10px 0 2px;
566
- display: grid;
567
- gap: 8px;
568
- }
569
- .imsc-presetHead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
570
- .imsc-presetName { font-size: 13px; font-weight: 600; }
571
- .imsc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
572
- .imsc-textarea {
573
- box-sizing: border-box;
574
- width: 100%;
575
- min-height: 64px;
576
- padding: 6px 10px;
577
- border: 1px solid var(--dsw-alias-border-l2);
578
- border-radius: 8px;
579
- background: var(--dsw-alias-bg-layer-3);
580
- color: var(--dsw-alias-label-primary);
581
- font-family: var(--ds-font-family-code);
582
- font-size: 12px;
583
- resize: vertical;
584
- }
585
562
  .imsc-credRow { display: flex; align-items: center; gap: 8px; }
586
563
  .imsc-credRow .imsc-input { flex: 1; min-width: 0; }
587
564
 
@@ -617,7 +594,6 @@ export const imageStudioCss = `
617
594
  .ims-paramControl { width: 108px; }
618
595
  .ims-btn { min-height: 40px; }
619
596
  .ims-btnSmall { min-height: 32px; }
620
- .imsc-grid2 { grid-template-columns: 1fr; }
621
597
  }
622
598
  `
623
599
 
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * 凭据引用名派生与校验:提供商预设 id → IMAGE_STUDIO_PRESET_<ID>。
3
- * 规则对齐《插件存储规范》:大写下划线、全大写、前缀属主。
4
- * 纯函数,零依赖。
3
+ * 命名与归一走 `@dsh-plus/shared` 的公共助手,本模块只补预设 id 的形态校验。
4
+ * 纯函数,零依赖(浏览器半亦可安全 import)。
5
5
  * @module image-studio/credentials
6
6
  */
7
7
 
8
- /** 引用名前缀(属主段)。 */
9
- const REF_PREFIX = 'IMAGE_STUDIO_PRESET_'
8
+ import { credentialRefName } from '@dsh-plus/shared'
9
+
10
+ /** 属主段(插件 id)。 */
11
+ const REF_OWNER = 'image-studio'
12
+ /** 业务段前缀(与属主一起构成 IMAGE_STUDIO_PRESET_<ID>)。 */
13
+ const REF_KIND = 'preset'
10
14
 
11
15
  /** 预设 id 是否合法(kebab-case,用于引用名派生)。 */
12
16
  export function isValidPresetId(id: string): boolean {
@@ -18,5 +22,5 @@ export function credentialRefNameOf(presetId: string): string {
18
22
  if (!isValidPresetId(presetId)) {
19
23
  throw new Error(`非法提供商预设 id:${JSON.stringify(presetId)}`)
20
24
  }
21
- return `${REF_PREFIX}${presetId.replaceAll('-', '_').toUpperCase()}`
25
+ return credentialRefName(REF_OWNER, REF_KIND, presetId)
22
26
  }
@@ -11,7 +11,7 @@ import { randomUUID } from 'node:crypto'
11
11
  import { appendFile, mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises'
12
12
  import { join } from 'node:path'
13
13
 
14
- import { atomicWriteFile, commitTmpFile, pluginDataPath } from '@dsh-plus/shared'
14
+ import { atomicWriteFile, commitTmpFile, pluginCachePath } from '@dsh-plus/shared'
15
15
  import { isImageId } from '../images/id.ts'
16
16
  import { extOfMime } from '../images/mime.ts'
17
17
 
@@ -27,9 +27,12 @@ export interface UploadEntry {
27
27
  size: number
28
28
  }
29
29
 
30
- /** 存储层根路径(惰性解析:DSH_HOME 可能在模块加载后才被测试环境设置)。 */
30
+ /**
31
+ * 存储层根路径(惰性解析:DSH_HOME 可能在模块加载后才被测试环境设置)。
32
+ * 上传是带 TTL 的暂存派生物(`uploadTtlHours` 回收),故落缓存目录。
33
+ */
31
34
  function uploadsRoot(): string {
32
- return pluginDataPath('image-studio', 'uploads')
35
+ return pluginCachePath('image-studio', 'uploads')
33
36
  }
34
37
 
35
38
  function indexFile(): string {