@notectl/core 2.2.5 → 2.2.6

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 (92) hide show
  1. package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs → AlignmentPlugin-DeD4C4EP.mjs} +2 -2
  2. package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs.map → AlignmentPlugin-DeD4C4EP.mjs.map} +1 -1
  3. package/dist/chunks/{CodeBlockPlugin-DC0-BnNy.mjs → CodeBlockPlugin-3V2K3RBe.mjs} +2 -2
  4. package/dist/chunks/{CodeBlockPlugin-DC0-BnNy.mjs.map → CodeBlockPlugin-3V2K3RBe.mjs.map} +1 -1
  5. package/dist/chunks/{ColorGrid-CXRdpP_n.mjs → ColorGrid-DPNiXxpD.mjs} +2 -2
  6. package/dist/chunks/{ColorGrid-CXRdpP_n.mjs.map → ColorGrid-DPNiXxpD.mjs.map} +1 -1
  7. package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs → ColorPickerPopup-lcf3jS6G.mjs} +2 -2
  8. package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs.map → ColorPickerPopup-lcf3jS6G.mjs.map} +1 -1
  9. package/dist/chunks/FontPlugin-DQMj65Bc.mjs +2 -0
  10. package/dist/chunks/{FontPlugin-DB1_bgam.mjs.map → FontPlugin-DQMj65Bc.mjs.map} +1 -1
  11. package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs → FontSizePlugin-9StCjEfN.mjs} +2 -2
  12. package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs.map → FontSizePlugin-9StCjEfN.mjs.map} +1 -1
  13. package/dist/chunks/{FormulaPlugin-BLEcyazj.mjs → FormulaPlugin-CV5VUxkb.mjs} +2 -2
  14. package/dist/chunks/{FormulaPlugin-BLEcyazj.mjs.map → FormulaPlugin-CV5VUxkb.mjs.map} +1 -1
  15. package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs → HeadingPlugin-BuGoM9Rz.mjs} +2 -2
  16. package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs.map → HeadingPlugin-BuGoM9Rz.mjs.map} +1 -1
  17. package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs → HighlightPlugin-C6pHifVz.mjs} +2 -2
  18. package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs.map → HighlightPlugin-C6pHifVz.mjs.map} +1 -1
  19. package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs → ImagePlugin-KpkuE2LH.mjs} +2 -2
  20. package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs.map → ImagePlugin-KpkuE2LH.mjs.map} +1 -1
  21. package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs → InlineStyleMarkSpec-C6LJT7kp.mjs} +2 -2
  22. package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs.map → InlineStyleMarkSpec-C6LJT7kp.mjs.map} +1 -1
  23. package/dist/chunks/{ListPlugin-CVId2dE0.mjs → ListPlugin-2yl6KiTK.mjs} +2 -2
  24. package/dist/chunks/{ListPlugin-CVId2dE0.mjs.map → ListPlugin-2yl6KiTK.mjs.map} +1 -1
  25. package/dist/chunks/{PopupManager-CyOfZUab.mjs → PopupManager-DUtaK3WX.mjs} +2 -2
  26. package/dist/chunks/{PopupManager-CyOfZUab.mjs.map → PopupManager-DUtaK3WX.mjs.map} +1 -1
  27. package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs → PopupPositioning-BB97-__N.mjs} +2 -2
  28. package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs.map → PopupPositioning-BB97-__N.mjs.map} +1 -1
  29. package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs +2 -0
  30. package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs.map +1 -0
  31. package/dist/chunks/{PrintTypes-WdtgSj74.mjs → PrintTypes-CxU69qu3.mjs} +3 -2
  32. package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +1 -0
  33. package/dist/chunks/StyleRuntime-BFKu52mS.mjs +2 -0
  34. package/dist/chunks/StyleRuntime-BFKu52mS.mjs.map +1 -0
  35. package/dist/chunks/{TablePlugin-D93RR5xH.mjs → TablePlugin-BTH9VRZq.mjs} +2 -2
  36. package/dist/chunks/{TablePlugin-D93RR5xH.mjs.map → TablePlugin-BTH9VRZq.mjs.map} +1 -1
  37. package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs → TextColorPlugin-CEfZQ6Md.mjs} +2 -2
  38. package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs.map → TextColorPlugin-CEfZQ6Md.mjs.map} +1 -1
  39. package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs → ToolbarPlugin-DVGrFf8v.mjs} +2 -2
  40. package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs.map → ToolbarPlugin-DVGrFf8v.mjs.map} +1 -1
  41. package/dist/chunks/{VideoPlugin-D9rQZol6.mjs → VideoPlugin-B3uf1Dwp.mjs} +2 -2
  42. package/dist/chunks/{VideoPlugin-D9rQZol6.mjs.map → VideoPlugin-B3uf1Dwp.mjs.map} +1 -1
  43. package/dist/chunks/{full-Cah3qjCT.mjs → full-BBl7mvwH.mjs} +2 -2
  44. package/dist/chunks/{full-Cah3qjCT.mjs.map → full-BBl7mvwH.mjs.map} +1 -1
  45. package/dist/chunks/minimal-CtnR4dqp.mjs +2 -0
  46. package/dist/chunks/{minimal-DqATlnAL.mjs.map → minimal-CtnR4dqp.mjs.map} +1 -1
  47. package/dist/chunks/src-C89Cw7ni.mjs +2 -0
  48. package/dist/chunks/{src-YY6n2SmV.mjs.map → src-C89Cw7ni.mjs.map} +1 -1
  49. package/dist/editor/NotectlEditor.d.ts +22 -3
  50. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  51. package/dist/full.mjs +1 -1
  52. package/dist/notectl-core.mjs +1 -1
  53. package/dist/notectl-core.umd.js +1 -1
  54. package/dist/notectl-core.umd.js.map +1 -1
  55. package/dist/plugins/alignment.mjs +1 -1
  56. package/dist/plugins/code-block.mjs +1 -1
  57. package/dist/plugins/font-size.mjs +1 -1
  58. package/dist/plugins/font.mjs +1 -1
  59. package/dist/plugins/formula.mjs +1 -1
  60. package/dist/plugins/heading.mjs +1 -1
  61. package/dist/plugins/highlight.mjs +1 -1
  62. package/dist/plugins/image.mjs +1 -1
  63. package/dist/plugins/list.mjs +1 -1
  64. package/dist/plugins/print/PrintHostStyles.d.ts +50 -0
  65. package/dist/plugins/print/PrintHostStyles.d.ts.map +1 -0
  66. package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
  67. package/dist/plugins/print/PrintServiceImpl.d.ts +72 -3
  68. package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
  69. package/dist/plugins/print/PrintStyleCollector.d.ts +150 -21
  70. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
  71. package/dist/plugins/print/StaticHostMarker.d.ts +18 -0
  72. package/dist/plugins/print/StaticHostMarker.d.ts.map +1 -0
  73. package/dist/plugins/print.mjs +1 -1
  74. package/dist/plugins/shared.mjs +1 -1
  75. package/dist/plugins/table.mjs +1 -1
  76. package/dist/plugins/text-color.mjs +1 -1
  77. package/dist/plugins/toolbar.mjs +1 -1
  78. package/dist/plugins/video.mjs +1 -1
  79. package/dist/presets/full.mjs +1 -1
  80. package/dist/presets/minimal.mjs +1 -1
  81. package/dist/presets.mjs +1 -1
  82. package/dist/style/StyleRuntime.d.ts +7 -0
  83. package/dist/style/StyleRuntime.d.ts.map +1 -1
  84. package/package.json +1 -1
  85. package/dist/chunks/FontPlugin-DB1_bgam.mjs +0 -2
  86. package/dist/chunks/PrintPlugin-C6gOJT6d.mjs +0 -2
  87. package/dist/chunks/PrintPlugin-C6gOJT6d.mjs.map +0 -1
  88. package/dist/chunks/PrintTypes-WdtgSj74.mjs.map +0 -1
  89. package/dist/chunks/StyleRuntime-BAutwDZT.mjs +0 -2
  90. package/dist/chunks/StyleRuntime-BAutwDZT.mjs.map +0 -1
  91. package/dist/chunks/minimal-DqATlnAL.mjs +0 -2
  92. package/dist/chunks/src-YY6n2SmV.mjs +0 -2
