inkpen 0.8.3 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f2b2d7c2657d94cf09267ba1623de494e1fed19349433a2185d901259224d9c
4
- data.tar.gz: 266dcb58ef1b3feedf4fdf9164d380307e465d4f09dcc026515ec1a726fcd489
3
+ metadata.gz: 53bb272d92be9ebaaa8096f29650efdaf398d94869ba2816a6ce1865934ef052
4
+ data.tar.gz: 5d1e03b894fcd2a74f58b04e9d647483bd8536111aecb6d43f13e1b6defbe2bd
5
5
  SHA512:
6
- metadata.gz: c21807eebda1ca64e48c47508c090a5f14b315292da3fccc5ba8f989d219f2d4c9e598ac4d9d183241e1fc987794e69df1add4f1de5777e473c069d18aee0a1f
7
- data.tar.gz: 1db7aa4eee124f24ed2b44985b8a4e391247d771b7c7a23bf6d97ff67c277ce514497ab589ed273facbd19c3e8c7ad2e42d1973c9b7e4583fe49b6ec6d8666ba
6
+ metadata.gz: b54aed81a7ed029d17713ec708326ebe26e55eb1d042cdd6d8d5da68adc972767525efd0e828fff0d4d3930ce82939e5cf901dec6c30c24cd1ec40a483c46d0e
7
+ data.tar.gz: d11b40ec2bed5b98667ffca8e8689ea8e97a03ef8d5da060ac530cfd29fb74064297baacca19993f9a94a60413a743d83114bd3fd93c75d25f352e2efc051566
@@ -1,87 +1,50 @@
1
- // Inkpen - TipTap-based rich text editor for Rails
2
- // Entry point for importmap
1
+ // Inkpen TipTap-based rich text editor for Rails.
2
+ //
3
+ // This is the entry the host's importmap pins as `inkpen`. The host
4
+ // does `import "inkpen"` from its application.js; the side effect of
5
+ // that import is registering the three Stimulus controllers below.
6
+ // Everything else (TipTap core, every extension, ProseMirror, etc.)
7
+ // is loaded LAZILY by the EditorController via gated dynamic imports,
8
+ // not statically here.
9
+ //
10
+ // Spec 02 (2026-05-17, gem 0.9.0): the previous index.js statically
11
+ // imported 17 custom extensions and re-exported them as named exports.
12
+ // That made every consumer pay the full extension graph at module-eval
13
+ // time, even when their editor enabled only a subset. Those static
14
+ // imports are gone. Extension classes are now loaded on demand by
15
+ // editor_controller.js#loadEditorModules based on the editor instance's
16
+ // `extensions-value`. Hosts that previously did `import { Section }
17
+ // from "inkpen"` must now either:
18
+ //
19
+ // a) Configure the editor's extensions-value to include "section"
20
+ // (preferred — the controller manages the extension lifecycle)
21
+ // b) Import the extension's path directly through a custom importmap
22
+ // pin (advanced; only if you need direct programmatic access)
23
+ //
24
+ // InventList today only does `import "inkpen"` and configures
25
+ // extensions-value on the data-controller element — the supported and
26
+ // recommended pattern.
3
27
 
4
28
  import { Application } from "@hotwired/stimulus"
5
29
  import EditorController from "inkpen/controllers/editor_controller"
6
30
  import ToolbarController from "inkpen/controllers/toolbar_controller"
7
31
  import StickyToolbarController from "inkpen/controllers/sticky_toolbar_controller"
8
32
 
9
- // ============================================
10
- // IMPORTANT: Register controllers IMMEDIATELY before any async code
11
- // This ensures controllers are available when Stimulus scans the DOM
12
- // ============================================
33
+ // Register controllers IMMEDIATELY at module-eval. Stimulus scans the
34
+ // DOM as soon as it boots; controllers not registered by then won't
35
+ // connect to their elements.
13
36
  const application = window.Stimulus || Application.start()
