@quillmark/svelte 0.0.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/LICENSE +201 -0
- package/NOTICE +58 -0
- package/README.md +241 -0
- package/THEMING.md +153 -0
- package/dist/core/address.d.ts +56 -0
- package/dist/core/address.js +95 -0
- package/dist/core/bloom.d.ts +37 -0
- package/dist/core/bloom.js +116 -0
- package/dist/core/codec/anchor.d.ts +19 -0
- package/dist/core/codec/anchor.js +36 -0
- package/dist/core/codec/code.d.ts +12 -0
- package/dist/core/codec/code.js +118 -0
- package/dist/core/codec/decode.d.ts +24 -0
- package/dist/core/codec/decode.js +270 -0
- package/dist/core/codec/encode.d.ts +71 -0
- package/dist/core/codec/encode.js +480 -0
- package/dist/core/codec/field.d.ts +171 -0
- package/dist/core/codec/field.js +493 -0
- package/dist/core/codec/index.d.ts +22 -0
- package/dist/core/codec/index.js +43 -0
- package/dist/core/codec/inputrules.d.ts +7 -0
- package/dist/core/codec/inputrules.js +168 -0
- package/dist/core/codec/islands.d.ts +36 -0
- package/dist/core/codec/islands.js +82 -0
- package/dist/core/codec/keymap.d.ts +13 -0
- package/dist/core/codec/keymap.js +29 -0
- package/dist/core/codec/lists.d.ts +22 -0
- package/dist/core/codec/lists.js +104 -0
- package/dist/core/codec/marks.d.ts +37 -0
- package/dist/core/codec/marks.js +74 -0
- package/dist/core/codec/positions.d.ts +17 -0
- package/dist/core/codec/positions.js +108 -0
- package/dist/core/codec/prose.css +458 -0
- package/dist/core/codec/reconcile.d.ts +26 -0
- package/dist/core/codec/reconcile.js +64 -0
- package/dist/core/codec/schema.d.ts +13 -0
- package/dist/core/codec/schema.js +155 -0
- package/dist/core/codec/slash.d.ts +79 -0
- package/dist/core/codec/slash.js +0 -0
- package/dist/core/codec/table-view.d.ts +50 -0
- package/dist/core/codec/table-view.js +928 -0
- package/dist/core/codec/table.d.ts +85 -0
- package/dist/core/codec/table.js +224 -0
- package/dist/core/errors.d.ts +73 -0
- package/dist/core/errors.js +24 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +19 -0
- package/dist/core/lifecycle.d.ts +7 -0
- package/dist/core/lifecycle.js +21 -0
- package/dist/core/rebind.svelte.d.ts +18 -0
- package/dist/core/rebind.svelte.js +44 -0
- package/dist/core/teardown.d.ts +20 -0
- package/dist/core/teardown.js +37 -0
- package/dist/core/theme.css +276 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -0
- package/dist/preset/index.css +10 -0
- package/dist/preset/recipes.css +188 -0
- package/dist/preset/scale.css +97 -0
- package/dist/preview/Preview.svelte +118 -0
- package/dist/preview/Preview.svelte.d.ts +39 -0
- package/dist/preview/bridge.d.ts +13 -0
- package/dist/preview/bridge.js +88 -0
- package/dist/preview/controller.d.ts +40 -0
- package/dist/preview/controller.js +141 -0
- package/dist/preview/geometry.d.ts +37 -0
- package/dist/preview/geometry.js +45 -0
- package/dist/preview/index.d.ts +5 -0
- package/dist/preview/index.js +14 -0
- package/dist/preview/overlay.d.ts +10 -0
- package/dist/preview/overlay.js +82 -0
- package/dist/preview/paint.d.ts +17 -0
- package/dist/preview/paint.js +262 -0
- package/dist/preview/strings.d.ts +14 -0
- package/dist/preview/strings.js +22 -0
- package/dist/visual/ArrayField.svelte +362 -0
- package/dist/visual/ArrayField.svelte.d.ts +24 -0
- package/dist/visual/BooleanField.svelte +88 -0
- package/dist/visual/BooleanField.svelte.d.ts +20 -0
- package/dist/visual/Card.svelte +849 -0
- package/dist/visual/Card.svelte.d.ts +43 -0
- package/dist/visual/CardControls.svelte +92 -0
- package/dist/visual/CardControls.svelte.d.ts +11 -0
- package/dist/visual/DateField.svelte +203 -0
- package/dist/visual/DateField.svelte.d.ts +28 -0
- package/dist/visual/DiagnosticList.svelte +50 -0
- package/dist/visual/DiagnosticList.svelte.d.ts +7 -0
- package/dist/visual/EnumField.svelte +169 -0
- package/dist/visual/EnumField.svelte.d.ts +25 -0
- package/dist/visual/Field.svelte +270 -0
- package/dist/visual/Field.svelte.d.ts +37 -0
- package/dist/visual/FieldHint.svelte +185 -0
- package/dist/visual/FieldHint.svelte.d.ts +13 -0
- package/dist/visual/FieldLabel.svelte +141 -0
- package/dist/visual/FieldLabel.svelte.d.ts +19 -0
- package/dist/visual/FormatPopover.svelte +396 -0
- package/dist/visual/FormatPopover.svelte.d.ts +9 -0
- package/dist/visual/NumberField.svelte +72 -0
- package/dist/visual/NumberField.svelte.d.ts +19 -0
- package/dist/visual/ObjectField.svelte +131 -0
- package/dist/visual/ObjectField.svelte.d.ts +17 -0
- package/dist/visual/ProseArrayElement.svelte +98 -0
- package/dist/visual/ProseArrayElement.svelte.d.ts +19 -0
- package/dist/visual/ProseField.svelte +213 -0
- package/dist/visual/ProseField.svelte.d.ts +50 -0
- package/dist/visual/SlashMenu.svelte +126 -0
- package/dist/visual/SlashMenu.svelte.d.ts +14 -0
- package/dist/visual/TextField.svelte +63 -0
- package/dist/visual/TextField.svelte.d.ts +23 -0
- package/dist/visual/TipsCard.svelte +191 -0
- package/dist/visual/TipsCard.svelte.d.ts +13 -0
- package/dist/visual/VisualEditor.svelte +96 -0
- package/dist/visual/VisualEditor.svelte.d.ts +14 -0
- package/dist/visual/VisualEditorInner.svelte +1032 -0
- package/dist/visual/VisualEditorInner.svelte.d.ts +17 -0
- package/dist/visual/controls.css +272 -0
- package/dist/visual/diagnostics.d.ts +52 -0
- package/dist/visual/diagnostics.js +83 -0
- package/dist/visual/domid.d.ts +21 -0
- package/dist/visual/domid.js +36 -0
- package/dist/visual/ext.d.ts +19 -0
- package/dist/visual/ext.js +29 -0
- package/dist/visual/icons/Icon.svelte +39 -0
- package/dist/visual/icons/Icon.svelte.d.ts +12 -0
- package/dist/visual/icons/nodes.d.ts +103 -0
- package/dist/visual/icons/nodes.js +55 -0
- package/dist/visual/index.d.ts +9 -0
- package/dist/visual/index.js +24 -0
- package/dist/visual/motion.d.ts +18 -0
- package/dist/visual/motion.js +53 -0
- package/dist/visual/props.d.ts +77 -0
- package/dist/visual/props.js +1 -0
- package/dist/visual/signals.d.ts +59 -0
- package/dist/visual/signals.js +1 -0
- package/dist/visual/strings.d.ts +123 -0
- package/dist/visual/strings.js +80 -0
- package/dist/visual/structure.d.ts +224 -0
- package/dist/visual/structure.js +270 -0
- package/dist/visual/synced.svelte.d.ts +15 -0
- package/dist/visual/synced.svelte.js +34 -0
- package/dist/visual/tips.d.ts +24 -0
- package/dist/visual/tips.js +50 -0
- package/package.json +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Quillmark
|
|
2
|
+
Copyright 2026 Nibs
|
|
3
|
+
|
|
4
|
+
--------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
This package contains SVG glyph geometry derived from Lucide, carried in source
|
|
7
|
+
rather than installed.
|
|
8
|
+
|
|
9
|
+
`visual/icons/nodes.ts` holds thirteen verbatim from @lucide/svelte 1.28.0:
|
|
10
|
+
chevron-right, chevron-down, chevron-up, bold, italic, underline, strikethrough,
|
|
11
|
+
code, link, hash, info, plus and x.
|
|
12
|
+
|
|
13
|
+
`core/codec/table-view.ts` holds a plus and four text-alignment glyphs derived
|
|
14
|
+
from an earlier release of the same project.
|
|
15
|
+
|
|
16
|
+
ISC License
|
|
17
|
+
|
|
18
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
19
|
+
|
|
20
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
21
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
22
|
+
copyright notice and this permission notice appear in all copies.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
25
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
26
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
27
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
28
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
29
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
30
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
|
|
32
|
+
--------------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
Ten of those glyphs — chevron-down, chevron-right, chevron-up, code, hash, info,
|
|
35
|
+
italic, link, plus and x — are derived from the Feather project and carry its
|
|
36
|
+
license as well.
|
|
37
|
+
|
|
38
|
+
The MIT License (MIT)
|
|
39
|
+
|
|
40
|
+
Copyright (c) 2013-present Cole Bemis
|
|
41
|
+
|
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
43
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
44
|
+
in the Software without restriction, including without limitation the rights
|
|
45
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
46
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
47
|
+
furnished to do so, subject to the following conditions:
|
|
48
|
+
|
|
49
|
+
The above copyright notice and this permission notice shall be included in all
|
|
50
|
+
copies or substantial portions of the Software.
|
|
51
|
+
|
|
52
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
54
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
55
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
56
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
57
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
58
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# @quillmark/svelte
|
|
2
|
+
|
|
3
|
+
Editor + live-preview components for [Quillmark](https://github.com/borb-sh/quillmark) WASM consumers. A WYSIWYG **VisualEditor**, and a canvas **Preview** that paints the compiled document and round-trips clicks to the editor, over one `@quillmark/wasm` session. Vanilla-TS cores with thin Svelte 5 wrappers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @quillmark/svelte
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`svelte@^5` and `@quillmark/wasm` are peer dependencies: the session's handles cross the package boundary, so the consumer supplies the one copy both sides mint them from.
|
|
12
|
+
|
|
13
|
+
## Subpaths
|
|
14
|
+
|
|
15
|
+
Each subpath is its own module root; a bundler pulls only what the entry you import reaches.
|
|
16
|
+
|
|
17
|
+
| Import | Surface |
|
|
18
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `@quillmark/svelte/core` | What the surfaces share: the `DocPath`/`Place` address vocabulary, the `EditorError` channel, `init`. Framework-free. |
|
|
20
|
+
| `@quillmark/svelte/preview` | The live preview: `createPreview` + `<Preview>`. Reaches nothing editor-side. |
|
|
21
|
+
| `@quillmark/svelte/visual` | The federated WYSIWYG: `<VisualEditor>`, the codec's `createField` prose leaf. |
|
|
22
|
+
| `@quillmark/svelte` | Re-exports `/core`. |
|
|
23
|
+
|
|
24
|
+
## Open a session
|
|
25
|
+
|
|
26
|
+
The **consumer** owns the session and the handles, and drives every edit; the surfaces are views over it. The handles come from the `@quillmark/wasm` peer, never re-exported here.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { Document, Engine, Quill } from '@quillmark/wasm';
|
|
30
|
+
import { init } from '@quillmark/svelte/core';
|
|
31
|
+
|
|
32
|
+
init(); // one-time WASM panic-hook install
|
|
33
|
+
|
|
34
|
+
const quill = Quill.fromTree(tree); // tree: Map<string, Uint8Array> of the quill dir
|
|
35
|
+
|
|
36
|
+
// A NEW document: seeded from the quill's blueprint.
|
|
37
|
+
const doc = quill.seedDocument();
|
|
38
|
+
|
|
39
|
+
// An EXISTING document: parsed back from what you stored.
|
|
40
|
+
const doc = Document.fromMarkdown(markdown); // canonical Quillmark markdown
|
|
41
|
+
const doc = Document.fromJson(json); // the versioned storage DTO (`doc.toJson()`)
|
|
42
|
+
|
|
43
|
+
const session = await new Engine().open(quill, doc);
|
|
44
|
+
// free() on teardown the handles you MINTED: this quill, this doc, this session.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## The quill resolves from the document
|
|
48
|
+
|
|
49
|
+
A stored document carries none of its quill's bytes, only a reference: `doc.quillRef` is `name@version`, persisted in the markdown itself. Resolution is **host code**: read the ref, map it to a `Quill`, open. No surface resolves, so one resolution per document holds by construction.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const doc = Document.fromMarkdown(stored);
|
|
53
|
+
const quill = await registry.getQuill(doc.quillRef); // your ref → Quill mapping
|
|
54
|
+
const session = await new Engine().open(quill, doc);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`@quillmark/quiver` is one such registry, and the quill it hands back is **borrowed**: it is cached per ref and shared with every caller, so freeing it strands the next one.
|
|
58
|
+
|
|
59
|
+
Opening a document that names a **different** quill is the same sequence, in order: resolve the new ref, `engine.open(quill, next)`, swap the props, then free the replaced handles that were yours to free. `<VisualEditor>` re-keys itself on the new `doc` (see below); `<Preview>` swaps by remount (`{#key session}`).
|
|
60
|
+
|
|
61
|
+
## Preview
|
|
62
|
+
|
|
63
|
+
`createPreview` supplies the layer the session omits: viewport, DOM, DPR, click mapping. It is a pure view: it never calls `session.apply`; you drive the edit and hand it the resulting `ChangeSet`.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { createPreview } from '@quillmark/svelte/preview';
|
|
67
|
+
|
|
68
|
+
const preview = createPreview(session, {
|
|
69
|
+
container: document.querySelector('#preview')!,
|
|
70
|
+
onCaretPick: (hit) => {
|
|
71
|
+
/* a click resolved to a content position; see the bridge below */
|
|
72
|
+
},
|
|
73
|
+
onError: (err) => {
|
|
74
|
+
/* a page paint the backend refused; the preview shows its error state either way */
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// after an edit lands on `doc`, from any source:
|
|
79
|
+
preview.refresh(session.update(doc)); // repaint dirtyPages ∩ visible
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
In Svelte, `<Preview {session} onCaretPick={…} />` exposes the same verbs (`refresh`, `scrollToField`, `focusPosition`, `setZoom`) via `bind:this`.
|
|
83
|
+
|
|
84
|
+
`<Preview>` binds **once**, at mount: swapping `session`, `margin`, `overlays`, `onCaretPick`, `onError` or `strings` in place changes nothing on screen and reports `rebind-ignored` through `onError` at `dev` severity, naming the prop. Swap by remounting (`{#key session}`); drive in-place edits through `refresh(change)`. `class` and `style` are the exceptions, landing on the root element and staying live.
|
|
85
|
+
|
|
86
|
+
## Visual editor
|
|
87
|
+
|
|
88
|
+
`<VisualEditor>` is a federated composition of many small editors over one document: each content leaf a ProseMirror prose surface, each scalar a form control, cards the editor's own. It commits directly to the `doc` handle.
|
|
89
|
+
|
|
90
|
+
```svelte
|
|
91
|
+
<script lang="ts">
|
|
92
|
+
import { VisualEditor } from '@quillmark/svelte/visual';
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<VisualEditor
|
|
96
|
+
{doc}
|
|
97
|
+
{quill}
|
|
98
|
+
onChange={(change) => {
|
|
99
|
+
/* an edit LANDED; `change.source` is 'prose' | 'field' | 'structure' */
|
|
100
|
+
}}
|
|
101
|
+
onActiveLeafChange={(active) => {
|
|
102
|
+
/* the active leaf: `active.field` (a DocPath), and `active.cardId` for its card */
|
|
103
|
+
}}
|
|
104
|
+
onCaretMove={(at) => {
|
|
105
|
+
/* the caret moved to `at.field` (a DocPath) at `at.pos` (USV) */
|
|
106
|
+
}}
|
|
107
|
+
onError={(err) => {
|
|
108
|
+
/* a failure the editor recovered from; editing continues */
|
|
109
|
+
}}
|
|
110
|
+
diagnostics={external}
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Hand it a different `doc` and the editor **re-keys itself**: every leaf remounts against the new handle, and the id state, the commit-error map and the active address seed fresh. Nothing to key at the call site. `quill` is not part of that key — the schema is re-read on every derive, so a quill swap re-projects on its own; swapping it _without_ the doc reports `rebind-ignored`.
|
|
115
|
+
|
|
116
|
+
### Driving it from outside
|
|
117
|
+
|
|
118
|
+
`bind:this` reaches the same verbs the card header calls, so a toolbar, command palette or shortcut needs no second path into the document. Every one reports through `onChange` exactly as the click does.
|
|
119
|
+
|
|
120
|
+
```svelte
|
|
121
|
+
<script lang="ts">
|
|
122
|
+
let editor: ReturnType<typeof VisualEditor> | undefined = $state();
|
|
123
|
+
let activeCard = $state<string | undefined>();
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<VisualEditor
|
|
127
|
+
bind:this={editor}
|
|
128
|
+
{doc}
|
|
129
|
+
{quill}
|
|
130
|
+
onActiveLeafChange={(a) => (activeCard = a.cardId)}
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
<button onclick={() => editor?.insertCard('indorsement')}>Add indorsement</button>
|
|
134
|
+
<button onclick={() => activeCard && editor?.moveCard(activeCard, -1)}>Move up</button>
|
|
135
|
+
<button onclick={() => editor?.focusField('main.subject')}>Jump to subject</button>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`insertCard` hands back the new card's `cardId`; `removeCard`, `moveCard` and `setKind` take one. A card key or a path the surface does not hold is a no-op that reports `target-unknown` through `onError` at `dev` severity.
|
|
139
|
+
|
|
140
|
+
### Wording
|
|
141
|
+
|
|
142
|
+
The package ships English and a seam to replace it. `strings` is keyed and **partial**: set what you have translations for, and the rest stay the package's. Several keys are **accessible names** rather than decoration (the card controls, the add trigger, the required marker), so an untranslated surface reads the wrong language to a screen reader. `DEFAULT_VISUAL_STRINGS` is the English, exported so you can compose against it. `<Preview>` takes its own three-key `strings` for the states it shows when there is nothing to paint.
|
|
143
|
+
|
|
144
|
+
```svelte
|
|
145
|
+
<VisualEditor
|
|
146
|
+
{doc}
|
|
147
|
+
{quill}
|
|
148
|
+
strings={{
|
|
149
|
+
cardDelete: 'Supprimer la carte',
|
|
150
|
+
addCardOfKind: (kind) => `Ajouter : ${kind}`
|
|
151
|
+
}}
|
|
152
|
+
formatDiagnostic={(d) =>
|
|
153
|
+
d.code === 'validation::must_fill' ? `${d.path} est obligatoire` : undefined}
|
|
154
|
+
/>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`formatDiagnostic` gets the whole `Diagnostic` and returns `undefined` to take its own message. Validation and edit diagnostics re-word from `code`, `path` and `args`; parse errors and render warnings carry their detail inside English text and stand as they are ([VISUAL_EDITOR.md](prose/canon/VISUAL_EDITOR.md)).
|
|
158
|
+
|
|
159
|
+
### Recompiling
|
|
160
|
+
|
|
161
|
+
`onChange` is the signal to recompile, and it covers **all three lanes**: a prose keystroke, a scalar write, a card operation. `onCaretMove` is a _selection_ signal, not a change signal: it fires on a bare arrow key, so a recompile hung off it recompiles on every one.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
165
|
+
|
|
166
|
+
onChange: (change) => {
|
|
167
|
+
// a structure op happens once per gesture, so it applies at once;
|
|
168
|
+
// prose and field edits arrive per keystroke, so they debounce.
|
|
169
|
+
if (change.source === 'structure') recompileNow();
|
|
170
|
+
else {
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
timer = setTimeout(recompileNow, 120);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
function recompileNow() {
|
|
177
|
+
timer = undefined;
|
|
178
|
+
const change = session.update(doc);
|
|
179
|
+
preview.refresh(change);
|
|
180
|
+
source.refresh();
|
|
181
|
+
diagnostics = [...session.warnings]; // → the editor's `diagnostics` prop
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`session.warnings` is a **getter on a handle Svelte does not track**: pull it per apply, or the editor shows the previous compile's diagnostics.
|
|
186
|
+
|
|
187
|
+
This shell layer is deliberately yours: the debounce value, what applies at once, and which surfaces refresh are host policy, so the package ships no scheduler over them. Three obligations ride with that: an edit of your own (an import, an undo, a direct `doc` write) recompiles by the same calls, since nothing polls the document; a compile owes the diagnostics re-read above, since nothing polls the session; and teardown clears the timer **before** freeing the handles, so a pending recompile never touches a freed session.
|
|
188
|
+
|
|
189
|
+
## The caret bridge
|
|
190
|
+
|
|
191
|
+
The bridge lives at the **consumer** layer and is opt-in; the editor is unaware of the preview, the preview unaware of the editor. Both hops are pass-throughs: the two surfaces already speak one address grammar, the canonical `DocPath`.
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// preview → editor: a click resolved to a content position places the caret.
|
|
195
|
+
onCaretPick: (hit) => visualEditor.setCaret(hit);
|
|
196
|
+
|
|
197
|
+
// editor → preview: a caret move scrolls the preview to follow it.
|
|
198
|
+
onCaretMove: preview.focusPosition;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
A consumer holding an `Addr` of its own maps it with `fieldPathForAddr` (from `@quillmark/svelte/core`). The playground app's split-pane route is the full reference shell: one session, both bridge directions, the preview following edits, and diagnostics routed inline.
|
|
202
|
+
|
|
203
|
+
## Errors
|
|
204
|
+
|
|
205
|
+
Every surface takes `onError`. It reports failures the surface **recovered from**: a commit the boundary refused, a card operation that threw, a page paint that failed, a serialize that threw. None of them stop editing. Wire nothing and each lands in the console, which an app cannot route, filter or count.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
onError: (err) => {
|
|
209
|
+
// err.code: 'commit-refused' | 'paint-failed' | … (see EditorErrorCode)
|
|
210
|
+
// err.severity: 'error' (runtime) | 'dev' (a contract violation)
|
|
211
|
+
// err.cause: whatever was thrown, unwrapped
|
|
212
|
+
if (err.severity === 'error') telemetry.capture(err);
|
|
213
|
+
};
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
This is not the diagnostics channel. A `Diagnostic` is about the **document** and draws on the field it belongs to; an `EditorError` is about the **surface** and draws nowhere. A refused scalar commit produces both.
|
|
217
|
+
|
|
218
|
+
## Canonical markdown
|
|
219
|
+
|
|
220
|
+
`doc.toMarkdown()` returns the document's canonical Quillmark markdown, which re-parses to an equal `Document`. A read-only mirror is that call in a `<pre>`, re-run after each edit lands, so it needs no surface from this package:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
el.textContent = doc.toMarkdown();
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The playground's debug drawer is the worked version, holding scroll across the swap and showing a throw in place: `packages/playground/src/routes/playground/SourceMirror.svelte`.
|
|
227
|
+
|
|
228
|
+
## Theming
|
|
229
|
+
|
|
230
|
+
The surfaces carry the behavior against a neutral, overridable visual baseline: a set of `--qm-*` CSS custom properties you override on any ancestor. See [`THEMING.md`](THEMING.md).
|
|
231
|
+
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
This package is one workspace of [`quillmark-js`](../..); the gates are the root's, and the settled architecture lives in [`prose/`](prose/).
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
npm run build -w packages/svelte # svelte-package → dist/
|
|
238
|
+
npm run test -w packages/svelte # Vitest (codec, diagnostics, geometry, chain)
|
|
239
|
+
npm run check -w packages/svelte # svelte-check
|
|
240
|
+
npm run dev # the playground, from the root
|
|
241
|
+
```
|
package/THEMING.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Theming
|
|
2
|
+
|
|
3
|
+
`@quillmark/svelte` ships complex UX over a thin skin: the surfaces carry the behavior (direct manipulation, the caret bridge, per-field state) against a neutral visual baseline a consumer restyles to its brand without fighting baked-in design.
|
|
4
|
+
|
|
5
|
+
There are three depths to that, and most apps stop at the first:
|
|
6
|
+
|
|
7
|
+
| | You write | You get |
|
|
8
|
+
| ----------------- | --------------------- | ------------------------------------------------------- |
|
|
9
|
+
| **Drop it in** | nothing | a mounted surface that looks right in a bare `<div>` |
|
|
10
|
+
| **Make it yours** | ten custom properties | the whole surface rescaled and recolored to your brand |
|
|
11
|
+
| **Match ours** | one CSS import | the page around the surface, drawn the way we draw ours |
|
|
12
|
+
|
|
13
|
+
## Drop it in
|
|
14
|
+
|
|
15
|
+
```svelte
|
|
16
|
+
<VisualEditor {doc} {quill} />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Nothing to import and nothing to set. The package pulls its own stylesheet, and each surface owns its whole **column**, not only the cards in it: the gutter the stack sits in, the tone behind it, and (for the preview) the desk the painted sheet floats on. A bare `<div>` is a mounting site.
|
|
20
|
+
|
|
21
|
+
**Mounting into a fixed-height pane**: pass `class="qm-pane"`. The surface becomes its own scroll container and takes a scroll tail, so the last card can be read at the middle of your pane rather than against its bottom edge. Without it the editor grows to its content and your page scrolls, which is what you want when the editor _is_ the page. The preview always scrolls: a viewport onto a document has nothing else to be.
|
|
22
|
+
|
|
23
|
+
`.qm-pane` is opt-in on the editor rather than the default because the editor is what its own popovers portal into, and a scroll container clips them. In a pane you would have had that clipping from your own scrolling frame anyway; in a page you should not have it at all.
|
|
24
|
+
|
|
25
|
+
**Placing and sizing**: each surface carries a stable root class (`.qm-editor`, `.qm-preview`), so you can place it from your own stylesheet without a wrapper. Each also takes a `class` prop that merges onto the same element, which is the better handle when you have one to give.
|
|
26
|
+
|
|
27
|
+
**Taking the column back**: your CSS is unlayered and ours is not (below), so `padding: 0` or a `background` of your own on `.qm-editor` wins outright. Nothing is locked.
|
|
28
|
+
|
|
29
|
+
## Make it yours
|
|
30
|
+
|
|
31
|
+
The whole contract is **ten CSS custom properties**. They are dials, not a palette: each derives a closed private scale that every component reads, so one override rescales or recolors the whole surface. Set them on any ancestor of a mounted surface (the app, or one pane):
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
.my-editor {
|
|
35
|
+
--qm-bg: #fff;
|
|
36
|
+
--qm-fg: #10233b;
|
|
37
|
+
--qm-accent: #6d28d9;
|
|
38
|
+
--qm-font: 'Inter', system-ui, sans-serif;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### The dials
|
|
43
|
+
|
|
44
|
+
| Token | Default | What it sets |
|
|
45
|
+
| ---------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| `--qm-bg` | `#fff` / `#14171c` | Base surface. Cards, fields, the painted page, the popover, and the column behind them step off it. |
|
|
47
|
+
| `--qm-fg` | `#1a1a1a` / `#e8eaed` | Base ink. Body text, labels, and borders step off it. |
|
|
48
|
+
| `--qm-accent` | `#2563eb` | Focus rings, active marks, the preview's active field box. |
|
|
49
|
+
| `--qm-danger` | `#c5221f` | Error diagnostics, the required marker, the delete glyph. |
|
|
50
|
+
| `--qm-warning` | `#b25000` | Warning diagnostics. |
|
|
51
|
+
| `--qm-font` | `ui-sans-serif, system-ui, sans-serif` | The editor surface's font family. Controls and buttons take it too, in place of the UA face. |
|
|
52
|
+
| `--qm-font-mono` | `ui-monospace, monospace` | The monospace face: the JSON array control, the tips card. |
|
|
53
|
+
| `--qm-font-size` | `0.875rem` | Body text: every control's size, and the anchor the ramp derives up (title) and down (label/meta) from. |
|
|
54
|
+
| `--qm-radius` | `8px` | Card & popover corner. Interior controls derive a tighter tier (half). |
|
|
55
|
+
| `--qm-space` | `0.25rem` | Spacing base. Gaps and insets are `half`/`1×`/`2×`/`3×`/`4×` multiples of it. |
|
|
56
|
+
|
|
57
|
+
Give a length dial a length: `--qm-space: 4` is a valid custom property and an invalid length, so it substitutes through every `calc()` that reads it. Where `@property` is supported the surface absorbs that, landing on the package default rather than collapsing the padding to zero.
|
|
58
|
+
|
|
59
|
+
### Your CSS beats ours
|
|
60
|
+
|
|
61
|
+
The surfaces' own rules live in the `qm` cascade layer, so **unlayered CSS of yours beats them outright**, at any specificity and without `!important`. Nothing to declare; this is the case most apps are in.
|
|
62
|
+
|
|
63
|
+
If your app uses cascade layers of its own, layer order decides it, and layer order is first-declaration order across the document — which makes it the bundler's, not yours. Name our layer first in one statement of your own, anywhere in your CSS, and it stops mattering:
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
@layer qm, app;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Declared before our sheet it fixes the order outright; declared after, `qm` is already first and `app` appends behind it. Either way your layer lands after ours and wins. `qm` is the contract; the sub-layers under it (`qm.scale`, `qm.chrome`) are ours to re-cut.
|
|
70
|
+
|
|
71
|
+
### The surface follows your colour scheme
|
|
72
|
+
|
|
73
|
+
Surfaces step `bg → fg` and ink steps `fg → bg`, mixed in **oklab**, so inverting the two poles inverts the whole scale, including borders and the popover's translucent fill.
|
|
74
|
+
|
|
75
|
+
Which way the poles default is **your `color-scheme`**, not the operating system's. Declare the scheme your app is in and the surface lands on it, along with native chrome, which reads the same property:
|
|
76
|
+
|
|
77
|
+
```css
|
|
78
|
+
html {
|
|
79
|
+
color-scheme: light dark; /* follow the OS */
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* A class-driven theme declares the scheme alongside the class. */
|
|
83
|
+
html.dark {
|
|
84
|
+
color-scheme: dark;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Declare nothing and you get light. A dark app that skips this line gets a light editor in a dark page, and light scrollbars, date pickers and carets throughout. (The preset below declares `light dark` for you.)
|
|
89
|
+
|
|
90
|
+
Setting the poles yourself wins over the default in both schemes, so a fixed palette stays fixed:
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
.my-editor {
|
|
94
|
+
--qm-bg: #14171c;
|
|
95
|
+
--qm-fg: #e8eaed;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A palette **pinned against** your own scheme is the one case needing a second line: the surfaces follow your dials, but native chrome follows `color-scheme`, so pin it with them (`.my-editor { color-scheme: dark }`). Skip that line and what the browser paints — the selection highlight, the scrollbar, the spinner — stays on whichever scheme the host inherits.
|
|
100
|
+
|
|
101
|
+
No JS runs and no media query: the derivation resolves through the cascade at paint time, so there is no `dark` prop and no mode toggle. The consumer's palette decides.
|
|
102
|
+
|
|
103
|
+
## Match ours
|
|
104
|
+
|
|
105
|
+
A mounted surface looks right on its own. The page around it (the label over a readout, the status line, the plate your controls sit on) is yours, and if you have a design system it should stay yours. If you do not, take ours:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import '@quillmark/svelte/preset';
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<body class="qm-page">
|
|
113
|
+
<p class="qm-label">quill</p>
|
|
114
|
+
<pre class="qm-readout">usaf_memo@0.2.0</pre>
|
|
115
|
+
</body>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This is the stylesheet our own apps import: the playground and studio draw with these rules and nothing else, so what you get is what we ship, not a reduction of it.
|
|
119
|
+
|
|
120
|
+
It carries a `--qmh-*` scale for the page, derived from the same ten dials and calibrated against the surfaces' own steps, so a plate of yours and a card of ours agree about which way "raised" goes. Turning a dial moves both.
|
|
121
|
+
|
|
122
|
+
| Class | What it is |
|
|
123
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
124
|
+
| `.qm-page` | The page baseline: tone, ink, face, leading, and `color-scheme: light dark`. Put it on `<body>` or the element your app mounts into. |
|
|
125
|
+
| `.qm-panel` | The plate your controls and readouts sit on: one rung off the page, a hairline, a corner. |
|
|
126
|
+
| `.qm-label` | A run of chrome type: a section label, the name over a value. |
|
|
127
|
+
| `.qm-readout` | A value read back out of the session, monospace and tabular. `<pre class="qm-readout">` is the block form. |
|
|
128
|
+
| `.qm-status` | A phase line. `.qm-status-error` and `.qm-status-warn` are the two it fails to. |
|
|
129
|
+
| `.qm-control` | A boxed button or select, which is what a host's controls are and the package's are not. |
|
|
130
|
+
| `.qm-measure` | A reading column at the width a passage wants. |
|
|
131
|
+
|
|
132
|
+
It is **unlayered**, so your own rules beat it by ordinary precedence, exactly as they beat the surfaces. It is also opt-in and side-effect free until imported: nothing that styles your document arrives with a component.
|
|
133
|
+
|
|
134
|
+
One rule in it earns its place regardless of whether you take the rest, and you want it if you draw a focus ring of your own:
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
[data-qm-root] :focus-visible {
|
|
138
|
+
outline: revert-layer;
|
|
139
|
+
outline-offset: revert-layer;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
A blanket `:focus-visible` of yours is unlayered, so it beats `@layer qm.chrome`, including on the controls that already draw a ring. `revert-layer` hands those back to ours and leaves yours everywhere else.
|
|
144
|
+
|
|
145
|
+
## What is deliberately not public
|
|
146
|
+
|
|
147
|
+
The three root classes and `.qm-pane` are the whole class contract on the surfaces. Every other `qm-*` class inside them is internal and renames without notice: a class contract over the interior would freeze the DOM shape the surfaces are free to re-cut, and the dials already reach the values a restyle wants. The preset's classes are a contract of their own: they land on _your_ DOM, so they freeze nothing of ours.
|
|
148
|
+
|
|
149
|
+
The derived surface scale (surface / border / ink rungs, the blur radius, the popover's translucency ratio, the recede-opacity ladder, the two leading rungs, the overlay ring widths, the scroll tail) is internal on the same terms, and declared **on** each root element, so setting a rung from an ancestor does nothing. A dial appears when a real consumer needs one; every dial is one more thing a reader has to hold.
|
|
150
|
+
|
|
151
|
+
## Requirements
|
|
152
|
+
|
|
153
|
+
`@layer`, `color-mix()` and `light-dark()`: Baseline since 2022, 2023 and 2024 respectively. `@property` is the one feature the surface does not require: where it is missing, an invalid length dial collapses the surface rather than falling back.
|