@@ -1 +1 @@
1
- import{i as s,n,r as a,t as i}from"../chunks/AlignmentPlugin-BCHxo16v.mjs";export{i as ALIGNMENT_ICONS,a as ALIGNMENT_LOCALE_EN,n as AlignmentPlugin,s as loadAlignmentLocale};
1
+ import{i as s,n,r as a,t as i}from"../chunks/AlignmentPlugin-DeD4C4EP.mjs";export{i as ALIGNMENT_ICONS,a as ALIGNMENT_LOCALE_EN,n as AlignmentPlugin,s as loadAlignmentLocale};
@@ -1 +1 @@
1
- import{a as s,i as a,n as o,o as m,r,t as i}from"../chunks/CodeBlockPlugin-DC0-BnNy.mjs";import{c as n,i as p,n as t,o as c}from"../chunks/XmlSupport-BYiRwlkK.mjs";export{o as CODE_BLOCK_LOCALE_EN,s as CODE_BLOCK_SERVICE_KEY,i as CodeBlockPlugin,n as JAVA_LANGUAGE,c as JSON_LANGUAGE,a as RegexTokenizer,m as SYNTAX_HIGHLIGHTER_SERVICE_KEY,p as TYPESCRIPT_LANGUAGE,t as XML_LANGUAGE,r as loadCodeBlockLocale};
1
+ import{a as s,i as a,n as o,o as m,r,t as i}from"../chunks/CodeBlockPlugin-3V2K3RBe.mjs";import{c as n,i as p,n as t,o as c}from"../chunks/XmlSupport-BYiRwlkK.mjs";export{o as CODE_BLOCK_LOCALE_EN,s as CODE_BLOCK_SERVICE_KEY,i as CodeBlockPlugin,n as JAVA_LANGUAGE,c as JSON_LANGUAGE,a as RegexTokenizer,m as SYNTAX_HIGHLIGHTER_SERVICE_KEY,p as TYPESCRIPT_LANGUAGE,t as XML_LANGUAGE,r as loadCodeBlockLocale};
@@ -1 +1 @@
1
- import{n as s,r as n,t as o}from"../chunks/FontSizePlugin-DFvp7Ki9.mjs";export{s as FONT_SIZE_LOCALE_EN,o as FontSizePlugin,n as loadFontSizeLocale};
1
+ import{n as s,r as n,t as o}from"../chunks/FontSizePlugin-9StCjEfN.mjs";export{s as FONT_SIZE_LOCALE_EN,o as FontSizePlugin,n as loadFontSizeLocale};
@@ -1 +1 @@
1
- import{n as s,r as n,t as o}from"../chunks/FontPlugin-DB1_bgam.mjs";export{s as FONT_LOCALE_EN,o as FontPlugin,n as loadFontLocale};
1
+ import{n as s,r as n,t as o}from"../chunks/FontPlugin-DQMj65Bc.mjs";export{s as FONT_LOCALE_EN,o as FontPlugin,n as loadFontLocale};
@@ -1 +1 @@
1
- import{a as s,c as a,i as o,n as r,o as m,r as i,s as n,t}from"../chunks/FormulaPlugin-BLEcyazj.mjs";export{n as DEFAULT_FORMULA_KEYMAP,r as FORMULA_LOCALE_EN,t as FormulaPlugin,s as MATHML_ATTRS,m as MATHML_TAGS,a as buildMathML,o as latexToMathML,i as loadFormulaLocale};
1
+ import{a as s,c as a,i as o,n as r,o as m,r as i,s as n,t}from"../chunks/FormulaPlugin-CV5VUxkb.mjs";export{n as DEFAULT_FORMULA_KEYMAP,r as FORMULA_LOCALE_EN,t as FormulaPlugin,s as MATHML_ATTRS,m as MATHML_TAGS,a as buildMathML,o as latexToMathML,i as loadFormulaLocale};
@@ -1 +1 @@
1
- import{t as s}from"../chunks/BlockTypePickerRegistry-BTET9jM-.mjs";import{n as r,r as i,t as m}from"../chunks/HeadingPlugin-D9yvG2Aw.mjs";export{s as BlockTypePickerRegistry,r as HEADING_LOCALE_EN,m as HeadingPlugin,i as loadHeadingLocale};
1
+ import{t as s}from"../chunks/BlockTypePickerRegistry-BTET9jM-.mjs";import{n as r,r as i,t as m}from"../chunks/HeadingPlugin-BuGoM9Rz.mjs";export{s as BlockTypePickerRegistry,r as HEADING_LOCALE_EN,m as HeadingPlugin,i as loadHeadingLocale};
@@ -1 +1 @@
1
- import{n as s,r as i,t as r}from"../chunks/HighlightPlugin-D4gh4RP7.mjs";export{s as HIGHLIGHT_LOCALE_EN,r as HighlightPlugin,i as loadHighlightLocale};
1
+ import{n as s,r as i,t as r}from"../chunks/HighlightPlugin-C6pHifVz.mjs";export{s as HIGHLIGHT_LOCALE_EN,r as HighlightPlugin,i as loadHighlightLocale};
@@ -1 +1 @@
1
- import{a,i as s,n as m,r,t as i}from"../chunks/ImagePlugin-Cp_RINtc.mjs";export{m as DEFAULT_IMAGE_KEYMAP,s as IMAGE_LOCALE_EN,r as IMAGE_UPLOAD_SERVICE,i as ImagePlugin,a as loadImageLocale};
1
+ import{a,i as s,n as m,r,t as i}from"../chunks/ImagePlugin-KpkuE2LH.mjs";export{m as DEFAULT_IMAGE_KEYMAP,s as IMAGE_LOCALE_EN,r as IMAGE_UPLOAD_SERVICE,i as ImagePlugin,a as loadImageLocale};
@@ -1 +1 @@
1
- import{n as s,r,t}from"../chunks/ListPlugin-CVId2dE0.mjs";export{s as LIST_LOCALE_EN,t as ListPlugin,r as loadListLocale};
1
+ import{n as s,r,t}from"../chunks/ListPlugin-2yl6KiTK.mjs";export{s as LIST_LOCALE_EN,t as ListPlugin,r as loadListLocale};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copies the host page's stylesheets verbatim into the print document.
3
+ *
4
+ * The print document preserves the editor's shadow boundary (declarative
5
+ * shadow DOM), so host-authored rules — `::part()`, element selectors, custom
6
+ * properties, `@media`, `@layer`, `@supports`, CSS nesting — apply natively
7
+ * and need no translation or rewriting.
8
+ *
9
+ * All copied CSS is wrapped in the `notectl-host` cascade layer. Layering does
10
+ * not weaken it against the editor's shadow styles, because the cascade
11
+ * compares tree context before layers (an outer normal declaration beats a
12
+ * shadow-tree one regardless). It does keep the print document's own rules in
13
+ * control: its unlayered rules (page setup, body typography, customCSS) win
14
+ * over the copy for normal declarations regardless of specificity, and the
15
+ * print guards (host-element reset, forced light theme) — `!important` inside
16
+ * the earlier-declared `notectl-print` layer — win even against `!important`
17
+ * host rules.
18
+ *
19
+ * Stylesheets whose rules are not readable (cross-origin) are re-referenced
20
+ * via hoisted `@import ... layer(notectl-host)` statements so the print
21
+ * document loads them itself. The copy is produced as an ordered segment list
22
+ * (rule chunks and `@import` statements interleaved in source order) so
23
+ * equal-specificity cascade ties resolve exactly as on the live page.
24
+ * Disabled stylesheets are skipped and stylesheet-level media conditions are
25
+ * preserved as `@media` wrappers.
26
+ */
27
+ /** Cascade layer that holds the copied host-page styles in print output. */
28
+ export declare const HOST_STYLE_LAYER = "notectl-host";
29
+ /**
30
+ * One source-ordered piece of the host-page CSS copy. `rules` segments hold
31
+ * verbatim rule text destined for the `notectl-host` layer; `import` segments
32
+ * hold hoisted `@import` statements for unreadable (cross-origin) sheets.
33
+ * `@import` must precede every other rule of its stylesheet, so each segment
34
+ * is emitted as its own `<style>` element — keeping the live source order,
35
+ * which decides equal-specificity ties within the layer.
36
+ */
37
+ export type HostStyleSegment = {
38
+ readonly kind: 'rules';
39
+ readonly css: string;
40
+ } | {
41
+ readonly kind: 'import';
42
+ readonly statement: string;
43
+ };
44
+ /**
45
+ * Copies all stylesheets that can target this editor (document-level plus any
46
+ * enclosing shadow roots, including adopted sheets) into an ordered list of
47
+ * verbatim CSS segments for the print document.
48
+ */
49
+ export declare function collectHostStyleSegments(host: HTMLElement): readonly HostStyleSegment[];
50
+ //# sourceMappingURL=PrintHostStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrintHostStyles.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/PrintHostStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAI/C;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAyS3D;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,gBAAgB,EAAE,CAavF"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrintPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/PrintPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,KAAK,EAAgB,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAiBrF,qBAAa,WAAY,YAAW,MAAM;IACzC,QAAQ,CAAC,EAAE,WAAW;IACtB,QAAQ,CAAC,IAAI,WAAW;IAExB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,CAAC,EAAE,iBAAiB;IAIhC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDjD,OAAO,IAAI,IAAI;CAGf"}
1
+ {"version":3,"file":"PrintPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/PrintPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,KAAK,EAAgB,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAkBrF,qBAAa,WAAY,YAAW,MAAM;IACzC,QAAQ,CAAC,EAAE,WAAW;IACtB,QAAQ,CAAC,IAAI,WAAW;IAExB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,CAAC,EAAE,iBAAiB;IAIhC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDjD,OAAO,IAAI,IAAI;CAMf"}
@@ -1,7 +1,76 @@
1
1
  import { PluginEventBus } from '../Plugin.js';
2
+ import { HostStyleSegment } from './PrintHostStyles.js';
2
3
  import { PrintService } from './PrintTypes.js';
