mnfst 0.5.236 → 0.5.238
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/lib/manifest.appwrite.data.js +1 -1
- package/lib/manifest.code.css +12 -12
- package/lib/manifest.code.min.css +1 -1
- package/lib/manifest.css +43 -26
- package/lib/manifest.d.ts +2 -0
- package/lib/manifest.data.js +1 -1
- package/lib/manifest.edit.css +26 -23
- package/lib/manifest.edit.js +52 -98
- package/lib/manifest.integrity.json +5 -5
- package/lib/manifest.min.css +1 -1
- package/lib/manifest.rich.text.css +15 -1
- package/lib/manifest.rich.text.js +4 -4
- package/lib/manifest.sw.js +1 -1
- package/lib/manifest.table.css +2 -2
- package/package.json +1 -1
package/lib/manifest.code.css
CHANGED
|
@@ -238,12 +238,12 @@
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
/* Pre code blocks (individual or tab grouped) */
|
|
241
|
+
/* Pre code blocks (individual or tab grouped); direct children only */
|
|
242
242
|
:where([x-code], [x-code-group]):not(.unstyle) {
|
|
243
243
|
position: relative;
|
|
244
244
|
|
|
245
245
|
/* Header */
|
|
246
|
-
|
|
246
|
+
&>:where(header) {
|
|
247
247
|
|
|
248
248
|
display: flex;
|
|
249
249
|
flex-direction: row;
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
/* Copy code button */
|
|
302
|
-
|
|
302
|
+
&>button.copy {
|
|
303
303
|
position: absolute;
|
|
304
304
|
top: 0;
|
|
305
305
|
inset-inline-end: 0;
|
|
@@ -330,12 +330,12 @@
|
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
|
|
333
|
+
&>:where(header)::-webkit-scrollbar {
|
|
334
334
|
display: none
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
/* Line numbers overlay */
|
|
338
|
-
|
|
338
|
+
&>.lines {
|
|
339
339
|
position: absolute;
|
|
340
340
|
inset-inline-start: 0;
|
|
341
341
|
display: inline-flex;
|
|
@@ -352,12 +352,12 @@
|
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
/* Indent code when line numbers present */
|
|
355
|
-
&:has(
|
|
355
|
+
&:has(>.lines)>code {
|
|
356
356
|
padding-inline-start: calc(calc(var(--spacing, 0.25rem) * 8) + 2ch)
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
/* Code */
|
|
360
|
-
|
|
360
|
+
&>:where(code) {
|
|
361
361
|
flex: 1 1 100%;
|
|
362
362
|
min-width: 0;
|
|
363
363
|
white-space: pre;
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
/* Expand / collapse toggle */
|
|
368
|
-
|
|
368
|
+
&>button.expand {
|
|
369
369
|
order: 99;
|
|
370
370
|
display: flex;
|
|
371
371
|
align-items: center;
|
|
@@ -388,8 +388,8 @@
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
&[data-collapsed]
|
|
392
|
-
&[data-collapsed]
|
|
391
|
+
&[data-collapsed]>code,
|
|
392
|
+
&[data-collapsed]>.lines {
|
|
393
393
|
max-height: calc(var(--collapse-lines, 20) * 1.7em + calc(var(--spacing, 0.25rem) * 8));
|
|
394
394
|
overflow: hidden;
|
|
395
395
|
mask-image: linear-gradient(to bottom,
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
:where([x-code-group]) {
|
|
418
418
|
flex-flow: column;
|
|
419
419
|
|
|
420
|
-
|
|
420
|
+
&>:where([x-code]) {
|
|
421
421
|
border: 0 none;
|
|
422
422
|
border-radius: 0;
|
|
423
423
|
background: transparent
|
|
@@ -425,7 +425,7 @@
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
:where([x-code]):has(>header) {
|
|
428
|
-
|
|
428
|
+
&>.lines {
|
|
429
429
|
top: var(--spacing-field-height, 2.25rem)
|
|
430
430
|
}
|
|
431
431
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer base, components, utilities, syntax;:root{--icon-code-copy:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/g%3E%3C/svg%3E");--icon-code-copied:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1jb3B5LWNoZWNrLWljb24gbHVjaWRlLWNvcHktY2hlY2siIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0ibTEyIDE1IDIgMiA0LTQiLz48cmVjdCB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHg9IjgiIHk9IjgiIHJ4PSIyIiByeT0iMiIvPjxwYXRoIGQ9Ik00IDE2Yy0xLjEgMC0yLS45LTItMlY0YzAtMS4xLjktMiAyLTJoMTBjMS4xIDAgMiAuOSAyIDIiLz48L3N2Zz4=");--icon-code-expand:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");--color-code-keyword:#b8860b;--color-code-string:#8b4513;--color-code-comment:gray;--color-code-function:peru;--color-code-number:sienna;--color-code-operator:#2f4f4f;--color-code-class-name:#daa520;--color-code-tag:#4682b4;--color-code-attr-name:#ff8c00;--color-code-attr-value:#8b4513;--color-code-property:sienna;--color-code-selector:#4682b4;--color-code-punctuation:#2f4f4f;--color-code-builtin:#b8860b;--color-code-constant:sienna;--color-code-boolean:sienna;--color-code-regex:#8b4513;--color-code-symbol:#daa520;--color-code-entity:#daa520;--color-code-url:sienna;--color-code-atrule:#b8860b;--color-code-rule:#4682b4;--color-code-doctype:gray;--color-code-cdata:gray;--color-code-prolog:gray;--color-code-namespace:gray;--color-code-important:#b8860b;--color-code-inserted:#228b22;--color-code-deleted:#dc143c;--color-code-char:#8b4513}.dark{--color-code-keyword:#f4a460;--color-code-string:#deb887;--color-code-comment:#8b8b8b;--color-code-function:#daa520;--color-code-number:tan;--color-code-operator:wheat;--color-code-class-name:peru;--color-code-tag:#87ceeb;--color-code-attr-name:gold;--color-code-attr-value:#deb887;--color-code-property:tan;--color-code-selector:#87ceeb;--color-code-punctuation:wheat;--color-code-builtin:#f4a460;--color-code-constant:tan;--color-code-boolean:tan;--color-code-regex:#deb887;--color-code-symbol:peru;--color-code-entity:peru;--color-code-url:tan;--color-code-atrule:#f4a460;--color-code-rule:#98fb98;--color-code-doctype:#8b8b8b;--color-code-cdata:#8b8b8b;--color-code-prolog:#8b8b8b;--color-code-namespace:#8b8b8b;--color-code-important:#f4a460;--color-code-inserted:#98fb98;--color-code-deleted:#f08080;--color-code-char:#deb887}@layer syntax{.hljs-comment{color:var(--color-code-comment)}.hljs-keyword{color:var(--color-code-keyword)}.hljs-string{color:var(--color-code-string)}.hljs-number{color:var(--color-code-number)}.hljs-literal{color:var(--color-code-constant)}.hljs-type{color:var(--color-code-class-name)}.hljs-variable{color:var(--color-code-property)}.hljs-variable.language_{color:var(--color-code-keyword)}.hljs-variable.constant_{color:var(--color-code-constant)}.hljs-title{color:var(--color-code-function)}.hljs-title.class_.inherited__{color:var(--color-code-class-name)}.hljs-title.function_.invoke__{color:var(--color-code-function)}.hljs-params{color:var(--color-code-property)}.hljs-doctag{color:var(--color-code-keyword);font-weight:600}.hljs-meta{color:var(--color-code-comment)}.hljs-meta.keyword_,.hljs-meta.prompt_{color:var(--color-code-keyword)}.hljs-meta.string_{color:var(--color-code-string)}.hljs-section{color:var(--color-code-keyword);font-weight:600}.hljs-name{color:var(--color-code-tag)}.hljs-attribute{color:var(--color-code-attr-name)}.hljs-bullet{color:var(--color-code-punctuation)}.hljs-code{color:var(--color-code-property)}.hljs-formula{color:var(--color-code-number)}.hljs-quote{color:var(--color-code-string)}.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo{color:var(--color-code-selector)}.hljs-template-tag{color:var(--color-code-tag)}.hljs-template-variable{color:var(--color-code-property)}.hljs-subst{color:var(--color-code-string)}}@layer components{:where(code[role=button]){height:fit-content}:where(.code-copied-icon){background-color:currentColor;display:inline-block;height:1em;mask-image:var(--icon-code-copied);mask-position:center;mask-repeat:no-repeat;mask-size:1em;vertical-align:middle;width:1em;@supports (height:1lh){height:1lh;vertical-align:top}}:where([x-code],[x-code-group]):not(.unstyle){position:relative
|
|
1
|
+
@layer base, components, utilities, syntax;:root{--icon-code-copy:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/g%3E%3C/svg%3E");--icon-code-copied:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1jb3B5LWNoZWNrLWljb24gbHVjaWRlLWNvcHktY2hlY2siIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0ibTEyIDE1IDIgMiA0LTQiLz48cmVjdCB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHg9IjgiIHk9IjgiIHJ4PSIyIiByeT0iMiIvPjxwYXRoIGQ9Ik00IDE2Yy0xLjEgMC0yLS45LTItMlY0YzAtMS4xLjktMiAyLTJoMTBjMS4xIDAgMiAuOSAyIDIiLz48L3N2Zz4=");--icon-code-expand:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");--color-code-keyword:#b8860b;--color-code-string:#8b4513;--color-code-comment:gray;--color-code-function:peru;--color-code-number:sienna;--color-code-operator:#2f4f4f;--color-code-class-name:#daa520;--color-code-tag:#4682b4;--color-code-attr-name:#ff8c00;--color-code-attr-value:#8b4513;--color-code-property:sienna;--color-code-selector:#4682b4;--color-code-punctuation:#2f4f4f;--color-code-builtin:#b8860b;--color-code-constant:sienna;--color-code-boolean:sienna;--color-code-regex:#8b4513;--color-code-symbol:#daa520;--color-code-entity:#daa520;--color-code-url:sienna;--color-code-atrule:#b8860b;--color-code-rule:#4682b4;--color-code-doctype:gray;--color-code-cdata:gray;--color-code-prolog:gray;--color-code-namespace:gray;--color-code-important:#b8860b;--color-code-inserted:#228b22;--color-code-deleted:#dc143c;--color-code-char:#8b4513}.dark{--color-code-keyword:#f4a460;--color-code-string:#deb887;--color-code-comment:#8b8b8b;--color-code-function:#daa520;--color-code-number:tan;--color-code-operator:wheat;--color-code-class-name:peru;--color-code-tag:#87ceeb;--color-code-attr-name:gold;--color-code-attr-value:#deb887;--color-code-property:tan;--color-code-selector:#87ceeb;--color-code-punctuation:wheat;--color-code-builtin:#f4a460;--color-code-constant:tan;--color-code-boolean:tan;--color-code-regex:#deb887;--color-code-symbol:peru;--color-code-entity:peru;--color-code-url:tan;--color-code-atrule:#f4a460;--color-code-rule:#98fb98;--color-code-doctype:#8b8b8b;--color-code-cdata:#8b8b8b;--color-code-prolog:#8b8b8b;--color-code-namespace:#8b8b8b;--color-code-important:#f4a460;--color-code-inserted:#98fb98;--color-code-deleted:#f08080;--color-code-char:#deb887}@layer syntax{.hljs-comment{color:var(--color-code-comment)}.hljs-keyword{color:var(--color-code-keyword)}.hljs-string{color:var(--color-code-string)}.hljs-number{color:var(--color-code-number)}.hljs-literal{color:var(--color-code-constant)}.hljs-type{color:var(--color-code-class-name)}.hljs-variable{color:var(--color-code-property)}.hljs-variable.language_{color:var(--color-code-keyword)}.hljs-variable.constant_{color:var(--color-code-constant)}.hljs-title{color:var(--color-code-function)}.hljs-title.class_.inherited__{color:var(--color-code-class-name)}.hljs-title.function_.invoke__{color:var(--color-code-function)}.hljs-params{color:var(--color-code-property)}.hljs-doctag{color:var(--color-code-keyword);font-weight:600}.hljs-meta{color:var(--color-code-comment)}.hljs-meta.keyword_,.hljs-meta.prompt_{color:var(--color-code-keyword)}.hljs-meta.string_{color:var(--color-code-string)}.hljs-section{color:var(--color-code-keyword);font-weight:600}.hljs-name{color:var(--color-code-tag)}.hljs-attribute{color:var(--color-code-attr-name)}.hljs-bullet{color:var(--color-code-punctuation)}.hljs-code{color:var(--color-code-property)}.hljs-formula{color:var(--color-code-number)}.hljs-quote{color:var(--color-code-string)}.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo{color:var(--color-code-selector)}.hljs-template-tag{color:var(--color-code-tag)}.hljs-template-variable{color:var(--color-code-property)}.hljs-subst{color:var(--color-code-string)}}@layer components{:where(code[role=button]){height:fit-content}:where(.code-copied-icon){background-color:currentColor;display:inline-block;height:1em;mask-image:var(--icon-code-copied);mask-position:center;mask-repeat:no-repeat;mask-size:1em;vertical-align:middle;width:1em;@supports (height:1lh){height:1lh;vertical-align:top}}:where([x-code],[x-code-group]):not(.unstyle){position:relative;&>:where(header){align-items:center;background-color:color-mix(in oklch,var(--color-content-stark,oklch(43.9% 0 0)) 8%,transparent);color:var(--color-content-neutral,oklch(43.9% 0 0));display:flex;flex-direction:row;font-family:var(--font-sans,sans-serif);font-size:inherit;min-height:var(--spacing-field-height,2.25rem);padding-inline-end:var(--spacing-field-height);padding-inline-start:calc(var(--spacing, .25rem)*4);width:100%;&:has(button[role=tab]){padding-inline-start:calc(var(--spacing, .25rem)*2)}& [role=tablist]{display:flex;flex-direction:row;overflow-x:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}& button[role=tab]{background:transparent;border:0;color:inherit;flex-shrink:0;font-family:inherit;font-size:inherit;height:fit-content;justify-content:start;&:hover{background-color:var(--color-field-surface,color-mix(in oklch,oklch(20.5% 0 0) 10%,transparent));color:var(--color-content-stark,oklch(43.9% 0 0))}&[aria-selected=true]{color:var(--color-brand-content,oklch(68.1% .162 75.834));pointer-events:none;position:relative}}}}&>button.copy{background-color:transparent;font-size:75%;inset-inline-end:0;position:absolute;top:0;&:hover{background-color:transparent;&:after{background-color:var(--color-field-inverse,oklch(43.9% 0 0))}}&:after{background-color:var(--color-content-neutral,oklch(43.9% 0 0));content:"";display:block;height:.8125rem;mask-image:var(--icon-code-copy);mask-repeat:no-repeat;mask-size:contain;width:.8125rem}&.copied:after{mask-image:var(--icon-code-copied)}}&>:where(header)::-webkit-scrollbar{display:none}&>.lines{background-color:var(--color-page,oklch(98.5% 0 0));color:var(--color-content-subtle,oklch(55.6% 0 0));display:inline-flex;flex-direction:column;font-family:inherit;font-size:inherit;inset-inline-start:0;line-height:inherit;padding:calc(var(--spacing, .25rem)*4);pointer-events:none;position:absolute;text-align:end;user-select:none}&:has(>.lines)>code{padding-inline-start:calc(var(--spacing, .25rem)*8 + 2ch)}&>:where(code){flex:1 1 100%;min-width:0;white-space:pre;white-space-collapse:preserve}&>button.expand{align-items:center;background:transparent;border:0;border-radius:0;color:var(--color-content-subtle,oklch(55.6% 0 0));cursor:pointer;display:flex;font-family:var(--font-sans,sans-serif);font-size:inherit;height:var(--spacing-field-height,2.25rem);justify-content:center;order:99;padding:0 calc(var(--spacing, .25rem)*2);transition:var(--transition,all .05s ease-in-out);width:100%;&:hover{background:color-mix(in oklch,var(--color-content-stark,oklch(43.9% 0 0)) 8%,transparent);color:var(--color-content-neutral,oklch(43.9% 0 0))}}&[data-collapsed]>.lines,&[data-collapsed]>code{mask-image:linear-gradient(180deg,#000 0,#000 calc(100% - 3em),transparent calc(100% - .75em),transparent);max-height:calc(var(--collapse-lines, 20)*1.7em + var(--spacing, .25rem)*8);overflow:hidden}:where(aside.frame){background:unset;border:0;box-shadow:unset;color:unset;font-family:unset;font-size:unset;font-weight:unset;line-height:unset;white-space:normal;white-space-collapse:collapse}}:where([x-code-group]){flex-flow:column;&>:where([x-code]){background:transparent;border:0;border-radius:0}}:where([x-code]):has(>header){&>.lines{top:var(--spacing-field-height,2.25rem)}}}
|
package/lib/manifest.css
CHANGED
|
@@ -2945,32 +2945,15 @@
|
|
|
2945
2945
|
outline-offset: 3px;
|
|
2946
2946
|
}
|
|
2947
2947
|
|
|
2948
|
-
/*
|
|
2949
|
-
:where([data-edit-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
translate: calc(-100% - var(--edit-grip-offset, 0.25rem)) 0;
|
|
2955
|
-
border-radius: 3px;
|
|
2956
|
-
color: var(--edit-accent, var(--color-brand-content));
|
|
2957
|
-
background: radial-gradient(circle, currentColor 1px, transparent 1.5px) center / 6px 6px;
|
|
2958
|
-
opacity: 0.6;
|
|
2948
|
+
/* A piece with its own grab handle drags only from it */
|
|
2949
|
+
:where([data-edit-piece][data-edit-grabbable]) {
|
|
2950
|
+
cursor: auto;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
:where([x-edit\.grab]) {
|
|
2959
2954
|
cursor: grab;
|
|
2960
2955
|
touch-action: none;
|
|
2961
2956
|
user-select: none;
|
|
2962
|
-
|
|
2963
|
-
&:hover {
|
|
2964
|
-
opacity: 1;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
:where([data-edit-grip]:dir(rtl)) {
|
|
2969
|
-
translate: var(--edit-grip-offset, 0.25rem) 0;
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
:where([data-edit-grip][hidden]) {
|
|
2973
|
-
display: none;
|
|
2974
2957
|
}
|
|
2975
2958
|
|
|
2976
2959
|
/* Lifted, following the pointer */
|
|
@@ -3084,6 +3067,26 @@
|
|
|
3084
3067
|
}
|
|
3085
3068
|
}
|
|
3086
3069
|
|
|
3070
|
+
/* While resizing, the edge stays drawn; at a snap point it thickens */
|
|
3071
|
+
:where([data-edit-handle][data-edit-resizing]):where(:not([data-edit-area="bare"] *))::before {
|
|
3072
|
+
opacity: 1;
|
|
3073
|
+
background-color: var(--edit-accent, var(--color-brand-content));
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
:where([data-edit-handle="top"][data-edit-snapped], [data-edit-handle="bottom"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
3077
|
+
height: 3px;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
:where([data-edit-handle="left"][data-edit-snapped], [data-edit-handle="right"][data-edit-snapped], [data-edit-handle="start"][data-edit-snapped], [data-edit-handle="end"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
3081
|
+
width: 3px;
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
:where([data-edit-handle*="-"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
3085
|
+
width: 0.5rem;
|
|
3086
|
+
height: 0.5rem;
|
|
3087
|
+
border-radius: 50%;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3087
3090
|
:where([data-edit-handle]):focus-visible:where(:not([data-edit-area="bare"], [data-edit-area="bare"] *)) {
|
|
3088
3091
|
outline: 2px solid var(--edit-accent, var(--color-brand-content));
|
|
3089
3092
|
}
|
|
@@ -4033,13 +4036,27 @@
|
|
|
4033
4036
|
& table {
|
|
4034
4037
|
width: 100%;
|
|
4035
4038
|
table-layout: fixed;
|
|
4039
|
+
border-collapse: separate;
|
|
4040
|
+
border-spacing: 0;
|
|
4041
|
+
border: 1px solid var(--color-line);
|
|
4036
4042
|
|
|
4043
|
+
/* Inner dividers only: the table's own border draws the rounded edge */
|
|
4037
4044
|
& :where(td, th) {
|
|
4038
4045
|
padding: 0.35em 0.5em;
|
|
4039
|
-
border:
|
|
4046
|
+
border: 0 none;
|
|
4047
|
+
border-inline-end: 1px solid var(--color-line);
|
|
4048
|
+
border-block-end: 1px solid var(--color-line);
|
|
4040
4049
|
vertical-align: top;
|
|
4041
4050
|
}
|
|
4042
4051
|
|
|
4052
|
+
& :where(tr > :last-child) {
|
|
4053
|
+
border-inline-end: 0 none;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
& :where(tbody:last-child > tr:last-child > *, tfoot > tr:last-child > *) {
|
|
4057
|
+
border-block-end: 0 none;
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4043
4060
|
& th {
|
|
4044
4061
|
font-weight: 600;
|
|
4045
4062
|
text-align: start;
|
|
@@ -4365,8 +4382,8 @@
|
|
|
4365
4382
|
text-align: left;
|
|
4366
4383
|
text-align: start;
|
|
4367
4384
|
|
|
4368
|
-
/* Make elements within cell inline */
|
|
4369
|
-
&>*:not(template) {
|
|
4385
|
+
/* Make elements within cell inline; text-level elements stay in the text flow */
|
|
4386
|
+
&>*:not(template, br, :is(a, abbr, b, cite, code, data, del, dfn, em, i, ins, kbd, mark, q, s, samp, small, strong, sub, sup, time, u, var):not([role=button], [x-icon], .badge)) {
|
|
4370
4387
|
display: inline-flex;
|
|
4371
4388
|
vertical-align: middle;
|
|
4372
4389
|
|
package/lib/manifest.d.ts
CHANGED
|
@@ -531,6 +531,8 @@ export interface ManifestRichTextAttachOptions {
|
|
|
531
531
|
mode?: 'block' | 'inline';
|
|
532
532
|
/** Inline html only: `<br>` line breaks are kept, Shift+Enter inserts one, pasted blocks become lines. */
|
|
533
533
|
breaks?: boolean;
|
|
534
|
+
/** 'break': Enter inserts a line break too, instead of firing `rich-text:enter`. Needs `breaks` and the 'html' format. */
|
|
535
|
+
enter?: 'break';
|
|
534
536
|
/** false: `.all` controls and `$rich.all` are unavailable (no area-wide --rich-text-* styles). Default true. */
|
|
535
537
|
all?: boolean;
|
|
536
538
|
/** Storage format: 'markdown' (default), 'html' or 'plain'. */
|
package/lib/manifest.data.js
CHANGED
package/lib/manifest.edit.css
CHANGED
|
@@ -25,32 +25,15 @@
|
|
|
25
25
|
outline-offset: 3px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/*
|
|
29
|
-
:where([data-edit-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
translate: calc(-100% - var(--edit-grip-offset, 0.25rem)) 0;
|
|
35
|
-
border-radius: 3px;
|
|
36
|
-
color: var(--edit-accent, var(--color-brand-content));
|
|
37
|
-
background: radial-gradient(circle, currentColor 1px, transparent 1.5px) center / 6px 6px;
|
|
38
|
-
opacity: 0.6;
|
|
28
|
+
/* A piece with its own grab handle drags only from it */
|
|
29
|
+
:where([data-edit-piece][data-edit-grabbable]) {
|
|
30
|
+
cursor: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where([x-edit\.grab]) {
|
|
39
34
|
cursor: grab;
|
|
40
35
|
touch-action: none;
|
|
41
36
|
user-select: none;
|
|
42
|
-
|
|
43
|
-
&:hover {
|
|
44
|
-
opacity: 1;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:where([data-edit-grip]:dir(rtl)) {
|
|
49
|
-
translate: var(--edit-grip-offset, 0.25rem) 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:where([data-edit-grip][hidden]) {
|
|
53
|
-
display: none;
|
|
54
37
|
}
|
|
55
38
|
|
|
56
39
|
/* Lifted, following the pointer */
|
|
@@ -164,6 +147,26 @@
|
|
|
164
147
|
}
|
|
165
148
|
}
|
|
166
149
|
|
|
150
|
+
/* While resizing, the edge stays drawn; at a snap point it thickens */
|
|
151
|
+
:where([data-edit-handle][data-edit-resizing]):where(:not([data-edit-area="bare"] *))::before {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
background-color: var(--edit-accent, var(--color-brand-content));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:where([data-edit-handle="top"][data-edit-snapped], [data-edit-handle="bottom"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
157
|
+
height: 3px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:where([data-edit-handle="left"][data-edit-snapped], [data-edit-handle="right"][data-edit-snapped], [data-edit-handle="start"][data-edit-snapped], [data-edit-handle="end"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
161
|
+
width: 3px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:where([data-edit-handle*="-"][data-edit-snapped]):where(:not([data-edit-area="bare"] *))::before {
|
|
165
|
+
width: 0.5rem;
|
|
166
|
+
height: 0.5rem;
|
|
167
|
+
border-radius: 50%;
|
|
168
|
+
}
|
|
169
|
+
|
|
167
170
|
:where([data-edit-handle]):focus-visible:where(:not([data-edit-area="bare"], [data-edit-area="bare"] *)) {
|
|
168
171
|
outline: 2px solid var(--edit-accent, var(--color-brand-content));
|
|
169
172
|
}
|
package/lib/manifest.edit.js
CHANGED
|
@@ -263,6 +263,7 @@
|
|
|
263
263
|
function registerEdit(el, modifiers, expression) {
|
|
264
264
|
if (modifiers.includes('cssvar')) return registerCssVar(el, expression, modifiers);
|
|
265
265
|
modifiers.forEach(m => { if (RETIRED[m] && !warnedRetired.has(m)) { warnedRetired.add(m); console.warn(`[edit] x-edit.${m} was removed — use ${RETIRED[m]}`); } });
|
|
266
|
+
if (modifiers.includes('grab')) return; // a piece's own drag handle, not a region
|
|
266
267
|
if (modifiers.includes('lock')) {
|
|
267
268
|
const actions = modifiers.filter(m => LOCK_ACTIONS.includes(m));
|
|
268
269
|
el._editLock = new Set(actions.length ? actions : ['*']);
|
|
@@ -330,7 +331,7 @@
|
|
|
330
331
|
};
|
|
331
332
|
function dataSourceExpr(area) { const t = listTpl(area); const m = t && t.getAttribute('x-for').match(/\bin\s+(.+)$/); return m ? m[1].trim() : null; }
|
|
332
333
|
const dataSourceName = (area) => { const e = dataSourceExpr(area); const m = e && e.match(/\$x\.(\w+)/); return m ? m[1] : (e || 'source'); };
|
|
333
|
-
const pluginNode = (x) => x.hasAttribute('data-edit-handle') || x.hasAttribute('data-edit-ghost')
|
|
334
|
+
const pluginNode = (x) => x.hasAttribute('data-edit-handle') || x.hasAttribute('data-edit-ghost');
|
|
334
335
|
// A component's roots past its first follow that first one (its <x-name> host) everywhere.
|
|
335
336
|
const groupOf = (el) => el && el._manifestHost && el._manifestHost.roots && el._manifestHost.roots[0] === el ? el._manifestHost.roots.slice() : [el];
|
|
336
337
|
const extraRoot = (x) => !!x._manifestHost && !!x._manifestHost.roots && x._manifestHost.roots[0] !== x;
|
|
@@ -359,7 +360,7 @@
|
|
|
359
360
|
function plainFormatted(el) {
|
|
360
361
|
if (!window.ManifestRichText) return false;
|
|
361
362
|
const c = el.cloneNode(true);
|
|
362
|
-
c.querySelectorAll('[data-edit-handle], [data-edit-ghost]
|
|
363
|
+
c.querySelectorAll('[data-edit-handle], [data-edit-ghost]').forEach(n => n.remove());
|
|
363
364
|
commentsIn(c).forEach(n => n.remove());
|
|
364
365
|
if (!c.children.length) return true;
|
|
365
366
|
c.querySelectorAll('*').forEach(n => [...n.attributes].forEach(a => { if (a.name.startsWith('data-edit-')) n.removeAttribute(a.name); }));
|
|
@@ -1103,7 +1104,7 @@
|
|
|
1103
1104
|
const src = [el, ...el.querySelectorAll('*')], dst = [c, ...c.querySelectorAll('*')];
|
|
1104
1105
|
dst.forEach((n, i) => { if (addedTab.has(src[i])) n.removeAttribute('tabindex'); });
|
|
1105
1106
|
unrich(el, c);
|
|
1106
|
-
c.querySelectorAll('[data-edit-handle], [data-edit-live], [data-edit-ghost]
|
|
1107
|
+
c.querySelectorAll('[data-edit-handle], [data-edit-live], [data-edit-ghost]').forEach(n => n.remove());
|
|
1107
1108
|
[c, ...c.querySelectorAll('*')].forEach(n => {
|
|
1108
1109
|
[...n.attributes].forEach(a => { if (a.name.startsWith('data-edit-') && !(keepKeys && a.name === 'data-edit-key')) n.removeAttribute(a.name); });
|
|
1109
1110
|
n.removeAttribute('contenteditable');
|
|
@@ -1357,16 +1358,17 @@
|
|
|
1357
1358
|
if (kind === 'component') return [];
|
|
1358
1359
|
if (kind === 'data') { const tpl = listTpl(area); return tpl ? sortableChildren(tpl.parentElement) : []; }
|
|
1359
1360
|
const out = [];
|
|
1360
|
-
const walk = (c) => sortableChildren(c).forEach(ch => { if (ch.closest('[data-edit-ghost]')) return; if (ch._manifestComponent) { if (isHostEl(ch)) out.push(ch); return; } out.push(ch); if (isContainer(ch) && !isRendered(ch)) walk(ch); });
|
|
1361
|
+
const walk = (c) => sortableChildren(c).forEach(ch => { if (ch.closest('[data-edit-ghost], [x-edit\\.grab]')) return; if (ch._manifestComponent) { if (isHostEl(ch)) out.push(ch); return; } out.push(ch); if (isContainer(ch) && !isRendered(ch)) walk(ch); });
|
|
1361
1362
|
if (isContainer(area)) walk(area);
|
|
1362
1363
|
return out;
|
|
1363
1364
|
}
|
|
1364
|
-
function unmarkPiece(el) { el.removeAttribute('data-edit-piece'); if (addedTab.has(el)) { el.removeAttribute('tabindex'); addedTab.delete(el); } }
|
|
1365
|
+
function unmarkPiece(el) { el.removeAttribute('data-edit-piece'); el.removeAttribute('data-edit-grabbable'); if (addedTab.has(el)) { el.removeAttribute('tabindex'); addedTab.delete(el); } }
|
|
1365
1366
|
function markPieces(area) {
|
|
1366
1367
|
const want = new Set(collectPieces(area).filter(movable));
|
|
1367
1368
|
area.querySelectorAll('[data-edit-piece]').forEach(el => { if (!want.has(el) && regionOf(el.parentElement) === area) unmarkPiece(el); });
|
|
1368
1369
|
want.forEach(el => {
|
|
1369
1370
|
el.setAttribute('data-edit-piece', '');
|
|
1371
|
+
el.toggleAttribute('data-edit-grabbable', !!ownGrab(el));
|
|
1370
1372
|
if (!el.hasAttribute('tabindex')) { el.tabIndex = 0; addedTab.add(el); }
|
|
1371
1373
|
});
|
|
1372
1374
|
}
|
|
@@ -1473,86 +1475,20 @@
|
|
|
1473
1475
|
const area = this;
|
|
1474
1476
|
if (!isActive(area) || (e.pointerType === 'mouse' && e.button !== 0) || e._editDrag) return;
|
|
1475
1477
|
const t = e.target;
|
|
1476
|
-
if (!t || t.nodeType !== 1 || t.
|
|
1478
|
+
if (!t || t.nodeType !== 1 || t.hasAttribute('data-edit-handle')) return;
|
|
1477
1479
|
if (t._pieceMode) { exitPieceMode(t); return; }
|
|
1478
1480
|
let item = null;
|
|
1479
1481
|
for (let n = t; n && n !== area; n = n.parentElement) if (n.hasAttribute('data-edit-piece') && movable(n)) { item = n; break; }
|
|
1480
1482
|
if (!item) return;
|
|
1483
|
+
const grab = ownGrab(item);
|
|
1484
|
+
if (grab) { if (!grab.contains(t)) return; e.preventDefault(); }
|
|
1485
|
+
else if (typing(t)) return; // in the text being typed: the drag selects
|
|
1481
1486
|
e._editDrag = true;
|
|
1482
1487
|
startDrag(e, item, area);
|
|
1483
1488
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
// Text pieces, and rows that are themselves a data field (their surface is for typing too)
|
|
1488
|
-
const needsGrip = (p) => !!p && movable(p) && ((isTextEl(p) && capOf(p, 'text')) || p._editField != null);
|
|
1489
|
-
function gripPiece(node, area) {
|
|
1490
|
-
for (let n = node; n && n.nodeType === 1 && n !== area; n = n.parentElement) if (n.hasAttribute('data-edit-piece')) return needsGrip(n) ? n : null;
|
|
1491
|
-
return null;
|
|
1492
|
-
}
|
|
1493
|
-
function ensureGrip() {
|
|
1494
|
-
if (grip && grip.isConnected) return grip;
|
|
1495
|
-
grip = document.createElement('span');
|
|
1496
|
-
grip.setAttribute('data-edit-grip', '');
|
|
1497
|
-
grip.setAttribute('aria-hidden', 'true');
|
|
1498
|
-
grip.hidden = true;
|
|
1499
|
-
grip.addEventListener('pointerdown', onGripDown);
|
|
1500
|
-
grip.addEventListener('pointerleave', (e) => gripLeave(e.relatedTarget));
|
|
1501
|
-
document.body.appendChild(grip);
|
|
1502
|
-
if (!gripListening) {
|
|
1503
|
-
gripListening = true;
|
|
1504
|
-
window.addEventListener('scroll', placeGrip, { capture: true, passive: true });
|
|
1505
|
-
window.addEventListener('resize', placeGrip, { passive: true });
|
|
1506
|
-
}
|
|
1507
|
-
return grip;
|
|
1508
|
-
}
|
|
1509
|
-
function placeGrip() {
|
|
1510
|
-
if (!gripFor || !grip) return;
|
|
1511
|
-
if (!gripFor.isConnected) return hideGrip();
|
|
1512
|
-
const r = gripFor.getBoundingClientRect(), rtl = getComputedStyle(gripFor).direction === 'rtl';
|
|
1513
|
-
grip.dir = rtl ? 'rtl' : 'ltr';
|
|
1514
|
-
grip.style.top = r.top + 'px';
|
|
1515
|
-
grip.style.left = (rtl ? r.right : r.left) + 'px';
|
|
1516
|
-
}
|
|
1517
|
-
function showGrip(piece) {
|
|
1518
|
-
const area = regionOf(piece);
|
|
1519
|
-
if (dragged || !area || area._edit.bare || piece.closest('[data-edit-area="bare"]')) return hideGrip();
|
|
1520
|
-
const g = ensureGrip();
|
|
1521
|
-
// The grip lives on <body>: it takes the piece's own accent and sizes
|
|
1522
|
-
['--edit-accent', '--edit-grip-size', '--edit-grip-offset'].forEach(v => { const x = rawVar(piece, v); if (x) g.style.setProperty(v, x); else g.style.removeProperty(v); });
|
|
1523
|
-
gripFor = piece; placeGrip(); g.hidden = false;
|
|
1524
|
-
}
|
|
1525
|
-
function hideGrip() { gripFor = null; if (grip) grip.hidden = true; }
|
|
1526
|
-
function gripOver(e, area) {
|
|
1527
|
-
if (dragged) return;
|
|
1528
|
-
const p = gripPiece(e.target, area);
|
|
1529
|
-
gripHovered = p;
|
|
1530
|
-
if (p) showGrip(p); else if (gripFocused) showGrip(gripFocused); else hideGrip();
|
|
1531
|
-
}
|
|
1532
|
-
function gripLeave(to) {
|
|
1533
|
-
if (to && grip && (to === grip || (gripFor && gripFor.contains(to)))) return;
|
|
1534
|
-
gripHovered = null;
|
|
1535
|
-
if (gripFocused && gripFocused.isConnected) showGrip(gripFocused); else hideGrip();
|
|
1536
|
-
}
|
|
1537
|
-
function gripFocus(e, area) {
|
|
1538
|
-
const p = gripPiece(e.target, area);
|
|
1539
|
-
gripFocused = p;
|
|
1540
|
-
if (p && !(gripHovered && gripHovered.isConnected)) showGrip(p);
|
|
1541
|
-
}
|
|
1542
|
-
function gripBlur(to) {
|
|
1543
|
-
if (to && gripFocused && gripFocused.contains(to)) return;
|
|
1544
|
-
gripFocused = null;
|
|
1545
|
-
if (!(gripHovered && gripHovered.isConnected)) hideGrip();
|
|
1546
|
-
}
|
|
1547
|
-
function onGripDown(e) {
|
|
1548
|
-
const piece = gripFor;
|
|
1549
|
-
if (!piece || (e.pointerType === 'mouse' && e.button !== 0)) return;
|
|
1550
|
-
const area = regionOf(piece);
|
|
1551
|
-
if (!isActive(area) || !movable(piece)) return;
|
|
1552
|
-
e.preventDefault(); e.stopPropagation();
|
|
1553
|
-
hideGrip();
|
|
1554
|
-
startDrag(e, piece, area);
|
|
1555
|
-
}
|
|
1489
|
+
// An x-edit.grab inside a piece, not a nested piece's: the only place that piece drags from.
|
|
1490
|
+
const ownGrab = (item) => [...item.querySelectorAll('[x-edit\\.grab]')].find(g => g.closest('[data-edit-piece]') === item) || null;
|
|
1491
|
+
const typing = (t) => { const a = document.activeElement; return !!a && a !== document.body && a.isContentEditable && (a === t || a.contains(t)); };
|
|
1556
1492
|
|
|
1557
1493
|
function startDrag(e, item, area) {
|
|
1558
1494
|
const home = item.parentElement, homeNext = groupOf(item).pop().nextElementSibling, rest = groupOf(item).slice(1);
|
|
@@ -1569,6 +1505,8 @@
|
|
|
1569
1505
|
let active = false, frame = 0, px = sx, py = sy, last = null;
|
|
1570
1506
|
|
|
1571
1507
|
const lift = (ev) => {
|
|
1508
|
+
const a = document.activeElement; if (a && item.contains(a) && a.isContentEditable) a.blur(); // a text piece moves, it isn't typed in
|
|
1509
|
+
try { window.getSelection().removeAllRanges(); } catch { }
|
|
1572
1510
|
if (s.crossOK) areas().forEach(a => { if (a !== area && dropValid(a)) a.setAttribute('data-edit-drop-target', ''); });
|
|
1573
1511
|
const ghost = s.ghost = item.cloneNode(true);
|
|
1574
1512
|
unrich(item, ghost);
|
|
@@ -1601,7 +1539,7 @@
|
|
|
1601
1539
|
px = ev.clientX; py = ev.clientY;
|
|
1602
1540
|
if (!active) {
|
|
1603
1541
|
if (Math.hypot(px - sx, py - sy) < 5) return;
|
|
1604
|
-
active = true;
|
|
1542
|
+
active = true; lift(ev); paint();
|
|
1605
1543
|
}
|
|
1606
1544
|
ev.preventDefault();
|
|
1607
1545
|
const drop = dropTarget(px, py, s);
|
|
@@ -1884,9 +1822,9 @@
|
|
|
1884
1822
|
const showable = (v) => { try { return JSON.stringify(v) !== undefined ? JSON.parse(JSON.stringify(v)) : true; } catch { return true; } };
|
|
1885
1823
|
function setShow(el, expr, value) { window.Alpine.evaluate(el, `${expr} = ${JSON.stringify(value)}`); }
|
|
1886
1824
|
// Closing is logged with the size change, so one undo reopens it.
|
|
1887
|
-
function closeVia(area, el, expr, join) {
|
|
1888
|
-
let before;
|
|
1889
|
-
try { before = showable(window.Alpine.evaluate(el, expr)); setShow(el, expr, false); } catch (err) { console.warn('[edit] could not close via x-show:', err); return false; }
|
|
1825
|
+
function closeVia(area, el, expr, join, prior) {
|
|
1826
|
+
let before = prior;
|
|
1827
|
+
try { if (before === undefined) before = showable(window.Alpine.evaluate(el, expr)); setShow(el, expr, false); } catch (err) { console.warn('[edit] could not close via x-show:', err); return false; }
|
|
1890
1828
|
const id = identity(el, area);
|
|
1891
1829
|
if (id != null) pushDelta(Object.assign({ kind: 'show', region: key(area), key: id, expr, before, value: false }, join ? { join: true } : {}));
|
|
1892
1830
|
return true;
|
|
@@ -1905,34 +1843,51 @@
|
|
|
1905
1843
|
const snapW = snapStops(el, 'x', 'w'), snapH = snapStops(el, 'y', 'h');
|
|
1906
1844
|
const closeX = lengthVar(el, '--edit-size-close', 'x', 'w'), closeY = lengthVar(el, '--edit-size-close', 'y', 'h');
|
|
1907
1845
|
const showExpr = closeX != null || closeY != null ? closable(el) : null;
|
|
1908
|
-
|
|
1846
|
+
let showBefore;
|
|
1847
|
+
if (showExpr) { try { showBefore = showable(window.Alpine.evaluate(el, showExpr)); } catch { } }
|
|
1848
|
+
const handle = e.target;
|
|
1849
|
+
try { handle.setPointerCapture && handle.setPointerCapture(e.pointerId); } catch { }
|
|
1850
|
+
handle.setAttribute('data-edit-resizing', '');
|
|
1909
1851
|
showOverlay();
|
|
1910
|
-
let rawW = baseW, rawH = baseH;
|
|
1852
|
+
let rawW = baseW, rawH = baseH, closed = false;
|
|
1853
|
+
const shut = () => ((right || left) && closeX != null && rawW < closeX) || ((top || bottom) && closeY != null && rawH < closeY);
|
|
1854
|
+
// Closes live once past the close size, and reopens if dragged back out.
|
|
1855
|
+
const setClosed = (v) => { if (v === closed || !showExpr) return; closed = v; try { setShow(el, showExpr, v ? false : showBefore); } catch { } };
|
|
1911
1856
|
const move = (ev) => {
|
|
1912
1857
|
const dx = ev.clientX - sx, dy = ev.clientY - sy;
|
|
1913
|
-
if (right || left)
|
|
1914
|
-
if (top || bottom)
|
|
1858
|
+
if (right || left) rawW = baseW + (right ? dx : -dx);
|
|
1859
|
+
if (top || bottom) rawH = baseH + (bottom ? dy : -dy);
|
|
1860
|
+
setClosed(shut());
|
|
1861
|
+
let snapped = false;
|
|
1862
|
+
if (right || left) { const c = clamp(rawW, minW, maxW), v = snapTo(c, snapW, reachX); snapped = snapped || (snapW.length > 0 && v !== c); el.style.width = toUnit(v, wu, el, el.parentElement, 'w') + wu; }
|
|
1863
|
+
if (top || bottom) { const c = clamp(rawH, minH, maxH), v = snapTo(c, snapH, reachY); snapped = snapped || (snapH.length > 0 && v !== c); el.style.height = toUnit(v, hu, el, el.parentElement, 'h') + hu; }
|
|
1864
|
+
el.toggleAttribute('data-edit-snapped', snapped && !closed);
|
|
1865
|
+
handle.toggleAttribute('data-edit-snapped', snapped && !closed);
|
|
1915
1866
|
sizeEvent(el, false);
|
|
1916
1867
|
};
|
|
1917
1868
|
const end = () => {
|
|
1918
1869
|
document.removeEventListener('pointermove', move); document.removeEventListener('pointerup', up); document.removeEventListener('pointercancel', cancel);
|
|
1919
1870
|
hideOverlay();
|
|
1871
|
+
['data-edit-snapped', 'data-edit-resizing'].forEach(a => handle.removeAttribute(a));
|
|
1872
|
+
el.removeAttribute('data-edit-snapped');
|
|
1920
1873
|
};
|
|
1921
1874
|
const restore = () => { if (preStyle == null) el.removeAttribute('style'); else el.setAttribute('style', preStyle); };
|
|
1922
|
-
const cancel = () => { end(); restore(); sizeEvent(el, true); };
|
|
1875
|
+
const cancel = () => { end(); setClosed(false); restore(); sizeEvent(el, true); };
|
|
1923
1876
|
const up = () => {
|
|
1924
1877
|
end();
|
|
1925
1878
|
const shutX = (right || left) && closeX != null && rawW < closeX, shutY = (top || bottom) && closeY != null && rawH < closeY;
|
|
1926
1879
|
if ((shutX || shutY) && showExpr) {
|
|
1927
1880
|
// Closed at the minimum it can have; with none, at the size it had, so it reopens sensibly.
|
|
1928
1881
|
const atMin = (shutX ? minW : 0) > 0 || (shutY ? minH : 0) > 0;
|
|
1882
|
+
const hidden = el.style.display; // x-show's own hide, applied while held
|
|
1929
1883
|
restore();
|
|
1930
1884
|
if (atMin) {
|
|
1931
1885
|
if (shutX && minW > 0) el.style.width = toUnit(minW, wu, el, el.parentElement, 'w') + wu;
|
|
1932
1886
|
if (shutY && minH > 0) el.style.height = toUnit(minH, hu, el, el.parentElement, 'h') + hu;
|
|
1933
1887
|
}
|
|
1934
|
-
const sized = commitStyle(area, el); sizeEvent(el, true);
|
|
1935
|
-
|
|
1888
|
+
const sized = commitStyle(area, el); sizeEvent(el, true); // the hide is page state: never logged
|
|
1889
|
+
if (hidden === 'none') el.style.display = 'none';
|
|
1890
|
+
closeVia(area, el, showExpr, sized, showBefore);
|
|
1936
1891
|
return;
|
|
1937
1892
|
}
|
|
1938
1893
|
if (shutX || shutY) { restore(); sizeEvent(el, true); return; } // close configured but not possible here: leave it as it was
|
|
@@ -1981,7 +1936,7 @@
|
|
|
1981
1936
|
if (el._editRt || el._pieceMode) return; // a focused piece re-attaches when it leaves piece mode
|
|
1982
1937
|
const RT = rtEngine();
|
|
1983
1938
|
el._editRtPrior = ['role', 'aria-multiline'].map(a => [a, el.getAttribute(a)]);
|
|
1984
|
-
const h = RT && RT.attach(el, { mode: 'inline', breaks: true, all: false, format, onChange: () => { } });
|
|
1939
|
+
const h = RT && RT.attach(el, { mode: 'inline', breaks: true, enter: 'break', all: false, format, onChange: () => { } });
|
|
1985
1940
|
if (!h) { el.setAttribute('contenteditable', 'true'); return; }
|
|
1986
1941
|
el._editRt = h;
|
|
1987
1942
|
el.setAttribute('data-edit-text', '');
|
|
@@ -2042,7 +1997,11 @@
|
|
|
2042
1997
|
if (el._textBound) return; el._textBound = true;
|
|
2043
1998
|
el._commitText = commit;
|
|
2044
1999
|
el.addEventListener('focus', () => { restartRich(el); el._preEdit = leafText(el); selectAllIn(el); });
|
|
2045
|
-
el.addEventListener('keydown', (e) => {
|
|
2000
|
+
el.addEventListener('keydown', (e) => {
|
|
2001
|
+
if (!el.isContentEditable) return;
|
|
2002
|
+
if (e.key === 'Escape') { e.preventDefault(); e.stopImmediatePropagation(); el.blur(); }
|
|
2003
|
+
else if (e.key === 'Enter' && e.altKey && !e.shiftKey && !e.metaKey && !e.ctrlKey) { e.preventDefault(); e.stopImmediatePropagation(); leaveText(el); }
|
|
2004
|
+
});
|
|
2046
2005
|
el.addEventListener('keydown', richHistoryKey);
|
|
2047
2006
|
noDrop(el);
|
|
2048
2007
|
if (input) el.addEventListener('input', input);
|
|
@@ -2075,7 +2034,7 @@
|
|
|
2075
2034
|
const nodes = [...area.querySelectorAll('*')];
|
|
2076
2035
|
if (!realChildren(area).length || wholeLeaf(area)) nodes.unshift(area); // size handles are children too
|
|
2077
2036
|
nodes.forEach(el => {
|
|
2078
|
-
if ((realChildren(el).length && !wholeLeaf(el)) || !el.textContent.trim() || el.closest('template') || el.
|
|
2037
|
+
if ((realChildren(el).length && !wholeLeaf(el)) || !el.textContent.trim() || el.closest('template') || el.closest('[data-edit-handle], [x-edit\\.grab]')) return;
|
|
2079
2038
|
if (el._manifestComponent && el !== area) return; // a component host: its markup is another file's
|
|
2080
2039
|
if (richOwned(el)) return; // the rich editor owns this subtree
|
|
2081
2040
|
if (el.closest('[contenteditable="false"]:not([data-edit-piece-mode])')) return; // an authored non-editable island
|
|
@@ -2154,7 +2113,7 @@
|
|
|
2154
2113
|
editable(el, 'html');
|
|
2155
2114
|
});
|
|
2156
2115
|
}
|
|
2157
|
-
//
|
|
2116
|
+
// Alt+Enter leaves text with the piece focused, so Space picks it up and Alt+arrows move it.
|
|
2158
2117
|
function leaveText(el) {
|
|
2159
2118
|
el.blur();
|
|
2160
2119
|
const piece = [el, ...ancestorsIn(el)].find(n => n.hasAttribute && n.hasAttribute('data-edit-piece'));
|
|
@@ -2525,10 +2484,6 @@
|
|
|
2525
2484
|
area._editBound = true;
|
|
2526
2485
|
area.addEventListener('pointerdown', onAreaPointerDown);
|
|
2527
2486
|
area.addEventListener('keydown', (e) => { if (isActive(area)) onPieceKeydown(e, area); });
|
|
2528
|
-
area.addEventListener('pointerover', (e) => { if (isActive(area)) gripOver(e, area); });
|
|
2529
|
-
area.addEventListener('pointerleave', (e) => gripLeave(e.relatedTarget));
|
|
2530
|
-
area.addEventListener('focusin', (e) => { if (isActive(area)) gripFocus(e, area); });
|
|
2531
|
-
area.addEventListener('focusout', (e) => gripBlur(e.relatedTarget));
|
|
2532
2487
|
// Native HTML5 drag would drop selected text into neighbouring leaves.
|
|
2533
2488
|
area.addEventListener('dragstart', (e) => { if (isActive(area)) e.preventDefault(); });
|
|
2534
2489
|
area.addEventListener('drop', (e) => { if (isActive(area)) e.preventDefault(); });
|
|
@@ -2543,7 +2498,6 @@
|
|
|
2543
2498
|
}
|
|
2544
2499
|
}
|
|
2545
2500
|
function disarmArea(area) {
|
|
2546
|
-
if (gripFor && area.contains(gripFor)) hideGrip();
|
|
2547
2501
|
[area, ...area.querySelectorAll('[data-edit-area]')].forEach(e => { if (e._editPos) { e.style.removeProperty('position'); e._editPos = false; } });
|
|
2548
2502
|
area.querySelectorAll('[data-edit-handle]').forEach(h => h.remove());
|
|
2549
2503
|
uneditIn(area);
|