V1_commit_RGC

This commit is contained in:
2026-02-11 13:57:54 +01:00
commit ef397eedac
4901 changed files with 292881 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,516 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.LineBreaker = exports.inlineBreakOpportunities = exports.lineBreakAtIndex = exports.codePointsToCharacterClasses = exports.UnicodeTrie = exports.BREAK_ALLOWED = exports.BREAK_NOT_ALLOWED = exports.BREAK_MANDATORY = exports.classes = exports.LETTER_NUMBER_MODIFIER = void 0;
var utrie_1 = require("utrie");
var linebreak_trie_1 = require("./linebreak-trie");
var Util_1 = require("./Util");
exports.LETTER_NUMBER_MODIFIER = 50;
// Non-tailorable Line Breaking Classes
var BK = 1; // Cause a line break (after)
var CR = 2; // Cause a line break (after), except between CR and LF
var LF = 3; // Cause a line break (after)
var CM = 4; // Prohibit a line break between the character and the preceding character
var NL = 5; // Cause a line break (after)
var SG = 6; // Do not occur in well-formed text
var WJ = 7; // Prohibit line breaks before and after
var ZW = 8; // Provide a break opportunity
var GL = 9; // Prohibit line breaks before and after
var SP = 10; // Enable indirect line breaks
var ZWJ = 11; // Prohibit line breaks within joiner sequences
// Break Opportunities
var B2 = 12; // Provide a line break opportunity before and after the character
var BA = 13; // Generally provide a line break opportunity after the character
var BB = 14; // Generally provide a line break opportunity before the character
var HY = 15; // Provide a line break opportunity after the character, except in numeric context
var CB = 16; // Provide a line break opportunity contingent on additional information
// Characters Prohibiting Certain Breaks
var CL = 17; // Prohibit line breaks before
var CP = 18; // Prohibit line breaks before
var EX = 19; // Prohibit line breaks before
var IN = 20; // Allow only indirect line breaks between pairs
var NS = 21; // Allow only indirect line breaks before
var OP = 22; // Prohibit line breaks after
var QU = 23; // Act like they are both opening and closing
// Numeric Context
var IS = 24; // Prevent breaks after any and before numeric
var NU = 25; // Form numeric expressions for line breaking purposes
var PO = 26; // Do not break following a numeric expression
var PR = 27; // Do not break in front of a numeric expression
var SY = 28; // Prevent a break before; and allow a break after
// Other Characters
var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID
var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters
var CJ = 31; // Treat as NS or ID for strict or normal breaking.
var EB = 32; // Do not break from following Emoji Modifier
var EM = 33; // Do not break from preceding Emoji Base
var H2 = 34; // Form Korean syllable blocks
var H3 = 35; // Form Korean syllable blocks
var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic
var ID = 37; // Break before or after; except in some numeric context
var JL = 38; // Form Korean syllable blocks
var JV = 39; // Form Korean syllable blocks
var JT = 40; // Form Korean syllable blocks
var RI = 41; // Keep pairs together. For pairs; break before and after other classes
var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis
var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions
var ea_OP = [0x2329, 0xff08];
exports.classes = {
BK: BK,
CR: CR,
LF: LF,
CM: CM,
NL: NL,
SG: SG,
WJ: WJ,
ZW: ZW,
GL: GL,
SP: SP,
ZWJ: ZWJ,
B2: B2,
BA: BA,
BB: BB,
HY: HY,
CB: CB,
CL: CL,
CP: CP,
EX: EX,
IN: IN,
NS: NS,
OP: OP,
QU: QU,
IS: IS,
NU: NU,
PO: PO,
PR: PR,
SY: SY,
AI: AI,
AL: AL,
CJ: CJ,
EB: EB,
EM: EM,
H2: H2,
H3: H3,
HL: HL,
ID: ID,
JL: JL,
JV: JV,
JT: JT,
RI: RI,
SA: SA,
XX: XX,
};
exports.BREAK_MANDATORY = '!';
exports.BREAK_NOT_ALLOWED = '×';
exports.BREAK_ALLOWED = '÷';
exports.UnicodeTrie = utrie_1.createTrieFromBase64(linebreak_trie_1.base64, linebreak_trie_1.byteLength);
var ALPHABETICS = [AL, HL];
var HARD_LINE_BREAKS = [BK, CR, LF, NL];
var SPACE = [SP, ZW];
var PREFIX_POSTFIX = [PR, PO];
var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE);
var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
var HYPHEN = [HY, BA];
var codePointsToCharacterClasses = function (codePoints, lineBreak) {
if (lineBreak === void 0) { lineBreak = 'strict'; }
var types = [];
var indices = [];
var categories = [];
codePoints.forEach(function (codePoint, index) {
var classType = exports.UnicodeTrie.get(codePoint);
if (classType > exports.LETTER_NUMBER_MODIFIER) {
categories.push(true);
classType -= exports.LETTER_NUMBER_MODIFIER;
}
else {
categories.push(false);
}
if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
// U+2010, U+2013, 〜 U+301C, U+30A0
if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
indices.push(index);
return types.push(CB);
}
}
if (classType === CM || classType === ZWJ) {
// LB10 Treat any remaining combining mark or ZWJ as AL.
if (index === 0) {
indices.push(index);
return types.push(AL);
}
// LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
// the base character in all of the following rules. Treat ZWJ as if it were CM.
var prev = types[index - 1];
if (LINE_BREAKS.indexOf(prev) === -1) {
indices.push(indices[index - 1]);
return types.push(prev);
}
indices.push(index);
return types.push(AL);
}
indices.push(index);
if (classType === CJ) {
return types.push(lineBreak === 'strict' ? NS : ID);
}
if (classType === SA) {
return types.push(AL);
}
if (classType === AI) {
return types.push(AL);
}
// For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
// and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
// to take into account the actual line breaking properties for these characters.
if (classType === XX) {
if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) {
return types.push(ID);
}
else {
return types.push(AL);
}
}
types.push(classType);
});
return [indices, types, categories];
};
exports.codePointsToCharacterClasses = codePointsToCharacterClasses;
var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) {
var current = classTypes[currentIndex];
if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
var i = currentIndex;
while (i <= classTypes.length) {
i++;
var next = classTypes[i];
if (next === b) {
return true;
}
if (next !== SP) {
break;
}
}
}
if (current === SP) {
var i = currentIndex;
while (i > 0) {
i--;
var prev = classTypes[i];
if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
var n = currentIndex;
while (n <= classTypes.length) {
n++;
var next = classTypes[n];
if (next === b) {
return true;
}
if (next !== SP) {
break;
}
}
}
if (prev !== SP) {
break;
}
}
}
return false;
};
var previousNonSpaceClassType = function (currentIndex, classTypes) {
var i = currentIndex;
while (i >= 0) {
var type = classTypes[i];
if (type === SP) {
i--;
}
else {
return type;
}
}
return 0;
};
var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) {
if (indicies[index] === 0) {
return exports.BREAK_NOT_ALLOWED;
}
var currentIndex = index - 1;
if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
return exports.BREAK_NOT_ALLOWED;
}
var beforeIndex = currentIndex - 1;
var afterIndex = currentIndex + 1;
var current = classTypes[currentIndex];
// LB4 Always break after hard line breaks.
// LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
var next = classTypes[afterIndex];
if (current === CR && next === LF) {
return exports.BREAK_NOT_ALLOWED;
}
if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
return exports.BREAK_MANDATORY;
}
// LB6 Do not break before hard line breaks.
if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB7 Do not break before spaces or zero width space.
if (SPACE.indexOf(next) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
return exports.BREAK_ALLOWED;
}
// LB8a Do not break after a zero width joiner.
if (exports.UnicodeTrie.get(codePoints[currentIndex]) === ZWJ) {
return exports.BREAK_NOT_ALLOWED;
}
// zwj emojis
if ((current === EB || current === EM) && exports.UnicodeTrie.get(codePoints[afterIndex]) === ZWJ) {
return exports.BREAK_NOT_ALLOWED;
}
// LB11 Do not break before or after Word joiner and related characters.
if (current === WJ || next === WJ) {
return exports.BREAK_NOT_ALLOWED;
}
// LB12 Do not break after NBSP and related characters.
if (current === GL) {
return exports.BREAK_NOT_ALLOWED;
}
// LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
return exports.BREAK_NOT_ALLOWED;
}
// LB13 Do not break before ] or ! or ; or /, even after spaces.
if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB14 Do not break after [, even after spaces.
if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
return exports.BREAK_NOT_ALLOWED;
}
// LB15 Do not break within ‘”[, even with intervening spaces.
if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB17 Do not break within ‘——’, even with intervening spaces.
if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB18 Break after spaces.
if (current === SP) {
return exports.BREAK_ALLOWED;
}
// LB19 Do not break before or after quotation marks, such as .
if (current === QU || next === QU) {
return exports.BREAK_NOT_ALLOWED;
}
// LB20 Break before and after unresolved CB.
if (next === CB || current === CB) {
return exports.BREAK_ALLOWED;
}
// LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
return exports.BREAK_NOT_ALLOWED;
}
// LB21a Don't break after Hebrew + Hyphen.
if (before === HL && HYPHEN.indexOf(current) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB21b Dont break between Solidus and Hebrew letters.
if (current === SY && next === HL) {
return exports.BREAK_NOT_ALLOWED;
}
// LB22 Do not break before ellipsis.
if (next === IN) {
return exports.BREAK_NOT_ALLOWED;
}
// LB23 Do not break between digits and letters.
if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) ||
([ID, EB, EM].indexOf(current) !== -1 && next === PO)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) ||
(PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB25 Do not break between the following pairs of classes relevant to numbers:
if (
// (PR | PO) × ( OP | HY )? NU
([PR, PO].indexOf(current) !== -1 &&
(next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) ||
// ( OP | HY ) × NU
([OP, HY].indexOf(current) !== -1 && next === NU) ||
// NU × (NU | SY | IS)
(current === NU && [NU, SY, IS].indexOf(next) !== -1)) {
return exports.BREAK_NOT_ALLOWED;
}
// NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
var prevIndex = currentIndex;
while (prevIndex >= 0) {
var type = classTypes[prevIndex];
if (type === NU) {
return exports.BREAK_NOT_ALLOWED;
}
else if ([SY, IS].indexOf(type) !== -1) {
prevIndex--;
}
else {
break;
}
}
}
// NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
if ([PR, PO].indexOf(next) !== -1) {
var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
while (prevIndex >= 0) {
var type = classTypes[prevIndex];
if (type === NU) {
return exports.BREAK_NOT_ALLOWED;
}
else if ([SY, IS].indexOf(type) !== -1) {
prevIndex--;
}
else {
break;
}
}
}
// LB26 Do not break a Korean syllable.
if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) ||
([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) ||
([JT, H3].indexOf(current) !== -1 && next === JT)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB27 Treat a Korean Syllable Block the same as ID.
if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) ||
(KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB28 Do not break between alphabetics (“at”).
if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
return exports.BREAK_NOT_ALLOWED;
}
// LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 &&
next === OP &&
ea_OP.indexOf(codePoints[afterIndex]) === -1) ||
(ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) {
return exports.BREAK_NOT_ALLOWED;
}
// LB30a Break between two regional indicator symbols if and only if there are an even number of regional
// indicators preceding the position of the break.
if (current === RI && next === RI) {
var i = indicies[currentIndex];
var count = 1;
while (i > 0) {
i--;
if (classTypes[i] === RI) {
count++;
}
else {
break;
}
}
if (count % 2 !== 0) {
return exports.BREAK_NOT_ALLOWED;
}
}
// LB30b Do not break between an emoji base and an emoji modifier.
if (current === EB && next === EM) {
return exports.BREAK_NOT_ALLOWED;
}
return exports.BREAK_ALLOWED;
};
var lineBreakAtIndex = function (codePoints, index) {
// LB2 Never break at the start of text.
if (index === 0) {
return exports.BREAK_NOT_ALLOWED;
}
// LB3 Always break at the end of text.
if (index >= codePoints.length) {
return exports.BREAK_MANDATORY;
}
var _a = exports.codePointsToCharacterClasses(codePoints), indices = _a[0], classTypes = _a[1];
return _lineBreakAtIndex(codePoints, classTypes, indices, index);
};
exports.lineBreakAtIndex = lineBreakAtIndex;
var cssFormattedClasses = function (codePoints, options) {
if (!options) {
options = { lineBreak: 'normal', wordBreak: 'normal' };
}
var _a = exports.codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2];
if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); });
}
var forbiddenBreakpoints = options.wordBreak === 'keep-all'
? isLetterNumber.map(function (letterNumber, i) {
return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
})
: undefined;
return [indicies, classTypes, forbiddenBreakpoints];
};
var inlineBreakOpportunities = function (str, options) {
var codePoints = Util_1.toCodePoints(str);
var output = exports.BREAK_NOT_ALLOWED;
var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
codePoints.forEach(function (codePoint, i) {
output +=
Util_1.fromCodePoint(codePoint) +
(i >= codePoints.length - 1
? exports.BREAK_MANDATORY
: _lineBreakAtIndex(codePoints, classTypes, indicies, i + 1, forbiddenBreakpoints));
});
return output;
};
exports.inlineBreakOpportunities = inlineBreakOpportunities;
var Break = /** @class */ (function () {
function Break(codePoints, lineBreak, start, end) {
this.codePoints = codePoints;
this.required = lineBreak === exports.BREAK_MANDATORY;
this.start = start;
this.end = end;
}
Break.prototype.slice = function () {
return Util_1.fromCodePoint.apply(void 0, this.codePoints.slice(this.start, this.end));
};
return Break;
}());
var LineBreaker = function (str, options) {
var codePoints = Util_1.toCodePoints(str);
var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
var length = codePoints.length;
var lastEnd = 0;
var nextIndex = 0;
return {
next: function () {
if (nextIndex >= length) {
return { done: true, value: null };
}
var lineBreak = exports.BREAK_NOT_ALLOWED;
while (nextIndex < length &&
(lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) ===
exports.BREAK_NOT_ALLOWED) { }
if (lineBreak !== exports.BREAK_NOT_ALLOWED || nextIndex === length) {
var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
lastEnd = nextIndex;
return { value: value, done: false };
}
return { done: true, value: null };
},
};
};
exports.LineBreaker = LineBreaker;
//# sourceMappingURL=LineBreak.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,109 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.polyUint32Array = exports.polyUint16Array = exports.decode = exports.fromCodePoint = exports.toCodePoints = void 0;
var toCodePoints = function (str) {
var codePoints = [];
var i = 0;
var length = str.length;
while (i < length) {
var value = str.charCodeAt(i++);
if (value >= 0xd800 && value <= 0xdbff && i < length) {
var extra = str.charCodeAt(i++);
if ((extra & 0xfc00) === 0xdc00) {
codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
}
else {
codePoints.push(value);
i--;
}
}
else {
codePoints.push(value);
}
}
return codePoints;
};
exports.toCodePoints = toCodePoints;
var fromCodePoint = function () {
var codePoints = [];
for (var _i = 0; _i < arguments.length; _i++) {
codePoints[_i] = arguments[_i];
}
if (String.fromCodePoint) {
return String.fromCodePoint.apply(String, codePoints);
}
var length = codePoints.length;
if (!length) {
return '';
}
var codeUnits = [];
var index = -1;
var result = '';
while (++index < length) {
var codePoint = codePoints[index];
if (codePoint <= 0xffff) {
codeUnits.push(codePoint);
}
else {
codePoint -= 0x10000;
codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00);
}
if (index + 1 === length || codeUnits.length > 0x4000) {
result += String.fromCharCode.apply(String, codeUnits);
codeUnits.length = 0;
}
}
return result;
};
exports.fromCodePoint = fromCodePoint;
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
var decode = function (base64) {
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
if (base64[base64.length - 1] === '=') {
bufferLength--;
if (base64[base64.length - 2] === '=') {
bufferLength--;
}
}
var buffer = typeof ArrayBuffer !== 'undefined' &&
typeof Uint8Array !== 'undefined' &&
typeof Uint8Array.prototype.slice !== 'undefined'
? new ArrayBuffer(bufferLength)
: new Array(bufferLength);
var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
for (i = 0; i < len; i += 4) {
encoded1 = lookup[base64.charCodeAt(i)];
encoded2 = lookup[base64.charCodeAt(i + 1)];
encoded3 = lookup[base64.charCodeAt(i + 2)];
encoded4 = lookup[base64.charCodeAt(i + 3)];
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return buffer;
};
exports.decode = decode;
var polyUint16Array = function (buffer) {
var length = buffer.length;
var bytes = [];
for (var i = 0; i < length; i += 2) {
bytes.push((buffer[i + 1] << 8) | buffer[i]);
}
return bytes;
};
exports.polyUint16Array = polyUint16Array;
var polyUint32Array = function (buffer) {
var length = buffer.length;
var bytes = [];
for (var i = 0; i < length; i += 4) {
bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]);
}
return bytes;
};
exports.polyUint32Array = polyUint32Array;
//# sourceMappingURL=Util.js.map

