@gjermundgaraba/pixel-paper 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,6 +46,16 @@ export default defineConfig({
46
46
 
47
47
  Provide `Clipboard.layer` as the application's resources where a component copies.
48
48
 
49
+ `MarkdownEditor.view` edits Markdown in place, and needs its element registered once, from the client entry, before the first render:
50
+
51
+ ```ts
52
+ import { defineMarkdownEditorElement } from "@gjermundgaraba/pixel-paper/markdown-editor/element";
53
+
54
+ defineMarkdownEditorElement();
55
+ ```
56
+
57
+ Only that subpath loads CodeMirror, so an application that never imports it pays nothing and shows a plain textarea. Links open with Ctrl or Cmd and a click, or Ctrl or Cmd and Enter at the caret. A disabled fieldset makes the editor read-only.
58
+
49
59
  ## Licence
50
60
 
51
- MIT. Departure Mono, in `fonts/`, carries its own licence beside it.
61
+ MIT. Departure Mono, in `fonts/`, carries its own licence beside it. `THIRD_PARTY_NOTICES.md` carries the licence of the Markdown editor's live layer.
@@ -0,0 +1,25 @@
1
+ # Third-party notices
2
+
3
+ The files in `src/markdown-editor/live/` derive from [cm-live-markdown](https://github.com/Jason1258t/cm-live-markdown), tag `v0.1.7`, commit `89166b7`, under the MIT licence below.
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2026 Jason
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -271,6 +271,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
271
271
  }>;
272
272
  };
273
273
  commands?: Update.Commands<{
274
+ readonly _tag: "PressedEscape";
275
+ } | {
274
276
  readonly _tag: "CompletedAnnounceMove";
275
277
  } | {
276
278
  readonly _tag: "CompletedSizeLiftedCard";
@@ -333,8 +335,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
333
335
  readonly label: string;
334
336
  }[];
335
337
  }[];
336
- } | {
337
- readonly _tag: "PressedEscape";
338
338
  } | {
339
339
  readonly _tag: "PressedGripKey";
340
340
  readonly cardId: string;
@@ -430,6 +430,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
430
430
  }>;
431
431
  }>;
432
432
  }, {
433
+ readonly _tag: "PressedEscape";
434
+ } | {
433
435
  readonly _tag: "CompletedAnnounceMove";
434
436
  } | {
435
437
  readonly _tag: "CompletedSizeLiftedCard";
@@ -492,8 +494,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
492
494
  readonly label: string;
493
495
  }[];
494
496
  }[];
495
- } | {
496
- readonly _tag: "PressedEscape";
497
497
  } | {
498
498
  readonly _tag: "PressedGripKey";
499
499
  readonly cardId: string;
@@ -572,6 +572,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
572
572
  }>;
573
573
  }>;
574
574
  }, {
575
+ readonly _tag: "PressedEscape";
576
+ } | {
575
577
  readonly _tag: "CompletedAnnounceMove";
576
578
  } | {
577
579
  readonly _tag: "CompletedSizeLiftedCard";
@@ -634,8 +636,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
634
636
  readonly label: string;
635
637
  }[];
636
638
  }[];
637
- } | {
638
- readonly _tag: "PressedEscape";
639
639
  } | {
640
640
  readonly _tag: "PressedGripKey";
641
641
  readonly cardId: string;
@@ -714,6 +714,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
714
714
  }>;
715
715
  }>;
716
716
  }, {
717
+ readonly _tag: "PressedEscape";
718
+ } | {
717
719
  readonly _tag: "CompletedAnnounceMove";
718
720
  } | {
719
721
  readonly _tag: "CompletedSizeLiftedCard";
@@ -776,8 +778,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
776
778
  readonly label: string;
777
779
  }[];
778
780
  }[];
779
- } | {
780
- readonly _tag: "PressedEscape";
781
781
  } | {
782
782
  readonly _tag: "PressedGripKey";
783
783
  readonly cardId: string;
@@ -855,6 +855,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
855
855
  }>;
856
856
  }>;
857
857
  }, {
858
+ readonly _tag: "PressedEscape";
859
+ } | {
858
860
  readonly _tag: "CompletedAnnounceMove";
859
861
  } | {
860
862
  readonly _tag: "CompletedSizeLiftedCard";
@@ -917,8 +919,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
917
919
  readonly label: string;
918
920
  }[];
919
921
  }[];
920
- } | {
921
- readonly _tag: "PressedEscape";
922
922
  } | {
923
923
  readonly _tag: "PressedGripKey";
924
924
  readonly cardId: string;
@@ -1065,6 +1065,8 @@ export declare const view: import("foldkit/submodel").View<{
1065
1065
  }>;
1066
1066
  }>;
1067
1067
  }, {
1068
+ readonly _tag: "PressedEscape";
1069
+ } | {
1068
1070
  readonly _tag: "CompletedAnnounceMove";
1069
1071
  } | {
1070
1072
  readonly _tag: "CompletedSizeLiftedCard";
@@ -1127,8 +1129,6 @@ export declare const view: import("foldkit/submodel").View<{
1127
1129
  readonly label: string;
1128
1130
  }[];
1129
1131
  }[];
