@threadlabs/looma 0.43.2 → 0.44.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.
Files changed (47) hide show
  1. package/components/ui-callout/ui-callout.html +4 -4
  2. package/components/ui-dialog/ui-dialog.html +0 -4
  3. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.html +4 -50
  4. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.js +10 -31
  5. package/dist/index.js +1 -1
  6. package/docs/README.md +19 -3
  7. package/docs/card.html +1 -1
  8. package/docs/catalog-view.js +11 -5
  9. package/docs/catalog-view.mjs +4 -3
  10. package/docs/catalog.json +73 -109
  11. package/docs/catalog.mjs +1 -1
  12. package/docs/customizer-render.mjs +9 -8
  13. package/docs/customizer.js +8 -8
  14. package/docs/documentation.css +2 -2
  15. package/docs/examples/ui-editor-footnote-editor/examples/01-note.behavior.js +9 -0
  16. package/docs/fonts.mjs +1 -1
  17. package/docs/index.mjs +1 -1
  18. package/docs/render.mjs +1 -1
  19. package/docs/site.mjs +14 -5
  20. package/docs/theme.mjs +96 -16
  21. package/editor/chunks/extensions.js +10 -0
  22. package/editor/extensions/footnote.d.ts +1 -0
  23. package/editor/footnote-editing.d.ts +16 -27
  24. package/package.json +2 -2
  25. package/styles/ui-callout.css +4 -4
  26. package/styles/ui-dialog.css +0 -8
  27. package/theme-dark.css +9 -9
  28. package/theme-high-contrast.css +4 -0
  29. package/theme-light.css +6 -6
  30. package/tokens.css +20 -18
  31. package/vanilla/UiEditorFootnoteEditor.d.ts +0 -5
  32. package/vanilla/UiEditorFootnoteEditor.js +20 -68
  33. package/vue/UiCallout.vue +4 -4
  34. package/vue/UiDialog.vue +0 -7
  35. package/vue/UiEditorFootnoteEditor.d.ts +11 -29
  36. package/vue/UiEditorFootnoteEditor.vue +21 -173
  37. package/vue/chunks/UiCallout.js +1 -1
  38. package/vue/chunks/UiDialog.js +1 -1
  39. package/vue/chunks/UiEditorFootnoteEditor.js +34 -226
  40. package/vue/chunks/UiEditorImageToolbar.js +1 -1
  41. package/vue/chunks/UiEditorLinkForm.js +1 -1
  42. package/vue/chunks/compact.js +565 -0
  43. package/vue/components.css +320 -327
  44. package/vue/editor/LoomaEditor.d.ts +2 -2
  45. package/vue/editor/compact/index.js +1 -562
  46. package/vue/editor/index.js +173 -80
  47. package/vue/index.js +2 -2
@@ -142,10 +142,10 @@
142
142
  }
143
143
 
144
144
  :host([tone="tip"]) {
145
- --_callout-border: var(--ui-success-soft-border);
146
- --_callout-surface: var(--ui-success-soft);
147
- --_callout-tone-text: var(--ui-success-subtle-text);
148
- --_callout-icon: var(--ui-success-subtle-text);
145
+ --_callout-border: var(--ui-info-soft-border);
146
+ --_callout-surface: var(--ui-info-soft);
147
+ --_callout-tone-text: var(--ui-info-subtle-text);
148
+ --_callout-icon: var(--ui-info-subtle-text);
149
149
  }
150
150
 
151
151
  :host([tone="important"]) {
@@ -72,10 +72,8 @@
72
72
  visibility: hidden;
73
73
  pointer-events: none;
74
74
  opacity: 0;
75
- transform: scale(0.96);
76
75
  transition:
77
76
  opacity var(--ui-dialog-duration, var(--ui-motion-base)) var(--ui-motion-ease),
78
- transform var(--ui-dialog-duration, var(--ui-motion-base)) var(--ui-motion-ease),
79
77
  visibility var(--ui-dialog-duration, var(--ui-motion-base)),
80
78
  display var(--ui-dialog-duration, var(--ui-motion-base)) var(--ui-motion-ease) allow-discrete,
81
79
  overlay var(--ui-dialog-duration, var(--ui-motion-base)) var(--ui-motion-ease) allow-discrete;
@@ -145,7 +143,6 @@
145
143
  visibility: visible;
146
144
  pointer-events: auto;
147
145
  opacity: 1;
148
- transform: scale(1);
149
146
  animation: ui-dialog-enter var(--ui-dialog-duration, var(--ui-motion-base)) var(--ui-motion-ease);
150
147
  }
151
148
 
@@ -231,7 +228,6 @@
231
228
  @keyframes ui-dialog-enter {
232
229
  from {
233
230
  opacity: 0;
234
- transform: scale(0.96);
235
231
  }
236
232
  }
237
233
 
@@ -1,57 +1,11 @@
1
- <link rel="component" href="../ui-stack/ui-stack.html">
2
- <link rel="component" href="../ui-form-field/ui-form-field.html">
3
- <link rel="component" href="../ui-input-group/ui-input-group.html">
4
- <link rel="component" href="../ui-input/ui-input.html">
5
1
  <link rel="component" href="../ui-textarea/ui-textarea.html">
6
- <link rel="component" href="../ui-button/ui-button.html">
7
2
  <template component="ui-editor-footnote-editor" module="./ui-editor-footnote-editor.js">
8
3
  <defs>
