gutterpress 0.10.6 → 0.10.7

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 (42) hide show
  1. package/README.md +71 -3
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +4 -2
  4. package/dist/{audit-0a4sp2w5.js → audit-19e2431j.js} +4 -4
  5. package/dist/{build-z53bbxtx.js → build-gqqew2vr.js} +4 -4
  6. package/dist/checks/source/css-ownership.d.ts +43 -0
  7. package/dist/checks/source/index.d.ts +1 -0
  8. package/dist/{cli-he23vgjj.js → cli-h8ejbtyr.js} +15 -2
  9. package/dist/{cli-kwt5ftvc.js → cli-kzf64c2g.js} +4991 -3933
  10. package/dist/{cli-m99hj80k.js → cli-pvk2s9d7.js} +1 -1
  11. package/dist/{cli-bwbs3qm4.js → cli-s8q42x3r.js} +1 -1
  12. package/dist/cli.js +70 -37
  13. package/dist/{doctor-d8vpv1pt.js → doctor-3ccz35yz.js} +2 -2
  14. package/dist/{engine-4ctgbwj5.js → engine-88mynx9a.js} +2 -2
  15. package/dist/{engine-bhhcne06.js → engine-pb6h089e.js} +1 -1
  16. package/dist/{index-k5hcp8wj.js → index-837htyjy.js} +1 -1
  17. package/dist/{index-eyzv51dw.js → index-a0xpm188.js} +1 -1
  18. package/dist/{index-1rcfsx67.js → index-r4ny4fyr.js} +2586 -2073
  19. package/dist/index.js +5 -3
  20. package/dist/lib/cli-args.d.ts +9 -0
  21. package/dist/lib/manifest-doc.d.ts +8 -2
  22. package/dist/lib/markdown/assemble.d.ts +24 -7
  23. package/dist/lib/markdown/gfm-alerts.d.ts +7 -0
  24. package/dist/lib/markdown/gutterpress-css.d.ts +1 -1
  25. package/dist/lib/markdown/index.d.ts +16 -0
  26. package/dist/lib/markdown/plugins.d.ts +8 -12
  27. package/dist/lib/markdown/renderer.d.ts +48 -1
  28. package/dist/lib/style-declarations.d.ts +20 -0
  29. package/dist/lib/style-resolver.d.ts +2 -0
  30. package/dist/lib/theme-manager.d.ts +110 -9
  31. package/dist/{lint-nm57gn26.js → lint-mpz7vfc8.js} +4 -4
  32. package/dist/{manifest.schema-hn6ac0ae.json → manifest.schema-kwnrwv8b.json} +11 -8
  33. package/dist/{new-sawc7zh4.js → new-nbrpsw7t.js} +4 -4
  34. package/dist/{plugin-p8yghztz.js → plugin-gg5mk26h.js} +5 -11
  35. package/dist/{preflight-48kwf2pm.js → preflight-jnmd4mg2.js} +4 -4
  36. package/dist/{preview-10r4dk3d.js → preview-hsr9d12d.js} +4 -4
  37. package/dist/{publish-cd05sbdx.js → publish-pcrrn6fd.js} +4 -4
  38. package/dist/render.js +155 -52
  39. package/dist/schema/manifest.types.d.ts +20 -7
  40. package/dist/theme-6fa0yjzq.js +323 -0
  41. package/dist/{validate-70ta3br9.js → validate-7n25fx0g.js} +4 -4
  42. package/package.json +1 -1
package/README.md CHANGED
@@ -133,9 +133,10 @@ The full configuration cascade is `CLI flags > manifest.yaml > preset defaults`.
133
133
 
134
134
  ## Commands
135
135
 
136
- Gutterpress has 10 subcommands. `new`, `preview`, `build`, and `publish` are the
136
+ Gutterpress has 11 subcommands. `new`, `preview`, `build`, and `publish` are the
137
137
  primary author commands; `lint`, `validate`, `audit`, and `preflight` are
138
- CI / advanced checks; and `doctor` reports system readiness. `plugin` manages project plugins. Every
138
+ CI / advanced checks; and `doctor` reports system readiness. `plugin` manages
139
+ project plugins and `theme` manages project themes. Every
139
140
  command also accepts `--help` for the authoritative, always-current flag list