14
37
 
15
38
  application.register("inkpen--editor", EditorController)
16
39
  application.register("inkpen--toolbar", ToolbarController)
17
40
  application.register("inkpen--sticky-toolbar", StickyToolbarController)
18
41
 
19
- // TipTap extensions (static imports)
20
- import { Section } from "inkpen/extensions/section"
21
- import { Preformatted } from "inkpen/extensions/preformatted"
22
- import { SlashCommands } from "inkpen/extensions/slash_commands"
23
- import { BlockGutter } from "inkpen/extensions/block_gutter"
24
- import { DragHandle } from "inkpen/extensions/drag_handle"
25
- import { ToggleBlock, ToggleSummary } from "inkpen/extensions/toggle_block"
26
- import { Columns, Column } from "inkpen/extensions/columns"
27
- import { Callout } from "inkpen/extensions/callout"
28
- import { BlockCommands } from "inkpen/extensions/block_commands"
29
- import { EnhancedImage } from "inkpen/extensions/enhanced_image"
30
- import { FileAttachment } from "inkpen/extensions/file_attachment"
31
- import { Embed } from "inkpen/extensions/embed"
32
- import { AdvancedTable, AdvancedTableRow, AdvancedTableCell, AdvancedTableHeader } from "inkpen/extensions/advanced_table"
33
- import { TableOfContents } from "inkpen/extensions/table_of_contents"
34
- import { Database } from "inkpen/extensions/database"
35
- import { DocumentSection } from "inkpen/extensions/document_section"
36
- import { SectionTitle } from "inkpen/extensions/section_title"
37
-
38
- // InkpenTable is loaded lazily to prevent import failures from breaking the library
39
- let InkpenTable, InkpenTableRow, InkpenTableCell, InkpenTableHeader
40
- try {
41
- const mod = await import("inkpen/extensions/inkpen_table")
42
- InkpenTable = mod.InkpenTable
43
- InkpenTableRow = mod.InkpenTableRow
44
- InkpenTableCell = mod.InkpenTableCell
45
- InkpenTableHeader = mod.InkpenTableHeader
46
- } catch (e) {
47
- console.warn("Inkpen: InkpenTable extension not available:", e.message)
48
- }
49
-
50
- // Export controllers
42
+ // Re-export the controller classes for hosts that want to wire them
43
+ // to their own Stimulus application instance (rare; most consumers
44
+ // just use the side-effect registration above).
51
45
  export { EditorController, ToolbarController, StickyToolbarController }
52
46
 
53
- // Export extensions for custom use
54
- export {
55
- Section,
56
- DocumentSection,
57
- SectionTitle,
58
- Preformatted,
59
- SlashCommands,
60
- BlockGutter,
61
- DragHandle,
62
- ToggleBlock,
63
- ToggleSummary,
64
- Columns,
65
- Column,
66
- Callout,
67
- BlockCommands,
68
- EnhancedImage,
69
- FileAttachment,
70
- Embed,
71
- // InkpenTable - Notion-style enhanced tables (recommended)
72
- InkpenTable,
73
- InkpenTableRow,
74
- InkpenTableCell,
75
- InkpenTableHeader,
76
- // AdvancedTable - Legacy (use InkpenTable instead)
77
- AdvancedTable,
78
- AdvancedTableRow,
79
- AdvancedTableCell,
80
- AdvancedTableHeader,
81
- TableOfContents,
82
- Database
83
- }
84
-
85
- // Export functionality is available separately:
86
- // import { ExportCommands } from "inkpen/extensions/export_commands"
87
- // import { exportToMarkdown, ... } from "inkpen/export"
47
+ // Extension classes are no longer exported from this entry. Configure
48
+ // them via the `data-inkpen--editor-extensions-value` attribute on the
49
+ // editor element; editor_controller.js loads each one lazily. See the
50
+ // README "Stimulus Controller" + "Public events" sections.