orca-gallery-panel 1.3.0 → 1.4.0

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/README.md CHANGED
@@ -38,64 +38,80 @@ can change without leaving Orca.
38
38
 
39
39
  ## Quick start
40
40
 
41
- Requires [Node.js](https://nodejs.org) 22.18 or later and Orca 1.4.160 or later.
41
+ ### 1. Try it from Orca
42
42
 
43
- ```bash
44
- mkdir ~/orca-gallery && cd ~/orca-gallery
45
- npx orca-gallery-panel ~/Pictures/wallpapers --title "Wallpapers"
46
- ```
43
+ [Open in Orca](https://onorca.dev/plugins/jerrazuw.gallery-panel-demo?catalog=community) takes you
44
+ to **Gallery Panel (demo)** in Orca's plugin directory; the first time, Orca asks to add its
45
+ community catalog. Click **Install**, then open the panel from the right sidebar. It rotates
46
+ through a few sample images and explains, inside the panel, how to show your own.
47
47
 
48
- The plugin is written to `dist/` in the current folder. In Orca, go to
49
- **Settings → Plugins → Development**, click **Add path** and enter the full path to `dist/`
50
- (here `~/orca-gallery/dist`). Then open the panel from the right sidebar.
48
+ Orca installs plugins from the directory as they are, so the listed one can only carry sample
49
+ images. Your own photos take one command, below.
51
50
 
52
- The examples below use `npm run build`, which is how the command runs from a clone of this
53
- repository. With `npx`, replace `npm run build --` with `npx orca-gallery-panel` and run it from
54
- the same folder each time, so it finds your `gallery.config.json` and rebuilds the same `dist/`.
51
+ ### 2. Show your own photos
55
52
 
56
- To work from a clone instead (also the way to try the bundled samples with
57
- `npm run build -- examples/images`):
53
+ You need [Node.js](https://nodejs.org) 22.18 or later and Orca 1.4.160 or later. In a terminal,
54
+ run this with the path to your folder instead of `~/Pictures/wallpapers`:
58
55
 
59
56
  ```bash
60
- git clone https://github.com/jerrazuw/orca-gallery-panel.git
61
- cd orca-gallery-panel
62
- npm install
63
- npm run build -- ~/Pictures/wallpapers --title "Wallpapers"
57
+ npx orca-gallery-panel ~/Pictures/wallpapers --out ~/orca-gallery --watch
64
58
  ```
65
59
 
66
- ### Saving your settings
60
+ It packs every image in the folder into an Orca plugin in `~/orca-gallery`, then keeps watching
61
+ the folder. In Orca, go to **Settings → Plugins → Development**, click **Add path** and enter the
62
+ full path of that folder (`/Users/<you>/orca-gallery` on a Mac). Open the panel from the right
63
+ sidebar.
67
64
 
68
- Instead of repeating options on every build, copy the example config and edit it:
65
+ If you installed the demo, uninstall it from **Settings → Plugins** so you don't have two
66
+ galleries.
69
67
 
70
- ```bash
71
- cp gallery.config.example.json gallery.config.json
72
- ```
68
+ ### 3. Add photos whenever you like
69
+
70
+ While the command runs, copy photos into your folder or delete them, and the panel updates by
71
+ itself within a few seconds: the plugin is rebuilt and Orca reloads it. Copying 20 photos at once
72
+ triggers a single rebuild. A good place to leave it running is a terminal tab inside Orca.
73
+
74
+ `Ctrl+C` stops it. Next time, run the same command again: it picks up whatever changed in the
75
+ meantime and goes back to watching. Without `--watch`, it builds once and exits, so run it again
76
+ after changing your photos.
77
+
78
+ ### Saving your settings
79
+
80
+ Instead of typing the options every time, put them in a `gallery.config.json` in the folder you
81
+ run the command from (your home folder, for example):
73
82
 
74
83
  ```json
75
84
  {
76
- "$schema": "./gallery.config.schema.json",
85
+ "$schema": "https://unpkg.com/orca-gallery-panel/gallery.config.schema.json",
77
86
  "folder": "~/Pictures/wallpapers",
87
+ "out": "~/orca-gallery",
78
88
  "title": "Wallpapers",
79
89
  "interval": 60
80
90
  }
81
91
  ```
82
92
 
83
- From then on, `npm run build` is enough. `gallery.config.json` is ignored by git, so your paths
84
- stay on your machine. The `$schema` line gives you autocomplete and validation in editors that
85
- support JSON Schema. Options passed on the command line still override the file for that build,
93
+ From then on, `npx orca-gallery-panel --watch` is enough, and editing the file while it runs
94
+ rebuilds the panel too. The `$schema` line gives you autocomplete and validation in editors that
95
+ support JSON Schema. Options passed on the command line still override the file for that run,
86
96
  and `--config <file>` reads a different one.
87
97
 
88
- ### Updating your images
98
+ If you installed the plugin with **Install plugin → Local folder** instead of **Development**,
99
+ Orca keeps a copy, so you need to install it again after each build.
100
+
101
+ ### Working from a clone
89
102
 
90
- Add or remove files in your folder and run `npm run build` again. A plugin loaded from
91
- **Development** reloads on its own.
103
+ To change the code, or to try the bundled samples with `npm run build -- examples/images`:
92
104
 
93
- Or leave `npm run build -- --watch` running: it rebuilds whenever an image in your folders or
94
- the config file changes, and a burst of changes (copying 20 photos at once) triggers a single
95
- rebuild.
105
+ ```bash
106
+ git clone https://github.com/jerrazuw/orca-gallery-panel.git
107
+ cd orca-gallery-panel
108
+ npm install
109
+ npm run build -- ~/Pictures/wallpapers --watch
110
+ ```
96
111
 
97
- If you installed it with **Install plugin → Local folder** instead, Orca keeps a copy, so you
98
- need to install it again after each build.
112
+ Here `npm run build --` takes the place of `npx orca-gallery-panel`, and the plugin goes to
113
+ `dist/` unless you pass `--out`. `gallery.config.json` at the root of the clone is ignored by
114
+ git, so your paths stay on your machine; `gallery.config.example.json` is a starting point.
99
115
 
100
116
  ## Options
101
117
 
@@ -182,6 +198,7 @@ npm run preview # writes dist/preview.html: the built panel inside an Orca-
182
198
  | `src/preview.ts` | Reproduces Orca's panel shell so the panel can be checked in a browser. |
183
199
  | `test/` | Unit tests (`node:test`) and browser tests (`test/e2e/`, Playwright). |
184
200
  | `examples/images/` | Sample images, made by `scripts/generate-examples.ts`. |
201
+ | `plugin/` | The demo build listed in Orca's plugin directory, by `npm run build:demo`. |
185
202
 
186
203
  TypeScript runs directly on Node through
187
204
  [type stripping](https://nodejs.org/api/typescript.html#type-stripping), so there is no compile
@@ -190,10 +207,13 @@ compiled to `lib/` by `npm run build:lib`, which `npm pack` runs on its own. CI
190
207
  macOS and Windows with Node 22.18, 22 and 24, and installs the packed package in an empty
191
208
  project to check that the command works.
192
209
 
193
- ## Why it isn't in the Orca marketplace
210
+ ## In Orca's plugin directory
194
211
 
195
- Plugins in the [Orca marketplace](https://github.com/stablyai/orca-plugins) are installed from a
196
- git repository as they are, but this panel only works once it has been built with your images. A marketplace entry could only ship the sample gallery.
212
+ Orca lists a plugin from a tagged commit of its repository and installs it as it is, with no build
213
+ step, so it cannot pack your photos. The listed plugin is the build in `plugin/`: the sample images
214
+ with a note on how to load your own, under its own id (`gallery-panel-demo`) so it can sit next to
215
+ the plugin you build. `npm run build:demo` writes it, and `npm version` reruns that for every
216
+ release.
197
217
 
198
218
  ## Contributing
199
219
 
package/lib/build.js CHANGED
@@ -48,7 +48,7 @@ async function assertFolder(folder) {
48
48
  if (!info?.isDirectory())
49
49
  throw new BuildError(`Image folder not found: ${folder}`);
50
50
  }
51
- async function buildGallery(gallery, logger) {
51
+ async function buildGallery(gallery, logger, demo) {
52
52
  await assertFolder(gallery.input);
53
53
  const files = await findImages(gallery.input, gallery.recursive);
54
54
  const skipped = [];
@@ -87,6 +87,7 @@ async function buildGallery(gallery, logger) {
87
87
  blur: gallery.blur,
88
88
  effect: gallery.effect,
89
89
  caption: gallery.caption,
90
+ demo,
90
91
  });
91
92
  const panelBytes = Buffer.byteLength(html);
92
93
  if (panelBytes > PANEL_ENTRY_MAX_BYTES) {
@@ -104,8 +105,9 @@ async function removeStalePanels(outDir, keep) {
104
105
  export async function buildPlugin(options, logger = console) {
105
106
  const entries = panelEntries(options.galleries.map((gallery) => gallery.title));
106
107
  const built = [];
108
+ const demo = options.demo ?? false;
107
109
  for (const gallery of options.galleries)
108
- built.push(await buildGallery(gallery, logger));
110
+ built.push(await buildGallery(gallery, logger, demo));
109
111
  const totalBytes = built.reduce((sum, { html }) => sum + Buffer.byteLength(html), 0);
110
112
  if (totalBytes > PLUGIN_MAX_BYTES) {
111
113
  throw new BuildError(`The galleries add up to ${formatBytes(totalBytes)}, over Orca's ${formatBytes(PLUGIN_MAX_BYTES)} limit for a plugin.`);
@@ -113,7 +115,7 @@ export async function buildPlugin(options, logger = console) {
113
115
  await mkdir(options.outDir, { recursive: true });
114
116
  await Promise.all([
115
117
  ...built.map(({ html }, i) => writeFile(join(options.outDir, entries[i]?.entry ?? ''), html)),
116
- writeFile(join(options.outDir, MANIFEST_FILE), `${JSON.stringify(createManifest(options.name, entries), null, 2)}\n`),
118
+ writeFile(join(options.outDir, MANIFEST_FILE), `${JSON.stringify(createManifest(options.name, entries, { demo }), null, 2)}\n`),
117
119
  ]);
118
120
  await removeStalePanels(options.outDir, new Set(entries.map(({ entry }) => entry)));
119
121
  return {
package/lib/manifest.js CHANGED
@@ -1,5 +1,15 @@
1
1
  import { pkg } from "./package-info.js";
2
2
  export const PLUGIN_ID = 'gallery-panel';
3
+ /**
4
+ * The sample build in plugin/, listed in Orca's plugin directory. A different id
5
+ * lets it sit next to the plugin people build from their own photos.
6
+ */
7
+ export const DEMO_PLUGIN_ID = 'gallery-panel-demo';
8
+ export const DEMO_NAME = 'Gallery Panel (demo)';
9
+ export const DEMO_TITLE = 'Gallery (demo)';
10
+ export const DEMO_DESCRIPTION = 'Background images for Orca: a side panel that rotates through your pictures. This install shows sample images; the panel explains how to show a folder of your own photos that updates as you add more.';
11
+ /** Square plugin icon, written next to the demo manifest. */
12
+ export const DEMO_ICON = 'icon.png';
3
13
  export const PUBLISHER = 'jerrazuw';
4
14
  export const PANEL_ID = 'gallery';
5
15
  export const PANEL_ENTRY = 'panel.html';
@@ -41,17 +51,18 @@ export function panelEntries(titles) {
41
51
  export function isGeneratedPanelFile(file) {
42
52
  return file === PANEL_ENTRY || /^panel-[a-z0-9]+(?:-[a-z0-9]+)*\.html$/.test(file);
43
53
  }
44
- export function createManifest(name, panels) {
54
+ export function createManifest(name, panels, { demo = false } = {}) {
45
55
  return {
46
56
  manifestVersion: 1,
47
- id: PLUGIN_ID,
57
+ id: demo ? DEMO_PLUGIN_ID : PLUGIN_ID,
48
58
  publisher: PUBLISHER,
49
59
  name,
50
60
  version: pkg.version,
51
- description: pkg.description,
61
+ description: demo ? DEMO_DESCRIPTION : pkg.description,
52
62
  author: pkg.author,
53
63
  repository: pkg.repository.url.replace(/^git\+/, ''),
54
64
  engines: { orca: `>=${MIN_ORCA_VERSION}` },
65
+ ...(demo ? { icon: DEMO_ICON } : {}),
55
66
  pluginApi: 1,
56
67
  contributes: {
57
68
  panels: panels.map(({ id, title, entry }) => ({ id, title, icon: PANEL_ICON, entry })),
@@ -11,7 +11,7 @@ export function isEffect(value) {
11
11
  export function parseConfig(raw) {
12
12
  if (typeof raw !== 'object' || raw === null)
13
13
  throw new TypeError('Config must be an object');
14
- const { images, intervalMs, fit, blur, effect, caption } = raw;
14
+ const { images, intervalMs, fit, blur, effect, caption, demo } = raw;
15
15
  if (!Array.isArray(images))
16
16
  throw new TypeError('Config.images must be an array');
17
17
  const parsed = images.map((image, i) => {
@@ -33,7 +33,10 @@ export function parseConfig(raw) {
33
33
  throw new TypeError('Config.blur must be a boolean');
34
34
  if (typeof caption !== 'boolean')
35
35
  throw new TypeError('Config.caption must be a boolean');
36
- return { images: parsed, intervalMs, fit, blur, effect, caption };
36
+ if (demo !== undefined && typeof demo !== 'boolean') {
37
+ throw new TypeError('Config.demo must be a boolean');
38
+ }
39
+ return { images: parsed, intervalMs, fit, blur, effect, caption, demo: demo ?? false };
37
40
  }
38
41
  /** Parses what a user typed as the interval; undefined unless it is a whole number of seconds in range. */
39
42
  export function parseIntervalSeconds(text) {
package/lib/panel/i18n.js CHANGED
@@ -20,6 +20,11 @@ const en = {
20
20
  counter: (position, total) => `Image ${String(position)} of ${String(total)}`,
21
21
  empty: 'No images yet. Rebuild the panel with a folder that contains images.',
22
22
  allFailed: 'None of the images could be displayed.',
23
+ demoTitle: 'These are sample images',
24
+ demoRun: 'To show your own photos, run this in a terminal, with the path to your folder:',
25
+ demoAdd: 'Then, in Orca, go to Settings → Plugins → Development, click Add path and enter the full path of orca-gallery in your home folder.',
26
+ demoWatch: 'Leave the command running: photos you add to or remove from your folder show up in the panel on their own.',
27
+ demoDismiss: 'Hide this note',
23
28
  };
24
29
  const es = {
25
30
  previous: 'Imagen anterior',
@@ -43,6 +48,11 @@ const es = {
43
48
  counter: (position, total) => `Imagen ${String(position)} de ${String(total)}`,
44
49
  empty: 'Todavía no hay imágenes. Vuelve a generar el panel con una carpeta que tenga imágenes.',
45
50
  allFailed: 'No se pudo mostrar ninguna de las imágenes.',
51
+ demoTitle: 'Estas son imágenes de ejemplo',
52
+ demoRun: 'Para ver tus propias fotos, corre esto en una terminal, con la ruta de tu carpeta:',
53
+ demoAdd: 'Después, en Orca, ve a Settings → Plugins → Development, haz clic en Add path y escribe la ruta completa de orca-gallery en tu carpeta personal.',
54
+ demoWatch: 'Deja el comando corriendo: las fotos que agregues o quites de tu carpeta aparecen solas en el panel.',
55
+ demoDismiss: 'Ocultar este aviso',
46
56
  };
47
57
  export const catalogs = { en, es };
48
58
  export function pickLocale(languages) {
package/lib/panel/main.js CHANGED
@@ -16,6 +16,20 @@ function showMessage(text) {
16
16
  document.body.classList.add('message');
17
17
  query('#message', HTMLElement).textContent = text;
18
18
  }
19
+ /** In the sample build, explains how to load a folder of your own photos. */
20
+ function showDemoNote(t) {
21
+ const note = query('#demo-note', HTMLElement);
22
+ query('#demo-title', HTMLElement).textContent = t.demoTitle;
23
+ query('#demo-run', HTMLElement).textContent = t.demoRun;
24
+ query('#demo-add', HTMLElement).textContent = t.demoAdd;
25
+ query('#demo-watch', HTMLElement).textContent = t.demoWatch;
26
+ const dismiss = query('#demo-dismiss', HTMLButtonElement);
27
+ setLabel(dismiss, t.demoDismiss);
28
+ dismiss.addEventListener('click', () => {
29
+ note.hidden = true;
30
+ });
31
+ note.hidden = false;
32
+ }
19
33
  function readConfig() {
20
34
  const raw = document.getElementById(CONFIG_ELEMENT_ID)?.textContent ?? '';
21
35
  return parseConfig(JSON.parse(raw));
@@ -358,5 +372,7 @@ function main() {
358
372
  return;
359
373
  }
360
374
  new Gallery(config, t).start();
375
+ if (config.demo)
376
+ showDemoNote(t);
361
377
  }
362
378
  main();
@@ -353,9 +353,89 @@ body.single .counter {
353
353
  color: var(--gallery-danger);
354
354
  }
355
355
 
356
+ /* Note in the sample build listed in Orca's plugin directory */
357
+
358
+ .demo-note {
359
+ position: absolute;
360
+ inset: 12px 12px auto;
361
+ max-height: calc(100% - 80px);
362
+ overflow-y: auto;
363
+ padding: 10px 32px 10px 12px;
364
+ border: 1px solid var(--gallery-border);
365
+ border-radius: var(--gallery-radius);
366
+ background: color-mix(in srgb, var(--gallery-surface) 92%, transparent);
367
+ backdrop-filter: blur(6px);
368
+ box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
369
+ }
370
+
371
+ .demo-note[hidden] {
372
+ display: none;
373
+ }
374
+
375
+ .demo-note p {
376
+ margin: 0 0 6px;
377
+ }
378
+
379
+ .demo-note p:last-of-type {
380
+ margin-bottom: 0;
381
+ color: var(--gallery-muted);
382
+ }
383
+
384
+ .demo-title {
385
+ font-weight: 600;
386
+ }
387
+
388
+ .demo-command {
389
+ display: block;
390
+ margin: 0 0 6px;
391
+ padding: 6px 8px;
392
+ border-radius: calc(var(--gallery-radius) - 4px);
393
+ background: var(--gallery-bg);
394
+ font:
395
+ 11px/1.4 ui-monospace,
396
+ monospace;
397
+ overflow-wrap: break-word;
398
+ user-select: all;
399
+ }
400
+
401
+ .demo-dismiss {
402
+ position: absolute;
403
+ top: 6px;
404
+ right: 6px;
405
+ display: grid;
406
+ place-items: center;
407
+ width: 22px;
408
+ height: 22px;
409
+ padding: 0;
410
+ border: 0;
411
+ border-radius: calc(var(--gallery-radius) - 4px);
412
+ background: transparent;
413
+ color: var(--gallery-muted);
414
+ cursor: pointer;
415
+ }
416
+
417
+ .demo-dismiss:hover {
418
+ background: color-mix(in srgb, var(--gallery-fg) 10%, transparent);
419
+ color: var(--gallery-fg);
420
+ }
421
+
422
+ .demo-dismiss svg {
423
+ width: 14px;
424
+ height: 14px;
425
+ fill: none;
426
+ stroke: currentColor;
427
+ stroke-width: 2;
428
+ stroke-linecap: round;
429
+ }
430
+
431
+ body.message .demo-note {
432
+ display: none;
433
+ }
434
+
356
435
  /* Focus and motion */
357
436
 
358
437
  .control:focus-visible,
438
+ .demo-dismiss:focus-visible,
359
439
  .apply:focus-visible,
360
440
  .interval-row input:focus-visible,
361
441
  .switch input:focus-visible {
@@ -22,6 +22,19 @@
22
22
  <p id="message" class="message-text" role="status"></p>
23
23
  </main>
24
24
 
25
+ <aside id="demo-note" class="demo-note" aria-labelledby="demo-title" hidden>
26
+ <p id="demo-title" class="demo-title"></p>
27
+ <p id="demo-run"></p>
28
+ <code class="demo-command"
29
+ >npx orca-gallery-panel ~/Pictures --out ~/orca-gallery --watch</code
30
+ >
31
+ <p id="demo-add"></p>
32
+ <p id="demo-watch"></p>
33
+ <button type="button" id="demo-dismiss" class="demo-dismiss">
34
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" /></svg>
35
+ </button>
36
+ </aside>
37
+
25
38
  <div class="controls" role="toolbar">
26
39
  <button type="button" class="control" data-action="previous">
27
40
  <svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6" /></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orca-gallery-panel",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Background images for the Orca agent IDE: a side panel with a rotating gallery of your own pictures.",
5
5
  "keywords": [
6
6
  "orca",
@@ -50,7 +50,9 @@
50
50
  "check": "npm run typecheck && npm run lint && npm run format:check && npm test",
51
51
  "test:e2e": "node --test --test-concurrency=1 \"test/e2e/**/*.test.ts\"",
52
52
  "build:lib": "node scripts/build-lib.ts",
53
- "prepack": "npm run build:lib"
53
+ "build:demo": "node scripts/build-demo-plugin.ts",
54
+ "prepack": "npm run build:lib",
55
+ "version": "npm run build:demo && git add plugin"
54
56
  },
55
57
  "dependencies": {
56
58
  "esbuild": "^0.28.2",