svedit 0.10.0 → 0.11.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 +387 -384
- package/dist/AnnotatedTextProperty.svelte +2 -5
- package/dist/AnnotatedTextProperty.svelte.d.ts.map +1 -1
- package/dist/Command.svelte.d.ts +0 -1
- package/dist/Command.svelte.d.ts.map +1 -1
- package/dist/Command.svelte.js +30 -5
- package/dist/KeyMapper.svelte.d.ts.map +1 -1
- package/dist/KeyMapper.svelte.js +18 -6
- package/dist/NodeArrayProperty.svelte +13 -25
- package/dist/NodeArrayProperty.svelte.d.ts.map +1 -1
- package/dist/NodeGap.svelte +49 -57
- package/dist/NodeGap.svelte.d.ts.map +1 -1
- package/dist/Svedit.svelte +189 -85
- package/dist/Svedit.svelte.d.ts.map +1 -1
- package/dist/doc_utils.d.ts +5 -0
- package/dist/doc_utils.d.ts.map +1 -1
- package/dist/doc_utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/paste_utils.d.ts +46 -0
- package/dist/paste_utils.d.ts.map +1 -0
- package/dist/paste_utils.js +167 -0
- package/dist/utils.d.ts +14 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +28 -7
- package/package.json +1 -1
- package/src/lib/AnnotatedTextProperty.svelte +2 -5
- package/src/lib/Command.svelte.js +30 -5
- package/src/lib/KeyMapper.svelte.js +18 -6
- package/src/lib/NodeArrayProperty.svelte +13 -25
- package/src/lib/NodeGap.svelte +49 -57
- package/src/lib/Svedit.svelte +189 -85
- package/src/lib/doc_utils.js +1 -1
- package/src/lib/index.js +1 -0
- package/src/lib/paste_utils.js +167 -0
- package/src/lib/utils.js +28 -7
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
get_char_length,
|
|
6
6
|
paths_equal,
|
|
7
7
|
serialize_path,
|
|
8
|
-
snake_to_pascal,
|
|
9
8
|
get_selection_range
|
|
10
9
|
} from './utils.js';
|
|
11
10
|
|
|
@@ -109,7 +108,6 @@
|
|
|
109
108
|
|
|
110
109
|
return fragments;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
111
|
</script>
|
|
114
112
|
|
|
115
113
|
<!-- ATTENTION: The comments are needed to prevent unwanted text nodes with whitespace. -->
|
|
@@ -133,8 +131,7 @@
|
|
|
133
131
|
class="selection-highlight"
|
|
134
132
|
style="anchor-name: --selection-highlight;">{fragment.content}</span
|
|
135
133
|
>{:else if fragment.type === 'annotation'}
|
|
136
|
-
{@const AnnotationComponent =
|
|
137
|
-
svedit.session.config.node_components[snake_to_pascal(fragment.node.type)]}
|
|
134
|
+
{@const AnnotationComponent = svedit.session.config.node_components[fragment.node.type]}
|
|
138
135
|
<AnnotationComponent
|
|
139
136
|
path={[...path, 'annotations', fragment.annotation_index, 'node_id']}
|
|
140
137
|
content={fragment.content}
|
|
@@ -167,7 +164,7 @@
|
|
|
167
164
|
caret-color: transparent !important;
|
|
168
165
|
}
|
|
169
166
|
:global(.svedit.editable) [placeholder].empty.focused::before {
|
|
170
|
-
content:
|
|
167
|
+
content: '';
|
|
171
168
|
/* we limit width & height to avoid layout shifts in case the text has a lower natural height */
|
|
172
169
|
width: 0px;
|
|
173
170
|
height: 1cap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotatedTextProperty.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AnnotatedTextProperty.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AnnotatedTextProperty.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AnnotatedTextProperty.svelte.js"],"names":[],"mappings":";;;;;AAwIA,2HAAoE"}
|
package/dist/Command.svelte.d.ts
CHANGED
|
@@ -85,7 +85,6 @@ export class ToggleAnnotationCommand extends Command {
|
|
|
85
85
|
/**
|
|
86
86
|
* Command that adds a new line character at the current caret position.
|
|
87
87
|
* Only works in text selections where newlines are allowed.
|
|
88
|
-
* Disabled on mobile browsers where Shift+Enter has different behavior.
|
|
89
88
|
*/
|
|
90
89
|
export class AddNewLineCommand extends Command {
|
|
91
90
|
is_enabled(): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Command.svelte.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAOC;;;;OAIG;IACH,qBAFW,GAAG,EAIb;IAbD;;;OAGG;IACH,kBAAwC;IAQvC,aAAsB;IAGvB;;;;;OAKG;IACH,cAFa,OAAO,CAInB;IAED;;;;;;OAMG;IACH,WAFa,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhC;CACD;AAED;;GAEG;AACH;IACC,kBAEC;IAED,gBAEC;CACD;AAED;;GAEG;AACH;IACC,kBAEC;IAED,gBAEC;CACD;AAED;;;GAGG;AACH;IASC,gBAEC;CACD;AAED;;;GAGG;AACH;IACC,0CAGC;IADA,eAA0B;IAG3B,YAAoC;IAEpC,iBAEC;IAED,kBAqBC;IAED,gBAEC;CACD;AAED
|
|
1
|
+
{"version":3,"file":"Command.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Command.svelte.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAOC;;;;OAIG;IACH,qBAFW,GAAG,EAIb;IAbD;;;OAGG;IACH,kBAAwC;IAQvC,aAAsB;IAGvB;;;;;OAKG;IACH,cAFa,OAAO,CAInB;IAED;;;;;;OAMG;IACH,WAFa,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhC;CACD;AAED;;GAEG;AACH;IACC,kBAEC;IAED,gBAEC;CACD;AAED;;GAEG;AACH;IACC,kBAEC;IAED,gBAEC;CACD;AAED;;;GAGG;AACH;IASC,gBAEC;CACD;AAED;;;GAGG;AACH;IACC,0CAGC;IADA,eAA0B;IAG3B,YAAoC;IAEpC,iBAEC;IAED,kBAqBC;IAED,gBAEC;CACD;AAED;;;GAGG;AACH;IACC,kBASC;IAED,gBAqBC;CACD;AAED;;;;GAIG;AACH;IAaC,gBAKC;CACD;AAED;;;GAGG;AACH;IACC,kBAEC;IAED,gBAwGC;CACD;AAED;;;GAGG;AACH;IAUC,gBAIC;CACD"}
|
package/dist/Command.svelte.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { insert_default_node, break_text_node } from './transforms.svelte.js';
|
|
2
2
|
import { can_switch_annotation_type } from './doc_utils.js';
|
|
3
|
-
import { is_selection_collapsed,
|
|
3
|
+
import { is_selection_collapsed, get_char_length, char_slice } from './utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Base class for commands that can be executed in response to user actions
|
|
@@ -153,7 +153,6 @@ export class ToggleAnnotationCommand extends Command {
|
|
|
153
153
|
/**
|
|
154
154
|
* Command that adds a new line character at the current caret position.
|
|
155
155
|
* Only works in text selections where newlines are allowed.
|
|
156
|
-
* Disabled on mobile browsers where Shift+Enter has different behavior.
|
|
157
156
|
*/
|
|
158
157
|
export class AddNewLineCommand extends Command {
|
|
159
158
|
is_enabled() {
|
|
@@ -162,14 +161,32 @@ export class AddNewLineCommand extends Command {
|
|
|
162
161
|
|
|
163
162
|
return (
|
|
164
163
|
this.context.editable &&
|
|
165
|
-
!is_mobile_browser() &&
|
|
166
164
|
selection?.type === 'text' &&
|
|
167
165
|
session.inspect(selection.path).allow_newlines
|
|
168
166
|
);
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
execute() {
|
|
172
|
-
|
|
170
|
+
const session = this.context.session;
|
|
171
|
+
const selection = session.selection;
|
|
172
|
+
if (!selection || selection.type !== 'text') return;
|
|
173
|
+
if (!session.inspect(selection.path).allow_newlines) return;
|
|
174
|
+
|
|
175
|
+
const tr = session.tr;
|
|
176
|
+
if (selection.anchor_offset !== selection.focus_offset) {
|
|
177
|
+
tr.delete_selection();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const collapsed_offset = tr.selection.anchor_offset;
|
|
181
|
+
const content = tr.get(tr.selection.path);
|
|
182
|
+
const text_before_caret = char_slice(content.text, 0, collapsed_offset);
|
|
183
|
+
const line_start_index = text_before_caret.lastIndexOf('\n') + 1;
|
|
184
|
+
const current_line_prefix = text_before_caret.slice(line_start_index);
|
|
185
|
+
const indentation_match = current_line_prefix.match(/^[\t ]*/);
|
|
186
|
+
const indentation = indentation_match ? indentation_match[0] : '';
|
|
187
|
+
|
|
188
|
+
tr.insert_text(`\n${indentation}`);
|
|
189
|
+
session.apply(tr);
|
|
173
190
|
}
|
|
174
191
|
}
|
|
175
192
|
|
|
@@ -180,7 +197,15 @@ export class AddNewLineCommand extends Command {
|
|
|
180
197
|
*/
|
|
181
198
|
export class BreakTextNodeCommand extends Command {
|
|
182
199
|
is_enabled() {
|
|
183
|
-
|
|
200
|
+
const session = this.context.session;
|
|
201
|
+
const selection = session.selection;
|
|
202
|
+
if (!this.context.editable || selection?.type !== 'text') return false;
|
|
203
|
+
|
|
204
|
+
const owner_node = session.get(selection.path.slice(0, -1));
|
|
205
|
+
const owner_node_schema = owner_node ? session.schema[owner_node.type] : null;
|
|
206
|
+
if (!owner_node_schema || owner_node_schema.kind !== 'text') return false;
|
|
207
|
+
|
|
208
|
+
return session.inspect(selection.path.slice(0, -2))?.type === 'node_array';
|
|
184
209
|
}
|
|
185
210
|
|
|
186
211
|
execute() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyMapper.svelte.d.ts","sourceRoot":"","sources":["../src/lib/KeyMapper.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KeyMapper.svelte.d.ts","sourceRoot":"","sources":["../src/lib/KeyMapper.svelte.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,gDAgBC;AAuED;;;;;;;;;;;GAWG;AACH;IAEE,mBAAqB;IACrB,wBAA2B;IAG5B;;OAEG;IACH,8BAGC;IAED;;OAEG;IACH,iBAIC;IAED;;OAEG;IACH,iCAUC;CACD"}
|
package/dist/KeyMapper.svelte.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { is_virtual_keyboard_active } from './utils.js';
|
|
2
|
+
|
|
1
3
|
const MODIFIER_KEYS = ['meta', 'ctrl', 'alt', 'shift'];
|
|
2
4
|
const MODIFIER_EVENT_KEYS = {
|
|
3
5
|
meta: 'metaKey',
|
|
@@ -34,7 +36,7 @@ export function define_keymap(keymap) {
|
|
|
34
36
|
* Matches a keyboard event against a key combo string.
|
|
35
37
|
* Example: 'meta+e,ctrl+e' matches either (metaKey && key==='e') OR (ctrlKey && key==='e')
|
|
36
38
|
*/
|
|
37
|
-
function matches_key_combo(key_combo, event) {
|
|
39
|
+
function matches_key_combo(key_combo, event, virtual_keyboard_active = false) {
|
|
38
40
|
const alternatives = key_combo.split(',');
|
|
39
41
|
|
|
40
42
|
return alternatives.some((alternative) => {
|
|
@@ -42,14 +44,22 @@ function matches_key_combo(key_combo, event) {
|
|
|
42
44
|
const modifiers = parts.filter((part) => MODIFIER_KEYS.includes(part));
|
|
43
45
|
const non_modifier = parts.find((part) => !MODIFIER_KEYS.includes(part));
|
|
44
46
|
|
|
47
|
+
if (virtual_keyboard_active && modifiers.length > 0) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
// Check if all specified modifiers are pressed
|
|
46
52
|
const modifiers_match = modifiers.every((mod) => event[MODIFIER_EVENT_KEYS[mod]]);
|
|
47
53
|
|
|
48
54
|
// Check if no unspecified modifiers are pressed
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
// NOTE: On virtual keyboards (iOS / Anroid) modifier keys are just ignored, because
|
|
56
|
+
// they must be assumed accidental (e.g. Shift activated as a result of auto-capitalization)
|
|
57
|
+
const no_extra_modifiers = virtual_keyboard_active
|
|
58
|
+
? true
|
|
59
|
+
: MODIFIER_KEYS.every((mod) => {
|
|
60
|
+
if (modifiers.includes(mod)) return true; // This modifier is expected
|
|
61
|
+
return !event[MODIFIER_EVENT_KEYS[mod]]; // This modifier should NOT be pressed
|
|
62
|
+
});
|
|
53
63
|
|
|
54
64
|
// Check if the key matches
|
|
55
65
|
const key_matches = event.key.toLowerCase() === non_modifier;
|
|
@@ -65,8 +75,10 @@ function matches_key_combo(key_combo, event) {
|
|
|
65
75
|
* but don't crash the application.
|
|
66
76
|
*/
|
|
67
77
|
function handle_key_map(key_map, event) {
|
|
78
|
+
const virtual_keyboard_active = is_virtual_keyboard_active();
|
|
79
|
+
|
|
68
80
|
for (const [key_combo, commands] of Object.entries(key_map)) {
|
|
69
|
-
if (matches_key_combo(key_combo, event)) {
|
|
81
|
+
if (matches_key_combo(key_combo, event, virtual_keyboard_active)) {
|
|
70
82
|
// Find the first enabled command and execute it
|
|
71
83
|
const enabled_command = commands.find((cmd) => cmd.is_enabled());
|
|
72
84
|
if (enabled_command) {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext, setContext } from 'svelte';
|
|
3
3
|
import UnknownNode from './UnknownNode.svelte';
|
|
4
|
-
import { serialize_path
|
|
4
|
+
import { serialize_path } from './utils.js';
|
|
5
5
|
import DefaultNodeGap from './NodeGap.svelte';
|
|
6
6
|
import DefaultNodeGapMarkers from './NodeGapMarkers.svelte';
|
|
7
7
|
|
|
8
8
|
/** @import { NodeArrayPropertyProps } from './types.d.ts'; */
|
|
9
9
|
|
|
10
10
|
const svedit = getContext('svedit');
|
|
11
|
-
let NodeGap = $derived(svedit.session.config.system_components?.
|
|
12
|
-
let NodeGapMarkers = $derived(
|
|
11
|
+
let NodeGap = $derived(svedit.session.config.system_components?.node_gap ?? DefaultNodeGap);
|
|
12
|
+
let NodeGapMarkers = $derived(
|
|
13
|
+
svedit.session.config.system_components?.node_gap_markers ?? DefaultNodeGapMarkers
|
|
14
|
+
);
|
|
13
15
|
|
|
14
16
|
/** @type {NodeArrayPropertyProps} */
|
|
15
17
|
let { path, tag = 'div', class: css_class, style = '', ...rest } = $props();
|
|
@@ -26,8 +28,8 @@
|
|
|
26
28
|
// NodeGap while the caret is in the placeholder, so its <br> isn't a
|
|
27
29
|
// second arrow-key stop (issue #260).
|
|
28
30
|
let is_focused = $derived(
|
|
29
|
-
svedit.session.selection?.type === 'node'
|
|
30
|
-
|
|
31
|
+
svedit.session.selection?.type === 'node' &&
|
|
32
|
+
serialize_path(svedit.session.selection.path) === path_str
|
|
31
33
|
);
|
|
32
34
|
|
|
33
35
|
setContext('node_array_meta', {
|
|
@@ -35,7 +37,6 @@
|
|
|
35
37
|
return node_ids.length;
|
|
36
38
|
}
|
|
37
39
|
});
|
|
38
|
-
|
|
39
40
|
</script>
|
|
40
41
|
|
|
41
42
|
<!-- we use the anchor of node_array in Overlays.svelte to position the last insertion point in a horizontal layout based on the right edge of the container -->
|
|
@@ -55,21 +56,12 @@
|
|
|
55
56
|
data-type="node"
|
|
56
57
|
style="anchor-name: --{serialize_path([...path, 0])};"
|
|
57
58
|
>
|
|
58
|
-
|
|
59
|
-
array_path={path}
|
|
60
|
-
offset={0}
|
|
61
|
-
count={0}
|
|
62
|
-
empty
|
|
63
|
-
/>
|
|
59
|
+
<NodeGap array_path={path} offset={0} count={0} empty />
|
|
64
60
|
</div>
|
|
65
61
|
{/if}
|
|
66
62
|
{#each nodes as node, index (index)}
|
|
67
|
-
<NodeGap
|
|
68
|
-
|
|
69
|
-
offset={index}
|
|
70
|
-
count={nodes.length}
|
|
71
|
-
/>
|
|
72
|
-
{@const Component = svedit.session.config.node_components[snake_to_pascal(node.type)]}
|
|
63
|
+
<NodeGap array_path={path} offset={index} count={nodes.length} />
|
|
64
|
+
{@const Component = svedit.session.config.node_components[node.type]}
|
|
73
65
|
{#if Component}
|
|
74
66
|
<Component path={[...path, index]} />
|
|
75
67
|
{:else}
|
|
@@ -77,11 +69,7 @@
|
|
|
77
69
|
{/if}
|
|
78
70
|
{/each}
|
|
79
71
|
{#if node_ids.length > 0}
|
|
80
|
-
<NodeGap
|
|
81
|
-
array_path={path}
|
|
82
|
-
offset={node_ids.length}
|
|
83
|
-
count={node_ids.length}
|
|
84
|
-
/>
|
|
72
|
+
<NodeGap array_path={path} offset={node_ids.length} count={node_ids.length} />
|
|
85
73
|
{/if}
|
|
86
74
|
{#if svedit.editable && NodeGapMarkers}
|
|
87
75
|
<NodeGapMarkers {path} count={node_ids.length} />
|
|
@@ -89,7 +77,7 @@
|
|
|
89
77
|
</svelte:element>
|
|
90
78
|
|
|
91
79
|
<style>
|
|
92
|
-
/* position: relative makes this the containing block for the gap's
|
|
80
|
+
/* position: relative makes this the containing block for the gap's
|
|
93
81
|
.svedit-selectable, which fills it via inset:0. You may override to
|
|
94
82
|
position: absolute (e.g. so an empty array doesn't occupy flow space)
|
|
95
83
|
— still a containing block; then also set position: relative on the
|
|
@@ -102,4 +90,4 @@
|
|
|
102
90
|
min-width: 24px;
|
|
103
91
|
cursor: pointer;
|
|
104
92
|
}
|
|
105
|
-
</style>
|
|
93
|
+
</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeArrayProperty.svelte.d.ts","sourceRoot":"","sources":["../src/lib/NodeArrayProperty.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"NodeArrayProperty.svelte.d.ts","sourceRoot":"","sources":["../src/lib/NodeArrayProperty.svelte.js"],"names":[],"mappings":";;;;;AA8EA,mHAAgE"}
|
package/dist/NodeGap.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function cycle_z_index(/** @type {MouseEvent} */ e) {
|
|
3
3
|
const el = /** @type {HTMLElement} */ (e.currentTarget);
|
|
4
4
|
if (el.hasAttribute('data-sent-to-back')) {
|
|
5
|
-
document.querySelectorAll('.svedit-selectable[data-sent-to-back]').forEach(prev => {
|
|
5
|
+
document.querySelectorAll('.svedit-selectable[data-sent-to-back]').forEach((prev) => {
|
|
6
6
|
prev.removeAttribute('data-sent-to-back');
|
|
7
7
|
});
|
|
8
8
|
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* Row/column detection uses var(--row, 1) with the * 99999 multiplier
|
|
51
51
|
* trick — no @container style() queries, works in all browsers.
|
|
52
52
|
*
|
|
53
|
-
* If you override this component via `system_components.
|
|
53
|
+
* If you override this component via `system_components.node_gap`, make
|
|
54
54
|
* sure your custom component also handles read-only mode by rendering a
|
|
55
55
|
* plain `.node-gap` placeholder without editable internals.
|
|
56
56
|
*/
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
let anchor_name = $derived.by(() => {
|
|
77
|
-
|
|
77
|
+
if (!is_editable) return '';
|
|
78
78
|
if (is_first) return `--g-${serialize_path([...array_path, 0])}-gap-before`;
|
|
79
79
|
return `--g-${serialize_path([...array_path, offset - 1])}-gap-after`;
|
|
80
80
|
});
|
|
@@ -93,7 +93,9 @@
|
|
|
93
93
|
style={gap_style}
|
|
94
94
|
>
|
|
95
95
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
96
|
-
<div class="svedit-selectable" style="anchor-name:{anchor_name}" onpointerdown={cycle_z_index}
|
|
96
|
+
<div class="svedit-selectable" style="anchor-name:{anchor_name}" onpointerdown={cycle_z_index}>
|
|
97
|
+
<br />
|
|
98
|
+
</div>
|
|
97
99
|
</div>
|
|
98
100
|
{:else}
|
|
99
101
|
<div class="node-gap"></div>
|
|
@@ -161,8 +163,14 @@
|
|
|
161
163
|
--_s-r: anchor(var(--_pa) right, 9999999px);
|
|
162
164
|
}
|
|
163
165
|
:global(.node-gap.positioned.gap-before:not(.empty)) {
|
|
164
|
-
--_b-t: anchor(
|
|
165
|
-
|
|
166
|
+
--_b-t: anchor(
|
|
167
|
+
var(--node-caret-boundary-y, var(--node-caret-boundary, --_no-boundary)) top,
|
|
168
|
+
0px
|
|
169
|
+
);
|
|
170
|
+
--_b-l: anchor(
|
|
171
|
+
var(--node-caret-boundary-x, var(--node-caret-boundary, --_no-boundary)) left,
|
|
172
|
+
0px
|
|
173
|
+
);
|
|
166
174
|
}
|
|
167
175
|
:global(.node-gap.positioned.gap-after:not(.last)) {
|
|
168
176
|
--_n-t: anchor(var(--_next) top);
|
|
@@ -175,10 +183,22 @@
|
|
|
175
183
|
--_c-b: anchor(var(--_container) bottom);
|
|
176
184
|
--_c-l: anchor(var(--_container) left);
|
|
177
185
|
--_c-r: anchor(var(--_container) right);
|
|
178
|
-
--_b-b: anchor(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
--_b-b: anchor(
|
|
187
|
+
var(--node-caret-boundary-y, var(--node-caret-boundary, --_no-boundary)) bottom,
|
|
188
|
+
0px
|
|
189
|
+
);
|
|
190
|
+
--_b-r: anchor(
|
|
191
|
+
var(--node-caret-boundary-x, var(--node-caret-boundary, --_no-boundary)) right,
|
|
192
|
+
0px
|
|
193
|
+
);
|
|
194
|
+
--_b-bt: anchor(
|
|
195
|
+
var(--node-caret-boundary-y, var(--node-caret-boundary, --_no-boundary)) bottom,
|
|
196
|
+
9999999px
|
|
197
|
+
);
|
|
198
|
+
--_b-rl: anchor(
|
|
199
|
+
var(--node-caret-boundary-x, var(--node-caret-boundary, --_no-boundary)) right,
|
|
200
|
+
9999999px
|
|
201
|
+
);
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
:global(.node-gap.positioned .svedit-selectable) {
|
|
@@ -226,10 +246,8 @@
|
|
|
226
246
|
calc(var(--_s-l) + var(--_R) * 9999999px),
|
|
227
247
|
calc(var(--_s-r) + var(--_C) * 9999999px),
|
|
228
248
|
calc(
|
|
229
|
-
(var(--_s-r) + var(--_n-l)) / 2
|
|
230
|
-
|
|
231
|
-
+ max(0px, var(--_s-r) - var(--_n-l)) * 999
|
|
232
|
-
+ var(--_C) * 9999999px
|
|
249
|
+
(var(--_s-r) + var(--_n-l)) / 2 - var(--_gm) / 2 + max(0px, var(--_s-r) - var(--_n-l)) *
|
|
250
|
+
999 + var(--_C) * 9999999px
|
|
233
251
|
),
|
|
234
252
|
/* Safety clamp for wrap: pins gap inside CB when current/next
|
|
235
253
|
wrap across rows. Disabled in nowrap/horizontal-scroll where
|
|
@@ -237,35 +255,25 @@
|
|
|
237
255
|
the other branches position correctly and this clamp would
|
|
238
256
|
wrongly force the gap to CB right minus eg. */
|
|
239
257
|
calc(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
)
|
|
258
|
+
100% - var(--_eg) + max(0px, var(--_n-l) - var(--_s-r) + 0.5px) * 9999 + var(--_C) *
|
|
259
|
+
9999999px
|
|
260
|
+
)
|
|
244
261
|
);
|
|
245
262
|
right: min(
|
|
246
263
|
calc(var(--_s-r) + var(--_R) * 9999999px),
|
|
247
264
|
calc(
|
|
248
265
|
max(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
max(
|
|
257
|
-
min(
|
|
258
|
-
calc(var(--_c-r) - var(--_eg)),
|
|
259
|
-
calc(var(--_s-r) - var(--_eg))
|
|
260
|
-
),
|
|
261
|
-
calc(
|
|
262
|
-
var(--_s-r)
|
|
263
|
-
- (var(--_n-l) - var(--_s-r)) * 999
|
|
266
|
+
0px,
|
|
267
|
+
min(
|
|
268
|
+
var(--_n-l),
|
|
269
|
+
calc((var(--_s-r) + var(--_n-l)) / 2 - var(--_gm) / 2),
|
|
270
|
+
max(
|
|
271
|
+
min(calc(var(--_c-r) - var(--_eg)), calc(var(--_s-r) - var(--_eg))),
|
|
272
|
+
calc(var(--_s-r) - (var(--_n-l) - var(--_s-r)) * 999)
|
|
264
273
|
)
|
|
265
274
|
)
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
+ var(--_C) * 9999999px
|
|
275
|
+
) +
|
|
276
|
+
var(--_C) * 9999999px
|
|
269
277
|
)
|
|
270
278
|
);
|
|
271
279
|
min-height: calc(var(--_gm) * var(--_C));
|
|
@@ -307,23 +315,13 @@
|
|
|
307
315
|
left: min(
|
|
308
316
|
calc(var(--_s-l) + var(--_R) * 9999999px),
|
|
309
317
|
calc(min(var(--_s-r), calc(var(--_b-rl) - var(--_eg))) + var(--_C) * 9999999px),
|
|
310
|
-
calc(
|
|
311
|
-
100% - var(--_eg)
|
|
312
|
-
+ max(0px, var(--_s-r) - 100% + 0.5px) * 9999
|
|
313
|
-
+ var(--_C) * 9999999px
|
|
314
|
-
)
|
|
318
|
+
calc(100% - var(--_eg) + max(0px, var(--_s-r) - 100% + 0.5px) * 9999 + var(--_C) * 9999999px)
|
|
315
319
|
);
|
|
316
320
|
right: min(
|
|
317
321
|
calc(var(--_s-r) + var(--_R) * 9999999px),
|
|
318
322
|
calc(
|
|
319
|
-
max(
|
|
320
|
-
var(--
|
|
321
|
-
min(
|
|
322
|
-
calc(var(--_c-r) - var(--_eg)),
|
|
323
|
-
calc(var(--_s-r) - var(--_eg))
|
|
324
|
-
)
|
|
325
|
-
)
|
|
326
|
-
+ var(--_C) * 9999999px
|
|
323
|
+
max(var(--_b-r), min(calc(var(--_c-r) - var(--_eg)), calc(var(--_s-r) - var(--_eg)))) +
|
|
324
|
+
var(--_C) * 9999999px
|
|
327
325
|
)
|
|
328
326
|
);
|
|
329
327
|
min-height: calc(var(--_eg) * var(--_C));
|
|
@@ -333,10 +331,7 @@
|
|
|
333
331
|
/* Before first node: col extends up, row extends left */
|
|
334
332
|
:global(.node-gap.positioned.gap-before:not(.empty) .svedit-selectable) {
|
|
335
333
|
top: min(
|
|
336
|
-
calc(
|
|
337
|
-
max(var(--_b-t), var(--_s-t) - var(--_eg))
|
|
338
|
-
+ var(--_R) * 9999999px
|
|
339
|
-
),
|
|
334
|
+
calc(max(var(--_b-t), var(--_s-t) - var(--_eg)) + var(--_R) * 9999999px),
|
|
340
335
|
calc(var(--_s-t) + var(--_C) * 9999999px)
|
|
341
336
|
);
|
|
342
337
|
bottom: min(
|
|
@@ -345,10 +340,7 @@
|
|
|
345
340
|
);
|
|
346
341
|
left: min(
|
|
347
342
|
calc(var(--_s-l) + var(--_R) * 9999999px),
|
|
348
|
-
calc(
|
|
349
|
-
max(var(--_b-l), var(--_s-l) - var(--_eg))
|
|
350
|
-
+ var(--_C) * 9999999px
|
|
351
|
-
)
|
|
343
|
+
calc(max(var(--_b-l), var(--_s-l) - var(--_eg)) + var(--_C) * 9999999px)
|
|
352
344
|
);
|
|
353
345
|
right: min(
|
|
354
346
|
calc(var(--_s-r) + var(--_R) * 9999999px),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeGap.svelte.d.ts","sourceRoot":"","sources":["../src/lib/NodeGap.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"NodeGap.svelte.d.ts","sourceRoot":"","sources":["../src/lib/NodeGap.svelte.js"],"names":[],"mappings":";;;;;AAwGA;gBA1CgC,GAAG;YAAU,GAAG;WAAS,GAAG;YAAU,OAAO;WA0CvB;wBA1CpC;IAAE,UAAU,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE"}
|