140
141
  (`gutterpress <command> --help`) — this section is regenerated from the same
141
142
  source.
@@ -349,6 +350,73 @@ gutterpress plugin add markdown-it-highlightjs@4.3.0 ./my-book
349
350
  gutterpress plugin add markdown-it-emoji@3.0.0 ./my-book --export full
350
351
  ```
351
352
 
353
+ ### `gutterpress theme`
354
+
355
+ List, apply, import, revert, or remove project themes — the same
356
+ `applyTheme`/`importThemeFrom*`/`revertTheme`/`removeProjectTheme` functions
357
+ the desktop app's Theme panel calls, so a theme applied from the terminal is
358
+ just as switchable/revertible as one applied from the GUI.
359
+
360
+ ```sh
361
+ gutterpress theme
362
+
363
+ --help Show theme subcommands
364
+ ```
365
+
366
+ #### `gutterpress theme list`
367
+
368
+ List the built-in themes, the themes already vendored into this project
369
+ (`themes/<id>/`), and which one (if any) is active.
370
+
371
+ ```sh
372
+ gutterpress theme list ./my-book
373
+ ```
374
+
375
+ #### `gutterpress theme apply`
376
+
377
+ Apply a theme: a built-in id (`clean-book`, `zine`, `technical-doc`) is copied
378
+ into `themes/<id>/` the first time, and the manifest's `styles:` entry is
379
+ wired so its `theme.css` is the active stylesheet, keeping its cascade
380
+ position. Re-running `apply` with an id that is already a project theme makes
381
+ it active again without forking a second copy — the same non-destructive
382
+ re-apply guarantee the desktop's Theme panel relies on.
383
+
384
+ ```sh
385
+ gutterpress theme apply clean-book ./my-book
386
+ gutterpress theme apply zine ./my-book
387
+ ```
388
+
389
+ #### `gutterpress theme import`
390
+
391
+ Import a theme from a local folder, a `.zip` package, a `.css` file, or an
392
+ `http(s)` URL. Importing vendors the theme under `themes/<id>/` but does not
393
+ apply it — follow up with `gutterpress theme apply <id>`.
394
+
395
+ ```sh
396
+ gutterpress theme import ./my-theme-folder ./my-book
397
+ gutterpress theme import ./my-theme.zip ./my-book
398
+ gutterpress theme import ./my-theme.css ./my-book
399
+ gutterpress theme import https://example.com/themes/cool/ ./my-book
400
+ ```
401
+
402
+ #### `gutterpress theme revert`
403
+
404
+ Re-apply the theme that was active immediately before the current one.
405
+ Reverting twice toggles back — it is a swap, not a history stack.
406
+
407
+ ```sh
408
+ gutterpress theme revert ./my-book
409
+ ```
410
+
411
+ #### `gutterpress theme remove`
412
+
413
+ Remove a project theme (never a built-in). If it was the active theme, its
414
+ manifest `styles:` entry is dropped too, leaving no theme active.
415
+
416
+ ```sh
417
+ gutterpress theme remove zine ./my-book
418
+ ```
419
+
352
420
  ## Exit codes
353
421
 
354
422
  Every command follows the same exit-code contract, so CI can branch on the result without parsing output:
@@ -360,7 +428,7 @@ Every command follows the same exit-code contract, so CI can branch on the resul
360
428
  | `2` | Usage — the invocation itself was wrong: a bad flag, positional argument, preset, or value. |
361
429
  | `3` | Pipeline — the build/render/export pipeline itself failed for a reason unrelated to usage or findings (I/O error, missing tool, renderer crash). |
362
430
 
363
- This applies uniformly across `build`, `preview`, `lint`, `validate`, `preflight`, `audit`, `publish`, `plugin`, `new`, and `doctor`.
431
+ This applies uniformly across `build`, `preview`, `lint`, `validate`, `preflight`, `audit`, `publish`, `plugin`, `theme`, `new`, and `doctor`.
364
432
 
365
433
  ## Plugins
366
434
 
@@ -33,7 +33,7 @@ export { extractVariables, substituteVariables, listSnippets, readSnippet, saveS
33
33
  export type { SnippetEntry } from "../lib/snippets.ts";
34
34
  export { listProjectPlugins, setPluginEnabled, addLocalPlugin, addNpmPlugin, validateProjectPlugins, RECOMMENDED_PLUGINS, PLUGINS_DIR, } from "../lib/plugin-manager.ts";
35
35
  export type { ProjectPluginEntry, PluginValidationResult, RecommendedPlugin, PluginKind, } from "../lib/plugin-manager.ts";
36
- export { listBuiltInThemes, resolveBuiltInTheme, listProjectThemes, getActiveTheme, applyTheme, importThemeFromFolder, importThemeFromUrl, readThemeCss, removeProjectTheme, getPreviousTheme, revertTheme, BUILT_IN_THEME_IDS, THEMES_DIR, } from "../lib/theme-manager.ts";
36
+ export { listBuiltInThemes, resolveBuiltInTheme, listProjectThemes, getActiveTheme, applyTheme, importThemeFromFolder, importThemeFromUrl, readThemeCss, removeProjectTheme, getPreviousTheme, revertTheme, detectLegacyForkedTheme, BUILT_IN_THEME_IDS, THEMES_DIR, } from "../lib/theme-manager.ts";
37
37
  export type { ThemeInfo, ThemeMetadata, ResolvedTheme, ApplyThemeTarget, BuiltInThemeId, } from "../lib/theme-manager.ts";
38
38
  export { importThemeFromFile } from "../lib/theme-import.ts";
39
39
  export type { ThemeImportResult, ThemeImportWarning } from "../lib/theme-import.ts";
package/dist/api/index.js CHANGED
@@ -37,6 +37,7 @@ import {
37
37
  connectPublishProvider,
38
38
  defaultConfigDir,
39
39
  deleteSnippet,
40
+ detectLegacyForkedTheme,
40
41
  diagnoseProjectRemote,
41
42
  disconnectPublishCredential,
42
43
  escapeYamlScalar,
@@ -106,12 +107,12 @@ import {
106
107
  syncProject,
107
108
  testRemoteAccess,
108
109
  validateProjectPlugins
109
- } from "../index-1rcfsx67.js";
110
+ } from "../index-r4ny4fyr.js";
110
111
  import {
111
112
  BuildError,
112
113
  DEFAULT_PRINT_OPTS,
113
114
  readyProbeExpr
114
- } from "../index-k5hcp8wj.js";
115
+ } from "../index-837htyjy.js";
115
116
  import {
116
117
  AUTO_SNAPSHOT_MESSAGE,
117
118
  HISTORY_PAGE_LIMIT,
@@ -208,6 +209,7 @@ export {
208
209
  disconnectPublishCredential,
209
210
  diagnoseProjectRemote,
210
211
  detectProjectSource,
212
+ detectLegacyForkedTheme,
211
213
  deleteSnippet,
212
214
  defaultConfigDir,
213
215
  connectPublishProvider,
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  executeAndReport
3
- } from "./cli-kwt5ftvc.js";
3
+ } from "./cli-kzf64c2g.js";
4
4
  import {
5
5
  log
6
- } from "./cli-m99hj80k.js";
6
+ } from "./cli-pvk2s9d7.js";
7
7
  import {
8
8
  UsageError,
9
9
  rejectExtraPositionals,
10
10
  rejectUnknownFlags
11
- } from "./cli-he23vgjj.js";
12
- import"./cli-bwbs3qm4.js";
11
+ } from "./cli-h8ejbtyr.js";
12
+ import"./cli-s8q42x3r.js";
13
13
  import"./cli-c41yr7he.js";
14
14
  import {
15
15
  EXIT_CODES
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runBuild,
3
3
  splitOutPath
4
- } from "./cli-kwt5ftvc.js";
4
+ } from "./cli-kzf64c2g.js";
5
5
  import {
6
6
  log
7
- } from "./cli-m99hj80k.js";
7
+ } from "./cli-pvk2s9d7.js";
8
8
  import {
9
9
  UsageError,
10
10
  parseEngine,
@@ -12,8 +12,8 @@ import {
12
12
  parsePdfxFlavor,
13
13
  rejectExtraPositionals,
14
14
  rejectUnknownFlags
15
- } from "./cli-he23vgjj.js";
16
- import"./cli-bwbs3qm4.js";
15
+ } from "./cli-h8ejbtyr.js";
16
+ import"./cli-s8q42x3r.js";
17
17
  import"./cli-c41yr7he.js";
18
18
  import {
19
19
  BuildError
@@ -0,0 +1,43 @@
1
+ import type { Check } from "../types";
2
+ /** One file's rules in the contract. Every key is optional — a file entry
3
+ * with none of these is legal (and pointless) but never an error. */
4
+ export interface CssContractFileRules {
5
+ /**
6
+ * Closed allow-list for this file's TOP-LEVEL content only (direct children
7
+ * of the stylesheet root — deliberately not recursive into `@media`/
8
+ * `@supports`, keeping this a check on the file's own flat structure, not a
9
+ * search through every possible nesting). A plain entry (e.g. ":root")
10
+ * matches a top-level rule's selector, trimmed, exactly. An `@`-prefixed
11
+ * entry (e.g. "@font-face") matches a top-level at-rule's name. Anything
12
+ * else at the top level is a violation.
13
+ */
14
+ allow?: string[];
15
+ /** Property names (case-insensitive) that must never be declared anywhere
16
+ * in this file, independent of any ownership claim below. */
17
+ "forbid-properties"?: string[];
18
+ /**
19
+ * Property names this file exclusively owns. Checked project-wide: ANY
20
+ * OTHER css file passed to this check (whether or not that file has its
21
+ * own contract entry) that declares one of these properties is flagged —
22
+ * the whole point being that a collision can appear in a file nobody
23
+ * thought to annotate.
24
+ */
25
+ "owns-properties"?: string[];
26
+ /** Same mechanism as `owns-properties`, keyed by at-rule name (without the
27
+ * leading `@`, e.g. "page" for `@page`). */
28
+ "owns-at-rules"?: string[];
29
+ /**
30
+ * Regex source strings (case-insensitive). A rule is flagged when one of
31
+ * its comma-separated selector branches matches a pattern AND nothing
32
+ * precedes the match in that branch — i.e. the matched class/pattern is the
33
+ * outermost compound selector, with no page/chapter/section ancestor
34
+ * qualifying it. `.page .dc-callout` is scoped and passes; a bare
35
+ * `.dc-callout` does not.
36
+ */
37
+ "forbid-unscoped-selectors"?: string[];
38
+ }
39
+ export interface CssContract {
40
+ files?: Record<string, CssContractFileRules>;
41
+ }
42
+ declare const check: Check;
43
+ export default check;
@@ -1,6 +1,7 @@
1
1
  import "./markdownlint";
2
2
  import "./htmlhint";
3
3
  import "./stylelint";
4
+ import "./css-ownership";
4
5
  import "./local-refs";
5
6
  import "./accessibility-alt-text";
6
7
  import "./accessibility-heading-order";
@@ -4,7 +4,7 @@ import {
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "gutterpress",
7
- version: "0.10.6",
7
+ version: "0.10.7",
8
8
  description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
9
9
  author: "itlackey",
10
10
  license: "MPL-2.0",
@@ -105,6 +105,9 @@ var package_default = {
105
105
  }
106
106
  };
107
107
 
108
+ // src/lib/cli-args.ts
109
+ import { resolve } from "node:path";
110
+
108
111
  // src/constants.ts
109
112
  var NETWORK = {
110
113
  DEFAULT_PORT: 3579
@@ -273,5 +276,15 @@ function resolvePort(raw) {
273
276
  }
274
277
  return n;
275
278
  }
279
+ function exitForUsage(error) {
280
+ if (error instanceof UsageError) {
281
+ console.error(error.message);
282
+ process.exit(error.exitCode);
283
+ }
284
+ throw error;
285
+ }
286
+ function resolveProjectDir(dir) {
287
+ return resolve(typeof dir === "string" && dir ? dir : process.cwd());
288
+ }
276
289
 
277
- export { package_default, DEBOUNCE, UsageError, rejectUnknownFlags, rejectExtraPositionals, parseFormat, parsePdfxFlavor, parseEngine, resolvePort };
290
+ export { package_default, DEBOUNCE, UsageError, rejectUnknownFlags, rejectExtraPositionals, parseFormat, parsePdfxFlavor, parseEngine, resolvePort, exitForUsage, resolveProjectDir };