View File

@@ -0,0 +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AAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KAChG;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAPW,QAAA,eAAe,mBAO1B"}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LineBreaker = exports.fromCodePoint = exports.toCodePoints = void 0;
var Util_1 = require("./Util");
Object.defineProperty(exports, "toCodePoints", { enumerable: true, get: function () { return Util_1.toCodePoints; } });
Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return Util_1.fromCodePoint; } });
var LineBreak_1 = require("./LineBreak");
Object.defineProperty(exports, "LineBreaker", { enumerable: true, get: function () { return LineBreak_1.LineBreaker; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAAmD;AAA3C,oGAAA,YAAY,OAAA;AAAE,qGAAA,aAAa,OAAA;AACnC,yCAAwC;AAAhC,wGAAA,WAAW,OAAA"}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":3,"file":"linebreak-trie.js","sourceRoot":"","sources":["../../src/linebreak-trie.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GACf,0pnDAA0pnD,CAAC;AAClpnD,QAAA,UAAU,GAAG,KAAK,CAAC"}

View File

@@ -0,0 +1,38 @@
export declare const LETTER_NUMBER_MODIFIER = 50;
export declare const classes: {
[key: string]: number;
};
export declare const BREAK_MANDATORY = "!";
export declare const BREAK_NOT_ALLOWED = "\u00D7";
export declare const BREAK_ALLOWED = "\u00F7";
export declare const UnicodeTrie: import("utrie").Trie;
export declare const codePointsToCharacterClasses: (codePoints: number[], lineBreak?: string) => [number[], number[], boolean[]];
export declare type BREAK_OPPORTUNITIES = typeof BREAK_NOT_ALLOWED | typeof BREAK_ALLOWED | typeof BREAK_MANDATORY;
export declare const lineBreakAtIndex: (codePoints: number[], index: number) => BREAK_OPPORTUNITIES;
export declare type LINE_BREAK = 'auto' | 'normal' | 'strict';
export declare type WORD_BREAK = 'normal' | 'break-all' | 'break-word' | 'keep-all';
interface IOptions {
lineBreak?: LINE_BREAK;
wordBreak?: WORD_BREAK;
}
export declare const inlineBreakOpportunities: (str: string, options?: IOptions | undefined) => string;
declare class Break {
private readonly codePoints;
readonly required: boolean;
readonly start: number;
readonly end: number;
constructor(codePoints: number[], lineBreak: string, start: number, end: number);
slice(): string;
}
export declare type LineBreak = {
done: true;
value: null;
} | {
done: false;
value: Break;
};
interface ILineBreakIterator {
next: () => LineBreak;
}
export declare const LineBreaker: (str: string, options?: IOptions | undefined) => ILineBreakIterator;
export {};

View File

@@ -0,0 +1,5 @@
export declare const toCodePoints: (str: string) => number[];
export declare const fromCodePoint: (...codePoints: number[]) => string;
export declare const decode: (base64: string) => ArrayBuffer | number[];
export declare const polyUint16Array: (buffer: number[]) => number[];
export declare const polyUint32Array: (buffer: number[]) => number[];

View File

@@ -0,0 +1,2 @@
export { toCodePoints, fromCodePoint } from './Util';
export { LineBreaker } from './LineBreak';

File diff suppressed because one or more lines are too long