9
- <prop name="label" type="string" default="">The footnote's label, which its references and its note share, shown between [^ and ].</prop>
10
- <prop name="note" type="string" default="">The note's text, shown in the note field, with each block of a longer note on its own line.</prop>
11
- <prop name="editable" type="boolean" default="false"
12
- >Whether the note's text can be edited here. A note with formatting or more than one block shows its text read-only; Go to note edits it in the
13
- document.</prop>
14
- <prop name="error" type="string" default="">Why the label field's label was not used. While set, the field is invalid and shows it.</prop>
15
- <state name="base" type="string" value="ui-editor-footnote-editor"></state>
16
- <event name="text" type="object">
17
- <prop name="text" required type="string"></prop>
18
- The note's text changed.
19
- </event>
20
- <event name="label" type="object">
21
- <prop name="label" required type="string"></prop>
22
- A new label was committed: the label field changed and lost focus, or Enter was pressed in it.
23
- </event>
24
- <event name="go" type="object">Go to note was pressed.</event>
25
- <event name="done" type="object">Enter or Escape was pressed in a field, to close the editor and return to the reference.</event>
4
+ <prop name="note" type="string" default="">Content for the default plain-text field. Supply rich editing content through the default slot.</prop>
5
+ <event name="text" type="object"><prop name="text" required type="string"></prop>The default text field changed.</event>
6
+ <event name="done" type="object">An unhandled Escape closes the editor and returns to the reference.</event>
26
7
  </defs>
27
8
  <div role="dialog" aria-label="Edit footnote">
28
- <ui-stack gap="s">
29
- <ui-form-field from:invalid="$error != ''">
30
- <label slot="label" from:for="concat($base, '-label')">Label</label>
31
- <ui-input-group>
32
- <span slot="prefix">[^</span>
33
- <ui-input data-footnote-label from:id="concat($base, '-label')" size="sm" autocomplete="off" from:value="$label"></ui-input>
34
- <span slot="suffix">]</span>
35
- </ui-input-group>
36
- <span slot="error">{$error}</span>
37
- </ui-form-field>
38
- <ui-form-field>
39
- <label slot="label" from:for="concat($base, '-note')">Note</label>
40
- <ui-input-group multiline>
41
- <ui-textarea
42
- data-footnote-note
43
- from:id="concat($base, '-note')"
44
- size="sm"
45
- rows="2"
46
- autosize
47
- placeholder="Write the note"
48
- from:readonly="not $editable"
49
- from:value="$note"
50
- ></ui-textarea>
51
- <ui-button slot="action" size="sm" data-footnote-go>Go to note</ui-button>
52
- </ui-input-group>
53
- <span $if="not $editable" slot="help">This note has formatting, so it is edited in the document.</span>
54
- </ui-form-field>
55
- </ui-stack>
9
+ <slot><ui-textarea data-footnote-note aria-label="Footnote" rows="3" autosize placeholder="Write the note" from:value="$note"></ui-textarea></slot>
56
10
  </div>
57
11
  </template>
@@ -1,38 +1,17 @@
1
- // Gives each editor its own field ids, reports the note's text as it changes and a label when it is
2
- // committed, Go to note when pressed, and Enter or Escape in a field as done.
3
1
  export function connect(host) {
4
2
  const element = host.element;
5
- if (host.state.base === "ui-editor-footnote-editor") host.state.base = `ui-editor-footnote-editor-${Math.random().toString(36).slice(2, 11)}`;
6
- const within = (event, selector) => {
7
- const match = event.target.closest?.(selector);
8
- return match && element.contains(match) ? match : null;
3
+ const onInput = event => {
4
+ if (event.target.matches?.('[data-footnote-note]')) host.dispatch('text', { text: event.target.value });
9
5
  };
10
- const onInput = (event) => {
11
- if (within(event, "[data-footnote-note]")) host.dispatch("text", { text: event.target.value });
6
+ const onKeyDown = event => {
7
+ if (event.key !== 'Escape' || event.defaultPrevented) return;
8
+ event.preventDefault(); event.stopPropagation();
9
+ host.dispatch('done', {});
12
10
  };
13
- const onChange = (event) => {
14
- if (within(event, "[data-footnote-label]") && typeof event.target.value === "string") host.dispatch("label", { label: event.target.value.trim() });
15
- };
16
- const onClick = (event) => {
17
- if (within(event, "[data-footnote-go]")) host.dispatch("go", {});
18
- };
19
- // The editor handles Enter and Escape itself, so the overlay around it does not also act on them.
20
- const onKeyDown = (event) => {
21
- const label = within(event, "[data-footnote-label]");
22
- if ((event.key !== "Enter" && event.key !== "Escape") || !(label || within(event, "[data-footnote-note]"))) return;
23
- event.preventDefault();
24
- event.stopPropagation();
25
- if (label && event.key === "Enter") host.dispatch("label", { label: event.target.value.trim() });
26
- host.dispatch("done", {});
27
- };
28
- element.addEventListener("input", onInput);
29
- element.addEventListener("change", onChange);
30
- element.addEventListener("click", onClick);
31
- element.addEventListener("keydown", onKeyDown);
11
+ element.addEventListener('input', onInput);
12
+ element.addEventListener('keydown', onKeyDown);
32
13
  return () => {
33
- element.removeEventListener("input", onInput);
34
- element.removeEventListener("change", onChange);
35
- element.removeEventListener("click", onClick);
36
- element.removeEventListener("keydown", onKeyDown);
14
+ element.removeEventListener('input', onInput);
15
+ element.removeEventListener('keydown', onKeyDown);
37
16
  };
38
17
  }