@quillmark/svelte 0.3.0 → 0.3.2
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/NOTICE +6 -6
- package/README.md +1 -1
- package/THEMING.md +1 -1
- package/dist/core/bloom.d.ts +1 -30
- package/dist/core/bloom.js +13 -45
- package/dist/core/codec/anchor.d.ts +5 -5
- package/dist/core/codec/anchor.js +37 -13
- package/dist/core/codec/prose.css +5 -6
- package/dist/core/theme.css +39 -19
- package/dist/preset/scale.css +4 -4
- package/dist/preview/Preview.svelte +6 -18
- package/dist/preview/Preview.svelte.d.ts +2 -3
- package/dist/preview/bridge.js +2 -2
- package/dist/preview/controller.d.ts +8 -10
- package/dist/preview/controller.js +16 -41
- package/dist/preview/geometry.d.ts +7 -9
- package/dist/preview/geometry.js +7 -9
- package/dist/preview/index.js +1 -1
- package/dist/preview/paint.d.ts +1 -1
- package/dist/preview/paint.js +5 -5
- package/dist/visual/Card.svelte +40 -35
- package/dist/visual/Card.svelte.d.ts +0 -1
- package/dist/visual/FormatPopover.svelte +58 -37
- package/dist/visual/ProseField.svelte +22 -20
- package/dist/visual/ProseField.svelte.d.ts +1 -2
- package/dist/visual/TipsCard.svelte +56 -53
- package/dist/visual/VisualEditorInner.svelte +126 -206
- package/dist/visual/icons/nodes.d.ts +16 -0
- package/dist/visual/icons/nodes.js +11 -0
- package/package.json +2 -2
- package/dist/preview/overlay.d.ts +0 -11
- package/dist/preview/overlay.js +0 -97
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
with the caret riding the untouched view.
|
|
2
|
+
A Svelte mount of the codec's `createField` (VISUAL_EDITOR §Surface), which owns the
|
|
3
|
+
PM state, the history and the per-keystroke commit, leaving this wrapper wiring and
|
|
4
|
+
registration. `addr` is a live object the parent builds, so a card reorder re-targets
|
|
5
|
+
this leaf's commits with the caret riding the untouched view.
|
|
7
6
|
-->
|
|
8
7
|
<script lang="ts">
|
|
9
8
|
import { onMount } from 'svelte';
|
|
@@ -41,8 +40,7 @@
|
|
|
41
40
|
/** Ghost shown on the empty leaf: an inline leaf's resolved `default:` or
|
|
42
41
|
* nothing, a body's always text (`resolveBodyGhost`). */
|
|
43
42
|
placeholder?: string;
|
|
44
|
-
/**
|
|
45
|
-
* visible as one. */
|
|
43
|
+
/** Registry identity, stamped on the DOM node so a remount is visible as one. */
|
|
46
44
|
leafKey: string;
|
|
47
45
|
onFocus?: (addr: Addr) => void;
|
|
48
46
|
onCaretMove?: (addr: Addr, pos: number) => void;
|
|
@@ -79,9 +77,9 @@
|
|
|
79
77
|
// locale swap reaches a mounted table without remounting the leaf and losing the caret.
|
|
80
78
|
const t = wording();
|
|
81
79
|
|
|
82
|
-
/**
|
|
83
|
-
* the
|
|
84
|
-
*
|
|
80
|
+
/** Pushed by the leaf's trigger plugin: the menu is the leaf's surface rather than
|
|
81
|
+
* the shell's (VISUAL_EDITOR §Chrome). A constrained leaf never receives one, the
|
|
82
|
+
* trigger mounting on the block schema alone. */
|
|
85
83
|
let slash: SlashState | undefined = $state();
|
|
86
84
|
|
|
87
85
|
// The codec's own schema predicate (`createField`: `plaintext` implies `inline`), so
|
|
@@ -91,8 +89,8 @@
|
|
|
91
89
|
|
|
92
90
|
let controller: FieldController | undefined;
|
|
93
91
|
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
92
|
+
/** What the label's click calls. The controller's focus, not the container's, which
|
|
93
|
+
* leaves the PM selection unplaced. */
|
|
96
94
|
export function focus(): void {
|
|
97
95
|
controller?.focus();
|
|
98
96
|
}
|
|
@@ -153,16 +151,15 @@
|
|
|
153
151
|
/* Containing block for the arrival wash's inset child (`core/bloom.ts`). */
|
|
154
152
|
position: relative;
|
|
155
153
|
}
|
|
156
|
-
/* A leaf the inline schema does not constrain
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
/* A leaf the inline schema does not constrain grows, and opens at one line box: the
|
|
155
|
+
empty leaf is the height its first line will take, so the first keystroke displaces
|
|
156
|
+
nothing below it. `1em`, not a size rung, which is the rule below's to name.
|
|
159
157
|
|
|
160
|
-
On the editable rather than on the wrapper, which is what makes
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
the end of it. */
|
|
158
|
+
On the editable rather than on the wrapper, which is what makes that line part of the
|
|
159
|
+
body: height the wrapper holds is height outside the `contenteditable`, where a press
|
|
160
|
+
lands no caret. */
|
|
164
161
|
.qm-prose-block :global(.ProseMirror) {
|
|
165
|
-
min-height: calc(1em * var(--_qm-leading-body)
|
|
162
|
+
min-height: calc(1em * var(--_qm-leading-body));
|
|
166
163
|
}
|
|
167
164
|
/* Paper, and the withheld box is what says so. Not `block` alone: `inline` is the
|
|
168
165
|
quill's to declare, so a schema omitting it on a richtext field puts a block leaf in
|
|
@@ -170,6 +167,11 @@
|
|
|
170
167
|
.qm-prose-block:not(.qm-control-box) {
|
|
171
168
|
font-size: var(--_qm-text-paper);
|
|
172
169
|
}
|
|
170
|
+
/* Paper's margin, which a field has none of. On the editable, so a press in the strip
|
|
171
|
+
lands a caret; carried by the card's inset it would be dead width. */
|
|
172
|
+
.qm-prose-block:not(.qm-control-box) :global(.ProseMirror) {
|
|
173
|
+
padding-inline: var(--_qm-space-2);
|
|
174
|
+
}
|
|
173
175
|
/* The caret is the body's focus indicator: a ring around the one surface in a card
|
|
174
176
|
that is paper reads as form chrome. So the contenteditable's own outline is dropped
|
|
175
177
|
everywhere, and a boxed leaf takes the shared ring on its wrapper instead
|
|
@@ -28,8 +28,7 @@ interface Props {
|
|
|
28
28
|
/** Ghost shown on the empty leaf: an inline leaf's resolved `default:` or
|
|
29
29
|
* nothing, a body's always text (`resolveBodyGhost`). */
|
|
30
30
|
placeholder?: string;
|
|
31
|
-
/**
|
|
32
|
-
* visible as one. */
|
|
31
|
+
/** Registry identity, stamped on the DOM node so a remount is visible as one. */
|
|
33
32
|
leafKey: string;
|
|
34
33
|
onFocus?: (addr: Addr) => void;
|
|
35
34
|
onCaretMove?: (addr: Addr, pos: number) => void;
|
|
@@ -81,13 +81,11 @@
|
|
|
81
81
|
{/each}
|
|
82
82
|
</div>
|
|
83
83
|
{/if}
|
|
84
|
-
<!-- One button, and its action is where the cursor stands: the set is walked,
|
|
85
|
-
and its end is the exit. -->
|
|
86
84
|
<button type="button" class="qm-icon-btn qm-tips-action" onclick={advance}>
|
|
87
85
|
{#if isLast}
|
|
88
|
-
{t.strings.tipsDismiss} <Icon name="
|
|
86
|
+
{t.strings.tipsDismiss} <Icon name="trash-2" size={GLYPH} />
|
|
89
87
|
{:else}
|
|
90
|
-
{t.strings.tipsNext} <Icon name="
|
|
88
|
+
{t.strings.tipsNext} <Icon name="arrow-right" size={GLYPH} />
|
|
91
89
|
{/if}
|
|
92
90
|
</button>
|
|
93
91
|
</div>
|
|
@@ -97,44 +95,45 @@
|
|
|
97
95
|
/* Attached to `main`, not a block beside it: a square top pulled up by the radius,
|
|
98
96
|
so its background fills the notches `main`'s rounded bottom corners cut and `main`
|
|
99
97
|
paints over the rest. The two read as one block, which is what document-level
|
|
100
|
-
guidance is: the main card's, not a card of its own. Still in-flow, no
|
|
101
|
-
lift.
|
|
98
|
+
guidance is: the main card's, not a card of its own. Still in-flow, no lift.
|
|
102
99
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
the surface and the ink the consumer already tuned, so the card cannot end up less
|
|
107
|
-
legible than the editor around it.
|
|
100
|
+
It takes the card's hairline, and the tuck makes the two outlines one: the slip's top
|
|
101
|
+
stroke and the tops of its sides run under `main`, so what shows starts at the card's
|
|
102
|
+
bottom corners.
|
|
108
103
|
|
|
109
|
-
The
|
|
110
|
-
the
|
|
104
|
+
The bottom corners take the inner rung where the card above takes the outer: a slip
|
|
105
|
+
is cut crisper than the thing it is tucked under, at every setting of the dial.
|
|
111
106
|
|
|
112
|
-
The
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
The insets are asymmetric so the ink is not: the top takes the tuck back, and the
|
|
108
|
+
bottom gives up a rung to the foot's control, whose box stands on the tap floor
|
|
109
|
+
rather than on its own one-line label. The horizontal is the card's inset plus the
|
|
110
|
+
body's margin (ProseField), so the tip starts under the prose rather than under the
|
|
111
|
+
fields. */
|
|
115
112
|
.qm-tips {
|
|
116
113
|
margin-top: calc(var(--_qm-radius) * -1);
|
|
117
|
-
border
|
|
118
|
-
|
|
114
|
+
border: var(--_qm-border-width) solid var(--_qm-border);
|
|
115
|
+
border-radius: 0 0 var(--_qm-radius-inner) var(--_qm-radius-inner);
|
|
116
|
+
padding: calc(var(--_qm-space-3) + var(--_qm-radius)) var(--_qm-space-5) var(--_qm-space-2);
|
|
119
117
|
background: var(--_qm-tips-surface);
|
|
120
118
|
display: flex;
|
|
121
119
|
flex-direction: column;
|
|
122
120
|
gap: var(--_qm-space-2);
|
|
123
|
-
font-family: var(--_qm-font
|
|
121
|
+
font-family: var(--_qm-tips-font);
|
|
124
122
|
font-size: var(--_qm-text-body);
|
|
125
123
|
line-height: var(--_qm-leading-body);
|
|
126
124
|
color: var(--_qm-tips-ink);
|
|
127
125
|
}
|
|
126
|
+
/* One line held open, so the foot does not step up under a shorter tip. */
|
|
127
|
+
.qm-tips-body {
|
|
128
|
+
min-height: calc(var(--_qm-leading-body) * 1em);
|
|
129
|
+
}
|
|
128
130
|
/* The rendered tip is injected DOM (the codec's `toDOM` output), so its element
|
|
129
131
|
styles are `:global`: the compiler never sees these tags in the markup. Restated
|
|
130
132
|
from `core/codec/prose.css`, which is where they are argued and which cannot reach
|
|
131
|
-
here: its selectors are scoped to `.ProseMirror` and a tip is not a view.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
already the card's own and a token like `- ` has nothing else to set it apart.
|
|
136
|
-
`pre-wrap` is what keeps the significant space inside such a token: collapsed, the
|
|
137
|
-
chip closes on the word after it. */
|
|
133
|
+
here: its selectors are scoped to `.ProseMirror` and a tip is not a view. The one
|
|
134
|
+
divergence: `code` takes a chip and a warmer ink where a leaf gives it a face, the
|
|
135
|
+
face here being the card's own already. `pre-wrap` keeps the significant space
|
|
136
|
+
inside a token like `- `; collapsed, the chip closes on the word after it. */
|
|
138
137
|
.qm-tips-body :global(p) {
|
|
139
138
|
margin: 0;
|
|
140
139
|
}
|
|
@@ -142,12 +141,14 @@
|
|
|
142
141
|
font-family: inherit;
|
|
143
142
|
font-size: inherit;
|
|
144
143
|
white-space: pre-wrap;
|
|
145
|
-
padding: 0 var(--_qm-space
|
|
144
|
+
padding: 0 var(--_qm-space);
|
|
146
145
|
border-radius: var(--_qm-radius-inner);
|
|
147
|
-
background: var(--_qm-tips-
|
|
146
|
+
background: var(--_qm-tips-fill);
|
|
147
|
+
color: var(--_qm-tips-ink-warm);
|
|
148
148
|
}
|
|
149
149
|
.qm-tips-body :global(a) {
|
|
150
150
|
color: inherit;
|
|
151
|
+
text-decoration: underline;
|
|
151
152
|
}
|
|
152
153
|
.qm-tips-foot {
|
|
153
154
|
display: flex;
|
|
@@ -158,49 +159,51 @@
|
|
|
158
159
|
.qm-tips-dots {
|
|
159
160
|
display: flex;
|
|
160
161
|
align-items: center;
|
|
162
|
+
gap: var(--_qm-space-half);
|
|
161
163
|
margin-right: auto;
|
|
162
164
|
}
|
|
163
|
-
/* Random access to the set,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
/* Random access to the set, drawn as one cluster: a row of marks spaced to the tap
|
|
166
|
+
floor reads as a row of controls. So the target is the mark plus its padding, under
|
|
167
|
+
the floor, which 2.5.8 allows on the equivalent-control exception rather than on
|
|
168
|
+
the spacing one — the foot's button clears the floor and walks the whole set from
|
|
169
|
+
the tip the card opens on, so no tip is reachable only by a dot. State is three
|
|
170
|
+
steps of one ink on the recede ladder, never a second hue and never a size: a dot
|
|
171
|
+
that grew would move the row it sits in. */
|
|
169
172
|
.qm-tips-dot {
|
|
170
|
-
|
|
171
|
-
align-items: center;
|
|
172
|
-
justify-content: center;
|
|
173
|
-
box-sizing: border-box;
|
|
174
|
-
min-width: var(--_qm-tap-min);
|
|
175
|
-
min-height: var(--_qm-tap-min);
|
|
176
|
-
border: none;
|
|
177
|
-
background: transparent;
|
|
178
|
-
cursor: pointer;
|
|
179
|
-
}
|
|
180
|
-
/* Three steps of one ink on the recede ladder (rest, hover, current), never a
|
|
181
|
-
second hue and never a size: a dot that grew would move the row it sits in. */
|
|
182
|
-
.qm-tips-dot::before {
|
|
183
|
-
content: '';
|
|
173
|
+
box-sizing: content-box;
|
|
184
174
|
width: 5px;
|
|
185
175
|
height: 5px;
|
|
176
|
+
padding: var(--_qm-space-half);
|
|
177
|
+
border: none;
|
|
186
178
|
border-radius: var(--_qm-radius-pill);
|
|
187
179
|
background: currentColor;
|
|
180
|
+
background-clip: content-box;
|
|
188
181
|
opacity: var(--_qm-opacity-idle);
|
|
182
|
+
cursor: pointer;
|
|
189
183
|
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
190
184
|
}
|
|
191
|
-
.qm-tips-dot:hover
|
|
185
|
+
.qm-tips-dot:hover {
|
|
192
186
|
opacity: var(--_qm-opacity-muted);
|
|
193
187
|
}
|
|
194
|
-
.qm-tips-dot[aria-current='true']
|
|
188
|
+
.qm-tips-dot[aria-current='true'] {
|
|
195
189
|
opacity: 1;
|
|
196
190
|
}
|
|
197
|
-
/* Box and disabled state come from `.qm-icon-btn` (controls.css);
|
|
198
|
-
|
|
199
|
-
|
|
191
|
+
/* Box and disabled state come from `.qm-icon-btn` (controls.css); what this
|
|
192
|
+
overrides is everything the family sets for a glyph among callers of its own
|
|
193
|
+
colour, a labelled control on a warm card wanting none of it. The hover included:
|
|
194
|
+
the family's neutral step would read as lent from the document above. Unlayered,
|
|
195
|
+
so it beats the base rule without out-specifying it. */
|
|
200
196
|
.qm-tips-action {
|
|
201
197
|
padding: var(--_qm-space-half) var(--_qm-space-2);
|
|
202
198
|
font-family: inherit;
|
|
203
199
|
font-size: inherit;
|
|
204
200
|
color: inherit;
|
|
201
|
+
transition:
|
|
202
|
+
color var(--_qm-duration-fast) var(--_qm-ease-reverse),
|
|
203
|
+
background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
204
|
+
}
|
|
205
|
+
.qm-tips-action:hover {
|
|
206
|
+
color: var(--_qm-tips-ink-warm);
|
|
207
|
+
background: var(--_qm-tips-fill);
|
|
205
208
|
}
|
|
206
209
|
</style>
|