3
- /** Builds a complete HTML document string from CSS, body content, and title. */
4
- export declare function buildHTMLDocument(css: string, content: string, title: string, lang?: string): string;
4
+ /** Marker attribute on the static light-DOM fallback of the export variant. */
5
+ export declare const PRINT_FALLBACK_ATTRIBUTE = "data-notectl-print-fallback";
6
+ /**
7
+ * Marker attribute on the inert `<template>` carrying the export variant's
8
+ * standalone style bundle (page-level CSS and the verbatim host-CSS copy).
9
+ */
10
+ export declare const PRINT_STYLE_BUNDLE_ATTRIBUTE = "data-notectl-print-styles";
11
+ /**
12
+ * `<meta name>` marking the export document itself. The fallback script only
13
+ * activates the standalone style bundle when this meta sits in
14
+ * `document.head` — true when the export is the document being rendered
15
+ * (file, iframe `srcdoc`, `document.write`, HTML-to-PDF engines), never when
16
+ * it was inlined into a consumer page (fragment parsing keeps the meta inside
17
+ * the injected subtree, outside `document.head`).
18
+ */
19
+ export declare const PRINT_EXPORT_META_NAME = "notectl-print-export";
20
+ /** Everything needed to assemble the print document. */
21
+ export interface PrintDocumentInput {
22
+ /**
23
+ * Document-level CSS matching the variant: full page fidelity for
24
+ * `internal` ({@link buildDocumentCSS}), marker-qualified inline baseline
25
+ * for `export` ({@link buildExportDocumentCSS}).
26
+ */
27
+ readonly documentCSS: string;
28
+ /**
29
+ * Full-fidelity page CSS ({@link buildDocumentCSS}) shipped by the export
30
+ * variant inside the inert standalone style bundle; the fallback script
31
+ * activates it only when the export is rendered as its own document.
32
+ */
33
+ readonly standaloneCSS: string;
34
+ /** Source-ordered host-page CSS copy (rule chunks and hoisted `@import`s). */
35
+ readonly hostSegments: readonly HostStyleSegment[];
36
+ /** CSS placed inside the declarative shadow root. */
37
+ readonly shadowCSS: string;
38
+ /** The live editor host element; its tag and attributes are replicated. */
39
+ readonly host: HTMLElement;
40
+ /** Serialized cloned editor content. */
41
+ readonly contentHTML: string;
42
+ readonly title: string;
43
+ readonly lang: string;
44
+ /** Copy html/body theme-context attributes (only when the live theme is carried). */
45
+ readonly carryThemeContext: boolean;
46
+ /**
47
+ * `export` (`toHTML()`, `AFTER_PRINT`) is embed-safe: its inline styles are
48
+ * marker-qualified, and everything page-level — the host-CSS copy, hoisted
49
+ * `@import`s, and `standaloneCSS` — ships inside an inert `<template>`
50
+ * bundle that the replica-scoped fallback script activates only when the
51
+ * export is rendered as its own document. A consumer page embedding the
52
+ * output can neither load foreign stylesheets nor have its own elements
53
+ * restyled. `internal` (the transient print iframe) inlines the unscoped
54
+ * copy and the imports directly and omits fallback, bundle, and script: the
55
+ * iframe is parsed by the same modern browser, where declarative shadow DOM
56
+ * is guaranteed.
57
+ */
58
+ readonly variant: 'export' | 'internal';
59
+ /**
60
+ * CSP nonce applied to every embedded `<style>` element so the internal
61
+ * print iframe renders under an inherited `style-src` nonce policy. Never
62
+ * set on the export variant: serialized HTML must not persist the page's
63
+ * live nonce.
64
+ */
65
+ readonly styleNonce?: string;
66
+ }
67
+ /** Builds the complete print document as an HTML string. */
68
+ export declare function buildHTMLDocument(input: PrintDocumentInput): string;
69
+ /** PrintService plus internal lifecycle hooks (not part of the public service API). */
70
+ export interface ManagedPrintService extends PrintService {
71
+ /** Cancels pending print triggers and removes parked print iframes. */
72
+ dispose(): void;
73
+ }
5
74
  /** Creates and returns the PrintService implementation. */
6
- export declare function createPrintService(shadowRoot: ShadowRoot, host: HTMLElement, container: HTMLElement, eventBus: PluginEventBus): PrintService;
75
+ export declare function createPrintService(shadowRoot: ShadowRoot, host: HTMLElement, container: HTMLElement, eventBus: PluginEventBus): ManagedPrintService;
7
76
  //# sourceMappingURL=PrintServiceImpl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrintServiceImpl.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/PrintServiceImpl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CA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WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAkGnE;AAED,uFAAuF;AACvF,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACxD,uEAAuE;IACvE,OAAO,IAAI,IAAI,CAAC;CAChB;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,cAAc,GACtB,mBAAmB,CAmJrB"}
@@ -1,23 +1,152 @@
1
1
  import { PrintOptions } from './PrintTypes.js';
