@threadlabs/looma 0.29.8 → 0.29.9

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.
@@ -1,7 +1,7 @@
1
1
  import type { NodeViewRenderer } from "@tiptap/core";
2
2
  /**
3
3
  * Draws an editor callout with Looma's Callout, so it looks the same as a callout in any page.
4
- * @lifecycle ProseMirror owns the content DOM inside Callout's slot; destroying the view
5
- * releases its Vue app.
4
+ * @lifecycle ProseMirror owns the content DOM in Callout's slot and sets the tone and heading as the
5
+ * node changes. Callout disconnects once ProseMirror removes the view's element.
6
6
  */
7
7
  export declare const calloutNodeView: NodeViewRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.29.8",
3
+ "version": "0.29.9",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -11020,4 +11020,184 @@ html[data-ui-input-modality="touch"]
11020
11020
 
11021
11021
  /* The root is the hr, so the rules name :host; a bare hr matches only a descendant. */
11022
11022
  }
11023
+ /* Generated by HTML Next 1.0.0-alpha.55. Do not edit. */
11024
+ @supports (-moz-appearance: none) {
11025
+ :where([data-component], [data-slotted]) { --html-next-scope-owner: boundary; }
11026
+ :where([data-slotted]:not([data-component])) { --html-next-scope-owner: projected !important; }
11027
+ }
11028
+ @supports (-moz-appearance: none) {
11029
+ [data-component~="ui-callout"] { --html-next-scope-owner: "ui-callout" !important; }
11030
+ }
11031
+ @scope ([data-component~="ui-callout"]) to ([data-component], [data-slotted]) {
11032
+ /* This component's hooks style the element they are set on, and never a nested one. */
11033
+ @property --ui-callout-border {
11034
+ syntax: "*";
11035
+ inherits: false;
11036
+ }
11037
+ @property --ui-callout-border-width {
11038
+ syntax: "*";
11039
+ inherits: false;
11040
+ }
11041
+ @property --ui-callout-gap {
11042
+ syntax: "*";
11043
+ inherits: false;
11044
+ }
11045
+ @property --ui-callout-icon {
11046
+ syntax: "*";
11047
+ inherits: false;
11048
+ }
11049
+ @property --ui-callout-icon-column {
11050
+ syntax: "*";
11051
+ inherits: false;
11052
+ }
11053
+ @property --ui-callout-icon-size {
11054
+ syntax: "*";
11055
+ inherits: false;
11056
+ }
11057
+ @property --ui-callout-leading-border-width {
11058
+ syntax: "*";
11059
+ inherits: false;
11060
+ }
11061
+ @property --ui-callout-padding-block {
11062
+ syntax: "*";
11063
+ inherits: false;
11064
+ }
11065
+ @property --ui-callout-padding-inline {
11066
+ syntax: "*";
11067
+ inherits: false;
11068
+ }
11069
+ @property --ui-callout-surface {
11070
+ syntax: "*";
11071
+ inherits: false;
11072
+ }
11073
+ @property --ui-callout-text {
11074
+ syntax: "*";
11075
+ inherits: false;
11076
+ }
11077
+
11078
+ :scope:where([data-component~="ui-callout"]) {
11079
+ /* Hooks do not inherit, so the parts below read them from the root. */
11080
+ --_ui-callout-icon-column: var(--ui-callout-icon-column);
11081
+ --_ui-callout-icon: var(--ui-callout-icon);
11082
+ --_ui-callout-icon-size: var(--ui-callout-icon-size);
11083
+
11084
+ --_callout-surface: var(--ui-info-soft);
11085
+ --_ui-selection-context-surface: light-dark(
11086
+ oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l - 0.045) calc(max(c, min(0.045, c * 3))) h),
11087
+ oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l + 0.045) calc(max(c, min(0.045, c * 3))) h)
11088
+ );
11089
+ --_ui-selection-context-border: light-dark(
11090
+ oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l - 0.085) calc(max(c, min(0.045, c * 3))) h),
11091
+ oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l + 0.085) calc(max(c, min(0.045, c * 3))) h)
11092
+ );
11093
+ --_ui-selection-context-text: var(--ui-text-primary);
11094
+
11095
+ --_callout-border: var(--ui-info-solid);
11096
+ --_callout-icon: var(--ui-info-solid);
11097
+
11098
+ display: grid;
11099
+ grid-template-columns: var(--ui-callout-icon-column, 1.125rem) minmax(0, 1fr);
11100
+ gap: var(--ui-callout-gap, calc(var(--ui-space-2) * 0.75));
11101
+ align-items: start;
11102
+ max-width: 100%;
11103
+ padding-block: var(--ui-callout-padding-block, var(--ui-space-2));
11104
+ padding-inline-start: var(--ui-callout-padding-inline, var(--ui-space-2));
11105
+ padding-inline-end: var(--ui-callout-padding-inline, var(--ui-space-3));
11106
+ border: var(--ui-callout-border-width, var(--ui-border-width)) solid
11107
+ color-mix(in srgb, var(--ui-callout-border, var(--_callout-border)) 35%, transparent);
11108
+ border-inline-start: var(--ui-callout-leading-border-width, var(--ui-callout-border-width, var(--ui-border-width))) solid
11109
+ color-mix(in srgb, var(--ui-callout-border, var(--_callout-border)) 35%, transparent);
11110
+ border-radius: var(--ui-radius-md);
11111
+ background: var(--ui-callout-surface, var(--_callout-surface));
11112
+ color: var(--ui-callout-text, var(--ui-text-primary));
11113
+ font-family: var(--ui-font-family-sans);
11114
+ font-size: var(--ui-font-size-sm);
11115
+ font-weight: var(--ui-font-normal);
11116
+ line-height: var(--ui-line-height-md);
11117
+ }
11118
+
11119
+ /* One line box tall, so the icon centres on the first line of text. */
11120
+ .icon {
11121
+ display: grid;
11122
+ place-items: center;
11123
+ inline-size: var(--_ui-callout-icon-column, 1.125rem);
11124
+ block-size: 1lh;
11125
+ color: var(--_ui-callout-icon, var(--_callout-icon));
11126
+ }
11127
+
11128
+ .icon svg {
11129
+ inline-size: var(--_ui-callout-icon-size, 1.125rem);
11130
+ block-size: var(--_ui-callout-icon-size, 1.125rem);
11131
+ }
11132
+
11133
+ .content {
11134
+ min-inline-size: 0;
11135
+ }
11136
+
11137
+ .heading {
11138
+ display: block;
11139
+ font-weight: var(--ui-font-semibold);
11140
+ }
11141
+
11142
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=neutral"], :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=note"] {
11143
+ --_ui-selection-context-surface: initial;
11144
+ --_ui-selection-context-border: initial;
11145
+ --_ui-selection-context-text: initial;
11146
+ --_callout-surface: var(--ui-surface-muted);
11147
+ --_callout-border: var(--ui-border-strong);
11148
+ --_callout-icon: var(--ui-text-secondary);
11149
+ }
11150
+
11151
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=tip"] {
11152
+ --_callout-surface: var(--ui-success-soft);
11153
+ --_callout-border: var(--ui-success-solid);
11154
+ --_callout-icon: var(--ui-success-solid);
11155
+ }
11156
+
11157
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=important"] {
11158
+ --_callout-surface: var(--ui-accent-soft);
11159
+ --_callout-border: var(--ui-accent-solid);
11160
+ --_callout-icon: var(--ui-accent-solid);
11161
+ }
11162
+
11163
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=warning"] {
11164
+ --_callout-surface: var(--ui-warning-soft);
11165
+ --_callout-border: var(--ui-warning-solid);
11166
+ --_callout-icon: var(--ui-warning-solid);
11167
+ }
11168
+
11169
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=success"] {
11170
+ --_callout-surface: var(--ui-success-soft);
11171
+ --_callout-border: var(--ui-success-solid);
11172
+ --_callout-icon: var(--ui-success-solid);
11173
+ }
11174
+
11175
+ :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=danger"], :scope:where([data-component~="ui-callout"])[data-ui-callout-state~="tone=caution"] {
11176
+ --_callout-surface: var(--ui-danger-soft);
11177
+ --_callout-border: var(--ui-danger-solid);
11178
+ --_callout-icon: var(--ui-danger-solid);
11179
+ }
11180
+
11181
+ /* A link in the callout's text is underlined, so it reads as a link by more than colour. */
11182
+
11183
+ /* A component that sets its display still honours the hidden attribute on its root. */
11184
+ :scope:where([data-component~="ui-callout"])[hidden] {
11185
+ display: none;
11186
+ }
11187
+ }
11188
+ @scope ([data-component~="ui-callout"]) to ([data-component]) {
11189
+ /* This component's hooks style the element they are set on, and never a nested one. */
11190
+
11191
+ /* One line box tall, so the icon centres on the first line of text. */
11192
+
11193
+ /* A link in the callout's text is underlined, so it reads as a link by more than colour. */
11194
+ .content :where([data-slotted], [data-slotted] *):is(a) {
11195
+ color: var(--ui-accent-active);
11196
+ text-decoration: underline;
11197
+ text-decoration-thickness: 0.06em;
11198
+ text-underline-offset: 0.18em;
11199
+ }
11200
+
11201
+ /* A component that sets its display still honours the hidden attribute on its root. */
11202
+ }
11023
11203
  /*$vite$:1*/
