@shadow-garden/bapbong-model 0.7.0 → 0.9.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/dist/index.cjs +71 -1
- package/dist/index.js +71 -1
- package/dist/lib/model.d.ts +1 -1
- package/dist/lib/model.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -145,7 +145,14 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
145
145
|
page: { default: null },
|
|
146
146
|
// CommentNode[] (contracts) — comment threads keyed to `comment` marks.
|
|
147
147
|
// Edited via setDocAttribute so add/reply/resolve/delete undo cleanly.
|
|
148
|
-
comments: { default: null }
|
|
148
|
+
comments: { default: null },
|
|
149
|
+
// Per-section header/footer story OVERRIDES, keyed by section index →
|
|
150
|
+
// story ('headers'|'footers') → variant ('default'|'first'|'even') →
|
|
151
|
+
// the full story doc as JSON. The first chrome EDIT the model supports
|
|
152
|
+
// (the section marker's page-number toggle): an override replaces the
|
|
153
|
+
// section's inherited story (Word's "unlink from previous"), rides the
|
|
154
|
+
// doc so it undoes cleanly, and exports as a real header/footer part.
|
|
155
|
+
sectionChromeOverrides: { default: null }
|
|
149
156
|
}
|
|
150
157
|
},
|
|
151
158
|
paragraph: {
|
|
@@ -511,6 +518,69 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
511
518
|
],
|
|
512
519
|
toDOM: (mark) => [mark.attrs["value"] === "sub" ? "sub" : "sup", 0]
|
|
513
520
|
},
|
|
521
|
+
// w:spacing (rPr) — tracking in twips, positive = expanded. Absolute:
|
|
522
|
+
// unlike the font size it does not shrink for superscript or small caps.
|
|
523
|
+
letterSpacing: {
|
|
524
|
+
attrs: { twips: {} },
|
|
525
|
+
parseDOM: [
|
|
526
|
+
{
|
|
527
|
+
style: "letter-spacing",
|
|
528
|
+
getAttrs: (value) => {
|
|
529
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
530
|
+
return m ? { twips: Math.round(Number(m[1]) * 20) } : false;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
toDOM: (mark) => [
|
|
535
|
+
"span",
|
|
536
|
+
{ style: `letter-spacing: ${mark.attrs["twips"] / 20}pt` },
|
|
537
|
+
0
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
// w:w — horizontal glyph scale as a PERCENT (100 = normal). Squeezes the
|
|
541
|
+
// glyphs and their advances; independent of letterSpacing, which rides on
|
|
542
|
+
// top at its absolute value.
|
|
543
|
+
charScale: {
|
|
544
|
+
attrs: { percent: {} },
|
|
545
|
+
parseDOM: [
|
|
546
|
+
{
|
|
547
|
+
style: "transform",
|
|
548
|
+
getAttrs: (value) => {
|
|
549
|
+
const m = /^scaleX\(([\d.]+)\)$/.exec(String(value).trim());
|
|
550
|
+
return m ? { percent: Math.round(Number(m[1]) * 100) } : false;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
toDOM: (mark) => [
|
|
555
|
+
"span",
|
|
556
|
+
{
|
|
557
|
+
style: `display: inline-block; transform: scaleX(${mark.attrs["percent"] / 100})`
|
|
558
|
+
},
|
|
559
|
+
0
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
// w:position — baseline shift in half-points, positive up. Unlike
|
|
563
|
+
// super/subscript this does NOT resize the glyphs; Word treats the two
|
|
564
|
+
// as independent and documents combine them.
|
|
565
|
+
position: {
|
|
566
|
+
attrs: { halfPoints: {} },
|
|
567
|
+
parseDOM: [
|
|
568
|
+
{
|
|
569
|
+
style: "vertical-align",
|
|
570
|
+
getAttrs: (value) => {
|
|
571
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
572
|
+
return m ? { halfPoints: Number(m[1]) * 2 } : false;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
toDOM: (mark) => [
|
|
577
|
+
"span",
|
|
578
|
+
{
|
|
579
|
+
style: `vertical-align: ${mark.attrs["halfPoints"] / 2}pt`
|
|
580
|
+
},
|
|
581
|
+
0
|
|
582
|
+
]
|
|
583
|
+
},
|
|
514
584
|
// w:highlight / w:shd w:fill — run background color ("#RRGGBB")
|
|
515
585
|
highlight: {
|
|
516
586
|
attrs: { color: {} },
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,14 @@ var schema = new Schema({
|
|
|
113
113
|
page: { default: null },
|
|
114
114
|
// CommentNode[] (contracts) — comment threads keyed to `comment` marks.
|
|
115
115
|
// Edited via setDocAttribute so add/reply/resolve/delete undo cleanly.
|
|
116
|
-
comments: { default: null }
|
|
116
|
+
comments: { default: null },
|
|
117
|
+
// Per-section header/footer story OVERRIDES, keyed by section index →
|
|
118
|
+
// story ('headers'|'footers') → variant ('default'|'first'|'even') →
|
|
119
|
+
// the full story doc as JSON. The first chrome EDIT the model supports
|
|
120
|
+
// (the section marker's page-number toggle): an override replaces the
|
|
121
|
+
// section's inherited story (Word's "unlink from previous"), rides the
|
|
122
|
+
// doc so it undoes cleanly, and exports as a real header/footer part.
|
|
123
|
+
sectionChromeOverrides: { default: null }
|
|
117
124
|
}
|
|
118
125
|
},
|
|
119
126
|
paragraph: {
|
|
@@ -479,6 +486,69 @@ var schema = new Schema({
|
|
|
479
486
|
],
|
|
480
487
|
toDOM: (mark) => [mark.attrs["value"] === "sub" ? "sub" : "sup", 0]
|
|
481
488
|
},
|
|
489
|
+
// w:spacing (rPr) — tracking in twips, positive = expanded. Absolute:
|
|
490
|
+
// unlike the font size it does not shrink for superscript or small caps.
|
|
491
|
+
letterSpacing: {
|
|
492
|
+
attrs: { twips: {} },
|
|
493
|
+
parseDOM: [
|
|
494
|
+
{
|
|
495
|
+
style: "letter-spacing",
|
|
496
|
+
getAttrs: (value) => {
|
|
497
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
498
|
+
return m ? { twips: Math.round(Number(m[1]) * 20) } : false;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
toDOM: (mark) => [
|
|
503
|
+
"span",
|
|
504
|
+
{ style: `letter-spacing: ${mark.attrs["twips"] / 20}pt` },
|
|
505
|
+
0
|
|
506
|
+
]
|
|
507
|
+
},
|
|
508
|
+
// w:w — horizontal glyph scale as a PERCENT (100 = normal). Squeezes the
|
|
509
|
+
// glyphs and their advances; independent of letterSpacing, which rides on
|
|
510
|
+
// top at its absolute value.
|
|
511
|
+
charScale: {
|
|
512
|
+
attrs: { percent: {} },
|
|
513
|
+
parseDOM: [
|
|
514
|
+
{
|
|
515
|
+
style: "transform",
|
|
516
|
+
getAttrs: (value) => {
|
|
517
|
+
const m = /^scaleX\(([\d.]+)\)$/.exec(String(value).trim());
|
|
518
|
+
return m ? { percent: Math.round(Number(m[1]) * 100) } : false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
],
|
|
522
|
+
toDOM: (mark) => [
|
|
523
|
+
"span",
|
|
524
|
+
{
|
|
525
|
+
style: `display: inline-block; transform: scaleX(${mark.attrs["percent"] / 100})`
|
|
526
|
+
},
|
|
527
|
+
0
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
// w:position — baseline shift in half-points, positive up. Unlike
|
|
531
|
+
// super/subscript this does NOT resize the glyphs; Word treats the two
|
|
532
|
+
// as independent and documents combine them.
|
|
533
|
+
position: {
|
|
534
|
+
attrs: { halfPoints: {} },
|
|
535
|
+
parseDOM: [
|
|
536
|
+
{
|
|
537
|
+
style: "vertical-align",
|
|
538
|
+
getAttrs: (value) => {
|
|
539
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
540
|
+
return m ? { halfPoints: Number(m[1]) * 2 } : false;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
],
|
|
544
|
+
toDOM: (mark) => [
|
|
545
|
+
"span",
|
|
546
|
+
{
|
|
547
|
+
style: `vertical-align: ${mark.attrs["halfPoints"] / 2}pt`
|
|
548
|
+
},
|
|
549
|
+
0
|
|
550
|
+
]
|
|
551
|
+
},
|
|
482
552
|
// w:highlight / w:shd w:fill — run background color ("#RRGGBB")
|
|
483
553
|
highlight: {
|
|
484
554
|
attrs: { color: {} },
|
package/dist/lib/model.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Schema } from 'prosemirror-model';
|
|
|
8
8
|
* extend THIS schema so the importer, layout engine, and (canvas) painter all
|
|
9
9
|
* agree on one document model.
|
|
10
10
|
*/
|
|
11
|
-
export declare const schema: Schema<"paragraph" | "doc" | "text" | "hard_break" | "image" | "page_field" | "table" | "table_row" | "table_cell", "strong" | "em" | "underline" | "strike" | "dstrike" | "smallCaps" | "textColor" | "fontSize" | "vertAlign" | "highlight" | "fontFamily" | "link" | "footnote" | "carryRPr">;
|
|
11
|
+
export declare const schema: Schema<"paragraph" | "doc" | "text" | "hard_break" | "image" | "page_field" | "table" | "table_row" | "table_cell", "strong" | "em" | "underline" | "strike" | "dstrike" | "smallCaps" | "textColor" | "fontSize" | "vertAlign" | "letterSpacing" | "charScale" | "position" | "highlight" | "fontFamily" | "link" | "footnote" | "carryRPr">;
|
|
12
12
|
/** Concrete schema type, handy for typing Node/Mark across packages. */
|
|
13
13
|
export type BapbongSchema = typeof schema;
|
|
14
14
|
/**
|
package/dist/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAkF3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAkF3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,+UA0jBjB,CAAC;AAEH,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,OAAO,MAAM,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