2
- /** Extracts CSS text from all adopted stylesheets on a ShadowRoot. */
3
- export declare function extractAdoptedStyles(shadowRoot: ShadowRoot): string;
4
- /**
5
- * Generates light theme CSS custom properties for print output.
6
- * Uses the static LIGHT_THEME definition rather than reading computed styles,
7
- * ensuring print output is always readable on paper regardless of the active editor theme.
8
- */
9
- export declare function generateLightThemeTokens(): string;
10
- /** Snapshots --notectl-* CSS custom properties from the host element into a :root block. */
11
- export declare function snapshotThemeTokens(host: HTMLElement): string;
12
- /**
13
- * Snapshots computed typography from the host element into a `body` rule.
14
- * In the editor, typography is inherited from `:host` (shadow DOM).
15
- * The print iframe is a regular document where `:host` doesn't match,
16
- * so we must apply the same font/line-height explicitly.
17
- */
18
- export declare function snapshotTypography(host: HTMLElement, colorOverride?: string): string;
19
- /** Generates print-specific CSS rules based on PrintOptions. */
20
- export declare function generatePrintCSS(options: PrintOptions): string;
21
- /** Collects all CSS needed for print: adopted styles, theme tokens, print CSS, and custom CSS. */
22
- export declare function collectAll(shadowRoot: ShadowRoot, host: HTMLElement, options: PrintOptions): string;
2
+ /**
3
+ * Document-level cascade layer holding the print guards (host reset, forced
4
+ * light theme). Declared before the host-copy layer, so its `!important`
5
+ * declarations beat `!important` host rules.
6
+ */
7
+ export declare const PRINT_STYLE_LAYER = "notectl-print";
8
+ /**
9
+ * Earliest document-level cascade layer, holding a `customCSS` copy. Its
10
+ * `!important` declarations are the strongest in the print document the
11
+ * consumer's escape hatch over the print guards and host rules.
12
+ */
13
+ export declare const CUSTOM_STYLE_LAYER = "notectl-custom";
14
+ /** Adopted shadow styles split by role for print emission. */
15
+ export interface AdoptedStylePartition {
16
+ /** Editor base styles emitted inside the print cascade layer. */
17
+ readonly base: string;
18
+ /**
19
+ * Runtime style-token rules (strict-CSP mode) carrying user-applied content
20
+ * formatting emitted unlayered so they keep their cascade strength.
21
+ */
22
+ readonly runtime: string;
23
+ }
24
+ /**
25
+ * Extracts CSS text from all adopted stylesheets on a ShadowRoot, separating
26
+ * editor base styles from runtime style-token sheets. The distinction matters
27
+ * for print: base styles go into a cascade layer so consumer overrides win
28
+ * (the documented #202 semantic: `customCSS` overrides built-in element
29
+ * styling regardless of selector specificity — the flip side, also
30
+ * documented, is that broad customCSS resets such as `* { padding: 0 }`
31
+ * override base styling too), but token rules represent user content
32
+ * formatting (inline styles in non-CSP mode) and must not be demoted with
33
+ * them.
34
+ */
35
+ export declare function partitionAdoptedStyles(shadowRoot: ShadowRoot): AdoptedStylePartition;
36
+ /**
37
+ * Generates light theme custom properties targeting `selector` (a full
38
+ * selector list). The internal print iframe passes `:root` plus the host
39
+ * element, so page-level `customCSS` rules
40
+ * (`body { background: var(--notectl-bg) }`) keep resolving while the host
41
+ * element re-pins the tokens closer than the shadow theme sheet's `:host`
42
+ * defaults; the export variant passes only the marker-qualified replica so
43
+ * nothing can leak into an embedding page. Every declaration is `!important`;
44
+ * emitted inside the `notectl-print` layer, it beats copied host-page token
45
+ * overrides (even `!important` ones) and the shadow theme sheet (tree
46
+ * context), guaranteeing readable print output regardless of the active
47
+ * editor theme.
48
+ */
49
+ export declare function generateLightThemeTokens(selector: string): string;
50
+ /**
51
+ * Serializes an element's inline `--notectl-*` declarations. Tokens set via
52
+ * the `style` attribute or JS `setProperty` (runtime theme switchers) cannot
53
+ * travel through the stylesheet copy; re-emitting them as inline style on the
54
+ * print document's corresponding element preserves their live cascade
55
+ * strength — inline declarations beat every copied stylesheet rule, exactly
56
+ * as on the live page.
57
+ */
58
+ export declare function collectInlineThemeTokens(el: Element | null): string;
59
+ /**
60
+ * Snapshots all computed `--notectl-*` tokens from the host element when
61
+ * carrying the live theme (`forceLightTheme: false`). The computed values are
62
+ * the ground truth of what the user saw: tokens set via the host's inline
63
+ * `style` attribute (stripped from the print replica), via JS `setProperty`,
64
+ * or via rules scoped to wrapper elements that do not exist in the print
65
+ * document cannot travel through the stylesheet copy. Targeted at `selector`
66
+ * (a full selector list: the host element, plus `:root` in the internal
67
+ * variant so page-level `customCSS` keeps resolving the tokens) and emitted
68
+ * unlayered: unlayered normal declarations beat the layered host copy, so a
69
+ * host-page rule that matches differently in the print document (its wrapper
70
+ * ancestors are not replicated) cannot override the live values.
71
+ * Print-specific token overrides therefore need `!important` in the host
72
+ * page or `customCSS`.
73
+ */
74
+ export declare function snapshotThemeTokens(host: HTMLElement, selector: string): string;
75
+ /**
76
+ * Resolves the background the editor content visually sits on, for carrying
77
+ * the live theme into print (`forceLightTheme: false`). Walks up from the
78
+ * content container (crossing shadow boundaries) through the page body up to
79
+ * the root element — dark themes commonly paint `html` and leave `body`
80
+ * transparent — returning the first non-transparent computed
81
+ * background-color. Falls back to white so print output never inherits an
82
+ * undefined background.
83
+ */
84
+ export declare function resolveCarriedBackground(container: HTMLElement): string;
85
+ /**
86
+ * Snapshots computed typography from the host element into a rule for
87
+ * `selector` (the page body in the print iframe, the replica host in the
88
+ * export variant). Copied host-page styles are layered and `body` rules from
89
+ * the host page are meant for the host application, so print pins typography
90
+ * explicitly to what the editor computed live. The background is pinned to
91
+ * `background` — white when the light theme is forced, the carried theme
92
+ * background otherwise — so dark-theme output never renders light text on
93
+ * white paper.
94
+ */
95
+ export declare function snapshotTypography(host: HTMLElement, colorOverride?: string, background?: string, selector?: string): string;
96
+ /**
97
+ * Neutralizes page-level hiding and clipping from copied host rules on
98
+ * `html`/`body`. Every declaration is `!important`; emitted inside the
99
+ * `notectl-print` layer it beats the host copy even against `!important`
100
+ * host rules, while `customCSS` (earlier `notectl-custom` layer) still wins.
101
+ */
102
+ export declare function generatePageResetCSS(): string;
103
+ /**
104
+ * Neutralizes screen-widget chrome on the print host element. Copied
105
+ * host-page rules like `notectl-editor { height: 400px; border: … }` style
106
+ * the live widget but must not constrain the paginated print flow. Every
107
+ * declaration is `!important`; emitted inside the `notectl-print` layer, the
108
+ * reset beats the host copy even against `!important` host rules. Inherited
109
+ * properties (fonts, color) are deliberately not touched; `customCSS` can
110
+ * reclaim any of these via `!important` (earlier `notectl-custom` layer).
111
+ */
112
+ export declare function generateHostResetCSS(hostSelector: string): string;
113
+ /** Generates the `@page` rule based on PrintOptions. */
114
+ export declare function generatePageCSS(options: PrintOptions): string;
115
+ /** Generates print-specific content rules; emitted inside the shadow scope. */
116
+ export declare function generateContentPrintCSS(options: PrintOptions): string;
117
+ /**
118
+ * Builds the CSS placed inside the print document's declarative shadow root:
119
+ * editor base styles behind a cascade layer (so consumer overrides win),
120
+ * runtime style-token rules unlayered, print content rules, and customCSS as
121
+ * the final same-tree override.
122
+ */
123
+ export declare function buildShadowCSS(shadowRoot: ShadowRoot, options: PrintOptions): string;
124
+ /**
125
+ * Builds the document-level CSS of the internal print iframe: the print
126
+ * guards (host reset, `html`/`body` page reset, and forced light theme —
127
+ * `!important` inside the `notectl-print` layer), the unlayered theme-token
128
+ * snapshot, body typography, `@page`, and two copies of customCSS. The
129
+ * unlayered copy carries page-level custom rules (`@page`, `body` — they
130
+ * cannot live inside the shadow scope) at normal strength; the
131
+ * `notectl-custom` layer copy makes consumer `!important` rules outrank the
132
+ * print guards and `!important` host rules.
133
+ */
134
+ export declare function buildDocumentCSS(host: HTMLElement, container: HTMLElement, options: PrintOptions): string;
135
+ /**
136
+ * Builds the inline document-level CSS of the export variant (`toHTML()`,
137
+ * `AFTER_PRINT`). Every selector is qualified with `markerSelector` (the
138
+ * static-replica marker attribute), so the rules can only ever match a
139
+ * replica: embedding the export into a live page via the documented
140
+ * innerHTML/setHTMLUnsafe flow cannot restyle the consumer's document, hide
141
+ * its live editors, or force them light. (`@scope` cannot express this: its
142
+ * implicit `:where(:scope)` descendant prefix excludes the scoping root
143
+ * itself, and shadow content — every `::part()` subject — is outside the
144
+ * scope.) Page-level rules (`html`/`body` reset, `body` typography, `@page`,
145
+ * `:root` tokens, the customCSS document copies) are not emitted here; they
146
+ * ship in the script-gated standalone style bundle and otherwise apply in the
147
+ * `print()` iframe. Instead the typography and background snapshot is emitted
148
+ * `!important` after the host reset in the same layer, so the replica paints
149
+ * its own canvas even without scripts.
150
+ */
151
+ export declare function buildExportDocumentCSS(host: HTMLElement, container: HTMLElement, options: PrintOptions, markerAttribute: string): string;
23
152
  //# sourceMappingURL=PrintStyleCollector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrintStyleCollector.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/PrintStyleCollector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAQnE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAgB7D;AAED;;;;;GAKG;A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E,WAAW,GAAG,MAAM,CASvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,WAAW,EACjB,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,SAAY,EACtB,QAAQ,SAAS,GACf,MAAM,CAuBR;AAmDD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAmB7D;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAmDrE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAepF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,YAAY,GACnB,MAAM,CAqCR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,MAAM,GACrB,MAAM,CAmCR"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Marker attribute for static host replicas.