@@ -1,6 +1,6 @@
1
1
  import { computed, createApp, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, reactive, ref, shallowRef, useId, watch } from "vue";
2
2
  import { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ICONS, createLoomaMentionExtension, createLoomaSlashCommandExtension, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeTableOfContentsConfig } from "@threadlabs/looma/editor";
3
- import { Button, Callout, Card, Checkbox, Cluster, Disclosure, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, FormField, Icon, IconButton, Image, Input, List, Menu, MenuItem, Popover, Stack, StatusMessage, Text, Tooltip } from "@threadlabs/looma/vue";
3
+ import { Button, Card, Checkbox, Cluster, Disclosure, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, FormField, Icon, IconButton, Image, Input, List, Menu, MenuItem, Popover, Stack, StatusMessage, Text, Tooltip } from "@threadlabs/looma/vue";
4
4
  import { Editor, Extension, Node as Node$1, getText, getTextSerializersFromSchema, isNodeSelection, mergeAttributes, nodeInputRule, posToDOMRect } from "@tiptap/core";
5
5
  import { Editor as Editor$1 } from "@tiptap/vue-3";
6
6
  import { AllSelection, NodeSelection, Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
@@ -11,7 +11,7 @@ import "@tiptap/pm/tables";
11
11
  import "@tiptap/pm/transform";
12
12
  import { closeHistory } from "@tiptap/pm/history";
13
13
  import { DOMParser, DOMSerializer, Fragment as Fragment$1 } from "@tiptap/pm/model";
14
- import { acceptProps, attachGeneratedController, checkBoolean, checkFormat, formatOf, hostState, keywordFormat, manageProps, toAttribute, writeAttribute } from "@nextwebwg/html-next/generated-runtime";
14
+ import { acceptProps, attachGeneratedController, buildTemplate, checkBoolean, checkFormat, checkString, clearRegion, dispose, fillSlot, formatOf, hostState, keywordFormat, manageProps, project, toAttribute, toText, truthy, writeAttribute } from "@nextwebwg/html-next/generated-runtime";
15
15
  export * from "@threadlabs/looma/editor";
16
16
  //#region src/vue/editor/primitives.ts
17
17
  /** Each Vue editor component's element tag, for tooling that enumerates them. */
@@ -3175,13 +3175,13 @@ var expandNodeView = ({ editor, node, getPos }) => {
3175
3175
  };
3176
3176
  //#endregion
3177
3177
  //#region vanilla/UiSeparator.js
3178
- var S = {
3178
+ var S$1 = {
3179
3179
  n: [],
3180
3180
  t: [],
3181
3181
  f: import.meta.url,
3182
3182
  g: "ui-separator"
3183
3183
  };
3184
- var D = {
3184
+ var D$1 = {
3185
3185
  g: "ui-separator",
3186
3186
  props: {
3187
3187
  "emphasis": {
@@ -3242,7 +3242,7 @@ function createUiSeparator(options = {}, html) {
3242
3242
  null,
3243
3243
  null
3244
3244
  ];
3245
- const B = acceptProps(element, D, S.n, v, componentProps, [], html);
3245
+ const B = acceptProps(element, D$1, S$1.n, v, componentProps, [], html);
3246
3246
  const p0 = (r, c, d) => {
3247
3247
  if (c & 1073741826) {
3248
3248
  const x0 = v[1];
@@ -3268,7 +3268,7 @@ function createUiSeparator(options = {}, html) {
3268
3268
  v1: void 0
3269
3269
  };
3270
3270
  const I = { B };
3271
- attachGeneratedController(element, S, v, ((c, d) => p0(R, c, d)), void 0, void 0, I);
3271
+ attachGeneratedController(element, S$1, v, ((c, d) => p0(R, c, d)), void 0, void 0, I);
3272
3272
  manageProps(I);
3273
3273
  return element;
3274
3274
  }
@@ -3315,39 +3315,488 @@ var dividerNodeView = ({ editor, getPos }) => {
3315
3315
  };
3316
3316
  };
3317
3317
  //#endregion
3318
- //#region src/vue/editor/callout.ts
3318
+ //#region vanilla/UiCallout.js
3319
+ var T0 = [
3320
+ "",
3321
+ [],
3322
+ "\n ",
3323
+ [
3324
+ "span",
3325
+ [
3326
+ "class",
3327
+ "icon",
3328
+ "aria-hidden",
3329
+ "true"
3330
+ ],
3331
+ "\n ",
3332
+ 1,
3333
+ "\n ",
3334
+ 1,
3335
+ "\n ",
3336
+ 1,
3337
+ "\n ",
3338
+ 1,
3339
+ "\n ",
3340
+ 1,
3341
+ "\n ",
3342
+ 1,
3343
+ "\n ",
3344
+ 1,
3345
+ "\n "
3346
+ ],
3347
+ "\n ",
3348
+ [
3349
+ "div",
3350
+ ["class", "content"],
3351
+ "\n ",
3352
+ 1,
3353
+ "\n ",
3354
+ 4,
3355
+ "\n "
3356
+ ],
3357
+ "\n "
3358
+ ];
3359
+ var T1 = [
3360
+ "svg",
3361
+ [
3362
+ "viewBox",
3363
+ "0 0 24 24",
3364
+ "fill",
3365
+ "none",
3366
+ "stroke",
3367
+ "currentColor",
3368
+ "stroke-width",
3369
+ "2",
3370
+ "stroke-linecap",
3371
+ "round",
3372
+ "stroke-linejoin",
3373
+ "round"
3374
+ ],
3375
+ ["circle", [
3376
+ "cx",
3377
+ "12",
3378
+ "cy",
3379
+ "12",
3380
+ "r",
3381
+ "10"
3382
+ ]],
3383
+ ["path", ["d", "M12 16v-4"]],
3384
+ ["path", ["d", "M12 8h.01"]]
3385
+ ];
3386
+ var T2 = [
3387
+ "svg",
3388
+ [
3389
+ "viewBox",
3390
+ "0 0 24 24",
3391
+ "fill",
3392
+ "none",
3393
+ "stroke",
3394
+ "currentColor",
3395
+ "stroke-width",
3396
+ "2",
3397
+ "stroke-linecap",
3398
+ "round",
3399
+ "stroke-linejoin",
3400
+ "round"
3401
+ ],
3402
+ ["path", ["d", "M13.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.5L13.5 2Z"]],
3403
+ ["path", ["d", "M13 2v7h7"]],
3404
+ ["path", ["d", "m9.5 17.5 4-4 2 2-4 4H9.5v-2Z"]]
3405
+ ];
3406
+ var T3 = [
3407
+ "svg",
3408
+ [
3409
+ "viewBox",
3410
+ "0 0 24 24",
3411
+ "fill",
3412
+ "none",
3413
+ "stroke",
3414
+ "currentColor",
3415
+ "stroke-width",
3416
+ "2",
3417
+ "stroke-linecap",
3418
+ "round",
3419
+ "stroke-linejoin",
3420
+ "round"
3421
+ ],
3422
+ ["path", ["d", "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"]],
3423
+ ["path", ["d", "M9 18h6"]],
3424
+ ["path", ["d", "M10 22h4"]]
3425
+ ];
3426
+ var T4 = [
3427
+ "svg",
3428
+ [
3429
+ "viewBox",
3430
+ "0 0 24 24",
3431
+ "fill",
3432
+ "none",
3433
+ "stroke",
3434
+ "currentColor",
3435
+ "stroke-width",
3436
+ "2",
3437
+ "stroke-linecap",
3438
+ "round",
3439
+ "stroke-linejoin",
3440
+ "round"
3441
+ ],
3442
+ ["path", ["d", "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"]],
3443
+ ["path", ["d", "M12 15h.01"]],
3444
+ ["path", ["d", "M12 7v4"]]
3445
+ ];
3446
+ var T5 = [
3447
+ "svg",
3448
+ [
3449
+ "viewBox",
3450
+ "0 0 24 24",
3451
+ "fill",
3452
+ "none",
3453
+ "stroke",
3454
+ "currentColor",
3455
+ "stroke-width",
3456
+ "2",
3457
+ "stroke-linecap",
3458
+ "round",
3459
+ "stroke-linejoin",
3460
+ "round"
3461
+ ],
3462
+ ["path", ["d", "m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"]],
3463
+ ["path", ["d", "M12 9v4"]],
3464
+ ["path", ["d", "M12 17h.01"]]
3465
+ ];
3466
+ var T6 = [
3467
+ "svg",
3468
+ [
3469
+ "viewBox",
3470
+ "0 0 24 24",
3471
+ "fill",
3472
+ "none",
3473
+ "stroke",
3474
+ "currentColor",
3475
+ "stroke-width",
3476
+ "2",
3477
+ "stroke-linecap",
3478
+ "round",
3479
+ "stroke-linejoin",
3480
+ "round"
3481
+ ],
3482
+ ["circle", [
3483
+ "cx",
3484
+ "12",
3485
+ "cy",
3486
+ "12",
3487
+ "r",
3488
+ "10"
3489
+ ]],
3490
+ ["path", ["d", "m9 12 2 2 4-4"]]
3491
+ ];
3492
+ var T7 = [
3493
+ "svg",
3494
+ [
3495
+ "viewBox",
3496
+ "0 0 24 24",
3497
+ "fill",
3498
+ "none",
3499
+ "stroke",
3500
+ "currentColor",
3501
+ "stroke-width",
3502
+ "2",
3503
+ "stroke-linecap",
3504
+ "round",
3505
+ "stroke-linejoin",
3506
+ "round"
3507
+ ],
3508
+ ["circle", [
3509
+ "cx",
3510
+ "12",
3511
+ "cy",
3512
+ "12",
3513
+ "r",
3514
+ "10"
3515
+ ]],
3516
+ ["path", ["d", "m15 9-6 6"]],
3517
+ ["path", ["d", "m9 9 6 6"]]
3518
+ ];
3519
+ var T8 = [
3520
+ "strong",
3521
+ ["class", "heading"],
3522
+ 0
3523
+ ];
3524
+ var T9 = ["", []];
3525
+ var P0;
3526
+ var P1;
3527
+ var P2;
3528
+ var P3;
3529
+ var P4;
3530
+ var P5;
3531
+ var P6;
3532
+ var P7;
3533
+ var P8;
3534
+ var P9;
3535
+ var S = {
3536
+ n: [],
3537
+ t: [],
3538
+ f: import.meta.url,
3539
+ g: "ui-callout"
3540
+ };
3541
+ var D = {
3542
+ g: "ui-callout",
3543
+ props: {
3544
+ "heading": {
3545
+ "required": false,
3546
+ "default": "",
3547
+ c: checkString,
3548
+ t: "string",
3549
+ j: 0,
3550
+ m: "s"
3551
+ },
3552
+ "tone": {
3553
+ "required": false,
3554
+ "values": [
3555
+ "info",
3556
+ "neutral",
3557
+ "note",
3558
+ "tip",
3559
+ "important",
3560
+ "warning",
3561
+ "caution",
3562
+ "success",
3563
+ "danger"
3564
+ ],
3565
+ "default": "info",
3566
+ c: checkFormat("keyword", keywordFormat),
3567
+ t: "keyword",
3568
+ j: 0,
3569
+ m: [
3570
+ "p",
3571
+ formatOf(keywordFormat),
3572
+ false
3573
+ ]
3574
+ }
3575
+ }
3576
+ };
3577
+ function createUiCallout(options = {}, html) {
3578
+ const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
3579
+ const element = document.createElement("div");
3580
+ for (const [name, value] of Object.entries(attributes)) {
3581
+ if (value === null || value === void 0 || value === false) continue;
3582
+ element.setAttribute(name, value === true ? "" : String(value));
3583
+ }
3584
+ if (!element.hasAttribute("role")) element.setAttribute("role", "note");
3585
+ element.setAttribute("data-component", "ui-callout");
3586
+ element.append((P0 ??= buildTemplate(T0)).cloneNode(true));
3587
+ const v = [null, null];
3588
+ const B = acceptProps(element, D, S.n, v, componentProps, [], html);
3589
+ const m1 = (d) => {
3590
+ return { n: (P1 ??= buildTemplate(T1)).cloneNode(true) };
3591
+ };
3592
+ const m2 = (d) => {
3593
+ return { n: (P2 ??= buildTemplate(T2)).cloneNode(true) };
3594
+ };
3595
+ const m3 = (d) => {
3596
+ return { n: (P3 ??= buildTemplate(T3)).cloneNode(true) };
3597
+ };
3598
+ const m4 = (d) => {
3599
+ return { n: (P4 ??= buildTemplate(T4)).cloneNode(true) };
3600
+ };
3601
+ const m5 = (d) => {
3602
+ return { n: (P5 ??= buildTemplate(T5)).cloneNode(true) };
3603
+ };
3604
+ const m6 = (d) => {
3605
+ return { n: (P6 ??= buildTemplate(T6)).cloneNode(true) };
3606
+ };
3607
+ const m7 = (d) => {
3608
+ return { n: (P7 ??= buildTemplate(T7)).cloneNode(true) };
3609
+ };
3610
+ const m8 = (d) => {
3611
+ const n = (P8 ??= buildTemplate(T8)).cloneNode(true);
3612
+ const r = {
3613
+ n,
3614
+ a0: n.firstChild,
3615
+ v0: ""
3616
+ };
3617
+ p8(r, -1, d);
3618
+ return r;
3619
+ };
3620
+ const p8 = (r, c, d) => {
3621
+ if (c & 1) {
3622
+ const x0 = v[0];
3623
+ const s0 = toText(x0);
3624
+ if (s0 !== r.v0) r.a0.data = r.v0 = s0;
3625
+ }
3626
+ };
3627
+ const m9 = (d) => {
3628
+ return { n: (P9 ??= buildTemplate(T9)).cloneNode(true) };
3629
+ };
3630
+ const p0 = (r, c, d) => {
3631
+ if (c & 2) {
3632
+ const s0 = hostState(["tone"], [v[1]]);
3633
+ if (s0 !== r.v0) writeAttribute(r.n, "data-ui-callout-state", (r.v0 = s0) === "" ? null : s0);
3634
+ }
3635
+ if (c & 2 && !(v[1] === "info") !== !r.b0) {
3636
+ if (r.b0) {
3637
+ r.b0 = void 0;
3638
+ clearRegion(r.a0, r.e0);
3639
+ } else {
3640
+ r.b0 = m1(d);
3641
+ r.e0.before(r.b0.n);
3642
+ }
3643
+ } else if (r.b0 !== void 0) r.b0;
3644
+ if (c & 2 && !(v[1] === "neutral" || v[1] === "note") !== !r.b1) {
3645
+ if (r.b1) {
3646
+ r.b1 = void 0;
3647
+ clearRegion(r.a1, r.e1);
3648
+ } else {
3649
+ r.b1 = m2(d);
3650
+ r.e1.before(r.b1.n);
3651
+ }
3652
+ } else if (r.b1 !== void 0) r.b1;
3653
+ if (c & 2 && !(v[1] === "tip") !== !r.b2) {
3654
+ if (r.b2) {
3655
+ r.b2 = void 0;
3656
+ clearRegion(r.a2, r.e2);
3657
+ } else {
3658
+ r.b2 = m3(d);
3659
+ r.e2.before(r.b2.n);
3660
+ }
3661
+ } else if (r.b2 !== void 0) r.b2;
3662
+ if (c & 2 && !(v[1] === "important") !== !r.b3) {
3663
+ if (r.b3) {
3664
+ r.b3 = void 0;
3665
+ clearRegion(r.a3, r.e3);
3666
+ } else {
3667
+ r.b3 = m4(d);
3668
+ r.e3.before(r.b3.n);
3669
+ }
3670
+ } else if (r.b3 !== void 0) r.b3;
3671
+ if (c & 2 && !(v[1] === "warning") !== !r.b4) {
3672
+ if (r.b4) {
3673
+ r.b4 = void 0;
3674
+ clearRegion(r.a4, r.e4);
3675
+ } else {
3676
+ r.b4 = m5(d);
3677
+ r.e4.before(r.b4.n);
3678
+ }
3679
+ } else if (r.b4 !== void 0) r.b4;
3680
+ if (c & 2 && !(v[1] === "success") !== !r.b5) {
3681
+ if (r.b5) {
3682
+ r.b5 = void 0;
3683
+ clearRegion(r.a5, r.e5);
3684
+ } else {
3685
+ r.b5 = m6(d);
3686
+ r.e5.before(r.b5.n);
3687
+ }
3688
+ } else if (r.b5 !== void 0) r.b5;
3689
+ if (c & 2 && !(v[1] === "danger" || v[1] === "caution") !== !r.b6) {
3690
+ if (r.b6) {
3691
+ r.b6 = void 0;
3692
+ clearRegion(r.a6, r.e6);
3693
+ } else {
3694
+ r.b6 = m7(d);
3695
+ r.e6.before(r.b6.n);
3696
+ }
3697
+ } else if (r.b6 !== void 0) r.b6;
3698
+ if (c & 1 && !truthy(v[0]) !== !r.b7) {
3699
+ if (r.b7) {
3700
+ r.b7 = void 0;
3701
+ clearRegion(r.a7, r.e7);
3702
+ } else {
3703
+ r.b7 = m8(d);
3704
+ r.e7.before(r.b7.n);
3705
+ }
3706
+ } else if (r.b7 !== void 0) p8(r.b7, c, d);
3707
+ if (r.f8 === void 0) {
3708
+ r.f8 = 1;
3709
+ const at = fillSlot(r.a8, r.e8, "", J, false, void 0, d);
3710
+ if (Array.isArray(at)) (r.z ??= []).push(() => {
3711
+ at[0].l.delete(at[1]);
3712
+ dispose(at[1]);
3713
+ });
3714
+ else if (at !== void 0) {
3715
+ r.b8 = m9(d);
3716
+ at.before(r.b8.n);
3717
+ }
3718
+ } else if (r.b8 !== void 0) r.b8;
3719
+ };
3720
+ const t0 = element.firstChild.nextSibling;
3721
+ const t1 = t0.firstChild.nextSibling;
3722
+ const t2 = t1.nextSibling.nextSibling.nextSibling;
3723
+ const t3 = t2.nextSibling.nextSibling.nextSibling;
3724
+ const t4 = t3.nextSibling.nextSibling.nextSibling;
3725
+ const t5 = t4.nextSibling.nextSibling.nextSibling;
3726
+ const t6 = t5.nextSibling.nextSibling.nextSibling;
3727
+ const t7 = t6.nextSibling.nextSibling.nextSibling;
3728
+ const t9 = t0.nextSibling.nextSibling.firstChild.nextSibling;
3729
+ const t10 = t9.nextSibling.nextSibling.nextSibling;
3730
+ const R = {
3731
+ n: element,
3732
+ v0: void 0,
3733
+ a0: t1,
3734
+ e0: t1.nextSibling,
3735
+ b0: void 0,
3736
+ a1: t2,
3737
+ e1: t2.nextSibling,
3738
+ b1: void 0,
3739
+ a2: t3,
3740
+ e2: t3.nextSibling,
3741
+ b2: void 0,
3742
+ a3: t4,
3743
+ e3: t4.nextSibling,
3744
+ b3: void 0,
3745
+ a4: t5,
3746
+ e4: t5.nextSibling,
3747
+ b4: void 0,
3748
+ a5: t6,
3749
+ e5: t6.nextSibling,
3750
+ b5: void 0,
3751
+ a6: t7,
3752
+ e6: t7.nextSibling,
3753
+ b6: void 0,
3754
+ a7: t9,
3755
+ e7: t9.nextSibling,
3756
+ b7: void 0,
3757
+ a8: t10,
3758
+ e8: t10.nextSibling,
3759
+ b8: void 0,
3760
+ f8: void 0
3761
+ };
3762
+ const I = { B };
3763
+ const J = project(I, children, slots);
3764
+ attachGeneratedController(element, S, v, ((c, d) => p0(R, c, d)), void 0, void 0, I);
3765
+ manageProps(I);
3766
+ return element;
3767
+ }
3768
+ //#endregion
3769
+ //#region src/editor/node-views/callout.ts
3770
+ var calloutProps = (node) => ({
3771
+ tone: node.attrs.tone,
3772
+ heading: node.attrs.heading || void 0
3773
+ });
3319
3774
  /**
3320
3775
  * Draws an editor callout with Looma's Callout, so it looks the same as a callout in any page.
3321
- * @lifecycle ProseMirror owns the content DOM inside Callout's slot; destroying the view
3322
- * releases its Vue app.
3776
+ * @lifecycle ProseMirror owns the content DOM in Callout's slot and sets the tone and heading as the
3777
+ * node changes. Callout disconnects once ProseMirror removes the view's element.
3323
3778
  */
3324
3779
  var calloutNodeView = ({ node }) => {
3325
3780
  const dom = document.createElement("div");
3326
3781
  dom.dataset.loomaCallout = "";
3327
- const current = shallowRef(node);
3328
- let contentDOM;
3329
- const app = createApp({ render: () => h(Callout, {
3330
- tone: current.value.attrs.tone,
3331
- heading: current.value.attrs.heading || void 0
3332
- }, () => h("div", {
3333
- "data-looma-callout-body": "",
3334
- ref: (element) => {
3335
- if (element) contentDOM = element;
3336
- }
3337
- })) });
3338
- app.mount(dom);
3782
+ const contentDOM = document.createElement("div");
3783
+ contentDOM.dataset.loomaCalloutBody = "";
3784
+ const callout = createUiCallout({
3785
+ ...calloutProps(node),
3786
+ children: [contentDOM]
3787
+ });
3788
+ dom.append(callout);
3789
+ let current = node;
3339
3790
  return {
3340
3791
  dom,
3341
3792
  contentDOM,
3342
3793
  update(next) {
3343
- if (next.type !== current.value.type) return false;
3344
- current.value = next;
3794
+ if (next.type !== current.type) return false;
3795
+ current = next;
3796
+ updateComponentProps(callout, calloutProps(next));
3345
3797
  return true;
3346
3798
  },
3347
- ignoreMutation: (mutation) => mutation.type !== "selection" && !contentDOM.contains(mutation.target),
3348
- destroy() {
3349
- app.unmount();
3350
- }
3799
+ ignoreMutation: (mutation) => mutation.type !== "selection" && !contentDOM.contains(mutation.target)
3351
3800
  };
3352
3801
  };
3353
3802
  //#endregion