dsh-palace 1.0.0 → 1.1.1

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.
Files changed (86) hide show
  1. package/README.md +45 -28
  2. package/client/client.js +179 -81
  3. package/lib/index.js +13 -11
  4. package/package.json +2 -2
  5. package/vendor/themes/pixel/README.md +4 -0
  6. package/vendor/themes/pixel/fonts/OFL.txt +93 -0
  7. package/vendor/themes/pixel/fonts/PixelifySans.ttf +0 -0
  8. package/vendor/themes/pixel/icons/alpine-skis.png +0 -0
  9. package/vendor/themes/pixel/icons/badminton.png +0 -0
  10. package/vendor/themes/pixel/icons/black-swan.png +0 -0
  11. package/vendor/themes/pixel/icons/camera.png +0 -0
  12. package/vendor/themes/pixel/icons/camping.png +0 -0
  13. package/vendor/themes/pixel/icons/carabiner.png +0 -0
  14. package/vendor/themes/pixel/icons/chalk-bag.png +0 -0
  15. package/vendor/themes/pixel/icons/climbing-shoe.png +0 -0
  16. package/vendor/themes/pixel/icons/coffee.png +0 -0
  17. package/vendor/themes/pixel/icons/cooking.png +0 -0
  18. package/vendor/themes/pixel/icons/cycling.png +0 -0
  19. package/vendor/themes/pixel/icons/door.png +0 -0
  20. package/vendor/themes/pixel/icons/earth.png +0 -0
  21. package/vendor/themes/pixel/icons/fire.png +0 -0
  22. package/vendor/themes/pixel/icons/gardening.png +0 -0
  23. package/vendor/themes/pixel/icons/gold-coin.png +0 -0
  24. package/vendor/themes/pixel/icons/gta6.png +0 -0
  25. package/vendor/themes/pixel/icons/headphones.png +0 -0
  26. package/vendor/themes/pixel/icons/hiking-pack.png +0 -0
  27. package/vendor/themes/pixel/icons/hold-cluster.png +0 -0
  28. package/vendor/themes/pixel/icons/hold-crimp.png +0 -0
  29. package/vendor/themes/pixel/icons/hold-foot-chip.png +0 -0
  30. package/vendor/themes/pixel/icons/hold-horn.png +0 -0
  31. package/vendor/themes/pixel/icons/hold-jug.png +0 -0
  32. package/vendor/themes/pixel/icons/hold-pinch.png +0 -0
  33. package/vendor/themes/pixel/icons/hold-pocket-one.png +0 -0
  34. package/vendor/themes/pixel/icons/hold-pocket-two.png +0 -0
  35. package/vendor/themes/pixel/icons/hold-rail.png +0 -0
  36. package/vendor/themes/pixel/icons/hold-sloper.png +0 -0
  37. package/vendor/themes/pixel/icons/hold-volume-diamond.png +0 -0
  38. package/vendor/themes/pixel/icons/hold-volume-triangle.png +0 -0
  39. package/vendor/themes/pixel/icons/kayaking.png +0 -0
  40. package/vendor/themes/pixel/icons/lotus-leaf.png +0 -0
  41. package/vendor/themes/pixel/icons/mars.png +0 -0
  42. package/vendor/themes/pixel/icons/mercury.png +0 -0
  43. package/vendor/themes/pixel/icons/moon.png +0 -0
  44. package/vendor/themes/pixel/icons/motorcycle.png +0 -0
  45. package/vendor/themes/pixel/icons/open-book.png +0 -0
  46. package/vendor/themes/pixel/icons/orange.png +0 -0
  47. package/vendor/themes/pixel/icons/painting.png +0 -0
  48. package/vendor/themes/pixel/icons/pottery.png +0 -0
  49. package/vendor/themes/pixel/icons/pufferfish.png +0 -0
  50. package/vendor/themes/pixel/icons/rainbow.png +0 -0
  51. package/vendor/themes/pixel/icons/rock-climber.png +0 -0
  52. package/vendor/themes/pixel/icons/running-shoe.png +0 -0
  53. package/vendor/themes/pixel/icons/shell.png +0 -0
  54. package/vendor/themes/pixel/icons/skiing.png +0 -0
  55. package/vendor/themes/pixel/icons/snow-mountain.png +0 -0
  56. package/vendor/themes/pixel/icons/snowboard.png +0 -0
  57. package/vendor/themes/pixel/icons/stargazing.png +0 -0
  58. package/vendor/themes/pixel/icons/sun.png +0 -0
  59. package/vendor/themes/pixel/icons/surfing.png +0 -0
  60. package/vendor/themes/pixel/icons/swim-goggles.png +0 -0
  61. package/vendor/themes/pixel/icons/teardrop.png +0 -0
  62. package/vendor/themes/pixel/icons/tennis-ball.png +0 -0
  63. package/vendor/themes/pixel/icons/tennis-racket.png +0 -0
  64. package/vendor/themes/pixel/icons/venus.png +0 -0
  65. package/vendor/themes/pixel/icons/yoga-mat.png +0 -0
  66. package/vendor/themes/pixel/theme.json +38 -0
  67. package/vendor/themes/watercolor/README.md +2 -0
  68. package/vendor/themes/watercolor/paper.svg +1 -0
  69. package/vendor/themes/watercolor/theme.json +8 -0
  70. package/vendor/icons/README.md +0 -2
  71. /package/vendor/{icons → themes/watercolor/icons}/black-swan.webp +0 -0
  72. /package/vendor/{icons → themes/watercolor/icons}/earth.webp +0 -0
  73. /package/vendor/{icons → themes/watercolor/icons}/gold-coin.webp +0 -0
  74. /package/vendor/{icons → themes/watercolor/icons}/lotus-leaf.webp +0 -0
  75. /package/vendor/{icons → themes/watercolor/icons}/mars.webp +0 -0
  76. /package/vendor/{icons → themes/watercolor/icons}/mercury.webp +0 -0
  77. /package/vendor/{icons → themes/watercolor/icons}/moon.webp +0 -0
  78. /package/vendor/{icons → themes/watercolor/icons}/open-book.webp +0 -0
  79. /package/vendor/{icons → themes/watercolor/icons}/orange.webp +0 -0
  80. /package/vendor/{icons → themes/watercolor/icons}/pufferfish.webp +0 -0
  81. /package/vendor/{icons → themes/watercolor/icons}/rainbow.webp +0 -0
  82. /package/vendor/{icons → themes/watercolor/icons}/shell.webp +0 -0
  83. /package/vendor/{icons → themes/watercolor/icons}/snow-mountain.webp +0 -0
  84. /package/vendor/{icons → themes/watercolor/icons}/sun.webp +0 -0
  85. /package/vendor/{icons → themes/watercolor/icons}/teardrop.webp +0 -0
  86. /package/vendor/{icons → themes/watercolor/icons}/venus.webp +0 -0