3
+ *
4
+ * Print output replicates the editor host element (tag and attributes) so
5
+ * host-page `::part()` rules keep matching in the print document. When that
6
+ * markup is injected into a page where `<notectl-editor>` is registered, the
7
+ * replica must stay static markup: upgrading it into a live editor would
8
+ * replace the replicated shadow content with a fresh editor instance.
9
+ *
10
+ * The print plugin writes the marker; `NotectlEditor` honors it by refusing
11
+ * to boot on marked hosts.
12
+ */
13
+ export declare const STATIC_HOST_ATTRIBUTE = "data-notectl-static";
14
+ /** True when the element is a static replica that must not boot an editor. */
15
+ export declare function isStaticHostReplica(el: Element): boolean;
16
+ /** Error raised when editor lifecycle APIs are used on a static replica. */
17
+ export declare function createStaticReplicaError(): Error;
18
+ //# sourceMappingURL=StaticHostMarker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StaticHostMarker.d.ts","sourceRoot":"","sources":["../../../src/plugins/print/StaticHostMarker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAExD;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,IAAI,KAAK,CAKhD"}
@@ -1 +1 @@
1
- import{n as s,r,t as n}from"../chunks/PrintTypes-WdtgSj74.mjs";import{n as t,r as a,t as m}from"../chunks/PrintPlugin-C6gOJT6d.mjs";export{n as AFTER_PRINT,s as BEFORE_PRINT,t as PRINT_LOCALE_EN,r as PRINT_SERVICE_KEY,m as PrintPlugin,a as loadPrintLocale};
1
+ import{n as s,r,t as n}from"../chunks/PrintTypes-CxU69qu3.mjs";import{n as t,r as a,t as m}from"../chunks/PrintPlugin-DyIZDY3Q.mjs";export{n as AFTER_PRINT,s as BEFORE_PRINT,t as PRINT_LOCALE_EN,r as PRINT_SERVICE_KEY,m as PrintPlugin,a as loadPrintLocale};
@@ -1 +1 @@
1
- import{c as s,i as a,r,t as o}from"../chunks/PluginHelpers-KDuTlmXm.mjs";import{t as m}from"../chunks/ShortcutFormatting-TwiufqeV.mjs";import{n as t,r as n,t as i}from"../chunks/KeyboardNav-D0my3wuy.mjs";import{r as p,t as u}from"../chunks/PopupPositioning-DtUrY9bh.mjs";import{n as c,t as h}from"../chunks/PopupManager-CyOfZUab.mjs";import{a as k,i as f,n as j,r as e,t as P}from"../chunks/ColorValidation-DAijTjG9.mjs";import{n as l,t as d}from"../chunks/XmlPatterns-RN32-0ob.mjs";import{n as g,r as C,t as b}from"../chunks/PopupKeyboardPatterns-tUrT9TyV.mjs";import{a as v,i as x,n as y,r as K,t as M}from"../chunks/ColorPickerPopup-C_74bqid.mjs";import{n as S,r as w,t as z}from"../chunks/ColorGrid-CXRdpP_n.mjs";export{h as PopupManager,c as PopupServiceKey,d as XML_ATTRS,l as XML_TAG_NAME,u as appendToRoot,y as applyColorMark,i as applyRovingTabindex,b as attachGridKeyboard,g as attachListboxKeyboard,C as attachMenuKeyboard,o as capitalize,t as findNextDropdownItem,m as formatShortcut,K as getActiveColor,S as getColorName,r as getSelectedBlock,a as getSelectedBlockId,x as isColorMarkActive,w as isLightColor,P as isValidCSSColor,j as isValidCSSFontFamily,e as isValidCSSFontSize,f as isValidHexColor,s as loadLocaleModule,n as navigateGrid,p as positionPopup,v as removeColorMark,z as renderColorGrid,M as renderColorPickerPopup,k as resolveColors};
1
+ import{c as s,i as a,r,t as o}from"../chunks/PluginHelpers-KDuTlmXm.mjs";import{t as m}from"../chunks/ShortcutFormatting-TwiufqeV.mjs";import{n as t,r as n,t as i}from"../chunks/KeyboardNav-D0my3wuy.mjs";import{r as p,t as u}from"../chunks/PopupPositioning-BB97-__N.mjs";import{n as c,t as h}from"../chunks/PopupManager-DUtaK3WX.mjs";import{a as k,i as f,n as j,r as e,t as P}from"../chunks/ColorValidation-DAijTjG9.mjs";import{n as l,t as d}from"../chunks/XmlPatterns-RN32-0ob.mjs";import{n as g,r as C,t as b}from"../chunks/PopupKeyboardPatterns-tUrT9TyV.mjs";import{a as v,i as x,n as y,r as K,t as M}from"../chunks/ColorPickerPopup-lcf3jS6G.mjs";import{n as S,r as w,t as z}from"../chunks/ColorGrid-DPNiXxpD.mjs";export{h as PopupManager,c as PopupServiceKey,d as XML_ATTRS,l as XML_TAG_NAME,u as appendToRoot,y as applyColorMark,i as applyRovingTabindex,b as attachGridKeyboard,g as attachListboxKeyboard,C as attachMenuKeyboard,o as capitalize,t as findNextDropdownItem,m as formatShortcut,K as getActiveColor,S as getColorName,r as getSelectedBlock,a as getSelectedBlockId,x as isColorMarkActive,w as isLightColor,P as isValidCSSColor,j as isValidCSSFontFamily,e as isValidCSSFontSize,f as isValidHexColor,s as loadLocaleModule,n as navigateGrid,p as positionPopup,v as removeColorMark,z as renderColorGrid,M as renderColorPickerPopup,k as resolveColors};
@@ -1 +1 @@
1
- import{n as s,t as a}from"../chunks/TablePlugin-D93RR5xH.mjs";export{a as TablePlugin,s as TableSelectionServiceKey};
1
+ import{n as s,t as a}from"../chunks/TablePlugin-BTH9VRZq.mjs";export{a as TablePlugin,s as TableSelectionServiceKey};
@@ -1 +1 @@
1
- import{n as o,r,t as s}from"../chunks/TextColorPlugin-C1qpzEOa.mjs";export{o as TEXT_COLOR_LOCALE_EN,s as TextColorPlugin,r as loadTextColorLocale};
1
+ import{n as o,r,t as s}from"../chunks/TextColorPlugin-CEfZQ6Md.mjs";export{o as TEXT_COLOR_LOCALE_EN,s as TextColorPlugin,r as loadTextColorLocale};
@@ -1 +1 @@
1
- import{a,i as s,n as o,o as r,r as i,t as m}from"../chunks/ToolbarPlugin-CLz2wa2c.mjs";export{s as TOOLBAR_LOCALE_EN,i as ToolbarOverflowBehavior,m as ToolbarPlugin,r as ToolbarRegistry,o as ToolbarServiceKey,a as loadToolbarLocale};
1
+ import{a,i as s,n as o,o as r,r as i,t as m}from"../chunks/ToolbarPlugin-DVGrFf8v.mjs";export{s as TOOLBAR_LOCALE_EN,i as ToolbarOverflowBehavior,m as ToolbarPlugin,r as ToolbarRegistry,o as ToolbarServiceKey,a as loadToolbarLocale};
@@ -1 +1 @@
1
- import{a as s,i as a,n as o,o as i,r,s as m,t as n}from"../chunks/VideoPlugin-D9rQZol6.mjs";export{a as DEFAULT_VIDEO_CONFIG,s as DEFAULT_VIDEO_KEYMAP,i as DEFAULT_VIDEO_PROVIDERS,o as VIDEO_LOCALE_EN,n as VideoPlugin,r as loadVideoLocale,m as parseVideoUrl};
1
+ import{a as s,i as a,n as o,o as i,r,s as m,t as n}from"../chunks/VideoPlugin-B3uf1Dwp.mjs";export{a as DEFAULT_VIDEO_CONFIG,s as DEFAULT_VIDEO_KEYMAP,i as DEFAULT_VIDEO_PROVIDERS,o as VIDEO_LOCALE_EN,n as VideoPlugin,r as loadVideoLocale,m as parseVideoUrl};
@@ -1 +1 @@
1
- import{t as m}from"../chunks/full-Cah3qjCT.mjs";export{m as createFullPreset};
1
+ import{t as m}from"../chunks/full-BBl7mvwH.mjs";export{m as createFullPreset};
@@ -1 +1 @@
1
- import{t as m}from"../chunks/minimal-DqATlnAL.mjs";export{m as createMinimalPreset};
1
+ import{t as m}from"../chunks/minimal-CtnR4dqp.mjs";export{m as createMinimalPreset};
package/dist/presets.mjs CHANGED
@@ -1 +1 @@
1
- import{t as m}from"./chunks/minimal-DqATlnAL.mjs";import{t as s}from"./chunks/full-Cah3qjCT.mjs";export{s as createFullPreset,m as createMinimalPreset};
1
+ import{t as m}from"./chunks/minimal-CtnR4dqp.mjs";import{t as s}from"./chunks/full-BBl7mvwH.mjs";export{s as createFullPreset,m as createMinimalPreset};
@@ -10,6 +10,13 @@ export interface StyleRootOptions {
10
10
  readonly sheet?: CSSStyleSheet | null;
11
11
  }
12
12
  type StyleRoot = ShadowRoot | Document;
13
+ /**
14
+ * True when the sheet holds runtime style-token rules, i.e. element styling
15
+ * that would be inline `style` attributes outside strict-CSP mode. Consumers
16
+ * (e.g. print) can use this to treat such rules as content styling rather
17
+ * than editor base styles.
18
+ */
19
+ export declare function isRuntimeStyleSheet(sheet: CSSStyleSheet): boolean;
13
20
  /** Creates a constructable stylesheet when the environment supports it. */
14
21
  export declare function createRuntimeStyleSheet(): CSSStyleSheet | null;
15
22
  /** Registers styling mode for a root (shadow root or document). */
