@fileverse-dev/ddoc 5.1.10 → 6.0.0-drop-in.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -18
- package/dist/headless-editor-utils.es.js +3 -3
- package/dist/{index-DtE1zaH8.mjs → index-8MQH4TSF.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +11105 -10860
- package/dist/{markdown-source-pane-CA4cDQyu.mjs → markdown-source-pane-CXO7aIOp.mjs} +1 -1
- package/dist/package/components/editor-navbar.d.ts +12 -0
- package/dist/package/components/editor-toolbar.d.ts +2 -1
- package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
- package/dist/package/components/mobile-toolbar.d.ts +2 -1
- package/dist/package/components/tabs/document-mobile-tab-panel.d.ts +3 -1
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +2 -1
- package/dist/package/components/toc/document-outline.d.ts +1 -1
- package/dist/package/components/toc/toc.d.ts +1 -1
- package/dist/package/components/toc/types.d.ts +7 -0
- package/dist/package/hooks/use-canvas-metrics.d.ts +16 -0
- package/dist/package/hooks/use-controllable-state.d.ts +3 -0
- package/dist/package/hooks/use-editor-media-query.d.ts +4 -0
- package/dist/package/hooks/use-focus-mode.d.ts +1 -3
- package/dist/package/hooks/use-tab-editor.d.ts +4 -1
- package/dist/package/types.d.ts +41 -5
- package/dist/package/use-ddoc-editor.d.ts +3 -1
- package/dist/package/utils/container-query-support.d.ts +1 -0
- package/dist/package/utils/editor-width-store.d.ts +6 -0
- package/dist/package/utils/responsive.d.ts +3 -1
- package/dist/package/utils/stats-publisher.d.ts +8 -0
- package/dist/{split-view-toolbar-8eYCwI8J.mjs → split-view-toolbar-BnfwwwTs.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/{use-headless-editor-tZq6fxul.mjs → use-headless-editor-Buqsz3UI.mjs} +7628 -7612
- package/package.json +1 -1
- package/tailwind.preset.cjs +42 -0
package/package.json
CHANGED
package/tailwind.preset.cjs
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
// This file is the `@fileverse-dev/ddoc/tailwind` preset. It composes the ui preset
|
|
2
2
|
// (dark mode, theme, design-system classes) and adds the `mobile` screen.
|
|
3
|
+
// It also adds the ddoc-* variants (docs/DROP_IN_EDITOR.md §2.9).
|
|
3
4
|
// Consumers: `presets: [require('@fileverse-dev/ddoc/tailwind')]` and add
|
|
4
5
|
// node_modules/@fileverse-dev/ddoc/dist/**/*.{js,mjs} plus
|
|
5
6
|
// node_modules/@fileverse/ui/dist/**/*.{js,mjs} to `content` (the dist is chunked).
|
|
7
|
+
const plugin = require('tailwindcss/plugin');
|
|
8
|
+
|
|
9
|
+
// Same widths as the screens, evaluated against the editor root when the
|
|
10
|
+
// element is inside one and against the window otherwise. :where() keeps the
|
|
11
|
+
// window form at the specificity of a screen variant.
|
|
12
|
+
const DDOC_BREAKPOINTS = { sm: 640, md: 768, mobile: 960, lg: 1024, xl: 1280 };
|
|
13
|
+
|
|
6
14
|
module.exports = {
|
|
7
15
|
presets: [require('@fileverse/ui/tailwind')],
|
|
8
16
|
theme: {
|
|
@@ -12,4 +20,38 @@ module.exports = {
|
|
|
12
20
|
},
|
|
13
21
|
},
|
|
14
22
|
},
|
|
23
|
+
plugins: [
|
|
24
|
+
plugin(({ addVariant, matchVariant }) => {
|
|
25
|
+
const breakpoints = Object.entries(DDOC_BREAKPOINTS);
|
|
26
|
+
// Registration order is CSS order. Like Tailwind's screens: max variants
|
|
27
|
+
// first, widest first, so the narrower one wins; then min, ascending.
|
|
28
|
+
for (const [name, px] of [...breakpoints].reverse()) {
|
|
29
|
+
addVariant(`ddoc-max-${name}`, [
|
|
30
|
+
`@container ddoc-editor (max-width: ${px - 0.02}px)`,
|
|
31
|
+
`@media (max-width: ${px - 0.02}px) { &:where(:not(.ddoc-editor-cq *)) }`,
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
for (const [name, px] of breakpoints) {
|
|
35
|
+
addVariant(`ddoc-${name}`, [
|
|
36
|
+
`@container ddoc-editor (min-width: ${px}px)`,
|
|
37
|
+
`@media (min-width: ${px}px) { &:where(:not(.ddoc-editor-cq *)) }`,
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
// One-off widths: ddoc-min-[1410px]: and ddoc-max-[1280px]: (inclusive).
|
|
41
|
+
for (const bound of ['min', 'max']) {
|
|
42
|
+
matchVariant(
|
|
43
|
+
`ddoc-${bound}`,
|
|
44
|
+
(value) => [
|
|
45
|
+
`@container ddoc-editor (${bound}-width: ${value})`,
|
|
46
|
+
`@media (${bound}-width: ${value}) { &:where(:not(.ddoc-editor-cq *)) }`,
|
|
47
|
+
],
|
|
48
|
+
{
|
|
49
|
+
sort: (a, z) =>
|
|
50
|
+
(parseFloat(a.value) - parseFloat(z.value)) *
|
|
51
|
+
(bound === 'min' ? 1 : -1),
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
15
57
|
};
|