package/lib/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // src/host/index.ts
2
- import { existsSync as existsSync5 } from "node:fs";
3
2
  import { homedir as homedir3 } from "node:os";
4
3
  import { join as join6, resolve } from "node:path";
5
4
 
@@ -725,7 +724,7 @@ async function updateCell(store, args) {
725
724
  const title = args.title === void 0 ? void 0 : text(args.title, "\u6807\u9898");
726
725
  const subtitle = optionalText(args.subtitle, "\u5907\u6CE8");
727
726
  const icon = optionalText(args.icon, "\u56FE\u6807");
728
- if (icon !== void 0 && !/^[a-z][a-z-]{0,30}$/.test(icon)) throw new ShelfError("\u56FE\u6807\u540D\u65E0\u6548");
727
+ if (icon !== void 0 && !/^[a-z][a-z0-9-]{0,30}$/.test(icon)) throw new ShelfError("\u56FE\u6807\u540D\u65E0\u6548");
729
728
  return store.mutate((tx) => {
730
729
  const cell = cellOf(tx.palace, args.id);
731
730
  if (title !== void 0) cell.title = title;
@@ -1335,6 +1334,13 @@ function vendorDir() {
1335
1334
  const built = fileURLToPath(new URL("../vendor/", import.meta.url));
1336
1335
  return existsSync4(built) ? built : fileURLToPath(new URL("../../vendor/", import.meta.url));
1337
1336
  }
1337
+ var THEME_TYPES = {
1338
+ webp: "image/webp",
1339
+ png: "image/png",
1340
+ svg: "image/svg+xml",
1341
+ ttf: "font/ttf",
1342
+ woff2: "font/woff2"
1343
+ };
1338
1344
  var IMAGE_TYPES = {
1339
1345
  ".png": "image/png",
1340
1346
  ".jpg": "image/jpeg",
@@ -1428,11 +1434,11 @@ function createRoutes(store, active, memory = new Memory(store)) {
1428
1434
  response2.headers.set("cache-control", "public, max-age=86400");
1429
1435
  return response2;
1430
1436
  }
1431
- const icon = /^icons\/([a-z][a-z-]{0,30})\.webp$/.exec(rel)?.[1];
1432
- if (icon !== void 0) {
1433
- const file2 = join5(vendorDir(), "icons", `${icon}.webp`);
1437
+ const theme = /^themes\/[a-z][a-z0-9-]{0,30}\/(?:[a-z]+\/)?[A-Za-z0-9][A-Za-z0-9-]{0,60}\.(webp|png|svg|ttf|woff2)$/.exec(rel.split(sep2).join("/"));
1438
+ if (theme !== null) {
1439
+ const file2 = join5(vendorDir(), rel);
1434
1440
  if (!existsSync4(file2)) return new Response("not found", { status: 404 });
1435
- const response2 = streamFile(file2, "image/webp");
1441
+ const response2 = streamFile(file2, THEME_TYPES[theme[1]]);
1436
1442
  response2.headers.set("cache-control", "public, max-age=86400");
1437
1443
  return response2;
1438
1444
  }
@@ -1855,11 +1861,7 @@ ${page.body}`;
1855
1861
 
1856
1862
  // src/host/index.ts
1857
1863
  var name = "dsh-palace";
1858
- function defaultDataDir() {
1859
- const dir = join6(homedir3(), "Documents", "dsh-palace-data");
1860
- const old = join6(homedir3(), "Documents", "dsh-shelf-data");
1861
- return !existsSync5(join6(dir, "palace.json")) && existsSync5(join6(old, "palace.json")) ? old : dir;
1862
- }
1864
+ var defaultDataDir = () => join6(homedir3(), "Documents", "dsh-palace-data");
1863
1865
  function apply(ctx, config = {}) {
1864
1866
  const dir = config.dataDir ?? defaultDataDir();
1865
1867
  const store = new PalaceStore(dir);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-palace",
3
- "version": "1.0.0",
4
- "description": "Memory Palace:DeepSeek Harness 的读书插件。把书、视频课和笔记放进一座水彩宫殿,你只管记,AI 帮你整理。",
3
+ "version": "1.1.1",
4
+ "description": "Memory Palace:DeepSeek Harness 插件,一个懂你在想什么的 AI。把书、课、剧和随手的念头放进一座宫殿,你只管记、只管聊,AI 帮你整理,也慢慢记住你。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "license": "MIT",
@@ -0,0 +1,4 @@
1
+ 像素皮肤来自设计负责人 @bbhh1226 的原型(Discussion #39,本项目的设计资产)。
2
+
3
+ - `icons/`:原创 32×32 像素图标,显示时按像素放大(不做平滑)。前 16 个和水彩皮肤一一对应;另外 42 个运动和爱好图标(Discussion #110)列在 `theme.json` 的 `icons.more`。
4
+ - `fonts/PixelifySans.ttf`:英文像素字体 Pixelify Sans([Google Fonts](https://github.com/google/fonts/tree/main/ofl/pixelifysans)),SIL OFL 1.1,许可见 `fonts/OFL.txt`。中文用系统黑体。
@@ -0,0 +1,93 @@
1
+ Copyright 2021 The Pixelify Sans Project Authors (https://github.com/eifetx/Pixelify-Sans)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,38 @@
1
+ {
2
+ "schema": 1,
3
+ "name": "像素",
4
+ "edges": "hard",
5
+ "background": { "color": "#f8f8f8" },
6
+ "font": { "file": "fonts/PixelifySans.ttf", "latinOnly": true },
7
+ "icons": {
8
+ "file": "icons/{key}.png", "inset": 6.5, "pixelated": true,
9
+ "more": [
10
+ "tennis-racket", "tennis-ball", "rock-climber", "carabiner", "climbing-shoe", "chalk-bag",
11
+ "badminton", "running-shoe", "cycling", "swim-goggles", "surfing", "skiing",
12
+ "hiking-pack", "camping", "kayaking", "yoga-mat", "camera", "painting",
13
+ "headphones", "pottery", "cooking", "coffee", "gardening", "stargazing",
14
+ "hold-jug", "hold-sloper", "hold-crimp", "hold-pinch", "hold-pocket-one", "hold-pocket-two",
15
+ "hold-horn", "hold-rail", "hold-foot-chip", "hold-volume-triangle", "hold-volume-diamond", "hold-cluster",
16
+ "door", "fire", "snowboard", "alpine-skis", "gta6", "motorcycle"
17
+ ]
18
+ },
19
+ "colors": {
20
+ "ink": "#252329",
21
+ "quiet": "#5c5961",
22
+ "grid": "#000",
23
+ "dot": "#000",
24
+ "edge": "#252329",
25
+ "fill": "#f8f8f8",
26
+ "hover": "#e5e2dc",
27
+ "panel": "#f8f8f8",
28
+ "group": "rgba(170, 161, 150, .22)",
29
+ "shadow": "#252329",
30
+ "ring": "#343039",
31
+ "ringTrack": "#d6d3ce",
32
+ "arc": "#4f535e",
33
+ "arcOutline": "#f8f8f8",
34
+ "arcCurrent": "#222329",
35
+ "mark": "rgba(170, 161, 150, .45)",
36
+ "page": "#eeebe6"
37
+ }
38
+ }
@@ -0,0 +1,2 @@
1
+ 水彩图标来自设计负责人 @bbhh1226 的原型(Discussion #40,本项目的设计资产)。
2
+ 放在 `icons/`,由 `scripts/make-icons.py` 从原型的 PNG 按校准缩小转成 WebP:每张 194×194,物体画在中间 154×154(77×77 框的 2 倍)的位置,四周留余量。
@@ -0,0 +1 @@
1
+ <svg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200' viewBox='0 0 1200 1200' preserveAspectRatio='none'> <defs> <linearGradient id='blue' x1='0' y1='0' x2='0' y2='1' gradientUnits='objectBoundingBox'> <stop offset='0' stop-color='#93b8cf'/> <stop offset='0.24' stop-color='#9abdd1'/> <stop offset='0.50' stop-color='#a9c8d7'/> <stop offset='0.76' stop-color='#b8cfdb'/> <stop offset='1' stop-color='#bfd3de'/> </linearGradient> <radialGradient id='wash' cx='0.14' cy='0.44' r='0.83'> <stop offset='0' stop-color='#c7e0dd' stop-opacity='0.10'/> <stop offset='1' stop-color='#c7e0dd' stop-opacity='0'/> </radialGradient> <filter id='paper' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'> <feTurbulence type='fractalNoise' baseFrequency='0.008 0.011' numOctaves='3' seed='31' result='mottle'/> <feColorMatrix in='mottle' type='matrix' values='0.06 0 0 0 0.47 0.06 0 0 0 0.47 0.06 0 0 0 0.47 0 0 0 0 1' result='softMottle'/> <feBlend in='softMottle' in2='SourceGraphic' mode='soft-light' result='pigment'/> <feTurbulence type='fractalNoise' baseFrequency='0.105 0.17' numOctaves='3' seed='18' result='fibres'/> <feColorMatrix in='fibres' type='matrix' values='0.12 0 0 0 0.44 0.12 0 0 0 0.44 0.12 0 0 0 0.44 0 0 0 0 1' result='softFibres'/> <feBlend in='softFibres' in2='pigment' mode='soft-light' result='paperBody'/> <feTurbulence type='fractalNoise' baseFrequency='0.48 0.54' numOctaves='3' seed='57' result='grain'/> <feColorMatrix in='grain' type='matrix' values='0.22 0 0 0 0.39 0.22 0 0 0 0.39 0.22 0 0 0 0.39 0 0 0 0 1' result='neutralGrain'/> <feBlend in='neutralGrain' in2='paperBody' mode='soft-light'/> </filter> </defs> <g filter='url(#paper)'> <rect width='1200' height='1200' fill='url(#blue)'/> <rect width='1200' height='1200' fill='url(#wash)'/> </g> </svg>
@@ -0,0 +1,8 @@
1
+ {
2
+ "schema": 1,
3
+ "name": "水彩",
4
+ "edges": "soft",
5
+ "background": { "color": "#abc9d7", "image": "paper.svg" },
6
+ "icons": { "file": "icons/{key}.webp", "inset": -10 },
7
+ "colors": {}
8
+ }
@@ -1,2 +0,0 @@
1
- 水彩图标来自设计负责人 @bbhh1226 的原型(Discussion #40,本项目的设计资产)。
2
- 由 `scripts/make-icons.py` 从原型的 PNG 按校准缩小转成 WebP:每张 194×194,物体画在中间 154×154(77×77 框的 2 倍)的位置,四周留余量。