@@ -1 +1 @@
1
- {"version":3,"file":"StyleRuntime.d.ts","sourceRoot":"","sources":["../../src/style/StyleRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,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EAAE,EAAE,WAAW,GAAG,MAAM,CAIpD;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAInE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notectl/core",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- import{i as t}from"./TypeBrands-Ch9856Gb.mjs";import{i as e,n,r as o,t as i}from"./AttributedMarkCommands-D4W2Jgpj.mjs";import{r,s}from"./StyleRuntime-BAutwDZT.mjs";import{c as a,n as l,o as c}from"./PluginHelpers-KDuTlmXm.mjs";import{n as m}from"./ColorValidation-DAijTjG9.mjs";import{t as p}from"./InlineStyleMarkSpec-4R6DC7ij.mjs";var f={label:"Font",tooltip:"Font Family"},d=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DahJwMI9.mjs"),"./locales/de.ts":()=>import("./de-DiPz7abS.mjs"),"./locales/es.ts":()=>import("./es-CCQFu1t1.mjs"),"./locales/fr.ts":()=>import("./fr-BwWrFThE.mjs"),"./locales/hi.ts":()=>import("./hi-B-ZuX4aN.mjs"),"./locales/pt.ts":()=>import("./pt-Dg2ctkug.mjs"),"./locales/ru.ts":()=>import("./ru-DJMpeuey.mjs"),"./locales/zh.ts":()=>import("./zh-CRsDvfPR.mjs")});async function h(t){return a(d,t,f)}var g=class{id="font";name="Font";priority=22;config;locale;injectedStyleElement=null;context=null;constructor(t){this.config=t}async init(t){this.locale=await c(t,this.config.locale,f,h),t.registerStyleSheet("\n/* Font Select — Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n"),this.context=t,this.registerMarkSpec(t),this.registerCommands(t),this.config.fonts.length>0&&this.registerToolbarItem(t),this.injectFontFaces()}destroy(){this.injectedStyleElement?.remove(),this.injectedStyleElement=null,this.context=null}registerMarkSpec(t){t.registerMarkSpec(p({type:"font",rank:6,valueAttr:"family",domStyleProperty:"fontFamily",cssProperty:"font-family",validate:m,transformParsed:t=>t.replace(/"/g,"'")}))}registerCommands(t){t.registerCommand("removeFont",()=>{const e=t.getState();return this.removeFont(t,e)}),t.registerCommand("setFont",()=>!1)}get defaultFont(){if(this.config.defaultFont){const t=this.config.fonts.find(t=>t.name===this.config.defaultFont);if(t)return t}return this.config.fonts[0]}registerToolbarItem(t){t.registerToolbarItem({id:"font",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFont",popupType:"combobox",getLabel:t=>this.resolveFontName(this.getActiveFont(t)),renderPopup:(t,e,n)=>{this.renderFontPopup(t,e,n)},isActive:t=>this.isFontActive(t)})}resolveFontName(t){return t?this.config.fonts.find(e=>e.family===t)?.name??(t.split(",")[0]??"").trim().replace(/['"]/g,""):this.defaultFont?.name??this.locale.label}isFontActive(t){return o(t,"font")}getActiveFont(t){return n(t,"font",t=>t.attrs.family??null)}applyFont(e,n,o){return l(e,i(n,{type:t("font"),attrs:{family:o}}))}removeFont(n,o){return l(n,e(o,t("font")))}injectFontFaces(){const t=[];for(const o of this.config.fonts)if(o.fontFaces?.length)for(const e of o.fontFaces){const n=[`font-family: '${(o.family.split(",")[0]??"").trim().replace(/['"]/g,"")}'`,`src: ${e.src}`];e.weight&&n.push(`font-weight: ${e.weight}`),e.style&&n.push(`font-style: ${e.style}`),n.push(`font-display: ${e.display??"swap"}`),t.push(`@font-face {\n\t${n.join(";\n\t")};\n}`)}if(0===t.length)return;const e=document.createElement("style");e.setAttribute("data-notectl-fonts","");const n=this.context?r(this.context.getContainer()):void 0;n&&e.setAttribute("nonce",n),e.textContent=t.join("\n\n"),document.head.appendChild(e),this.injectedStyleElement=e}renderFontPopup(t,e,n){t.classList.add("notectl-font-picker");const o=e.getState(),i=this.getActiveFont(o),r=this.defaultFont?.family,s=e.getContainer(),a=document.createElement("div");a.className="notectl-font-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",this.locale.label);for(const l of this.config.fonts){const t=void 0!==r&&l.family===r,o=t&&!i||i===l.family,c=this.createFontItem(l.name,l.family,o,o=>{o.preventDefault(),o.stopPropagation(),t?e.executeCommand("removeFont"):this.applyFont(e,e.getState(),l.family),n({restoreFocusTo:s})});l.category&&c.setAttribute("data-category",l.category),a.appendChild(c)}t.appendChild(a)}createFontItem(t,e,n,o){const i=document.createElement("button");i.type="button",i.className="notectl-font-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n)),n&&i.classList.add("notectl-font-picker__item--active");const r=document.createElement("span");r.className="notectl-font-picker__check",r.textContent=n?"✓":"",i.appendChild(r);const a=document.createElement("span");return a.className="notectl-font-picker__label",a.textContent=t,e&&s(a,"fontFamily",e),i.appendChild(a),i.addEventListener("mousedown",o),i}};export{f as n,h as r,g as t};
2
- //# sourceMappingURL=FontPlugin-DB1_bgam.mjs.map
@@ -1,2 +0,0 @@
1
- import{c as t,o as e}from"./StyleRuntime-BAutwDZT.mjs";import{a as o,c as n,f as r,i,m as s,n as c,r as a,t as l}from"./PrintTypes-WdtgSj74.mjs";import{c as p,o as u}from"./PluginHelpers-KDuTlmXm.mjs";import{t as m}from"./ShortcutFormatting-TwiufqeV.mjs";import h from"dompurify";var d={label:"Print",tooltip:t=>`Print (${t})`,printingAnnouncement:"Printing"},f=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Uzo1Azdw.mjs"),"./locales/de.ts":()=>import("./de-DcMhfRBu.mjs"),"./locales/es.ts":()=>import("./es-BJHF95J_.mjs"),"./locales/fr.ts":()=>import("./fr-KXmbys88.mjs"),"./locales/hi.ts":()=>import("./hi-l6DA-aOw.mjs"),"./locales/pt.ts":()=>import("./pt-C8sOyw0V.mjs"),"./locales/ru.ts":()=>import("./ru-B1m8J9dl.mjs"),"./locales/zh.ts":()=>import("./zh-dGSDBBzb.mjs")});async function g(t){return p(f,t,d)}var v=["h1","h2","h3","h4","h5","h6","p","div","span","br","hr","strong","b","em","i","u","s","sub","sup","small","ul","ol","li","table","thead","tbody","tr","th","td","img"],y=["style","class","src","alt","width","height","colspan","rowspan"];function b(t){const e="function"==typeof t?t():t;return h.sanitize(e,{ALLOWED_TAGS:[...v],ALLOWED_ATTR:[...y]})}var j={print(){},toHTML:()=>""},w=class{id="print";name="Print";config;service=null;locale;constructor(t){this.config=t??{}}async init(o){this.locale=await u(o,this.config.locale,d,g);const i=o.getContainer(),p=i.getRootNode();if(p instanceof ShadowRoot){const a=p.host,u=o.getEventBus();this.service=function(o,i,a,p){function u(t){return t??{}}function m(t){const u={options:t,cancelled:!1};if(p.emit(c,u),u.cancelled)return null;const m=u.options,h=function(t,e,o,n="en"){return["<!DOCTYPE html>",`<html lang="${n}">`,"<head>",'<meta charset="utf-8">',`<title>${o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</title>`,`<style>${t}</style>`,"</head>",`<body>${e}</body>`,"</html>"].join("\n")}(function(t,e,o){const i=[],c=function(t){const e=[];for(const o of t.adoptedStyleSheets)for(const t of o.cssRules)e.push(t.cssText);return e.join("\n")}(t);c&&i.push(c);const a=!1!==o.forceLightTheme;if(a)i.push(r(s).replace(":host {",":root {"));else{const t=function(t){const e=getComputedStyle(t),o=[];for(let n=0;n<e.length;n++){const t=e[n]??"";if(t.startsWith("--notectl-")){const n=e.getPropertyValue(t).trim();n&&o.push(` ${t}: ${n};`)}}return 0===o.length?"":`:root {\n${o.join("\n")}\n}`}(e);t&&i.push(t)}const l=a?s.primitives.foreground:void 0;i.push(function(t,e){const o=getComputedStyle(t),n=["font-family","font-size","font-weight","line-height","letter-spacing","word-spacing","color"],r=[" margin: 0;"];for(const i of n){if("color"===i&&e){r.push(` color: ${e};`);continue}const t=o.getPropertyValue(i).trim();t&&r.push(` ${i}: ${t};`)}return`body {\n${r.join("\n")}\n}`}(e,l));const p=function(t){const e=[],o=[];if(t.margin?o.push(` margin: ${t.margin};`):t.paperSize&&o.push(" margin: 0;"),t.paperSize||t.orientation){const e=[t.paperSize?n(t.paperSize):"A4"];t.orientation&&e.push(t.orientation),o.push(` size: ${e.join(" ")};`)}o.length>0&&e.push(`@page {\n${o.join("\n")}\n}`),t.paperSize&&e.push(".notectl-content { padding: 48px 56px !important; }");const r=[];return r.push("[data-notectl-no-print] { display: none !important; }"),r.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"),r.push("img { page-break-inside: avoid; }"),r.push(".notectl-table { break-inside: avoid; }"),!1!==t.printBackground&&r.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"),e.push(`@media print {\n ${r.join("\n ")}\n}`),e.join("\n\n")}(o);return p&&i.push(p),o.customCSS&&i.push(o.customCSS),i.join("\n\n")}(o,i,m),function(t,o){const n=function(t){return(t.querySelector(".notectl-content")??t).cloneNode(!0)}(t);return function(t){t.removeAttribute("contenteditable");for(const e of["notectl-node-selected","notectl-content--empty"]){t.classList.remove(e);for(const o of t.querySelectorAll(`.${e}`))o.classList.remove(e)}t.removeAttribute("data-placeholder")}(n),function(t,o){if(o.excludeBlockTypes)for(const e of o.excludeBlockTypes){const o=t.querySelectorAll(`[data-block-type="${e}"]`);for(const t of o)t.remove()}if(o.pageBreakBefore)for(const n of o.pageBreakBefore){const o=t.querySelectorAll(`[data-block-type="${n}"]`);for(const t of o)e(t,{breakBefore:"page",pageBreakBefore:"always"})}}(n,o),function(t,e){if(e.header){const o=document.createElement("div");o.className="notectl-print-header",o.innerHTML=b(e.header),t.insertBefore(o,t.firstChild)}if(e.footer){const o=document.createElement("div");o.className="notectl-print-footer",o.innerHTML=b(e.footer),t.appendChild(o)}}(n,o),n}(a,m).outerHTML,m.title??"",i.closest("[lang]")?.getAttribute("lang")??(document.documentElement.lang||"en")),d={html:h};return p.emit(l,d),h}return{print(e){const o=m(u(e));if(!o)return;const n=document.createElement("iframe");t(n,"position:fixed;left:-9999px;width:0;height:0;border:none"),document.body.appendChild(n);const r=n.contentDocument;if(!r)return void document.body.removeChild(n);r.open(),r.write(o),r.close();const i=()=>{n.remove()};n.contentWindow?(n.contentWindow.addEventListener("afterprint",i,{once:!0}),n.contentWindow.print()):i()},toHTML:t=>m(u(t))??""}}(p,a,i,u)}else this.service=j;o.registerService(a,this.service);const h=this.config.defaults??{},f=this.service,v=this.locale;o.registerCommand("print",()=>(o.announce(v.printingAnnouncement),f.print(h),!0));const y=this.config.keyBinding??"Mod-P";if(o.registerKeymap({[y]:()=>(o.executeCommand("print"),!0)}),!1!==this.config.showToolbarItem){const t=m(y);o.registerToolbarItem({id:"print",group:"actions",label:this.locale.label,tooltip:this.locale.tooltip(t),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',command:"print"})}}destroy(){this.service=null}};export{d as n,g as r,w as t};
2
- //# sourceMappingURL=PrintPlugin-C6gOJT6d.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrintPlugin-C6gOJT6d.mjs","names":[],"sources":["../../src/plugins/print/PrintLocale.ts","../../src/plugins/print/PrintContentPreparer.ts","../../src/plugins/print/PrintStyleCollector.ts","../../src/plugins/print/PrintServiceImpl.ts","../../src/plugins/print/PrintPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the PrintPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface PrintLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly printingAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const PRINT_LOCALE_EN: PrintLocale = {\n\tlabel: 'Print',\n\ttooltip: (shortcut: string) => `Print (${shortcut})`,\n\tprintingAnnouncement: 'Printing',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<PrintLocale> = import.meta.glob<{\n\tdefault: PrintLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadPrintLocale(lang: string): Promise<PrintLocale> {\n\treturn loadLocaleModule(localeModules, lang, PRINT_LOCALE_EN);\n}\n","/**\n * Prepares editor content for print output.\n * Clones the DOM, sanitizes interactive attributes, applies block filters,\n * and inserts header/footer elements.\n */\n\nimport DOMPurify from 'dompurify';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Deep-clones the .notectl-content element from the editor container. */\nexport function cloneContent(container: HTMLElement): HTMLElement {\n\tconst content: HTMLElement | null = container.querySelector('.notectl-content');\n\tconst source: HTMLElement = content ?? container;\n\treturn source.cloneNode(true) as HTMLElement;\n}\n\n/** Sanitizes the cloned content for print: removes interactive attributes and selection styling. */\nexport function sanitize(clone: HTMLElement): void {\n\t// Remove contenteditable from the root\n\tclone.removeAttribute('contenteditable');\n\n\t// Remove selection-related CSS classes\n\tconst selectionClasses: readonly string[] = ['notectl-node-selected', 'notectl-content--empty'];\n\tfor (const cls of selectionClasses) {\n\t\tclone.classList.remove(cls);\n\t\tfor (const el of clone.querySelectorAll(`.${cls}`)) {\n\t\t\tel.classList.remove(cls);\n\t\t}\n\t}\n\n\t// Remove data-placeholder to avoid showing placeholder in print\n\tclone.removeAttribute('data-placeholder');\n}\n\n/** Removes excluded block types and applies page-break-before to configured block types. */\nexport function applyBlockFilters(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.excludeBlockTypes) {\n\t\tfor (const type of options.excludeBlockTypes) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tel.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.pageBreakBefore) {\n\t\tfor (const type of options.pageBreakBefore) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tsetStyleProperties(el as HTMLElement, {\n\t\t\t\t\tbreakBefore: 'page',\n\t\t\t\t\tpageBreakBefore: 'always',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Tags allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_TAGS: readonly string[] = [\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'p',\n\t'div',\n\t'span',\n\t'br',\n\t'hr',\n\t'strong',\n\t'b',\n\t'em',\n\t'i',\n\t'u',\n\t's',\n\t'sub',\n\t'sup',\n\t'small',\n\t'ul',\n\t'ol',\n\t'li',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tr',\n\t'th',\n\t'td',\n\t'img',\n];\n\n/** Attributes allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_ATTRS: readonly string[] = [\n\t'style',\n\t'class',\n\t'src',\n\t'alt',\n\t'width',\n\t'height',\n\t'colspan',\n\t'rowspan',\n];\n\n/** Resolves a header/footer value to a sanitized HTML string. */\nfunction resolveContent(value: string | (() => string)): string {\n\tconst raw: string = typeof value === 'function' ? value() : value;\n\treturn DOMPurify.sanitize(raw, {\n\t\tALLOWED_TAGS: [...HEADER_FOOTER_ALLOWED_TAGS],\n\t\tALLOWED_ATTR: [...HEADER_FOOTER_ALLOWED_ATTRS],\n\t});\n}\n\n/** Inserts header and footer elements into the cloned content. */\nexport function insertHeaderFooter(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.header) {\n\t\tconst headerEl: HTMLDivElement = document.createElement('div');\n\t\theaderEl.className = 'notectl-print-header';\n\t\theaderEl.innerHTML = resolveContent(options.header);\n\t\tclone.insertBefore(headerEl, clone.firstChild);\n\t}\n\n\tif (options.footer) {\n\t\tconst footerEl: HTMLDivElement = document.createElement('div');\n\t\tfooterEl.className = 'notectl-print-footer';\n\t\tfooterEl.innerHTML = resolveContent(options.footer);\n\t\tclone.appendChild(footerEl);\n\t}\n}\n\n/** Orchestrates all content preparation steps. Returns a ready-to-print DOM element. */\nexport function prepare(container: HTMLElement, options: PrintOptions): HTMLElement {\n\tconst clone: HTMLElement = cloneContent(container);\n\tsanitize(clone);\n\tapplyBlockFilters(clone, options);\n\tinsertHeaderFooter(clone, options);\n\treturn clone;\n}\n","/**\n * Collects and aggregates CSS for print output.\n * Extracts adopted stylesheets, snapshots theme tokens, and generates print-specific CSS.\n */\n\nimport { generateThemeCSS } from '../../editor/theme/ThemeEngine.js';\nimport { LIGHT_THEME } from '../../editor/theme/ThemeTokens.js';\nimport {\n\tPAPER_MARGIN_HORIZONTAL_PX,\n\tPAPER_MARGIN_TOP_PX,\n\tgetPaperCSSSize,\n} from '../../model/PaperSize.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Extracts CSS text from all adopted stylesheets on a ShadowRoot. */\nexport function extractAdoptedStyles(shadowRoot: ShadowRoot): string {\n\tconst parts: string[] = [];\n\tfor (const sheet of shadowRoot.adoptedStyleSheets) {\n\t\tfor (const rule of sheet.cssRules) {\n\t\t\tparts.push(rule.cssText);\n\t\t}\n\t}\n\treturn parts.join('\\n');\n}\n\n/**\n * Generates light theme CSS custom properties for print output.\n * Uses the static LIGHT_THEME definition rather than reading computed styles,\n * ensuring print output is always readable on paper regardless of the active editor theme.\n */\nexport function generateLightThemeTokens(): string {\n\treturn generateThemeCSS(LIGHT_THEME).replace(':host {', ':root {');\n}\n\n/** Snapshots --notectl-* CSS custom properties from the host element into a :root block. */\nexport function snapshotThemeTokens(host: HTMLElement): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst tokens: string[] = [];\n\n\tfor (let i = 0; i < computed.length; i++) {\n\t\tconst prop: string = computed[i] ?? '';\n\t\tif (prop.startsWith('--notectl-')) {\n\t\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\t\tif (value) {\n\t\t\t\ttokens.push(` ${prop}: ${value};`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tokens.length === 0) return '';\n\treturn `:root {\\n${tokens.join('\\n')}\\n}`;\n}\n\n/**\n * Snapshots computed typography from the host element into a `body` rule.\n * In the editor, typography is inherited from `:host` (shadow DOM).\n * The print iframe is a regular document where `:host` doesn't match,\n * so we must apply the same font/line-height explicitly.\n */\nexport function snapshotTypography(host: HTMLElement, colorOverride?: string): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst props: string[] = [\n\t\t'font-family',\n\t\t'font-size',\n\t\t'font-weight',\n\t\t'line-height',\n\t\t'letter-spacing',\n\t\t'word-spacing',\n\t\t'color',\n\t];\n\tconst rules: string[] = [' margin: 0;'];\n\tfor (const prop of props) {\n\t\tif (prop === 'color' && colorOverride) {\n\t\t\trules.push(` color: ${colorOverride};`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\tif (value) {\n\t\t\trules.push(` ${prop}: ${value};`);\n\t\t}\n\t}\n\treturn `body {\\n${rules.join('\\n')}\\n}`;\n}\n\n/** Generates print-specific CSS rules based on PrintOptions. */\nexport function generatePrintCSS(options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\t// @page rule\n\tconst pageProps: string[] = [];\n\tif (options.margin) {\n\t\tpageProps.push(` margin: ${options.margin};`);\n\t} else if (options.paperSize) {\n\t\t// WYSIWYG: zero @page margin so body = full paper width;\n\t\t// document margins are applied as content padding below.\n\t\tpageProps.push(' margin: 0;');\n\t}\n\tif (options.paperSize || options.orientation) {\n\t\tconst sizeKeyword: string = options.paperSize ? getPaperCSSSize(options.paperSize) : 'A4';\n\t\tconst sizeParts: string[] = [sizeKeyword];\n\t\tif (options.orientation) {\n\t\t\tsizeParts.push(options.orientation);\n\t\t}\n\t\tpageProps.push(` size: ${sizeParts.join(' ')};`);\n\t}\n\tif (pageProps.length > 0) {\n\t\tparts.push(`@page {\\n${pageProps.join('\\n')}\\n}`);\n\t}\n\n\t// WYSIWYG: apply paper-mode document margins to print content\n\tif (options.paperSize) {\n\t\tparts.push(\n\t\t\t`.notectl-content { padding: ${PAPER_MARGIN_TOP_PX}px ${PAPER_MARGIN_HORIZONTAL_PX}px !important; }`,\n\t\t);\n\t}\n\n\t// Print media rules\n\tconst printRules: string[] = [];\n\n\t// Hide non-printable elements\n\tprintRules.push('[data-notectl-no-print] { display: none !important; }');\n\n\t// Code blocks: preserve background, force wrapping\n\tprintRules.push(\n\t\t'.notectl-code-block { white-space: pre-wrap !important; ' +\n\t\t\t'word-break: break-all !important; page-break-inside: avoid; }',\n\t);\n\n\t// Images: avoid page breaks\n\tprintRules.push('img { page-break-inside: avoid; }');\n\n\t// Tables: avoid page breaks\n\tprintRules.push('.notectl-table { break-inside: avoid; }');\n\n\t// Preserve background colors and images in print output (WYSIWYG default).\n\t// Only omitted when the consumer explicitly opts out via printBackground: false.\n\tif (options.printBackground !== false) {\n\t\tprintRules.push(\n\t\t\t'* { -webkit-print-color-adjust: exact !important; ' +\n\t\t\t\t'print-color-adjust: exact !important; }',\n\t\t);\n\t}\n\n\tparts.push(`@media print {\\n ${printRules.join('\\n ')}\\n}`);\n\n\treturn parts.join('\\n\\n');\n}\n\n/** Collects all CSS needed for print: adopted styles, theme tokens, print CSS, and custom CSS. */\nexport function collectAll(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\toptions: PrintOptions,\n): string {\n\tconst parts: string[] = [];\n\n\tconst adopted: string = extractAdoptedStyles(shadowRoot);\n\tif (adopted) parts.push(adopted);\n\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\n\tif (forceLightTheme) {\n\t\tparts.push(generateLightThemeTokens());\n\t} else {\n\t\tconst theme: string = snapshotThemeTokens(host);\n\t\tif (theme) parts.push(theme);\n\t}\n\n\t// WYSIWYG: snapshot host typography so the print iframe matches the editor.\n\t// In the editor, .notectl-content inherits font from :host (shadow DOM).\n\t// The print iframe is a regular document where :host doesn't apply.\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tparts.push(snapshotTypography(host, colorOverride));\n\n\tconst printCSS: string = generatePrintCSS(options);\n\tif (printCSS) parts.push(printCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n","/**\n * PrintService implementation.\n * Handles the synchronous print flow: event emission, style collection,\n * content preparation, iframe creation, and cleanup.\n */\n\nimport { setStyleText } from '../../style/StyleRuntime.js';\nimport type { PluginEventBus } from '../Plugin.js';\nimport { prepare } from './PrintContentPreparer.js';\nimport { collectAll } from './PrintStyleCollector.js';\nimport {\n\tAFTER_PRINT,\n\ttype AfterPrintEvent,\n\tBEFORE_PRINT,\n\ttype BeforePrintEvent,\n\ttype PrintOptions,\n\ttype PrintService,\n} from './PrintTypes.js';\n\n/** Escapes HTML special characters in a plain-text string. */\nfunction escapeHTML(text: string): string {\n\treturn text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\n/** Builds a complete HTML document string from CSS, body content, and title. */\nexport function buildHTMLDocument(\n\tcss: string,\n\tcontent: string,\n\ttitle: string,\n\tlang = 'en',\n): string {\n\tconst safeTitle: string = escapeHTML(title);\n\treturn [\n\t\t'<!DOCTYPE html>',\n\t\t`<html lang=\"${lang}\">`,\n\t\t'<head>',\n\t\t`<meta charset=\"utf-8\">`,\n\t\t`<title>${safeTitle}</title>`,\n\t\t`<style>${css}</style>`,\n\t\t'</head>',\n\t\t`<body>${content}</body>`,\n\t\t'</html>',\n\t].join('\\n');\n}\n\n/** Creates and returns the PrintService implementation. */\nexport function createPrintService(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\teventBus: PluginEventBus,\n): PrintService {\n\tfunction mergeOptions(options?: PrintOptions): PrintOptions {\n\t\treturn options ?? {};\n\t}\n\n\tfunction executePrint(options: PrintOptions): string | null {\n\t\t// 1. Emit BEFORE_PRINT — listeners can mutate options or cancel\n\t\tconst beforeEvent: BeforePrintEvent = {\n\t\t\toptions,\n\t\t\tcancelled: false,\n\t\t};\n\t\teventBus.emit(BEFORE_PRINT, beforeEvent);\n\n\t\tif (beforeEvent.cancelled) return null;\n\n\t\tconst finalOptions: PrintOptions = beforeEvent.options;\n\n\t\t// 2. Collect styles\n\t\tconst css: string = collectAll(shadowRoot, host, finalOptions);\n\n\t\t// 3. Prepare content\n\t\tconst clone: HTMLElement = prepare(container, finalOptions);\n\t\tconst contentHTML: string = clone.outerHTML;\n\n\t\t// 4. Build HTML document\n\t\tconst title: string = finalOptions.title ?? '';\n\t\tconst lang: string =\n\t\t\thost.closest('[lang]')?.getAttribute('lang') ?? (document.documentElement.lang || 'en');\n\t\tconst html: string = buildHTMLDocument(css, contentHTML, title, lang);\n\n\t\t// 5. Emit AFTER_PRINT\n\t\tconst afterEvent: AfterPrintEvent = { html };\n\t\teventBus.emit(AFTER_PRINT, afterEvent);\n\n\t\treturn html;\n\t}\n\n\treturn {\n\t\tprint(options?: PrintOptions): void {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\tconst html: string | null = executePrint(resolved);\n\t\t\tif (!html) return;\n\n\t\t\t// Create hidden iframe\n\t\t\tconst iframe: HTMLIFrameElement = document.createElement('iframe');\n\t\t\tsetStyleText(iframe, 'position:fixed;left:-9999px;width:0;height:0;border:none');\n\t\t\tdocument.body.appendChild(iframe);\n\n\t\t\tconst iframeDoc: Document | null = iframe.contentDocument;\n\t\t\tif (!iframeDoc) {\n\t\t\t\tdocument.body.removeChild(iframe);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tiframeDoc.open();\n\t\t\tiframeDoc.write(html);\n\t\t\tiframeDoc.close();\n\n\t\t\tconst cleanup = (): void => {\n\t\t\t\tiframe.remove();\n\t\t\t};\n\n\t\t\t// Defer cleanup until print dialog closes\n\t\t\tif (iframe.contentWindow) {\n\t\t\t\tiframe.contentWindow.addEventListener('afterprint', cleanup, { once: true });\n\t\t\t\tiframe.contentWindow.print();\n\t\t\t} else {\n\t\t\t\tcleanup();\n\t\t\t}\n\t\t},\n\n\t\ttoHTML(options?: PrintOptions): string {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\treturn executePrint(resolved) ?? '';\n\t\t},\n\t};\n}\n","/**\n * PrintPlugin: provides print functionality for the notectl editor.\n * Registers a command, keymap, toolbar item, and exposes a PrintService.\n * Orchestrator only — delegates all logic to PrintServiceImpl, PrintStyleCollector,\n * and PrintContentPreparer.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { PRINT_LOCALE_EN, type PrintLocale, loadPrintLocale } from './PrintLocale.js';\nimport { createPrintService } from './PrintServiceImpl.js';\nimport type { PrintOptions, PrintPluginConfig, PrintService } from './PrintTypes.js';\nimport { PRINT_SERVICE_KEY } from './PrintTypes.js';\n\nconst PRINT_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">' +\n\t'<path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3' +\n\t' 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"/>' +\n\t'</svg>';\n\n/** No-op fallback service for environments without ShadowRoot. */\nconst NOOP_SERVICE: PrintService = {\n\tprint(): void {},\n\ttoHTML(): string {\n\t\treturn '';\n\t},\n};\n\nexport class PrintPlugin implements Plugin {\n\treadonly id = 'print';\n\treadonly name = 'Print';\n\n\tprivate readonly config: PrintPluginConfig;\n\tprivate service: PrintService | null = null;\n\tprivate locale!: PrintLocale;\n\n\tconstructor(config?: PrintPluginConfig) {\n\t\tthis.config = config ?? {};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tPRINT_LOCALE_EN,\n\t\t\tloadPrintLocale,\n\t\t);\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst rootNode: Node = container.getRootNode();\n\n\t\tif (rootNode instanceof ShadowRoot) {\n\t\t\tconst host: HTMLElement = rootNode.host as HTMLElement;\n\t\t\tconst eventBus = context.getEventBus();\n\t\t\tthis.service = createPrintService(rootNode, host, container, eventBus);\n\t\t} else {\n\t\t\tthis.service = NOOP_SERVICE;\n\t\t}\n\n\t\tcontext.registerService(PRINT_SERVICE_KEY, this.service);\n\n\t\tconst defaults: PrintOptions = this.config.defaults ?? {};\n\t\tconst service: PrintService = this.service;\n\n\t\tconst printLocale = this.locale;\n\t\tcontext.registerCommand('print', () => {\n\t\t\tcontext.announce(printLocale.printingAnnouncement);\n\t\t\tservice.print(defaults);\n\t\t\treturn true;\n\t\t});\n\n\t\tconst keyBinding: string = this.config.keyBinding ?? 'Mod-P';\n\t\tcontext.registerKeymap({\n\t\t\t[keyBinding]: () => {\n\t\t\t\tcontext.executeCommand('print');\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.showToolbarItem !== false) {\n\t\t\tconst shortcut: string = formatShortcut(keyBinding);\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: 'print',\n\t\t\t\tgroup: 'actions',\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(shortcut),\n\t\t\t\ticon: PRINT_ICON,\n\t\t\t\tcommand: 'print',\n\t\t\t});\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.service = null;\n\t}\n}\n"],"mappings":"wRAcA,IAAa,EAA+B,CAC3C,MAAO,QACP,QAAU,GAAqB,UAAU,KACzC,qBAAsB,YAKjB,iBAA8C,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAIpD,eAAsB,EAAgB,GACrC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCgCA,IAAM,EAAgD,CACrD,KACA,KACA,KACA,KACA,KACA,KACA,IAC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