1130
- } | {
1131
- readonly _tag: "PressedEscape";
1132
1132
  } | {
1133
1133
  readonly _tag: "PressedGripKey";
1134
1134
  readonly cardId: string;
@@ -111,15 +111,15 @@ export declare const update: (model: Model, message: Message, context?: UpdateCo
111
111
  } | {
112
112
  readonly _tag: "GotAnimationMessage";
113
113
  readonly message: {
114
+ readonly _tag: "Hid";
115
+ } | {
116
+ readonly _tag: "Showed";
117
+ } | {
114
118
  readonly _tag: "CompletedWaitForPaint";
115
119
  readonly generation: number;
116
120
  } | {
117
121
  readonly _tag: "EndedAnimation";
118
122
  readonly generation: number;
119
- } | {
120
- readonly _tag: "Hid";
121
- } | {
122
- readonly _tag: "Showed";
123
123
  };
124
124
  } | {
125
125
  readonly _tag: "RequestedClose";
@@ -230,15 +230,15 @@ export declare const view: import("foldkit/submodel").View<{
230
230
  } | {
231
231
  readonly _tag: "GotAnimationMessage";
232
232
  readonly message: {
233
+ readonly _tag: "Hid";
234
+ } | {
235
+ readonly _tag: "Showed";
236
+ } | {
233
237
  readonly _tag: "CompletedWaitForPaint";
234
238
  readonly generation: number;
235
239
  } | {
236
240
  readonly _tag: "EndedAnimation";
237
241
  readonly generation: number;
238
- } | {
239
- readonly _tag: "Hid";
240
- } | {
241
- readonly _tag: "Showed";
242
242
  };
243
243
  } | {
244
244
  readonly _tag: "RequestedClose";
@@ -108,15 +108,15 @@ export declare const update: (model: Model, message: Message, context?: UpdateCo
108
108
  } | {
109
109
  readonly _tag: "GotAnimationMessage";
110
110
  readonly message: {
111
+ readonly _tag: "Hid";
112
+ } | {
113
+ readonly _tag: "Showed";
114
+ } | {
111
115
  readonly _tag: "CompletedWaitForPaint";
112
116
  readonly generation: number;
113
117
  } | {
114
118
  readonly _tag: "EndedAnimation";
115
119
  readonly generation: number;
116
- } | {
117
- readonly _tag: "Hid";
118
- } | {
119
- readonly _tag: "Showed";
120
120
  };
121
121
  } | {
122
122
  readonly _tag: "RequestedClose";
@@ -235,15 +235,15 @@ export declare const view: import("foldkit/submodel").View<{
235
235
  } | {
236
236
  readonly _tag: "GotAnimationMessage";
237
237
  readonly message: {
238
+ readonly _tag: "Hid";
239
+ } | {
240
+ readonly _tag: "Showed";
241
+ } | {
238
242
  readonly _tag: "CompletedWaitForPaint";
239
243
  readonly generation: number;
240
244
  } | {
241
245
  readonly _tag: "EndedAnimation";
242
246
  readonly generation: number;
243
- } | {
244
- readonly _tag: "Hid";
245
- } | {
246
- readonly _tag: "Showed";
247
247
  };
248
248
  } | {
249
249
  readonly _tag: "RequestedClose";
package/dist/index.d.ts CHANGED
@@ -40,46 +40,47 @@ import { index_d_exports as index_d_exports$38 } from "./link-state/index.js";
40
40
  import { index_d_exports as index_d_exports$39 } from "./live-region/index.js";
41
41
  import { index_d_exports as index_d_exports$40 } from "./loading/index.js";
42
42
  import { index_d_exports as index_d_exports$41 } from "./mark/index.js";
43
- import { index_d_exports as index_d_exports$42 } from "./menu/index.js";
44
- import { index_d_exports as index_d_exports$43 } from "./meter/index.js";
45
- import { index_d_exports as index_d_exports$44 } from "./nav-strip/index.js";
46
- import { index_d_exports as index_d_exports$45 } from "./notice/index.js";
47
- import { index_d_exports as index_d_exports$46 } from "./outcome/index.js";
48
- import { index_d_exports as index_d_exports$47 } from "./page-head/index.js";
49
- import { index_d_exports as index_d_exports$48 } from "./panel/index.js";
50
- import { index_d_exports as index_d_exports$49 } from "./password-field/index.js";
51
- import { index_d_exports as index_d_exports$50 } from "./places/index.js";
52
- import { index_d_exports as index_d_exports$51 } from "./props-list/index.js";
53
- import { index_d_exports as index_d_exports$52 } from "./prose/index.js";
54
- import { index_d_exports as index_d_exports$53 } from "./query-chip/index.js";
55
- import { index_d_exports as index_d_exports$54 } from "./radio-choices/index.js";
56
- import { index_d_exports as index_d_exports$55 } from "./rail/index.js";
57
- import { index_d_exports as index_d_exports$56 } from "./reel/index.js";
58
- import { index_d_exports as index_d_exports$57 } from "./remote/index.js";
59
- import { index_d_exports as index_d_exports$58 } from "./rows/index.js";
60
- import { index_d_exports as index_d_exports$59 } from "./scheme/index.js";
61
- import { index_d_exports as index_d_exports$60 } from "./secret/index.js";
62
- import { index_d_exports as index_d_exports$61 } from "./segmented/index.js";
63
- import { index_d_exports as index_d_exports$62 } from "./select-field/index.js";
64
- import { index_d_exports as index_d_exports$63 } from "./sheet/index.js";
65
- import { index_d_exports as index_d_exports$64 } from "./skip-link/index.js";
66
- import { index_d_exports as index_d_exports$65 } from "./sortable/index.js";
67
- import { index_d_exports as index_d_exports$66 } from "./stack/index.js";
68
- import { index_d_exports as index_d_exports$67 } from "./stage/index.js";
69
- import { index_d_exports as index_d_exports$68 } from "./stat/index.js";
70
- import { index_d_exports as index_d_exports$69 } from "./status-bar/index.js";
71
- import { index_d_exports as index_d_exports$70 } from "./table/index.js";
72
- import { index_d_exports as index_d_exports$71 } from "./tabs/index.js";
73
- import { index_d_exports as index_d_exports$72 } from "./tag/index.js";
74
- import { index_d_exports as index_d_exports$74 } from "./textarea-field/index.js";
75
- import { index_d_exports as index_d_exports$73 } from "./text-button/index.js";
76
- import { index_d_exports as index_d_exports$75 } from "./time/index.js";
77
- import { index_d_exports as index_d_exports$76 } from "./tips/index.js";
78
- import { index_d_exports as index_d_exports$77 } from "./toast/index.js";
79
- import { index_d_exports as index_d_exports$78 } from "./toc/index.js";
80
- import { index_d_exports as index_d_exports$79 } from "./top-bar/index.js";
81
- import { index_d_exports as index_d_exports$80 } from "./wall/index.js";
82
- import { index_d_exports as index_d_exports$81 } from "./window/index.js";
83
- import { index_d_exports as index_d_exports$82 } from "./wordmark/index.js";
84
- import { index_d_exports as index_d_exports$83 } from "./wrap/index.js";
85
- export { index_d_exports as Announcer, index_d_exports$1 as Banner, index_d_exports$2 as Bench, index_d_exports$3 as Board, index_d_exports$4 as Button, index_d_exports$5 as Card, index_d_exports$6 as Chip, index_d_exports$7 as Choice, index_d_exports$8 as CodeEditor, index_d_exports$9 as CodeSurface, index_d_exports$10 as CommandPalette, index_d_exports$11 as ConfirmDialog, index_d_exports$12 as CopyButton, index_d_exports$13 as Crumbs, index_d_exports$14 as Deck, index_d_exports$15 as Dialog, index_d_exports$16 as Disclosure, index_d_exports$17 as DropZone, index_d_exports$18 as EmptyState, index_d_exports$19 as ErrorSummary, index_d_exports$20 as Field, index_d_exports$21 as FieldGrid, index_d_exports$22 as Fieldset, index_d_exports$23 as FilterChip, index_d_exports$24 as FilterStrip, index_d_exports$25 as FlashWord, index_d_exports$26 as Focus, index_d_exports$27 as Format, index_d_exports$28 as Glyph, index_d_exports$29 as Group, index_d_exports$30 as History, index_d_exports$31 as IconButton, index_d_exports$32 as Identity, index_d_exports$33 as InlineInput, index_d_exports$34 as KeyHelp, index_d_exports$35 as KeyHint, index_d_exports$36 as LineDiff, index_d_exports$37 as LinkButton, index_d_exports$38 as LinkState, index_d_exports$39 as LiveRegion, index_d_exports$40 as Loading, index_d_exports$41 as Mark, index_d_exports$42 as Menu, index_d_exports$43 as Meter, index_d_exports$44 as NavStrip, index_d_exports$45 as Notice, index_d_exports$46 as Outcome, index_d_exports$47 as PageHead, index_d_exports$48 as Panel, index_d_exports$49 as PasswordField, index_d_exports$50 as Places, index_d_exports$51 as PropsList, index_d_exports$52 as Prose, index_d_exports$53 as QueryChip, index_d_exports$54 as RadioChoices, index_d_exports$55 as Rail, index_d_exports$56 as Reel, index_d_exports$57 as Remote, index_d_exports$58 as Rows, index_d_exports$59 as Scheme, index_d_exports$60 as Secret, index_d_exports$61 as Segmented, index_d_exports$62 as SelectField, index_d_exports$63 as Sheet, index_d_exports$64 as SkipLink, index_d_exports$65 as Sortable, index_d_exports$66 as Stack, index_d_exports$67 as Stage, index_d_exports$68 as Stat, index_d_exports$69 as StatusBar, index_d_exports$70 as Table, index_d_exports$71 as Tabs, index_d_exports$72 as Tag, index_d_exports$73 as TextButton, index_d_exports$74 as TextareaField, index_d_exports$75 as Time, index_d_exports$76 as Tips, index_d_exports$77 as Toast, index_d_exports$78 as Toc, index_d_exports$79 as TopBar, index_d_exports$80 as Wall, index_d_exports$81 as Window, index_d_exports$82 as Wordmark, index_d_exports$83 as Wrap };
43
+ import { index_d_exports as index_d_exports$42 } from "./markdown-editor/index.js";
44
+ import { index_d_exports as index_d_exports$43 } from "./menu/index.js";
45
+ import { index_d_exports as index_d_exports$44 } from "./meter/index.js";
46
+ import { index_d_exports as index_d_exports$45 } from "./nav-strip/index.js";
47
+ import { index_d_exports as index_d_exports$46 } from "./notice/index.js";
48
+ import { index_d_exports as index_d_exports$47 } from "./outcome/index.js";
49
+ import { index_d_exports as index_d_exports$48 } from "./page-head/index.js";
50
+ import { index_d_exports as index_d_exports$49 } from "./panel/index.js";
51
+ import { index_d_exports as index_d_exports$50 } from "./password-field/index.js";
52
+ import { index_d_exports as index_d_exports$51 } from "./places/index.js";
53
+ import { index_d_exports as index_d_exports$52 } from "./props-list/index.js";
54
+ import { index_d_exports as index_d_exports$53 } from "./prose/index.js";
55
+ import { index_d_exports as index_d_exports$54 } from "./query-chip/index.js";
56
+ import { index_d_exports as index_d_exports$55 } from "./radio-choices/index.js";
57
+ import { index_d_exports as index_d_exports$56 } from "./rail/index.js";
58
+ import { index_d_exports as index_d_exports$57 } from "./reel/index.js";
59
+ import { index_d_exports as index_d_exports$58 } from "./remote/index.js";
60
+ import { index_d_exports as index_d_exports$59 } from "./rows/index.js";
61
+ import { index_d_exports as index_d_exports$60 } from "./scheme/index.js";
62
+ import { index_d_exports as index_d_exports$61 } from "./secret/index.js";
63
+ import { index_d_exports as index_d_exports$62 } from "./segmented/index.js";
64
+ import { index_d_exports as index_d_exports$63 } from "./select-field/index.js";
65
+ import { index_d_exports as index_d_exports$64 } from "./sheet/index.js";
66
+ import { index_d_exports as index_d_exports$65 } from "./skip-link/index.js";
67
+ import { index_d_exports as index_d_exports$66 } from "./sortable/index.js";
68
+ import { index_d_exports as index_d_exports$67 } from "./stack/index.js";
69
+ import { index_d_exports as index_d_exports$68 } from "./stage/index.js";
70
+ import { index_d_exports as index_d_exports$69 } from "./stat/index.js";
71
+ import { index_d_exports as index_d_exports$70 } from "./status-bar/index.js";
72
+ import { index_d_exports as index_d_exports$71 } from "./table/index.js";
73
+ import { index_d_exports as index_d_exports$72 } from "./tabs/index.js";
74
+ import { index_d_exports as index_d_exports$73 } from "./tag/index.js";
75
+ import { index_d_exports as index_d_exports$75 } from "./textarea-field/index.js";
76
+ import { index_d_exports as index_d_exports$74 } from "./text-button/index.js";
77
+ import { index_d_exports as index_d_exports$76 } from "./time/index.js";
78
+ import { index_d_exports as index_d_exports$77 } from "./tips/index.js";
79
+ import { index_d_exports as index_d_exports$78 } from "./toast/index.js";
80
+ import { index_d_exports as index_d_exports$79 } from "./toc/index.js";
81
+ import { index_d_exports as index_d_exports$80 } from "./top-bar/index.js";
82
+ import { index_d_exports as index_d_exports$81 } from "./wall/index.js";
83
+ import { index_d_exports as index_d_exports$82 } from "./window/index.js";
84
+ import { index_d_exports as index_d_exports$83 } from "./wordmark/index.js";
85
+ import { index_d_exports as index_d_exports$84 } from "./wrap/index.js";
86
+ export { index_d_exports as Announcer, index_d_exports$1 as Banner, index_d_exports$2 as Bench, index_d_exports$3 as Board, index_d_exports$4 as Button, index_d_exports$5 as Card, index_d_exports$6 as Chip, index_d_exports$7 as Choice, index_d_exports$8 as CodeEditor, index_d_exports$9 as CodeSurface, index_d_exports$10 as CommandPalette, index_d_exports$11 as ConfirmDialog, index_d_exports$12 as CopyButton, index_d_exports$13 as Crumbs, index_d_exports$14 as Deck, index_d_exports$15 as Dialog, index_d_exports$16 as Disclosure, index_d_exports$17 as DropZone, index_d_exports$18 as EmptyState, index_d_exports$19 as ErrorSummary, index_d_exports$20 as Field, index_d_exports$21 as FieldGrid, index_d_exports$22 as Fieldset, index_d_exports$23 as FilterChip, index_d_exports$24 as FilterStrip, index_d_exports$25 as FlashWord, index_d_exports$26 as Focus, index_d_exports$27 as Format, index_d_exports$28 as Glyph, index_d_exports$29 as Group, index_d_exports$30 as History, index_d_exports$31 as IconButton, index_d_exports$32 as Identity, index_d_exports$33 as InlineInput, index_d_exports$34 as KeyHelp, index_d_exports$35 as KeyHint, index_d_exports$36 as LineDiff, index_d_exports$37 as LinkButton, index_d_exports$38 as LinkState, index_d_exports$39 as LiveRegion, index_d_exports$40 as Loading, index_d_exports$41 as Mark, index_d_exports$42 as MarkdownEditor, index_d_exports$43 as Menu, index_d_exports$44 as Meter, index_d_exports$45 as NavStrip, index_d_exports$46 as Notice, index_d_exports$47 as Outcome, index_d_exports$48 as PageHead, index_d_exports$49 as Panel, index_d_exports$50 as PasswordField, index_d_exports$51 as Places, index_d_exports$52 as PropsList, index_d_exports$53 as Prose, index_d_exports$54 as QueryChip, index_d_exports$55 as RadioChoices, index_d_exports$56 as Rail, index_d_exports$57 as Reel, index_d_exports$58 as Remote, index_d_exports$59 as Rows, index_d_exports$60 as Scheme, index_d_exports$61 as Secret, index_d_exports$62 as Segmented, index_d_exports$63 as SelectField, index_d_exports$64 as Sheet, index_d_exports$65 as SkipLink, index_d_exports$66 as Sortable, index_d_exports$67 as Stack, index_d_exports$68 as Stage, index_d_exports$69 as Stat, index_d_exports$70 as StatusBar, index_d_exports$71 as Table, index_d_exports$72 as Tabs, index_d_exports$73 as Tag, index_d_exports$74 as TextButton, index_d_exports$75 as TextareaField, index_d_exports$76 as Time, index_d_exports$77 as Tips, index_d_exports$78 as Toast, index_d_exports$79 as Toc, index_d_exports$80 as TopBar, index_d_exports$81 as Wall, index_d_exports$82 as Window, index_d_exports$83 as Wordmark, index_d_exports$84 as Wrap };
package/dist/index.js CHANGED
@@ -40,6 +40,7 @@ import { link_state_exports } from "./link-state/index.js";
40
40
  import { live_region_exports } from "./live-region/index.js";
41
41
  import { loading_exports } from "./loading/index.js";
42
42
  import { mark_exports } from "./mark/index.js";
43
+ import { markdown_editor_exports } from "./markdown-editor/index.js";
43
44
  import { menu_exports } from "./menu/index.js";
44
45
  import { meter_exports } from "./meter/index.js";
45
46
  import { nav_strip_exports } from "./nav-strip/index.js";
@@ -82,4 +83,4 @@ import { wall_exports } from "./wall/index.js";
82
83
  import { window_exports } from "./window/index.js";
83
84
  import { wordmark_exports } from "./wordmark/index.js";
84
85
  import { wrap_exports } from "./wrap/index.js";
85
- export { announcer_exports as Announcer, banner_exports as Banner, bench_exports as Bench, board_exports as Board, button_exports as Button, card_exports as Card, chip_exports as Chip, choice_exports as Choice, code_editor_exports as CodeEditor, code_surface_exports as CodeSurface, command_palette_exports as CommandPalette, confirm_dialog_exports as ConfirmDialog, copy_button_exports as CopyButton, crumbs_exports as Crumbs, deck_exports as Deck, dialog_exports as Dialog, disclosure_exports as Disclosure, drop_zone_exports as DropZone, empty_state_exports as EmptyState, error_summary_exports as ErrorSummary, field_exports as Field, field_grid_exports as FieldGrid, fieldset_exports as Fieldset, filter_chip_exports as FilterChip, filter_strip_exports as FilterStrip, flash_word_exports as FlashWord, focus_exports as Focus, format_exports as Format, glyph_exports as Glyph, group_exports as Group, history_exports as History, icon_button_exports as IconButton, identity_exports as Identity, inline_input_exports as InlineInput, key_help_exports as KeyHelp, key_hint_exports as KeyHint, line_diff_exports as LineDiff, link_button_exports as LinkButton, link_state_exports as LinkState, live_region_exports as LiveRegion, loading_exports as Loading, mark_exports as Mark, menu_exports as Menu, meter_exports as Meter, nav_strip_exports as NavStrip, notice_exports as Notice, outcome_exports as Outcome, page_head_exports as PageHead, panel_exports as Panel, password_field_exports as PasswordField, places_exports as Places, props_list_exports as PropsList, prose_exports as Prose, query_chip_exports as QueryChip, radio_choices_exports as RadioChoices, rail_exports as Rail, reel_exports as Reel, remote_exports as Remote, rows_exports as Rows, scheme_exports as Scheme, secret_exports as Secret, segmented_exports as Segmented, select_field_exports as SelectField, sheet_exports as Sheet, skip_link_exports as SkipLink, sortable_exports as Sortable, stack_exports as Stack, stage_exports as Stage, stat_exports as Stat, status_bar_exports as StatusBar, table_exports as Table, tabs_exports as Tabs, tag_exports as Tag, text_button_exports as TextButton, textarea_field_exports as TextareaField, time_exports as Time, tips_exports as Tips, toast_exports as Toast, toc_exports as Toc, top_bar_exports as TopBar, wall_exports as Wall, window_exports as Window, wordmark_exports as Wordmark, wrap_exports as Wrap };
86
+ export { announcer_exports as Announcer, banner_exports as Banner, bench_exports as Bench, board_exports as Board, button_exports as Button, card_exports as Card, chip_exports as Chip, choice_exports as Choice, code_editor_exports as CodeEditor, code_surface_exports as CodeSurface, command_palette_exports as CommandPalette, confirm_dialog_exports as ConfirmDialog, copy_button_exports as CopyButton, crumbs_exports as Crumbs, deck_exports as Deck, dialog_exports as Dialog, disclosure_exports as Disclosure, drop_zone_exports as DropZone, empty_state_exports as EmptyState, error_summary_exports as ErrorSummary, field_exports as Field, field_grid_exports as FieldGrid, fieldset_exports as Fieldset, filter_chip_exports as FilterChip, filter_strip_exports as FilterStrip, flash_word_exports as FlashWord, focus_exports as Focus, format_exports as Format, glyph_exports as Glyph, group_exports as Group, history_exports as History, icon_button_exports as IconButton, identity_exports as Identity, inline_input_exports as InlineInput, key_help_exports as KeyHelp, key_hint_exports as KeyHint, line_diff_exports as LineDiff, link_button_exports as LinkButton, link_state_exports as LinkState, live_region_exports as LiveRegion, loading_exports as Loading, mark_exports as Mark, markdown_editor_exports as MarkdownEditor, menu_exports as Menu, meter_exports as Meter, nav_strip_exports as NavStrip, notice_exports as Notice, outcome_exports as Outcome, page_head_exports as PageHead, panel_exports as Panel, password_field_exports as PasswordField, places_exports as Places, props_list_exports as PropsList, prose_exports as Prose, query_chip_exports as QueryChip, radio_choices_exports as RadioChoices, rail_exports as Rail, reel_exports as Reel, remote_exports as Remote, rows_exports as Rows, scheme_exports as Scheme, secret_exports as Secret, segmented_exports as Segmented, select_field_exports as SelectField, sheet_exports as Sheet, skip_link_exports as SkipLink, sortable_exports as Sortable, stack_exports as Stack, stage_exports as Stage, stat_exports as Stat, status_bar_exports as StatusBar, table_exports as Table, tabs_exports as Tabs, tag_exports as Tag, text_button_exports as TextButton, textarea_field_exports as TextareaField, time_exports as Time, tips_exports as Tips, toast_exports as Toast, toc_exports as Toc, top_bar_exports as TopBar, wall_exports as Wall, window_exports as Window, wordmark_exports as Wordmark, wrap_exports as Wrap };
@@ -96,13 +96,13 @@ export declare const update: (model: Model, message: Message) => Readonly<{
96
96
  readonly isRepeating: boolean;
97
97
  };
98
98
  commands?: Update.Commands<{
99
- readonly _tag: "PressedEscape";
100
- } | {
101
99
  readonly _tag: "CompletedFocusField";
102
100
  } | {
103
101
  readonly _tag: "BlurredField";
104
102
  } | {
105
103
  readonly _tag: "PressedEnter";
104
+ } | {
105
+ readonly _tag: "PressedEscape";
106
106
  } | {
107
107
  readonly _tag: "UpdatedDraft";
108
108
  readonly value: string;
@@ -134,9 +134,9 @@ export declare const failed: (model: Model, error?: string) => Update.Return<Mod
134
134
  * never also closes the dialog around the field. Attached by `view`. In a Scene, resolve it
135
135
  * with `Message.PressedEscape`. */
136
136
  export declare const BindFieldKeys: Mount.MountDefinitionNoArgs<"BindFieldKeys", {
137
- readonly _tag: "PressedEscape";
138
- } | {
139
137
  readonly _tag: "PressedEnter";
138
+ } | {
139
+ readonly _tag: "PressedEscape";
140
140
  }>;
141
141
  /** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
142
142
  export type ViewInputs = Readonly<{
@@ -172,13 +172,13 @@ export declare const view: import("foldkit/submodel").View<{
172
172
  readonly maybeLastSavedId: Option.Option<string>;
173
173
  readonly isRepeating: boolean;
174
174
  }, {
175
- readonly _tag: "PressedEscape";
176
- } | {
177
175
  readonly _tag: "CompletedFocusField";
178
176
  } | {
179
177
  readonly _tag: "BlurredField";
180
178
  } | {
181
179
  readonly _tag: "PressedEnter";
180
+ } | {
181
+ readonly _tag: "PressedEscape";
182
182
  } | {
183
183
  readonly _tag: "UpdatedDraft";
184
184
  readonly value: string;
@@ -120,15 +120,15 @@ export declare const update: (model: Model, message: Message) => Readonly<{
120
120
  } | {
121
121
  readonly _tag: "GotAnimationMessage";
122
122
  readonly message: {
123
+ readonly _tag: "Hid";
124
+ } | {
125
+ readonly _tag: "Showed";
126
+ } | {
123
127
  readonly _tag: "CompletedWaitForPaint";
124
128
  readonly generation: number;
125
129
  } | {
126
130
  readonly _tag: "EndedAnimation";
127
131
  readonly generation: number;
128
- } | {
129
- readonly _tag: "Hid";
130
- } | {
131
- readonly _tag: "Showed";
132
132
  };
133
133
  } | {
134
134
  readonly _tag: "RequestedClose";
@@ -211,15 +211,15 @@ export declare const view: import("foldkit/submodel").View<{
211
211
  } | {
212
212
  readonly _tag: "GotAnimationMessage";
213
213
  readonly message: {
214
+ readonly _tag: "Hid";
215
+ } | {
216
+ readonly _tag: "Showed";
217
+ } | {
214
218
  readonly _tag: "CompletedWaitForPaint";
215
219
  readonly generation: number;
216
220
  } | {
217
221
  readonly _tag: "EndedAnimation";
218
222
  readonly generation: number;
219
- } | {
220
- readonly _tag: "Hid";
221
- } | {
222
- readonly _tag: "Showed";
223
223
  };
224
224
  } | {
225
225
  readonly _tag: "RequestedClose";
@@ -0,0 +1,4 @@
1
+ /** Registers `<pp-markdown-editor>`. Call it once from the client entry, before the first
2
+ * render. This subpath carries CodeMirror, so the package's root never registers it for an
3
+ * application that does not ask. */
4
+ export declare const defineMarkdownEditorElement: () => void;
@@ -0,0 +1,120 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { spec } from "./markdown-editor.js";
3
+ import { afterEmission, afterSource } from "./reconcile.js";
4
+ import { createEngine } from "./engine.js";
5
+ // src/markdown-editor/element.ts
6
+ const MIRRORED_ATTRIBUTES = [
7
+ "aria-describedby",
8
+ "aria-invalid",
9
+ "aria-required"
10
+ ];
11
+ const MOTION_END_EVENTS = ["animationend", "transitionend"];
12
+ const mirroredAttributes = (textarea) => __foldkitBrandViewResult((Object.fromEntries(MIRRORED_ATTRIBUTES.flatMap((name) => {
13
+ const value = textarea.getAttribute(name);
14
+ return __foldkitBrandViewResult((value === null ? [] : [[name, value]]), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#anonymous");
15
+ }))), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#mirroredAttributes");
16
+ const namedBy = (textarea) => {
17
+ const [label] = textarea.labels ?? [];
18
+ if (label === void 0) return __foldkitBrandViewResult(({}), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#namedBy");
19
+ if (label.id === "") label.id = `${textarea.id}-label`;
20
+ return __foldkitBrandViewResult(({ "aria-labelledby": label.id }), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#namedBy");
21
+ };
22
+ var MarkdownEditorElement = class extends HTMLElement {
23
+ static formAssociated = true;
24
+ #source = "";
25
+ #isDisabled = false;
26
+ #pending = [];
27
+ #mounted;
28
+ get source() {
29
+ return __foldkitBrandViewResult((this.#source), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#source");
30
+ }
31
+ set source(next) {
32
+ this.#source = next;
33
+ const engine = this.#mounted?.engine;
34
+ if (engine === void 0) return;
35
+ const { pending, isExternal } = afterSource(this.#pending, next, engine.doc());
36
+ this.#pending = pending;
37
+ if (isExternal) engine.applyExternal(next);
38
+ }
39
+ formDisabledCallback(isDisabled) {
40
+ this.#isDisabled = isDisabled;
41
+ this.#mounted?.syncAccess();
42
+ }
43
+ connectedCallback() {
44
+ const textarea = this.querySelector("textarea");
45
+ if (this.#mounted === void 0 && textarea !== null) this.#mounted = this.#mount(textarea);
46
+ }
47
+ disconnectedCallback() {
48
+ queueMicrotask(() => {
49
+ if (!this.isConnected) this.#mounted?.unmount();
50
+ });
51
+ }
52
+ #mount(textarea) {
53
+ const surface = document.createElement("div");
54
+ surface.className = "markdown-surface";
55
+ surface.style.setProperty("--rows", `${textarea.rows}`);
56
+ textarea.after(surface);
57
+ const accessAttributes = () => (__foldkitBrandViewResult(({
58
+ ...namedBy(textarea),
59
+ ...mirroredAttributes(textarea)
60
+ }), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#accessAttributes"));
61
+ const engine = createEngine({
62
+ parent: surface,
63
+ doc: this.#source,
64
+ attributes: accessAttributes(),
65
+ isReadOnly: this.#isDisabled,
66
+ onLocalChange: (doc) => {
67
+ this.#pending = afterEmission(this.#pending, doc);
68
+ this.dispatchEvent(new CustomEvent("value-change", { detail: { value: doc } }));
69
+ }
70
+ });
71
+ const syncAccess = () => {
72
+ engine.configureAccess(accessAttributes(), this.#isDisabled);
73
+ };
74
+ const lifetime = new AbortController();
75
+ const { signal } = lifetime;
76
+ const motion = new AbortController();
77
+ const remeasureAfterMotion = (event) => {
78
+ if (event.target instanceof Node && event.target.contains(this)) {
79
+ engine.requestMeasure();
80
+ motion.abort();
81
+ }
82
+ };
83
+ const attributeObserver = new MutationObserver(syncAccess);
84
+ textarea.tabIndex = -1;
85
+ textarea.setAttribute("aria-hidden", "true");
86
+ textarea.addEventListener("focus", engine.focus, { signal });
87
+ textarea.labels?.[0]?.addEventListener("click", (event) => {
88
+ event.preventDefault();
89
+ engine.focus();
90
+ }, { signal });
91
+ for (const name of MOTION_END_EVENTS) document.addEventListener(name, remeasureAfterMotion, {
92
+ capture: true,
93
+ signal: motion.signal
94
+ });
95
+ attributeObserver.observe(textarea, {
96
+ attributes: true,
97
+ attributeFilter: [...MIRRORED_ATTRIBUTES]
98
+ });
99
+ return __foldkitBrandViewResult(({
100
+ engine,
101
+ syncAccess,
102
+ unmount: () => {
103
+ lifetime.abort();
104
+ motion.abort();
105
+ attributeObserver.disconnect();
106
+ engine.destroy();
107
+ surface.remove();
108
+ this.#mounted = void 0;
109
+ this.#pending = [];
110
+ }
111
+ }), "@gjermundgaraba/pixel-paper/markdown-editor/element.js#mount");
112
+ }
113
+ };
114
+ /** Registers `<pp-markdown-editor>`. Call it once from the client entry, before the first
115
+ * render. This subpath carries CodeMirror, so the package's root never registers it for an
116
+ * application that does not ask. */
117
+ const defineMarkdownEditorElement = () => {
118
+ if (customElements.get(spec.tag) === void 0) customElements.define(spec.tag, MarkdownEditorElement);
119
+ };
120
+ export { defineMarkdownEditorElement };
@@ -0,0 +1,88 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { liveMarkdown } from "./live/live.js";
3
+ import { withLfLineEndings } from "./reconcile.js";
4
+ import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
5
+ import { commonmarkLanguage, markdownKeymap } from "@codemirror/lang-markdown";
6
+ import { Language } from "@codemirror/language";
7
+ import { diff } from "@codemirror/merge";
8
+ import { Compartment, EditorState, Prec, Transaction } from "@codemirror/state";
9
+ import { EditorView, keymap } from "@codemirror/view";
10
+ import { GFM, MarkdownParser } from "@lezer/markdown";
11
+ // src/markdown-editor/engine.ts
12
+ const DIFF_TIMEOUT_MS = 50;
13
+ const language = new Language(commonmarkLanguage.data, commonmarkLanguage.parser instanceof MarkdownParser ? commonmarkLanguage.parser.configure(GFM) : commonmarkLanguage.parser, [], "markdown");
14
+ /** Who is named by what, and whether the document may change. `readOnly` alone lets Enter and
15
+ * the Markdown keymap edit, so the filter refuses every change but an outside one. */
16
+ const accessExtension = (attributes, isReadOnly) => __foldkitBrandViewResult(([
17
+ EditorState.readOnly.of(isReadOnly),
18
+ ...isReadOnly ? [EditorState.changeFilter.of((transaction) => __foldkitBrandViewResult((transaction.annotation(Transaction.remote) === true), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#anonymous"))] : [],
19
+ EditorView.contentAttributes.of({
20
+ ...attributes,
21
+ ...isReadOnly ? { "aria-disabled": "true" } : {}
22
+ })
23
+ ]), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#accessExtension");
24
+ /** The editor's state. No line separator is set, so CRLF text parses like LF text. Tab stays
25
+ * unbound, so it leaves the field. */
26
+ const editorState = (doc, extensions = []) => __foldkitBrandViewResult((EditorState.create({
27
+ doc,
28
+ extensions: [
29
+ history(),
30
+ language,
31
+ liveMarkdown(),
32
+ Prec.high(keymap.of(markdownKeymap)),
33
+ keymap.of([...defaultKeymap, ...historyKeymap]),
34
+ EditorView.lineWrapping,
35
+ EditorView.contentAttributes.of({
36
+ spellcheck: "true",
37
+ autocorrect: "on",
38
+ autocapitalize: "sentences"
39
+ }),
40
+ extensions
41
+ ]
42
+ })), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#editorState");
43
+ /** The whole document to send up after these transactions, if one of them was a local edit. */
44
+ const emission = (transactions, state) => __foldkitBrandViewResult((transactions.some((transaction) => __foldkitBrandViewResult((transaction.docChanged && transaction.annotation(Transaction.remote) !== true), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#anonymous~2")) ? state.doc.toString() : void 0), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#emission");
45
+ /** A minimal edit from the document to an outside value: the caret survives it, and undo keeps
46
+ * to what was typed. */
47
+ const externalChange = (state, source) => {
48
+ const current = state.doc.toString();
49
+ const next = withLfLineEndings(source);
50
+ return __foldkitBrandViewResult(({
51
+ changes: diff(current, next, { timeout: DIFF_TIMEOUT_MS }).map(({ fromA, toA, fromB, toB }) => (__foldkitBrandViewResult(({
52
+ from: fromA,
53
+ to: toA,
54
+ insert: next.slice(fromB, toB)
55
+ }), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#anonymous~3"))),
56
+ annotations: [Transaction.remote.of(true), Transaction.addToHistory.of(false)]
57
+ }), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#externalChange");
58
+ };
59
+ /** Mounts CodeMirror in `parent`, and returns what the element drives it with. */
60
+ const createEngine = (config) => {
61
+ const access = new Compartment();
62
+ const view = new EditorView({
63
+ parent: config.parent,
64
+ state: editorState(config.doc, [access.of(accessExtension(config.attributes, config.isReadOnly)), EditorView.updateListener.of((update) => {
65
+ const doc = emission(update.transactions, update.state);
66
+ if (doc !== void 0) config.onLocalChange(doc);
67
+ })])
68
+ });
69
+ return __foldkitBrandViewResult(({
70
+ doc: () => __foldkitBrandViewResult((view.state.doc.toString()), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#doc"),
71
+ focus: () => {
72
+ view.focus();
73
+ },
74
+ requestMeasure: () => {
75
+ view.requestMeasure();
76
+ },
77
+ applyExternal: (source) => {
78
+ view.dispatch(externalChange(view.state, source));
79
+ },
80
+ configureAccess: (attributes, isReadOnly) => {
81
+ view.dispatch({ effects: access.reconfigure(accessExtension(attributes, isReadOnly)) });
82
+ },
83
+ destroy: () => {
84
+ view.destroy();
85
+ }
86
+ }), "@gjermundgaraba/pixel-paper/markdown-editor/engine.js#createEngine");
87
+ };
88
+ export { accessExtension, createEngine, editorState, emission, externalChange };