@tiptap/extension-typography 3.20.2 → 3.20.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-typography",
3
3
  "description": "typography extension for tiptap",
4
- "version": "3.20.2",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -31,10 +31,10 @@
31
31
  "dist"
32
32
  ],
33
33
  "devDependencies": {
34
- "@tiptap/core": "^3.20.2"
34
+ "@tiptap/core": "^3.20.3"
35
35
  },
36
36
  "peerDependencies": {
37
- "@tiptap/core": "^3.20.2"
37
+ "@tiptap/core": "^3.20.3"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
package/dist/index.cjs DELETED
@@ -1,268 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Typography: () => Typography,
24
- closeDoubleQuote: () => closeDoubleQuote,
25
- closeSingleQuote: () => closeSingleQuote,
26
- copyright: () => copyright,
27
- default: () => index_default,
28
- ellipsis: () => ellipsis,
29
- emDash: () => emDash,
30
- laquo: () => laquo,
31
- leftArrow: () => leftArrow,
32
- multiplication: () => multiplication,
33
- notEqual: () => notEqual,
34
- oneHalf: () => oneHalf,
35
- oneQuarter: () => oneQuarter,
36
- openDoubleQuote: () => openDoubleQuote,
37
- openSingleQuote: () => openSingleQuote,
38
- plusMinus: () => plusMinus,
39
- raquo: () => raquo,
40
- registeredTrademark: () => registeredTrademark,
41
- rightArrow: () => rightArrow,
42
- servicemark: () => servicemark,
43
- superscriptThree: () => superscriptThree,
44
- superscriptTwo: () => superscriptTwo,
45
- threeQuarters: () => threeQuarters,
46
- trademark: () => trademark
47
- });
48
- module.exports = __toCommonJS(index_exports);
49
-
50
- // src/typography.ts
51
- var import_core = require("@tiptap/core");
52
- var emDash = (override) => (0, import_core.textInputRule)({
53
- find: /--$/,
54
- replace: override != null ? override : "\u2014"
55
- });
56
- var ellipsis = (override) => (0, import_core.textInputRule)({
57
- find: /\.\.\.$/,
58
- replace: override != null ? override : "\u2026"
59
- });
60
- var openDoubleQuote = (override) => (0, import_core.textInputRule)({
61
- find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
62
- replace: override != null ? override : "\u201C"
63
- });
64
- var closeDoubleQuote = (override) => (0, import_core.textInputRule)({
65
- find: /"$/,
66
- replace: override != null ? override : "\u201D"
67
- });
68
- var openSingleQuote = (override) => (0, import_core.textInputRule)({
69
- find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
70
- replace: override != null ? override : "\u2018"
71
- });
72
- var closeSingleQuote = (override) => (0, import_core.textInputRule)({
73
- find: /'$/,
74
- replace: override != null ? override : "\u2019"
75
- });
76
- var leftArrow = (override) => (0, import_core.textInputRule)({
77
- find: /<-$/,
78
- replace: override != null ? override : "\u2190"
79
- });
80
- var rightArrow = (override) => (0, import_core.textInputRule)({
81
- find: /->$/,
82
- replace: override != null ? override : "\u2192"
83
- });
84
- var copyright = (override) => (0, import_core.textInputRule)({
85
- find: /\(c\)$/,
86
- replace: override != null ? override : "\xA9"
87
- });
88
- var trademark = (override) => (0, import_core.textInputRule)({
89
- find: /\(tm\)$/,
90
- replace: override != null ? override : "\u2122"
91
- });
92
- var servicemark = (override) => (0, import_core.textInputRule)({
93
- find: /\(sm\)$/,
94
- replace: override != null ? override : "\u2120"
95
- });
96
- var registeredTrademark = (override) => (0, import_core.textInputRule)({
97
- find: /\(r\)$/,
98
- replace: override != null ? override : "\xAE"
99
- });
100
- var oneHalf = (override) => (0, import_core.textInputRule)({
101
- find: /(?:^|\s)(1\/2)\s$/,
102
- replace: override != null ? override : "\xBD"
103
- });
104
- var plusMinus = (override) => (0, import_core.textInputRule)({
105
- find: /\+\/-$/,
106
- replace: override != null ? override : "\xB1"
107
- });
108
- var notEqual = (override) => (0, import_core.textInputRule)({
109
- find: /!=$/,
110
- replace: override != null ? override : "\u2260"
111
- });
112
- var laquo = (override) => (0, import_core.textInputRule)({
113
- find: /<<$/,
114
- replace: override != null ? override : "\xAB"
115
- });
116
- var raquo = (override) => (0, import_core.textInputRule)({
117
- find: />>$/,
118
- replace: override != null ? override : "\xBB"
119
- });
120
- var multiplication = (override) => (0, import_core.textInputRule)({
121
- find: /\d+\s?([*x])\s?\d+$/,
122
- replace: override != null ? override : "\xD7"
123
- });
124
- var superscriptTwo = (override) => (0, import_core.textInputRule)({
125
- find: /\^2$/,
126
- replace: override != null ? override : "\xB2"
127
- });
128
- var superscriptThree = (override) => (0, import_core.textInputRule)({
129
- find: /\^3$/,
130
- replace: override != null ? override : "\xB3"
131
- });
132
- var oneQuarter = (override) => (0, import_core.textInputRule)({
133
- find: /(?:^|\s)(1\/4)\s$/,
134
- replace: override != null ? override : "\xBC"
135
- });
136
- var threeQuarters = (override) => (0, import_core.textInputRule)({
137
- find: /(?:^|\s)(3\/4)\s$/,
138
- replace: override != null ? override : "\xBE"
139
- });
140
- var Typography = import_core.Extension.create({
141
- name: "typography",
142
- addOptions() {
143
- return {
144
- closeDoubleQuote: "\u201D",
145
- closeSingleQuote: "\u2019",
146
- copyright: "\xA9",
147
- ellipsis: "\u2026",
148
- emDash: "\u2014",
149
- laquo: "\xAB",
150
- leftArrow: "\u2190",
151
- multiplication: "\xD7",
152
- notEqual: "\u2260",
153
- oneHalf: "\xBD",
154
- oneQuarter: "\xBC",
155
- openDoubleQuote: "\u201C",
156
- openSingleQuote: "\u2018",
157
- plusMinus: "\xB1",
158
- raquo: "\xBB",
159
- registeredTrademark: "\xAE",
160
- rightArrow: "\u2192",
161
- servicemark: "\u2120",
162
- superscriptThree: "\xB3",
163
- superscriptTwo: "\xB2",
164
- threeQuarters: "\xBE",
165
- trademark: "\u2122"
166
- };
167
- },
168
- addInputRules() {
169
- const rules = [];
170
- if (this.options.emDash !== false) {
171
- rules.push(emDash(this.options.emDash));
172
- }
173
- if (this.options.ellipsis !== false) {
174
- rules.push(ellipsis(this.options.ellipsis));
175
- }
176
- if (this.options.openDoubleQuote !== false) {
177
- rules.push(openDoubleQuote(this.options.openDoubleQuote));
178
- }
179
- if (this.options.closeDoubleQuote !== false) {
180
- rules.push(closeDoubleQuote(this.options.closeDoubleQuote));
181
- }
182
- if (this.options.openSingleQuote !== false) {
183
- rules.push(openSingleQuote(this.options.openSingleQuote));
184
- }
185
- if (this.options.closeSingleQuote !== false) {
186
- rules.push(closeSingleQuote(this.options.closeSingleQuote));
187
- }
188
- if (this.options.leftArrow !== false) {
189
- rules.push(leftArrow(this.options.leftArrow));
190
- }
191
- if (this.options.rightArrow !== false) {
192
- rules.push(rightArrow(this.options.rightArrow));
193
- }
194
- if (this.options.copyright !== false) {
195
- rules.push(copyright(this.options.copyright));
196
- }
197
- if (this.options.trademark !== false) {
198
- rules.push(trademark(this.options.trademark));
199
- }
200
- if (this.options.servicemark !== false) {
201
- rules.push(servicemark(this.options.servicemark));
202
- }
203
- if (this.options.registeredTrademark !== false) {
204
- rules.push(registeredTrademark(this.options.registeredTrademark));
205
- }
206
- if (this.options.oneHalf !== false) {
207
- rules.push(oneHalf(this.options.oneHalf));
208
- }
209
- if (this.options.plusMinus !== false) {
210
- rules.push(plusMinus(this.options.plusMinus));
211
- }
212
- if (this.options.notEqual !== false) {
213
- rules.push(notEqual(this.options.notEqual));
214
- }
215
- if (this.options.laquo !== false) {
216
- rules.push(laquo(this.options.laquo));
217
- }
218
- if (this.options.raquo !== false) {
219
- rules.push(raquo(this.options.raquo));
220
- }
221
- if (this.options.multiplication !== false) {
222
- rules.push(multiplication(this.options.multiplication));
223
- }
224
- if (this.options.superscriptTwo !== false) {
225
- rules.push(superscriptTwo(this.options.superscriptTwo));
226
- }
227
- if (this.options.superscriptThree !== false) {
228
- rules.push(superscriptThree(this.options.superscriptThree));
229
- }
230
- if (this.options.oneQuarter !== false) {
231
- rules.push(oneQuarter(this.options.oneQuarter));
232
- }
233
- if (this.options.threeQuarters !== false) {
234
- rules.push(threeQuarters(this.options.threeQuarters));
235
- }
236
- return rules;
237
- }
238
- });
239
-
240
- // src/index.ts
241
- var index_default = Typography;
242
- // Annotate the CommonJS export names for ESM import in node:
243
- 0 && (module.exports = {
244
- Typography,
245
- closeDoubleQuote,
246
- closeSingleQuote,
247
- copyright,
248
- ellipsis,
249
- emDash,
250
- laquo,
251
- leftArrow,
252
- multiplication,
253
- notEqual,
254
- oneHalf,
255
- oneQuarter,
256
- openDoubleQuote,
257
- openSingleQuote,
258
- plusMinus,
259
- raquo,
260
- registeredTrademark,
261
- rightArrow,
262
- servicemark,
263
- superscriptThree,
264
- superscriptTwo,
265
- threeQuarters,
266
- trademark
267
- });
268
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/typography.ts"],"sourcesContent":["import { Typography } from './typography.js'\n\nexport * from './typography.js'\n\nexport default Typography\n","import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string\n}\n\nexport const emDash = (override?: string) =>\n textInputRule({\n find: /--$/,\n replace: override ?? '—',\n })\n\nexport const ellipsis = (override?: string) =>\n textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n })\n\nexport const openDoubleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n })\n\nexport const closeDoubleQuote = (override?: string) =>\n textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n })\n\nexport const openSingleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n })\n\nexport const closeSingleQuote = (override?: string) =>\n textInputRule({\n find: /'$/,\n replace: override ?? '’',\n })\n\nexport const leftArrow = (override?: string) =>\n textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n })\n\nexport const rightArrow = (override?: string) =>\n textInputRule({\n find: /->$/,\n replace: override ?? '→',\n })\n\nexport const copyright = (override?: string) =>\n textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n })\n\nexport const trademark = (override?: string) =>\n textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n })\n\nexport const servicemark = (override?: string) =>\n textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n })\n\nexport const registeredTrademark = (override?: string) =>\n textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n })\n\nexport const oneHalf = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n })\n\nexport const plusMinus = (override?: string) =>\n textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n })\n\nexport const notEqual = (override?: string) =>\n textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n })\n\nexport const laquo = (override?: string) =>\n textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n })\n\nexport const raquo = (override?: string) =>\n textInputRule({\n find: />>$/,\n replace: override ?? '»',\n })\n\nexport const multiplication = (override?: string) =>\n textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n })\n\nexport const superscriptTwo = (override?: string) =>\n textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n })\n\nexport const superscriptThree = (override?: string) =>\n textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n })\n\nexport const oneQuarter = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n })\n\nexport const threeQuarters = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n })\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyC;AAwIlC,IAAM,SAAS,CAAC,iBACrB,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,WAAW,CAAC,iBACvB,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,iBAC9B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,iBAC/B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,iBAC9B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mB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UAAU,OAAO;AAChC,YAAM,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,IACtC;AAEA,QAAI,KAAK,QAAQ,UAAU,OAAO;AAChC,YAAM,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,IACtC;AAEA,QAAI,KAAK,QAAQ,mBAAmB,OAAO;AACzC,YAAM,KAAK,eAAe,KAAK,QAAQ,cAAc,CAAC;AAAA,IACxD;AAEA,QAAI,KAAK,QAAQ,mBAAmB,OAAO;AACzC,YAAM,KAAK,eAAe,KAAK,QAAQ,cAAc,CAAC;AAAA,IACxD;AAEA,QAAI,KAAK,QAAQ,qBAAqB,OAAO;AAC3C,YAAM,KAAK,iBAAiB,KAAK,QAAQ,gBAAgB,CAAC;AAAA,IAC5D;AAEA,QAAI,KAAK,QAAQ,eAAe,OAAO;AACrC,YAAM,KAAK,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IAChD;AAEA,QAAI,KAAK,QAAQ,kBAAkB,OAAO;AACxC,YAAM,KAAK,cAAc,KAAK,QAAQ,aAAa,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AACF,CAAC;;;ADvYD,IAAO,gBAAQ;","names":[]}
package/dist/index.d.cts DELETED
@@ -1,144 +0,0 @@
1
- import * as _tiptap_core from '@tiptap/core';
2
- import { Extension } from '@tiptap/core';
3
-
4
- interface TypographyOptions {
5
- /**
6
- * The em dash character.
7
- * @default '—'
8
- */
9
- emDash: false | string;
10
- /**
11
- * The ellipsis character.
12
- * @default '…'
13
- */
14
- ellipsis: false | string;
15
- /**
16
- * The open double quote character.
17
- * @default '“'
18
- */
19
- openDoubleQuote: false | string;
20
- /**
21
- * The close double quote character.
22
- * @default '”'
23
- */
24
- closeDoubleQuote: false | string;
25
- /**
26
- * The open single quote character.
27
- * @default '‘'
28
- */
29
- openSingleQuote: false | string;
30
- /**
31
- * The close single quote character.
32
- * @default '’'
33
- */
34
- closeSingleQuote: false | string;
35
- /**
36
- * The left arrow character.
37
- * @default '←'
38
- */
39
- leftArrow: false | string;
40
- /**
41
- * The right arrow character.
42
- * @default '→'
43
- */
44
- rightArrow: false | string;
45
- /**
46
- * The copyright character.
47
- * @default '©'
48
- */
49
- copyright: false | string;
50
- /**
51
- * The trademark character.
52
- * @default '™'
53
- */
54
- trademark: false | string;
55
- /**
56
- * The servicemark character.
57
- * @default '℠'
58
- */
59
- servicemark: false | string;
60
- /**
61
- * The registered trademark character.
62
- * @default '®'
63
- */
64
- registeredTrademark: false | string;
65
- /**
66
- * The one half character.
67
- * @default '½'
68
- */
69
- oneHalf: false | string;
70
- /**
71
- * The plus minus character.
72
- * @default '±'
73
- */
74
- plusMinus: false | string;
75
- /**
76
- * The not equal character.
77
- * @default '≠'
78
- */
79
- notEqual: false | string;
80
- /**
81
- * The laquo character.
82
- * @default '«'
83
- */
84
- laquo: false | string;
85
- /**
86
- * The raquo character.
87
- * @default '»'
88
- */
89
- raquo: false | string;
90
- /**
91
- * The multiplication character.
92
- * @default '×'
93
- */
94
- multiplication: false | string;
95
- /**
96
- * The superscript two character.
97
- * @default '²'
98
- */
99
- superscriptTwo: false | string;
100
- /**
101
- * The superscript three character.
102
- * @default '³'
103
- */
104
- superscriptThree: false | string;
105
- /**
106
- * The one quarter character.
107
- * @default '¼'
108
- */
109
- oneQuarter: false | string;
110
- /**
111
- * The three quarters character.
112
- * @default '¾'
113
- */
114
- threeQuarters: false | string;
115
- }
116
- declare const emDash: (override?: string) => _tiptap_core.InputRule;
117
- declare const ellipsis: (override?: string) => _tiptap_core.InputRule;
118
- declare const openDoubleQuote: (override?: string) => _tiptap_core.InputRule;
119
- declare const closeDoubleQuote: (override?: string) => _tiptap_core.InputRule;
120
- declare const openSingleQuote: (override?: string) => _tiptap_core.InputRule;
121
- declare const closeSingleQuote: (override?: string) => _tiptap_core.InputRule;
122
- declare const leftArrow: (override?: string) => _tiptap_core.InputRule;
123
- declare const rightArrow: (override?: string) => _tiptap_core.InputRule;
124
- declare const copyright: (override?: string) => _tiptap_core.InputRule;
125
- declare const trademark: (override?: string) => _tiptap_core.InputRule;
126
- declare const servicemark: (override?: string) => _tiptap_core.InputRule;
127
- declare const registeredTrademark: (override?: string) => _tiptap_core.InputRule;
128
- declare const oneHalf: (override?: string) => _tiptap_core.InputRule;
129
- declare const plusMinus: (override?: string) => _tiptap_core.InputRule;
130
- declare const notEqual: (override?: string) => _tiptap_core.InputRule;
131
- declare const laquo: (override?: string) => _tiptap_core.InputRule;
132
- declare const raquo: (override?: string) => _tiptap_core.InputRule;
133
- declare const multiplication: (override?: string) => _tiptap_core.InputRule;
134
- declare const superscriptTwo: (override?: string) => _tiptap_core.InputRule;
135
- declare const superscriptThree: (override?: string) => _tiptap_core.InputRule;
136
- declare const oneQuarter: (override?: string) => _tiptap_core.InputRule;
137
- declare const threeQuarters: (override?: string) => _tiptap_core.InputRule;
138
- /**
139
- * This extension allows you to add typography replacements for specific characters.
140
- * @see https://www.tiptap.dev/api/extensions/typography
141
- */
142
- declare const Typography: Extension<TypographyOptions, any>;
143
-
144
- export { Typography, type TypographyOptions, closeDoubleQuote, closeSingleQuote, copyright, Typography as default, ellipsis, emDash, laquo, leftArrow, multiplication, notEqual, oneHalf, oneQuarter, openDoubleQuote, openSingleQuote, plusMinus, raquo, registeredTrademark, rightArrow, servicemark, superscriptThree, superscriptTwo, threeQuarters, trademark };
package/dist/index.d.ts DELETED
@@ -1,144 +0,0 @@
1
- import * as _tiptap_core from '@tiptap/core';
2
- import { Extension } from '@tiptap/core';
3
-
4
- interface TypographyOptions {
5
- /**
6
- * The em dash character.
7
- * @default '—'
8
- */
9
- emDash: false | string;
10
- /**
11
- * The ellipsis character.
12
- * @default '…'
13
- */
14
- ellipsis: false | string;
15
- /**
16
- * The open double quote character.
17
- * @default '“'
18
- */
19
- openDoubleQuote: false | string;
20
- /**
21
- * The close double quote character.
22
- * @default '”'
23
- */
24
- closeDoubleQuote: false | string;
25
- /**
26
- * The open single quote character.
27
- * @default '‘'
28
- */
29
- openSingleQuote: false | string;
30
- /**
31
- * The close single quote character.
32
- * @default '’'
33
- */
34
- closeSingleQuote: false | string;
35
- /**
36
- * The left arrow character.
37
- * @default '←'
38
- */
39
- leftArrow: false | string;
40
- /**
41
- * The right arrow character.
42
- * @default '→'
43
- */
44
- rightArrow: false | string;
45
- /**
46
- * The copyright character.
47
- * @default '©'
48
- */
49
- copyright: false | string;
50
- /**
51
- * The trademark character.
52
- * @default '™'
53
- */
54
- trademark: false | string;
55
- /**
56
- * The servicemark character.
57
- * @default '℠'
58
- */
59
- servicemark: false | string;
60
- /**
61
- * The registered trademark character.
62
- * @default '®'
63
- */
64
- registeredTrademark: false | string;
65
- /**
66
- * The one half character.
67
- * @default '½'
68
- */
69
- oneHalf: false | string;
70
- /**
71
- * The plus minus character.
72
- * @default '±'
73
- */
74
- plusMinus: false | string;
75
- /**
76
- * The not equal character.
77
- * @default '≠'
78
- */
79
- notEqual: false | string;
80
- /**
81
- * The laquo character.
82
- * @default '«'
83
- */
84
- laquo: false | string;
85
- /**
86
- * The raquo character.
87
- * @default '»'
88
- */
89
- raquo: false | string;
90
- /**
91
- * The multiplication character.
92
- * @default '×'
93
- */
94
- multiplication: false | string;
95
- /**
96
- * The superscript two character.
97
- * @default '²'
98
- */
99
- superscriptTwo: false | string;
100
- /**
101
- * The superscript three character.
102
- * @default '³'
103
- */
104
- superscriptThree: false | string;
105
- /**
106
- * The one quarter character.
107
- * @default '¼'
108
- */
109
- oneQuarter: false | string;
110
- /**
111
- * The three quarters character.
112
- * @default '¾'
113
- */
114
- threeQuarters: false | string;
115
- }
116
- declare const emDash: (override?: string) => _tiptap_core.InputRule;
117
- declare const ellipsis: (override?: string) => _tiptap_core.InputRule;
118
- declare const openDoubleQuote: (override?: string) => _tiptap_core.InputRule;
119
- declare const closeDoubleQuote: (override?: string) => _tiptap_core.InputRule;
120
- declare const openSingleQuote: (override?: string) => _tiptap_core.InputRule;
121
- declare const closeSingleQuote: (override?: string) => _tiptap_core.InputRule;
122
- declare const leftArrow: (override?: string) => _tiptap_core.InputRule;
123
- declare const rightArrow: (override?: string) => _tiptap_core.InputRule;
124
- declare const copyright: (override?: string) => _tiptap_core.InputRule;
125
- declare const trademark: (override?: string) => _tiptap_core.InputRule;
126
- declare const servicemark: (override?: string) => _tiptap_core.InputRule;
127
- declare const registeredTrademark: (override?: string) => _tiptap_core.InputRule;
128
- declare const oneHalf: (override?: string) => _tiptap_core.InputRule;
129
- declare const plusMinus: (override?: string) => _tiptap_core.InputRule;
130
- declare const notEqual: (override?: string) => _tiptap_core.InputRule;
131
- declare const laquo: (override?: string) => _tiptap_core.InputRule;
132
- declare const raquo: (override?: string) => _tiptap_core.InputRule;
133
- declare const multiplication: (override?: string) => _tiptap_core.InputRule;
134
- declare const superscriptTwo: (override?: string) => _tiptap_core.InputRule;
135
- declare const superscriptThree: (override?: string) => _tiptap_core.InputRule;
136
- declare const oneQuarter: (override?: string) => _tiptap_core.InputRule;
137
- declare const threeQuarters: (override?: string) => _tiptap_core.InputRule;
138
- /**
139
- * This extension allows you to add typography replacements for specific characters.
140
- * @see https://www.tiptap.dev/api/extensions/typography
141
- */
142
- declare const Typography: Extension<TypographyOptions, any>;
143
-
144
- export { Typography, type TypographyOptions, closeDoubleQuote, closeSingleQuote, copyright, Typography as default, ellipsis, emDash, laquo, leftArrow, multiplication, notEqual, oneHalf, oneQuarter, openDoubleQuote, openSingleQuote, plusMinus, raquo, registeredTrademark, rightArrow, servicemark, superscriptThree, superscriptTwo, threeQuarters, trademark };
package/dist/index.js DELETED
@@ -1,219 +0,0 @@
1
- // src/typography.ts
2
- import { Extension, textInputRule } from "@tiptap/core";
3
- var emDash = (override) => textInputRule({
4
- find: /--$/,
5
- replace: override != null ? override : "\u2014"
6
- });
7
- var ellipsis = (override) => textInputRule({
8
- find: /\.\.\.$/,
9
- replace: override != null ? override : "\u2026"
10
- });
11
- var openDoubleQuote = (override) => textInputRule({
12
- find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
13
- replace: override != null ? override : "\u201C"
14
- });
15
- var closeDoubleQuote = (override) => textInputRule({
16
- find: /"$/,
17
- replace: override != null ? override : "\u201D"
18
- });
19
- var openSingleQuote = (override) => textInputRule({
20
- find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
21
- replace: override != null ? override : "\u2018"
22
- });
23
- var closeSingleQuote = (override) => textInputRule({
24
- find: /'$/,
25
- replace: override != null ? override : "\u2019"
26
- });
27
- var leftArrow = (override) => textInputRule({
28
- find: /<-$/,
29
- replace: override != null ? override : "\u2190"
30
- });
31
- var rightArrow = (override) => textInputRule({
32
- find: /->$/,
33
- replace: override != null ? override : "\u2192"
34
- });
35
- var copyright = (override) => textInputRule({
36
- find: /\(c\)$/,
37
- replace: override != null ? override : "\xA9"
38
- });
39
- var trademark = (override) => textInputRule({
40
- find: /\(tm\)$/,
41
- replace: override != null ? override : "\u2122"
42
- });
43
- var servicemark = (override) => textInputRule({
44
- find: /\(sm\)$/,
45
- replace: override != null ? override : "\u2120"
46
- });
47
- var registeredTrademark = (override) => textInputRule({
48
- find: /\(r\)$/,
49
- replace: override != null ? override : "\xAE"
50
- });
51
- var oneHalf = (override) => textInputRule({
52
- find: /(?:^|\s)(1\/2)\s$/,
53
- replace: override != null ? override : "\xBD"
54
- });
55
- var plusMinus = (override) => textInputRule({
56
- find: /\+\/-$/,
57
- replace: override != null ? override : "\xB1"
58
- });
59
- var notEqual = (override) => textInputRule({
60
- find: /!=$/,
61
- replace: override != null ? override : "\u2260"
62
- });
63
- var laquo = (override) => textInputRule({
64
- find: /<<$/,
65
- replace: override != null ? override : "\xAB"
66
- });
67
- var raquo = (override) => textInputRule({
68
- find: />>$/,
69
- replace: override != null ? override : "\xBB"
70
- });
71
- var multiplication = (override) => textInputRule({
72
- find: /\d+\s?([*x])\s?\d+$/,
73
- replace: override != null ? override : "\xD7"
74
- });
75
- var superscriptTwo = (override) => textInputRule({
76
- find: /\^2$/,
77
- replace: override != null ? override : "\xB2"
78
- });
79
- var superscriptThree = (override) => textInputRule({
80
- find: /\^3$/,
81
- replace: override != null ? override : "\xB3"
82
- });
83
- var oneQuarter = (override) => textInputRule({
84
- find: /(?:^|\s)(1\/4)\s$/,
85
- replace: override != null ? override : "\xBC"
86
- });
87
- var threeQuarters = (override) => textInputRule({
88
- find: /(?:^|\s)(3\/4)\s$/,
89
- replace: override != null ? override : "\xBE"
90
- });
91
- var Typography = Extension.create({
92
- name: "typography",
93
- addOptions() {
94
- return {
95
- closeDoubleQuote: "\u201D",
96
- closeSingleQuote: "\u2019",
97
- copyright: "\xA9",
98
- ellipsis: "\u2026",
99
- emDash: "\u2014",
100
- laquo: "\xAB",
101
- leftArrow: "\u2190",
102
- multiplication: "\xD7",
103
- notEqual: "\u2260",
104
- oneHalf: "\xBD",
105
- oneQuarter: "\xBC",
106
- openDoubleQuote: "\u201C",
107
- openSingleQuote: "\u2018",
108
- plusMinus: "\xB1",
109
- raquo: "\xBB",
110
- registeredTrademark: "\xAE",
111
- rightArrow: "\u2192",
112
- servicemark: "\u2120",
113
- superscriptThree: "\xB3",
114
- superscriptTwo: "\xB2",
115
- threeQuarters: "\xBE",
116
- trademark: "\u2122"
117
- };
118
- },
119
- addInputRules() {
120
- const rules = [];
121
- if (this.options.emDash !== false) {
122
- rules.push(emDash(this.options.emDash));
123
- }
124
- if (this.options.ellipsis !== false) {
125
- rules.push(ellipsis(this.options.ellipsis));
126
- }
127
- if (this.options.openDoubleQuote !== false) {
128
- rules.push(openDoubleQuote(this.options.openDoubleQuote));
129
- }
130
- if (this.options.closeDoubleQuote !== false) {
131
- rules.push(closeDoubleQuote(this.options.closeDoubleQuote));
132
- }
133
- if (this.options.openSingleQuote !== false) {
134
- rules.push(openSingleQuote(this.options.openSingleQuote));
135
- }
136
- if (this.options.closeSingleQuote !== false) {
137
- rules.push(closeSingleQuote(this.options.closeSingleQuote));
138
- }
139
- if (this.options.leftArrow !== false) {
140
- rules.push(leftArrow(this.options.leftArrow));
141
- }
142
- if (this.options.rightArrow !== false) {
143
- rules.push(rightArrow(this.options.rightArrow));
144
- }
145
- if (this.options.copyright !== false) {
146
- rules.push(copyright(this.options.copyright));
147
- }
148
- if (this.options.trademark !== false) {
149
- rules.push(trademark(this.options.trademark));
150
- }
151
- if (this.options.servicemark !== false) {
152
- rules.push(servicemark(this.options.servicemark));
153
- }
154
- if (this.options.registeredTrademark !== false) {
155
- rules.push(registeredTrademark(this.options.registeredTrademark));
156
- }
157
- if (this.options.oneHalf !== false) {
158
- rules.push(oneHalf(this.options.oneHalf));
159
- }
160
- if (this.options.plusMinus !== false) {
161
- rules.push(plusMinus(this.options.plusMinus));
162
- }
163
- if (this.options.notEqual !== false) {
164
- rules.push(notEqual(this.options.notEqual));
165
- }
166
- if (this.options.laquo !== false) {
167
- rules.push(laquo(this.options.laquo));
168
- }
169
- if (this.options.raquo !== false) {
170
- rules.push(raquo(this.options.raquo));
171
- }
172
- if (this.options.multiplication !== false) {
173
- rules.push(multiplication(this.options.multiplication));
174
- }
175
- if (this.options.superscriptTwo !== false) {
176
- rules.push(superscriptTwo(this.options.superscriptTwo));
177
- }
178
- if (this.options.superscriptThree !== false) {
179
- rules.push(superscriptThree(this.options.superscriptThree));
180
- }
181
- if (this.options.oneQuarter !== false) {
182
- rules.push(oneQuarter(this.options.oneQuarter));
183
- }
184
- if (this.options.threeQuarters !== false) {
185
- rules.push(threeQuarters(this.options.threeQuarters));
186
- }
187
- return rules;
188
- }
189
- });
190
-
191
- // src/index.ts
192
- var index_default = Typography;
193
- export {
194
- Typography,
195
- closeDoubleQuote,
196
- closeSingleQuote,
197
- copyright,
198
- index_default as default,
199
- ellipsis,
200
- emDash,
201
- laquo,
202
- leftArrow,
203
- multiplication,
204
- notEqual,
205
- oneHalf,
206
- oneQuarter,
207
- openDoubleQuote,
208
- openSingleQuote,
209
- plusMinus,
210
- raquo,
211
- registeredTrademark,
212
- rightArrow,
213
- servicemark,
214
- superscriptThree,
215
- superscriptTwo,
216
- threeQuarters,
217
- trademark
218
- };
219
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/typography.ts","../src/index.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string\n}\n\nexport const emDash = (override?: string) =>\n textInputRule({\n find: /--$/,\n replace: override ?? '—',\n })\n\nexport const ellipsis = (override?: string) =>\n textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n })\n\nexport const openDoubleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n })\n\nexport const closeDoubleQuote = (override?: string) =>\n textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n })\n\nexport const openSingleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n })\n\nexport const closeSingleQuote = (override?: string) =>\n textInputRule({\n find: /'$/,\n replace: override ?? '’',\n })\n\nexport const leftArrow = (override?: string) =>\n textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n })\n\nexport const rightArrow = (override?: string) =>\n textInputRule({\n find: /->$/,\n replace: override ?? '→',\n })\n\nexport const copyright = (override?: string) =>\n textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n })\n\nexport const trademark = (override?: string) =>\n textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n })\n\nexport const servicemark = (override?: string) =>\n textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n })\n\nexport const registeredTrademark = (override?: string) =>\n textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n })\n\nexport const oneHalf = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n })\n\nexport const plusMinus = (override?: string) =>\n textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n })\n\nexport const notEqual = (override?: string) =>\n textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n })\n\nexport const laquo = (override?: string) =>\n textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n })\n\nexport const raquo = (override?: string) =>\n textInputRule({\n find: />>$/,\n replace: override ?? '»',\n })\n\nexport const multiplication = (override?: string) =>\n textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n })\n\nexport const superscriptTwo = (override?: string) =>\n textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n })\n\nexport const superscriptThree = (override?: string) =>\n textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n })\n\nexport const oneQuarter = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n })\n\nexport const threeQuarters = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n })\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n","import { Typography } from './typography.js'\n\nexport * from './typography.js'\n\nexport default Typography\n"],"mappings":";AAAA,SAAS,WAAW,qBAAqB;AAwIlC,IAAM,SAAS,CAAC,aACrB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,WAAW,CAAC,aACvB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,aAC9B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,aAC/B,cAAc;AAAA,EACZ,MAAM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