@portabletext/plugin-typography 8.0.43 → 8.0.45
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.d.ts +140 -204
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +229 -239
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {InputRule} from '@portabletext/plugin-input-rule'
|
|
4
|
-
import {InputRuleGuard} from '@portabletext/plugin-input-rule'
|
|
5
|
-
import {JSX} from 'react'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare const closingDoubleQuoteRule: InputRule<true>
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare const closingSingleQuoteRule: InputRule<true>
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export declare const copyrightRule: InputRule<true>
|
|
21
|
-
|
|
1
|
+
import { InputRule, InputRuleGuard } from "@portabletext/plugin-input-rule";
|
|
2
|
+
import { EditorContext, EditorSchema } from "@portabletext/editor";
|
|
22
3
|
/**
|
|
23
4
|
* @public
|
|
24
5
|
* Create an `InputRuleGuard` that can prevent the rule from running inside
|
|
@@ -33,247 +14,198 @@ export declare const copyrightRule: InputRule<true>
|
|
|
33
14
|
* <TypographyPlugin guard={guard} />
|
|
34
15
|
* ```
|
|
35
16
|
*/
|
|
36
|
-
|
|
37
|
-
decorators: ({
|
|
38
|
-
context,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}) => Array<EditorSchema['decorators'][number]['name']>
|
|
42
|
-
}): InputRuleGuard
|
|
43
|
-
|
|
44
|
-
declare const defaultRuleConfig: readonly [
|
|
45
|
-
{
|
|
46
|
-
readonly name: 'emDash'
|
|
47
|
-
readonly rule: InputRule<true>
|
|
48
|
-
readonly state: 'on'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
readonly name: 'ellipsis'
|
|
52
|
-
readonly rule: InputRule<true>
|
|
53
|
-
readonly state: 'on'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
readonly name: 'openingDoubleQuote'
|
|
57
|
-
readonly rule: InputRule<true>
|
|
58
|
-
readonly state: 'on'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
readonly name: 'closingDoubleQuote'
|
|
62
|
-
readonly rule: InputRule<true>
|
|
63
|
-
readonly state: 'on'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
readonly name: 'openingSingleQuote'
|
|
67
|
-
readonly rule: InputRule<true>
|
|
68
|
-
readonly state: 'on'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
readonly name: 'closingSingleQuote'
|
|
72
|
-
readonly rule: InputRule<true>
|
|
73
|
-
readonly state: 'on'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
readonly name: 'leftArrow'
|
|
77
|
-
readonly rule: InputRule<true>
|
|
78
|
-
readonly state: 'on'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
readonly name: 'rightArrow'
|
|
82
|
-
readonly rule: InputRule<true>
|
|
83
|
-
readonly state: 'on'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
readonly name: 'copyright'
|
|
87
|
-
readonly rule: InputRule<true>
|
|
88
|
-
readonly state: 'on'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
readonly name: 'trademark'
|
|
92
|
-
readonly rule: InputRule<true>
|
|
93
|
-
readonly state: 'on'
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
readonly name: 'servicemark'
|
|
97
|
-
readonly rule: InputRule<true>
|
|
98
|
-
readonly state: 'on'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
readonly name: 'registeredTrademark'
|
|
102
|
-
readonly rule: InputRule<true>
|
|
103
|
-
readonly state: 'on'
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
readonly name: 'oneHalf'
|
|
107
|
-
readonly rule: InputRule<true>
|
|
108
|
-
readonly state: 'off'
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
readonly name: 'plusMinus'
|
|
112
|
-
readonly rule: InputRule<true>
|
|
113
|
-
readonly state: 'off'
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
readonly name: 'laquo'
|
|
117
|
-
readonly rule: InputRule<true>
|
|
118
|
-
readonly state: 'off'
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
readonly name: 'notEqual'
|
|
122
|
-
readonly rule: InputRule<true>
|
|
123
|
-
readonly state: 'off'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
readonly name: 'raquo'
|
|
127
|
-
readonly rule: InputRule<true>
|
|
128
|
-
readonly state: 'off'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
readonly name: 'multiplication'
|
|
132
|
-
readonly rule: InputRule<true>
|
|
133
|
-
readonly state: 'off'
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
readonly name: 'superscriptTwo'
|
|
137
|
-
readonly rule: InputRule<true>
|
|
138
|
-
readonly state: 'off'
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
readonly name: 'superscriptThree'
|
|
142
|
-
readonly rule: InputRule<true>
|
|
143
|
-
readonly state: 'off'
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
readonly name: 'oneQuarter'
|
|
147
|
-
readonly rule: InputRule<true>
|
|
148
|
-
readonly state: 'off'
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
readonly name: 'threeQuarters'
|
|
152
|
-
readonly rule: InputRule<true>
|
|
153
|
-
readonly state: 'off'
|
|
154
|
-
},
|
|
155
|
-
]
|
|
156
|
-
|
|
17
|
+
declare function createDecoratorGuard(config: {
|
|
18
|
+
decorators: ({ context }: {
|
|
19
|
+
context: Pick<EditorContext, 'schema'>;
|
|
20
|
+
}) => Array<EditorSchema['decorators'][number]['name']>;
|
|
21
|
+
}): InputRuleGuard;
|
|
157
22
|
/**
|
|
158
23
|
* @public
|
|
159
24
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
25
|
+
declare const emDashRule: InputRule<true>;
|
|
162
26
|
/**
|
|
163
27
|
* @public
|
|
164
28
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
29
|
+
declare const ellipsisRule: InputRule<true>;
|
|
167
30
|
/**
|
|
168
31
|
* @public
|
|
169
32
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
33
|
+
declare const openingDoubleQuoteRule: InputRule<true>;
|
|
172
34
|
/**
|
|
173
35
|
* @public
|
|
174
36
|
*/
|
|
175
|
-
|
|
176
|
-
|
|
37
|
+
declare const closingDoubleQuoteRule: InputRule<true>;
|
|
177
38
|
/**
|
|
178
39
|
* @public
|
|
179
40
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
41
|
+
declare const openingSingleQuoteRule: InputRule<true>;
|
|
182
42
|
/**
|
|
183
43
|
* @public
|
|
184
44
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
45
|
+
declare const closingSingleQuoteRule: InputRule<true>;
|
|
187
46
|
/**
|
|
188
47
|
* @public
|
|
189
48
|
*/
|
|
190
|
-
|
|
191
|
-
|
|
49
|
+
declare const smartQuotesRules: Array<InputRule>;
|
|
192
50
|
/**
|
|
193
51
|
* @public
|
|
194
52
|
*/
|
|
195
|
-
|
|
196
|
-
|
|
53
|
+
declare const leftArrowRule: InputRule<true>;
|
|
197
54
|
/**
|
|
198
55
|
* @public
|
|
199
56
|
*/
|
|
200
|
-
|
|
201
|
-
|
|
57
|
+
declare const rightArrowRule: InputRule<true>;
|
|
202
58
|
/**
|
|
203
59
|
* @public
|
|
204
60
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
61
|
+
declare const copyrightRule: InputRule<true>;
|
|
207
62
|
/**
|
|
208
63
|
* @public
|
|
209
64
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
65
|
+
declare const servicemarkRule: InputRule<true>;
|
|
212
66
|
/**
|
|
213
67
|
* @public
|
|
214
68
|
*/
|
|
215
|
-
|
|
216
|
-
|
|
69
|
+
declare const trademarkRule: InputRule<true>;
|
|
217
70
|
/**
|
|
218
71
|
* @beta
|
|
219
72
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
73
|
+
declare const registeredTrademarkRule: InputRule<true>;
|
|
222
74
|
/**
|
|
223
75
|
* @public
|
|
224
76
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
declare type RuleName = (typeof defaultRuleConfig)[number]['name']
|
|
228
|
-
|
|
77
|
+
declare const oneHalfRule: InputRule<true>;
|
|
229
78
|
/**
|
|
230
79
|
* @public
|
|
231
80
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
81
|
+
declare const plusMinusRule: InputRule<true>;
|
|
234
82
|
/**
|
|
235
83
|
* @public
|
|
236
84
|
*/
|
|
237
|
-
|
|
238
|
-
|
|
85
|
+
declare const notEqualRule: InputRule<true>;
|
|
239
86
|
/**
|
|
240
87
|
* @public
|
|
241
88
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
89
|
+
declare const laquoRule: InputRule<true>;
|
|
244
90
|
/**
|
|
245
91
|
* @public
|
|
246
92
|
*/
|
|
247
|
-
|
|
248
|
-
|
|
93
|
+
declare const raquoRule: InputRule<true>;
|
|
249
94
|
/**
|
|
250
95
|
* @public
|
|
251
96
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
97
|
+
declare const multiplicationRule: InputRule<true>;
|
|
254
98
|
/**
|
|
255
|
-
* @public
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
declare const superscriptTwoRule: InputRule<true>;
|
|
102
|
+
/**
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
declare const superscriptThreeRule: InputRule<true>;
|
|
259
106
|
/**
|
|
260
107
|
* @public
|
|
261
108
|
*/
|
|
262
|
-
|
|
263
|
-
TEnabledRuleName extends RuleName = never,
|
|
264
|
-
TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never,
|
|
265
|
-
>(
|
|
266
|
-
props: TypographyPluginProps<TEnabledRuleName, TDisabledRuleName>,
|
|
267
|
-
): JSX.Element
|
|
268
|
-
|
|
109
|
+
declare const oneQuarterRule: InputRule<true>;
|
|
269
110
|
/**
|
|
270
111
|
* @public
|
|
271
112
|
*/
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
113
|
+
declare const threeQuartersRule: InputRule<true>;
|
|
114
|
+
declare const defaultRuleConfig: readonly [{
|
|
115
|
+
readonly name: "emDash";
|
|
116
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
117
|
+
readonly state: "on";
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "ellipsis";
|
|
120
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
121
|
+
readonly state: "on";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "openingDoubleQuote";
|
|
124
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
125
|
+
readonly state: "on";
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: "closingDoubleQuote";
|
|
128
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
129
|
+
readonly state: "on";
|
|
130
|
+
}, {
|
|
131
|
+
readonly name: "openingSingleQuote";
|
|
132
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
133
|
+
readonly state: "on";
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "closingSingleQuote";
|
|
136
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
137
|
+
readonly state: "on";
|
|
138
|
+
}, {
|
|
139
|
+
readonly name: "leftArrow";
|
|
140
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
141
|
+
readonly state: "on";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "rightArrow";
|
|
144
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
145
|
+
readonly state: "on";
|
|
146
|
+
}, {
|
|
147
|
+
readonly name: "copyright";
|
|
148
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
149
|
+
readonly state: "on";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "trademark";
|
|
152
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
153
|
+
readonly state: "on";
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "servicemark";
|
|
156
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
157
|
+
readonly state: "on";
|
|
158
|
+
}, {
|
|
159
|
+
readonly name: "registeredTrademark";
|
|
160
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
161
|
+
readonly state: "on";
|
|
162
|
+
}, {
|
|
163
|
+
readonly name: "oneHalf";
|
|
164
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
165
|
+
readonly state: "off";
|
|
166
|
+
}, {
|
|
167
|
+
readonly name: "plusMinus";
|
|
168
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
169
|
+
readonly state: "off";
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "laquo";
|
|
172
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
173
|
+
readonly state: "off";
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "notEqual";
|
|
176
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
177
|
+
readonly state: "off";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "raquo";
|
|
180
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
181
|
+
readonly state: "off";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "multiplication";
|
|
184
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
185
|
+
readonly state: "off";
|
|
186
|
+
}, {
|
|
187
|
+
readonly name: "superscriptTwo";
|
|
188
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
189
|
+
readonly state: "off";
|
|
190
|
+
}, {
|
|
191
|
+
readonly name: "superscriptThree";
|
|
192
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
193
|
+
readonly state: "off";
|
|
194
|
+
}, {
|
|
195
|
+
readonly name: "oneQuarter";
|
|
196
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
197
|
+
readonly state: "off";
|
|
198
|
+
}, {
|
|
199
|
+
readonly name: "threeQuarters";
|
|
200
|
+
readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
|
|
201
|
+
readonly state: "off";
|
|
202
|
+
}];
|
|
203
|
+
type RuleName = (typeof defaultRuleConfig)[number]['name'];
|
|
204
|
+
/**
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
type TypographyPluginProps<TEnabledRuleName extends RuleName = never, TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never> = {
|
|
208
|
+
guard?: InputRuleGuard;
|
|
277
209
|
/**
|
|
278
210
|
* Preset configuration for rules.
|
|
279
211
|
* - `'default'`: Common typography rules enabled (em dash, ellipsis, quotes, arrows, copyright symbols)
|
|
@@ -282,7 +214,7 @@ export declare type TypographyPluginProps<
|
|
|
282
214
|
*
|
|
283
215
|
* @defaultValue 'default'
|
|
284
216
|
*/
|
|
285
|
-
preset?: 'default' | 'all' | 'none'
|
|
217
|
+
preset?: 'default' | 'all' | 'none';
|
|
286
218
|
/**
|
|
287
219
|
* Enable specific rules (additive to preset).
|
|
288
220
|
* Use this to enable additional rules beyond the preset.
|
|
@@ -293,7 +225,7 @@ export declare type TypographyPluginProps<
|
|
|
293
225
|
* <TypographyPlugin enable={['multiplication', 'plusMinus']} />
|
|
294
226
|
* ```
|
|
295
227
|
*/
|
|
296
|
-
enable?: ReadonlyArray<TEnabledRuleName
|
|
228
|
+
enable?: ReadonlyArray<TEnabledRuleName>;
|
|
297
229
|
/**
|
|
298
230
|
* Disable specific rules (subtractive from preset).
|
|
299
231
|
* Use this to disable rules that would otherwise be enabled by the preset.
|
|
@@ -305,7 +237,11 @@ export declare type TypographyPluginProps<
|
|
|
305
237
|
* <TypographyPlugin disable={['emDash']} />
|
|
306
238
|
* ```
|
|
307
239
|
*/
|
|
308
|
-
disable?: ReadonlyArray<TDisabledRuleName
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
240
|
+
disable?: ReadonlyArray<TDisabledRuleName>;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function TypographyPlugin<TEnabledRuleName extends RuleName = never, TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never>(props: TypographyPluginProps<TEnabledRuleName, TDisabledRuleName>): import("react").JSX.Element;
|
|
246
|
+
export { TypographyPlugin, TypographyPluginProps, closingDoubleQuoteRule, closingSingleQuoteRule, copyrightRule, createDecoratorGuard, ellipsisRule, emDashRule, laquoRule, leftArrowRule, multiplicationRule, notEqualRule, oneHalfRule, oneQuarterRule, openingDoubleQuoteRule, openingSingleQuoteRule, plusMinusRule, raquoRule, registeredTrademarkRule, rightArrowRule, servicemarkRule, smartQuotesRules, superscriptThreeRule, superscriptTwoRule, threeQuartersRule, trademarkRule };
|
|
247
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/create-decorator-guard.ts","../src/input-rules.typography.ts","../src/plugin.typography.tsx"],"mappings":";;;;;;;;;;;;;;;;iBAsBgB,qBAAqB;EACnC,eACE;IAEA,SAAS,KAAK;QACV,MAAM;IACV;;;;cCpBS,YAAU;;;;cAQV,cAAY;;;;cAQZ,wBAAsB;;;;cAQtB,wBAAsB;;;;cAQtB,wBAAsB;;;;cAQtB,wBAAsB;;;;cAQtB,kBAAkB,MAAM;;;;cAUxB,eAAa;;;;cAQb,gBAAc;;;;cAQd,eAAa;;;;cAQb,iBAAe;;;;cAQf,eAAa;;;;cAQb,yBAAuB;;;;cAQvB,aAAW;;;;cAQX,eAAa;;;;cAQb,cAAY;;;;cAQZ,WAAS;;;;cAQT,WAAS;;;;cAQT,oBAAkB;;;;cAQlB,oBAAkB;;;;cAQlB,sBAAoB;;;;cAQpB,gBAAc;;;;cAQd,mBAAiB;cC5JxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyBD,mBAAmB;;;;KAKZ,sBACV,yBAAyB,kBACzB,0BAA0B,QAAQ,UAAU;EAE5C,QAAQ;;;;;;;;;EASR;;;;;;;;;;;EAWA,SAAS,cAAc;;;;;;;;;;;;EAYvB,UAAU,cAAc;;;;;iBAMV,iBACd,yBAAyB,kBACzB,0BAA0B,QAAQ,UAAU,2BAC5C,OAAO,sBAAsB,kBAAkB,qCAAkB,IAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,270 +1,260 @@
|
|
|
1
1
|
import { getSelectedSpans, isActiveDecorator } from "@portabletext/editor/selectors";
|
|
2
2
|
import { getPathSubSchema } from "@portabletext/editor/traversal";
|
|
3
|
-
import {
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InputRulePlugin, defineTextTransformRule } from "@portabletext/plugin-input-rule";
|
|
5
4
|
import { c } from "react/compiler-runtime";
|
|
6
5
|
import "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Create an `InputRuleGuard` that can prevent the rule from running inside
|
|
10
|
+
* certain decorators.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const guard = createDecoratorGuard({
|
|
15
|
+
* decorators: ({context}) => context.schema.decorators.flatMap((decorator) => decorator.name === 'code' ? [] : [decorator.name]),
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* <TypographyPlugin guard={guard} />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
7
21
|
function createDecoratorGuard(config) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
if (matchedSpans.some((span) => span.node.marks?.includes(decorator))) {
|
|
33
|
-
preventInputRule = !0;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return !preventInputRule;
|
|
38
|
-
};
|
|
22
|
+
return ({ snapshot, event }) => {
|
|
23
|
+
let subSchema = getPathSubSchema(snapshot, event.focusBlock.path), allowedDecorators = config.decorators({ context: { schema: subSchema } }), decorators = subSchema.decorators.flatMap((decorator) => allowedDecorators.includes(decorator.name) ? [] : [decorator.name]);
|
|
24
|
+
if (decorators.length === 0) return !0;
|
|
25
|
+
let matchedSpans = event.matches.flatMap((match) => getSelectedSpans({
|
|
26
|
+
...snapshot,
|
|
27
|
+
context: {
|
|
28
|
+
...snapshot.context,
|
|
29
|
+
selection: match.selection
|
|
30
|
+
}
|
|
31
|
+
})), preventInputRule = !1;
|
|
32
|
+
for (let decorator of decorators) {
|
|
33
|
+
if (isActiveDecorator(decorator)(snapshot)) {
|
|
34
|
+
preventInputRule = !0;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
if (matchedSpans.some((span) => span.node.marks?.includes(decorator))) {
|
|
38
|
+
preventInputRule = !0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return !preventInputRule;
|
|
43
|
+
};
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
40
48
|
const emDashRule = defineTextTransformRule({
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
on: /--/,
|
|
50
|
+
transform: () => "—"
|
|
43
51
|
}), ellipsisRule = defineTextTransformRule({
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
on: /\.\.\./,
|
|
53
|
+
transform: () => "…"
|
|
46
54
|
}), openingDoubleQuoteRule = defineTextTransformRule({
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
on: RegExp("(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))\"", "g"),
|
|
56
|
+
transform: () => "“"
|
|
49
57
|
}), closingDoubleQuoteRule = defineTextTransformRule({
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
on: /"/g,
|
|
59
|
+
transform: () => "”"
|
|
52
60
|
}), openingSingleQuoteRule = defineTextTransformRule({
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
on: RegExp("(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))'", "g"),
|
|
62
|
+
transform: () => "‘"
|
|
55
63
|
}), closingSingleQuoteRule = defineTextTransformRule({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}), smartQuotesRules = [
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
on: /'/g,
|
|
65
|
+
transform: () => "’"
|
|
66
|
+
}), smartQuotesRules = [
|
|
67
|
+
openingDoubleQuoteRule,
|
|
68
|
+
closingDoubleQuoteRule,
|
|
69
|
+
openingSingleQuoteRule,
|
|
70
|
+
closingSingleQuoteRule
|
|
71
|
+
], leftArrowRule = defineTextTransformRule({
|
|
72
|
+
on: /<-/,
|
|
73
|
+
transform: () => "←"
|
|
61
74
|
}), rightArrowRule = defineTextTransformRule({
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
on: /->/,
|
|
76
|
+
transform: () => "→"
|
|
64
77
|
}), copyrightRule = defineTextTransformRule({
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
on: /\(c\)/,
|
|
79
|
+
transform: () => "©"
|
|
67
80
|
}), servicemarkRule = defineTextTransformRule({
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
on: /\(sm\)/,
|
|
82
|
+
transform: () => "℠"
|
|
70
83
|
}), trademarkRule = defineTextTransformRule({
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
on: /\(tm\)/,
|
|
85
|
+
transform: () => "™"
|
|
73
86
|
}), registeredTrademarkRule = defineTextTransformRule({
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
on: /\(r\)/,
|
|
88
|
+
transform: () => "®"
|
|
76
89
|
}), oneHalfRule = defineTextTransformRule({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
fraction: () => "\xBD"
|
|
80
|
-
}
|
|
90
|
+
on: /(?:^|\s)(?<fraction>1\/2)\s/,
|
|
91
|
+
transform: { fraction: () => "½" }
|
|
81
92
|
}), plusMinusRule = defineTextTransformRule({
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
on: /\+\/-/,
|
|
94
|
+
transform: () => "±"
|
|
84
95
|
}), notEqualRule = defineTextTransformRule({
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
on: /!=/,
|
|
97
|
+
transform: () => "≠"
|
|
87
98
|
}), laquoRule = defineTextTransformRule({
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
on: /<</,
|
|
100
|
+
transform: () => "«"
|
|
90
101
|
}), raquoRule = defineTextTransformRule({
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
on: />>/,
|
|
103
|
+
transform: () => "»"
|
|
93
104
|
}), multiplicationRule = defineTextTransformRule({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
operator: () => "\xD7"
|
|
97
|
-
}
|
|
105
|
+
on: /\d+\s?(?<operator>[*x])\s?\d+/,
|
|
106
|
+
transform: { operator: () => "×" }
|
|
98
107
|
}), superscriptTwoRule = defineTextTransformRule({
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
on: /\^2/,
|
|
109
|
+
transform: () => "²"
|
|
101
110
|
}), superscriptThreeRule = defineTextTransformRule({
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
on: /\^3/,
|
|
112
|
+
transform: () => "³"
|
|
104
113
|
}), oneQuarterRule = defineTextTransformRule({
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
fraction: () => "\xBC"
|
|
108
|
-
}
|
|
114
|
+
on: /(?:^|\s)(?<fraction>1\/4)\s/,
|
|
115
|
+
transform: { fraction: () => "¼" }
|
|
109
116
|
}), threeQuartersRule = defineTextTransformRule({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
117
|
+
on: /(?:^|\s)(?<fraction>3\/4)\s/,
|
|
118
|
+
transform: { fraction: () => "¾" }
|
|
119
|
+
}), defaultRuleConfig = [
|
|
120
|
+
{
|
|
121
|
+
name: "emDash",
|
|
122
|
+
rule: emDashRule,
|
|
123
|
+
state: "on"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "ellipsis",
|
|
127
|
+
rule: ellipsisRule,
|
|
128
|
+
state: "on"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "openingDoubleQuote",
|
|
132
|
+
rule: openingDoubleQuoteRule,
|
|
133
|
+
state: "on"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "closingDoubleQuote",
|
|
137
|
+
rule: closingDoubleQuoteRule,
|
|
138
|
+
state: "on"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "openingSingleQuote",
|
|
142
|
+
rule: openingSingleQuoteRule,
|
|
143
|
+
state: "on"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "closingSingleQuote",
|
|
147
|
+
rule: closingSingleQuoteRule,
|
|
148
|
+
state: "on"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "leftArrow",
|
|
152
|
+
rule: leftArrowRule,
|
|
153
|
+
state: "on"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "rightArrow",
|
|
157
|
+
rule: rightArrowRule,
|
|
158
|
+
state: "on"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "copyright",
|
|
162
|
+
rule: copyrightRule,
|
|
163
|
+
state: "on"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "trademark",
|
|
167
|
+
rule: trademarkRule,
|
|
168
|
+
state: "on"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "servicemark",
|
|
172
|
+
rule: servicemarkRule,
|
|
173
|
+
state: "on"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "registeredTrademark",
|
|
177
|
+
rule: registeredTrademarkRule,
|
|
178
|
+
state: "on"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "oneHalf",
|
|
182
|
+
rule: oneHalfRule,
|
|
183
|
+
state: "off"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "plusMinus",
|
|
187
|
+
rule: plusMinusRule,
|
|
188
|
+
state: "off"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "laquo",
|
|
192
|
+
rule: laquoRule,
|
|
193
|
+
state: "off"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "notEqual",
|
|
197
|
+
rule: notEqualRule,
|
|
198
|
+
state: "off"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "raquo",
|
|
202
|
+
rule: raquoRule,
|
|
203
|
+
state: "off"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "multiplication",
|
|
207
|
+
rule: multiplicationRule,
|
|
208
|
+
state: "off"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "superscriptTwo",
|
|
212
|
+
rule: superscriptTwoRule,
|
|
213
|
+
state: "off"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "superscriptThree",
|
|
217
|
+
rule: superscriptThreeRule,
|
|
218
|
+
state: "off"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "oneQuarter",
|
|
222
|
+
rule: oneQuarterRule,
|
|
223
|
+
state: "off"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "threeQuarters",
|
|
227
|
+
rule: threeQuartersRule,
|
|
228
|
+
state: "off"
|
|
229
|
+
}
|
|
230
|
+
];
|
|
231
|
+
/**
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
203
234
|
function TypographyPlugin(props) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
rule_0.state === "on" && enabledRules.add(rule_0.name);
|
|
224
|
-
for (const ruleName of enable)
|
|
225
|
-
enabledRules.add(ruleName);
|
|
226
|
-
for (const ruleName_0 of disable)
|
|
227
|
-
enabledRules.delete(ruleName_0);
|
|
228
|
-
$[4] = disable, $[5] = enable, $[6] = preset, $[7] = enabledRules;
|
|
229
|
-
} else
|
|
230
|
-
enabledRules = $[7];
|
|
231
|
-
let t5;
|
|
232
|
-
$[8] !== enabledRules || $[9] !== guard ? (t5 = defaultRuleConfig.flatMap((rule_1) => enabledRules.has(rule_1.name) ? [{
|
|
233
|
-
...rule_1.rule,
|
|
234
|
-
guard: guard ?? _temp
|
|
235
|
-
}] : []), $[8] = enabledRules, $[9] = guard, $[10] = t5) : t5 = $[10];
|
|
236
|
-
const configuredInputRules = t5;
|
|
237
|
-
let t6;
|
|
238
|
-
return $[11] !== configuredInputRules ? (t6 = /* @__PURE__ */ jsx(InputRulePlugin, { rules: configuredInputRules }), $[11] = configuredInputRules, $[12] = t6) : t6 = $[12], t6;
|
|
235
|
+
let $ = c(13), { preset: t0, enable: t1, disable: t2, guard } = props, preset = t0 === void 0 ? "default" : t0, t3;
|
|
236
|
+
$[0] === t1 ? t3 = $[1] : (t3 = t1 === void 0 ? [] : t1, $[0] = t1, $[1] = t3);
|
|
237
|
+
let enable = t3, t4;
|
|
238
|
+
$[2] === t2 ? t4 = $[3] : (t4 = t2 === void 0 ? [] : t2, $[2] = t2, $[3] = t4);
|
|
239
|
+
let disable = t4, enabledRules;
|
|
240
|
+
if ($[4] !== disable || $[5] !== enable || $[6] !== preset) {
|
|
241
|
+
if (enabledRules = /* @__PURE__ */ new Set(), preset === "all") for (let rule of defaultRuleConfig) enabledRules.add(rule.name);
|
|
242
|
+
else if (preset === "default") for (let rule_0 of defaultRuleConfig) rule_0.state === "on" && enabledRules.add(rule_0.name);
|
|
243
|
+
for (let ruleName of enable) enabledRules.add(ruleName);
|
|
244
|
+
for (let ruleName_0 of disable) enabledRules.delete(ruleName_0);
|
|
245
|
+
$[4] = disable, $[5] = enable, $[6] = preset, $[7] = enabledRules;
|
|
246
|
+
} else enabledRules = $[7];
|
|
247
|
+
let t5;
|
|
248
|
+
$[8] !== enabledRules || $[9] !== guard ? (t5 = defaultRuleConfig.flatMap((rule_1) => enabledRules.has(rule_1.name) ? [{
|
|
249
|
+
...rule_1.rule,
|
|
250
|
+
guard: guard ?? _temp
|
|
251
|
+
}] : []), $[8] = enabledRules, $[9] = guard, $[10] = t5) : t5 = $[10];
|
|
252
|
+
let configuredInputRules = t5, t6;
|
|
253
|
+
return $[11] === configuredInputRules ? t6 = $[12] : (t6 = /* @__PURE__ */ jsx(InputRulePlugin, { rules: configuredInputRules }), $[11] = configuredInputRules, $[12] = t6), t6;
|
|
239
254
|
}
|
|
240
255
|
function _temp() {
|
|
241
|
-
|
|
256
|
+
return !0;
|
|
242
257
|
}
|
|
243
|
-
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
closingSingleQuoteRule,
|
|
247
|
-
copyrightRule,
|
|
248
|
-
createDecoratorGuard,
|
|
249
|
-
ellipsisRule,
|
|
250
|
-
emDashRule,
|
|
251
|
-
laquoRule,
|
|
252
|
-
leftArrowRule,
|
|
253
|
-
multiplicationRule,
|
|
254
|
-
notEqualRule,
|
|
255
|
-
oneHalfRule,
|
|
256
|
-
oneQuarterRule,
|
|
257
|
-
openingDoubleQuoteRule,
|
|
258
|
-
openingSingleQuoteRule,
|
|
259
|
-
plusMinusRule,
|
|
260
|
-
raquoRule,
|
|
261
|
-
registeredTrademarkRule,
|
|
262
|
-
rightArrowRule,
|
|
263
|
-
servicemarkRule,
|
|
264
|
-
smartQuotesRules,
|
|
265
|
-
superscriptThreeRule,
|
|
266
|
-
superscriptTwoRule,
|
|
267
|
-
threeQuartersRule,
|
|
268
|
-
trademarkRule
|
|
269
|
-
};
|
|
270
|
-
//# sourceMappingURL=index.js.map
|
|
258
|
+
export { TypographyPlugin, closingDoubleQuoteRule, closingSingleQuoteRule, copyrightRule, createDecoratorGuard, ellipsisRule, emDashRule, laquoRule, leftArrowRule, multiplicationRule, notEqualRule, oneHalfRule, oneQuarterRule, openingDoubleQuoteRule, openingSingleQuoteRule, plusMinusRule, raquoRule, registeredTrademarkRule, rightArrowRule, servicemarkRule, smartQuotesRules, superscriptThreeRule, superscriptTwoRule, threeQuartersRule, trademarkRule };
|
|
259
|
+
|
|
260
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/create-decorator-guard.ts","../src/input-rules.typography.ts","../src/plugin.typography.tsx"],"sourcesContent":["import type {EditorContext, EditorSchema} from '@portabletext/editor'\nimport {\n getSelectedSpans,\n isActiveDecorator,\n} from '@portabletext/editor/selectors'\nimport {getPathSubSchema} from '@portabletext/editor/traversal'\nimport type {InputRuleGuard} from '@portabletext/plugin-input-rule'\n\n/**\n * @public\n * Create an `InputRuleGuard` that can prevent the rule from running inside\n * certain decorators.\n *\n * @example\n * ```tsx\n * const guard = createDecoratorGuard({\n * decorators: ({context}) => context.schema.decorators.flatMap((decorator) => decorator.name === 'code' ? [] : [decorator.name]),\n * })\n *\n * <TypographyPlugin guard={guard} />\n * ```\n */\nexport function createDecoratorGuard(config: {\n decorators: ({\n context,\n }: {\n context: Pick<EditorContext, 'schema'>\n }) => Array<EditorSchema['decorators'][number]['name']>\n}): InputRuleGuard {\n return ({snapshot, event}) => {\n const subSchema = getPathSubSchema(snapshot, event.focusBlock.path)\n const allowedDecorators = config.decorators({\n context: {\n schema: subSchema,\n },\n })\n const decorators = subSchema.decorators.flatMap((decorator) =>\n allowedDecorators.includes(decorator.name) ? [] : [decorator.name],\n )\n\n if (decorators.length === 0) {\n return true\n }\n\n const matchedSpans = event.matches.flatMap((match) =>\n getSelectedSpans({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: match.selection,\n },\n }),\n )\n\n let preventInputRule = false\n\n for (const decorator of decorators) {\n if (isActiveDecorator(decorator)(snapshot)) {\n preventInputRule = true\n break\n }\n\n if (matchedSpans.some((span) => span.node.marks?.includes(decorator))) {\n preventInputRule = true\n break\n }\n }\n\n return !preventInputRule\n }\n}\n","import {\n defineTextTransformRule,\n type InputRule,\n} from '@portabletext/plugin-input-rule'\n\n/**\n * @public\n */\nexport const emDashRule = defineTextTransformRule({\n on: /--/,\n transform: () => '—',\n})\n\n/**\n * @public\n */\nexport const ellipsisRule = defineTextTransformRule({\n on: /\\.\\.\\./,\n transform: () => '…',\n})\n\n/**\n * @public\n */\nexport const openingDoubleQuoteRule = defineTextTransformRule({\n on: /(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))\"/g,\n transform: () => '“',\n})\n\n/**\n * @public\n */\nexport const closingDoubleQuoteRule = defineTextTransformRule({\n on: /\"/g,\n transform: () => '”',\n})\n\n/**\n * @public\n */\nexport const openingSingleQuoteRule = defineTextTransformRule({\n on: /(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))'/g,\n transform: () => '‘',\n})\n\n/**\n * @public\n */\nexport const closingSingleQuoteRule = defineTextTransformRule({\n on: /'/g,\n transform: () => '’',\n})\n\n/**\n * @public\n */\nexport const smartQuotesRules: Array<InputRule> = [\n openingDoubleQuoteRule,\n closingDoubleQuoteRule,\n openingSingleQuoteRule,\n closingSingleQuoteRule,\n]\n\n/**\n * @public\n */\nexport const leftArrowRule = defineTextTransformRule({\n on: /<-/,\n transform: () => '←',\n})\n\n/**\n * @public\n */\nexport const rightArrowRule = defineTextTransformRule({\n on: /->/,\n transform: () => '→',\n})\n\n/**\n * @public\n */\nexport const copyrightRule = defineTextTransformRule({\n on: /\\(c\\)/,\n transform: () => '©',\n})\n\n/**\n * @public\n */\nexport const servicemarkRule = defineTextTransformRule({\n on: /\\(sm\\)/,\n transform: () => '℠',\n})\n\n/**\n * @public\n */\nexport const trademarkRule = defineTextTransformRule({\n on: /\\(tm\\)/,\n transform: () => '™',\n})\n\n/**\n * @beta\n */\nexport const registeredTrademarkRule = defineTextTransformRule({\n on: /\\(r\\)/,\n transform: () => '®',\n})\n\n/**\n * @public\n */\nexport const oneHalfRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>1\\/2)\\s/,\n transform: {fraction: () => '½'},\n})\n\n/**\n * @public\n */\nexport const plusMinusRule = defineTextTransformRule({\n on: /\\+\\/-/,\n transform: () => '±',\n})\n\n/**\n * @public\n */\nexport const notEqualRule = defineTextTransformRule({\n on: /!=/,\n transform: () => '≠',\n})\n\n/**\n * @public\n */\nexport const laquoRule = defineTextTransformRule({\n on: /<</,\n transform: () => '«',\n})\n\n/**\n * @public\n */\nexport const raquoRule = defineTextTransformRule({\n on: />>/,\n transform: () => '»',\n})\n\n/**\n * @public\n */\nexport const multiplicationRule = defineTextTransformRule({\n on: /\\d+\\s?(?<operator>[*x])\\s?\\d+/,\n transform: {operator: () => '×'},\n})\n\n/**\n * @public\n */\nexport const superscriptTwoRule = defineTextTransformRule({\n on: /\\^2/,\n transform: () => '²',\n})\n\n/**\n * @public\n */\nexport const superscriptThreeRule = defineTextTransformRule({\n on: /\\^3/,\n transform: () => '³',\n})\n\n/**\n * @public\n */\nexport const oneQuarterRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>1\\/4)\\s/,\n transform: {fraction: () => '¼'},\n})\n\n/**\n * @public\n */\nexport const threeQuartersRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>3\\/4)\\s/,\n transform: {fraction: () => '¾'},\n})\n","import {\n InputRulePlugin,\n type InputRuleGuard,\n} from '@portabletext/plugin-input-rule'\nimport {useMemo} from 'react'\nimport {\n closingDoubleQuoteRule,\n closingSingleQuoteRule,\n copyrightRule,\n ellipsisRule,\n emDashRule,\n laquoRule,\n leftArrowRule,\n multiplicationRule,\n notEqualRule,\n oneHalfRule,\n oneQuarterRule,\n openingDoubleQuoteRule,\n openingSingleQuoteRule,\n plusMinusRule,\n raquoRule,\n registeredTrademarkRule,\n rightArrowRule,\n servicemarkRule,\n superscriptThreeRule,\n superscriptTwoRule,\n threeQuartersRule,\n trademarkRule,\n} from './input-rules.typography'\n\nconst defaultRuleConfig = [\n {name: 'emDash', rule: emDashRule, state: 'on'},\n {name: 'ellipsis', rule: ellipsisRule, state: 'on'},\n {name: 'openingDoubleQuote', rule: openingDoubleQuoteRule, state: 'on'},\n {name: 'closingDoubleQuote', rule: closingDoubleQuoteRule, state: 'on'},\n {name: 'openingSingleQuote', rule: openingSingleQuoteRule, state: 'on'},\n {name: 'closingSingleQuote', rule: closingSingleQuoteRule, state: 'on'},\n {name: 'leftArrow', rule: leftArrowRule, state: 'on'},\n {name: 'rightArrow', rule: rightArrowRule, state: 'on'},\n {name: 'copyright', rule: copyrightRule, state: 'on'},\n {name: 'trademark', rule: trademarkRule, state: 'on'},\n {name: 'servicemark', rule: servicemarkRule, state: 'on'},\n {name: 'registeredTrademark', rule: registeredTrademarkRule, state: 'on'},\n {name: 'oneHalf', rule: oneHalfRule, state: 'off'},\n {name: 'plusMinus', rule: plusMinusRule, state: 'off'},\n {name: 'laquo', rule: laquoRule, state: 'off'},\n {name: 'notEqual', rule: notEqualRule, state: 'off'},\n {name: 'raquo', rule: raquoRule, state: 'off'},\n {name: 'multiplication', rule: multiplicationRule, state: 'off'},\n {name: 'superscriptTwo', rule: superscriptTwoRule, state: 'off'},\n {name: 'superscriptThree', rule: superscriptThreeRule, state: 'off'},\n {name: 'oneQuarter', rule: oneQuarterRule, state: 'off'},\n {name: 'threeQuarters', rule: threeQuartersRule, state: 'off'},\n] as const\n\ntype RuleName = (typeof defaultRuleConfig)[number]['name']\n\n/**\n * @public\n */\nexport type TypographyPluginProps<\n TEnabledRuleName extends RuleName = never,\n TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never,\n> = {\n guard?: InputRuleGuard\n /**\n * Preset configuration for rules.\n * - `'default'`: Common typography rules enabled (em dash, ellipsis, quotes, arrows, copyright symbols)\n * - `'all'`: All rules enabled\n * - `'none'`: No rules enabled (use with `enable` prop)\n *\n * @defaultValue 'default'\n */\n preset?: 'default' | 'all' | 'none'\n /**\n * Enable specific rules (additive to preset).\n * Use this to enable additional rules beyond the preset.\n *\n * @example\n * ```tsx\n * // Enable multiplication and plusMinus in addition to default rules\n * <TypographyPlugin enable={['multiplication', 'plusMinus']} />\n * ```\n */\n enable?: ReadonlyArray<TEnabledRuleName>\n /**\n * Disable specific rules (subtractive from preset).\n * Use this to disable rules that would otherwise be enabled by the preset.\n * Cannot contain rules that are in the `enable` array (TypeScript will enforce this).\n *\n * @example\n * ```tsx\n * // Disable em dash from the default rules\n * <TypographyPlugin disable={['emDash']} />\n * ```\n */\n disable?: ReadonlyArray<TDisabledRuleName>\n}\n\n/**\n * @public\n */\nexport function TypographyPlugin<\n TEnabledRuleName extends RuleName = never,\n TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never,\n>(props: TypographyPluginProps<TEnabledRuleName, TDisabledRuleName>) {\n const {preset = 'default', enable = [], disable = [], guard} = props\n\n const configuredInputRules = useMemo(() => {\n // Determine which rules should be enabled based on preset\n const enabledRules = new Set<RuleName>()\n\n if (preset === 'all') {\n // Enable all rules\n for (const rule of defaultRuleConfig) {\n enabledRules.add(rule.name)\n }\n } else if (preset === 'default') {\n // Enable only default rules (state: 'on')\n for (const rule of defaultRuleConfig) {\n if (rule.state === 'on') {\n enabledRules.add(rule.name)\n }\n }\n }\n // preset === 'none' starts with empty set\n\n // Apply enable list (additive)\n for (const ruleName of enable) {\n enabledRules.add(ruleName)\n }\n\n // Apply disable list (subtractive)\n for (const ruleName of disable) {\n enabledRules.delete(ruleName)\n }\n\n // Build final rule list\n return defaultRuleConfig.flatMap((rule) =>\n enabledRules.has(rule.name)\n ? [{...rule.rule, guard: guard ?? (() => true)}]\n : [],\n )\n }, [preset, enable, disable, guard])\n\n return <InputRulePlugin rules={configuredInputRules} />\n}\n"],"names":["createDecoratorGuard","config","snapshot","event","subSchema","getPathSubSchema","focusBlock","path","allowedDecorators","decorators","context","schema","flatMap","decorator","includes","name","length","matchedSpans","matches","match","getSelectedSpans","selection","preventInputRule","isActiveDecorator","some","span","node","marks","emDashRule","defineTextTransformRule","on","transform","ellipsisRule","openingDoubleQuoteRule","closingDoubleQuoteRule","openingSingleQuoteRule","closingSingleQuoteRule","smartQuotesRules","leftArrowRule","rightArrowRule","copyrightRule","servicemarkRule","trademarkRule","registeredTrademarkRule","oneHalfRule","fraction","plusMinusRule","notEqualRule","laquoRule","raquoRule","multiplicationRule","operator","superscriptTwoRule","superscriptThreeRule","oneQuarterRule","threeQuartersRule","defaultRuleConfig","rule","state","TypographyPlugin","props","$","_c","preset","t0","enable","t1","disable","t2","guard","undefined","t3","t4","enabledRules","Set","add","rule_0","ruleName","ruleName_0","delete","t5","rule_1","has","_temp","configuredInputRules","t6"],"mappings":";;;;;;AAsBO,SAASA,qBAAqBC,QAMlB;AACjB,SAAO,CAAC;AAAA,IAACC;AAAAA,IAAUC;A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A,SAsC0C;AAAI;"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["EditorContext","EditorSchema","getSelectedSpans","isActiveDecorator","getPathSubSchema","InputRuleGuard","createDecoratorGuard","config","decorators","context","Pick","Array","snapshot","event","subSchema","focusBlock","path","allowedDecorators","schema","flatMap","decorator","includes","name","length","matchedSpans","matches","match","selection","preventInputRule","some","span","node","marks","defineTextTransformRule","InputRule","emDashRule","on","transform","ellipsisRule","openingDoubleQuoteRule","closingDoubleQuoteRule","openingSingleQuoteRule","closingSingleQuoteRule","smartQuotesRules","Array","leftArrowRule","rightArrowRule","copyrightRule","servicemarkRule","trademarkRule","registeredTrademarkRule","oneHalfRule","fraction","plusMinusRule","notEqualRule","laquoRule","raquoRule","multiplicationRule","operator","superscriptTwoRule","superscriptThreeRule","oneQuarterRule","threeQuartersRule","InputRulePlugin","InputRuleGuard","useMemo","closingDoubleQuoteRule","closingSingleQuoteRule","copyrightRule","ellipsisRule","emDashRule","laquoRule","leftArrowRule","multiplicationRule","notEqualRule","oneHalfRule","oneQuarterRule","openingDoubleQuoteRule","openingSingleQuoteRule","plusMinusRule","raquoRule","registeredTrademarkRule","rightArrowRule","servicemarkRule","superscriptThreeRule","superscriptTwoRule","threeQuartersRule","trademarkRule","defaultRuleConfig","name","rule","state","const","RuleName","TypographyPluginProps","Exclude","TEnabledRuleName","guard","preset","enable","ReadonlyArray","disable","TDisabledRuleName","TypographyPlugin","props","$","_c","t0","t1","t2","undefined","t3","t4","enabledRules","Set","add","rule_0","ruleName","ruleName_0","delete","t5","flatMap","rule_1","has","_temp","configuredInputRules","t6"],"sources":["../src/create-decorator-guard.ts","../src/input-rules.typography.ts","../src/plugin.typography.tsx"],"sourcesContent":["import type {EditorContext, EditorSchema} from '@portabletext/editor'\nimport {\n getSelectedSpans,\n isActiveDecorator,\n} from '@portabletext/editor/selectors'\nimport {getPathSubSchema} from '@portabletext/editor/traversal'\nimport type {InputRuleGuard} from '@portabletext/plugin-input-rule'\n\n/**\n * @public\n * Create an `InputRuleGuard` that can prevent the rule from running inside\n * certain decorators.\n *\n * @example\n * ```tsx\n * const guard = createDecoratorGuard({\n * decorators: ({context}) => context.schema.decorators.flatMap((decorator) => decorator.name === 'code' ? [] : [decorator.name]),\n * })\n *\n * <TypographyPlugin guard={guard} />\n * ```\n */\nexport function createDecoratorGuard(config: {\n decorators: ({\n context,\n }: {\n context: Pick<EditorContext, 'schema'>\n }) => Array<EditorSchema['decorators'][number]['name']>\n}): InputRuleGuard {\n return ({snapshot, event}) => {\n const subSchema = getPathSubSchema(snapshot, event.focusBlock.path)\n const allowedDecorators = config.decorators({\n context: {\n schema: subSchema,\n },\n })\n const decorators = subSchema.decorators.flatMap((decorator) =>\n allowedDecorators.includes(decorator.name) ? [] : [decorator.name],\n )\n\n if (decorators.length === 0) {\n return true\n }\n\n const matchedSpans = event.matches.flatMap((match) =>\n getSelectedSpans({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: match.selection,\n },\n }),\n )\n\n let preventInputRule = false\n\n for (const decorator of decorators) {\n if (isActiveDecorator(decorator)(snapshot)) {\n preventInputRule = true\n break\n }\n\n if (matchedSpans.some((span) => span.node.marks?.includes(decorator))) {\n preventInputRule = true\n break\n }\n }\n\n return !preventInputRule\n }\n}\n","import {\n defineTextTransformRule,\n type InputRule,\n} from '@portabletext/plugin-input-rule'\n\n/**\n * @public\n */\nexport const emDashRule = defineTextTransformRule({\n on: /--/,\n transform: () => '—',\n})\n\n/**\n * @public\n */\nexport const ellipsisRule = defineTextTransformRule({\n on: /\\.\\.\\./,\n transform: () => '…',\n})\n\n/**\n * @public\n */\nexport const openingDoubleQuoteRule = defineTextTransformRule({\n on: /(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))\"/g,\n transform: () => '“',\n})\n\n/**\n * @public\n */\nexport const closingDoubleQuoteRule = defineTextTransformRule({\n on: /\"/g,\n transform: () => '”',\n})\n\n/**\n * @public\n */\nexport const openingSingleQuoteRule = defineTextTransformRule({\n on: /(?:^|(?<=[\\s{[(<'\"\\u2018\\u201C]))'/g,\n transform: () => '‘',\n})\n\n/**\n * @public\n */\nexport const closingSingleQuoteRule = defineTextTransformRule({\n on: /'/g,\n transform: () => '’',\n})\n\n/**\n * @public\n */\nexport const smartQuotesRules: Array<InputRule> = [\n openingDoubleQuoteRule,\n closingDoubleQuoteRule,\n openingSingleQuoteRule,\n closingSingleQuoteRule,\n]\n\n/**\n * @public\n */\nexport const leftArrowRule = defineTextTransformRule({\n on: /<-/,\n transform: () => '←',\n})\n\n/**\n * @public\n */\nexport const rightArrowRule = defineTextTransformRule({\n on: /->/,\n transform: () => '→',\n})\n\n/**\n * @public\n */\nexport const copyrightRule = defineTextTransformRule({\n on: /\\(c\\)/,\n transform: () => '©',\n})\n\n/**\n * @public\n */\nexport const servicemarkRule = defineTextTransformRule({\n on: /\\(sm\\)/,\n transform: () => '℠',\n})\n\n/**\n * @public\n */\nexport const trademarkRule = defineTextTransformRule({\n on: /\\(tm\\)/,\n transform: () => '™',\n})\n\n/**\n * @beta\n */\nexport const registeredTrademarkRule = defineTextTransformRule({\n on: /\\(r\\)/,\n transform: () => '®',\n})\n\n/**\n * @public\n */\nexport const oneHalfRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>1\\/2)\\s/,\n transform: {fraction: () => '½'},\n})\n\n/**\n * @public\n */\nexport const plusMinusRule = defineTextTransformRule({\n on: /\\+\\/-/,\n transform: () => '±',\n})\n\n/**\n * @public\n */\nexport const notEqualRule = defineTextTransformRule({\n on: /!=/,\n transform: () => '≠',\n})\n\n/**\n * @public\n */\nexport const laquoRule = defineTextTransformRule({\n on: /<</,\n transform: () => '«',\n})\n\n/**\n * @public\n */\nexport const raquoRule = defineTextTransformRule({\n on: />>/,\n transform: () => '»',\n})\n\n/**\n * @public\n */\nexport const multiplicationRule = defineTextTransformRule({\n on: /\\d+\\s?(?<operator>[*x])\\s?\\d+/,\n transform: {operator: () => '×'},\n})\n\n/**\n * @public\n */\nexport const superscriptTwoRule = defineTextTransformRule({\n on: /\\^2/,\n transform: () => '²',\n})\n\n/**\n * @public\n */\nexport const superscriptThreeRule = defineTextTransformRule({\n on: /\\^3/,\n transform: () => '³',\n})\n\n/**\n * @public\n */\nexport const oneQuarterRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>1\\/4)\\s/,\n transform: {fraction: () => '¼'},\n})\n\n/**\n * @public\n */\nexport const threeQuartersRule = defineTextTransformRule({\n on: /(?:^|\\s)(?<fraction>3\\/4)\\s/,\n transform: {fraction: () => '¾'},\n})\n","import {\n InputRulePlugin,\n type InputRuleGuard,\n} from '@portabletext/plugin-input-rule'\nimport {useMemo} from 'react'\nimport {\n closingDoubleQuoteRule,\n closingSingleQuoteRule,\n copyrightRule,\n ellipsisRule,\n emDashRule,\n laquoRule,\n leftArrowRule,\n multiplicationRule,\n notEqualRule,\n oneHalfRule,\n oneQuarterRule,\n openingDoubleQuoteRule,\n openingSingleQuoteRule,\n plusMinusRule,\n raquoRule,\n registeredTrademarkRule,\n rightArrowRule,\n servicemarkRule,\n superscriptThreeRule,\n superscriptTwoRule,\n threeQuartersRule,\n trademarkRule,\n} from './input-rules.typography'\n\nconst defaultRuleConfig = [\n {name: 'emDash', rule: emDashRule, state: 'on'},\n {name: 'ellipsis', rule: ellipsisRule, state: 'on'},\n {name: 'openingDoubleQuote', rule: openingDoubleQuoteRule, state: 'on'},\n {name: 'closingDoubleQuote', rule: closingDoubleQuoteRule, state: 'on'},\n {name: 'openingSingleQuote', rule: openingSingleQuoteRule, state: 'on'},\n {name: 'closingSingleQuote', rule: closingSingleQuoteRule, state: 'on'},\n {name: 'leftArrow', rule: leftArrowRule, state: 'on'},\n {name: 'rightArrow', rule: rightArrowRule, state: 'on'},\n {name: 'copyright', rule: copyrightRule, state: 'on'},\n {name: 'trademark', rule: trademarkRule, state: 'on'},\n {name: 'servicemark', rule: servicemarkRule, state: 'on'},\n {name: 'registeredTrademark', rule: registeredTrademarkRule, state: 'on'},\n {name: 'oneHalf', rule: oneHalfRule, state: 'off'},\n {name: 'plusMinus', rule: plusMinusRule, state: 'off'},\n {name: 'laquo', rule: laquoRule, state: 'off'},\n {name: 'notEqual', rule: notEqualRule, state: 'off'},\n {name: 'raquo', rule: raquoRule, state: 'off'},\n {name: 'multiplication', rule: multiplicationRule, state: 'off'},\n {name: 'superscriptTwo', rule: superscriptTwoRule, state: 'off'},\n {name: 'superscriptThree', rule: superscriptThreeRule, state: 'off'},\n {name: 'oneQuarter', rule: oneQuarterRule, state: 'off'},\n {name: 'threeQuarters', rule: threeQuartersRule, state: 'off'},\n] as const\n\ntype RuleName = (typeof defaultRuleConfig)[number]['name']\n\n/**\n * @public\n */\nexport type TypographyPluginProps<\n TEnabledRuleName extends RuleName = never,\n TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never,\n> = {\n guard?: InputRuleGuard\n /**\n * Preset configuration for rules.\n * - `'default'`: Common typography rules enabled (em dash, ellipsis, quotes, arrows, copyright symbols)\n * - `'all'`: All rules enabled\n * - `'none'`: No rules enabled (use with `enable` prop)\n *\n * @defaultValue 'default'\n */\n preset?: 'default' | 'all' | 'none'\n /**\n * Enable specific rules (additive to preset).\n * Use this to enable additional rules beyond the preset.\n *\n * @example\n * ```tsx\n * // Enable multiplication and plusMinus in addition to default rules\n * <TypographyPlugin enable={['multiplication', 'plusMinus']} />\n * ```\n */\n enable?: ReadonlyArray<TEnabledRuleName>\n /**\n * Disable specific rules (subtractive from preset).\n * Use this to disable rules that would otherwise be enabled by the preset.\n * Cannot contain rules that are in the `enable` array (TypeScript will enforce this).\n *\n * @example\n * ```tsx\n * // Disable em dash from the default rules\n * <TypographyPlugin disable={['emDash']} />\n * ```\n */\n disable?: ReadonlyArray<TDisabledRuleName>\n}\n\n/**\n * @public\n */\nexport function TypographyPlugin<\n TEnabledRuleName extends RuleName = never,\n TDisabledRuleName extends Exclude<RuleName, TEnabledRuleName> = never,\n>(props: TypographyPluginProps<TEnabledRuleName, TDisabledRuleName>) {\n const {preset = 'default', enable = [], disable = [], guard} = props\n\n const configuredInputRules = useMemo(() => {\n // Determine which rules should be enabled based on preset\n const enabledRules = new Set<RuleName>()\n\n if (preset === 'all') {\n // Enable all rules\n for (const rule of defaultRuleConfig) {\n enabledRules.add(rule.name)\n }\n } else if (preset === 'default') {\n // Enable only default rules (state: 'on')\n for (const rule of defaultRuleConfig) {\n if (rule.state === 'on') {\n enabledRules.add(rule.name)\n }\n }\n }\n // preset === 'none' starts with empty set\n\n // Apply enable list (additive)\n for (const ruleName of enable) {\n enabledRules.add(ruleName)\n }\n\n // Apply disable list (subtractive)\n for (const ruleName of disable) {\n enabledRules.delete(ruleName)\n }\n\n // Build final rule list\n return defaultRuleConfig.flatMap((rule) =>\n enabledRules.has(rule.name)\n ? [{...rule.rule, guard: guard ?? (() => true)}]\n : [],\n )\n }, [preset, enable, disable, guard])\n\n return <InputRulePlugin rules={configuredInputRules} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgBM,qBAAqBC,QAMlB;CACjB,QAAQ,EAACK,UAAUC,YAAW;EAC5B,IAAMC,YAAYV,iBAAiBQ,UAAUC,MAAME,WAAWC,IAAI,GAC5DC,oBAAoBV,OAAOC,WAAW,EAC1CC,SAAS,EACPS,QAAQJ,UACV,EACF,CAAC,GACKN,aAAaM,UAAUN,WAAWW,SAASC,cAC/CH,kBAAkBI,SAASD,UAAUE,IAAI,IAAI,CAAA,IAAK,CAACF,UAAUE,IAAI,CACnE;EAEA,IAAId,WAAWe,WAAW,GACxB,OAAO;EAGT,IAAMC,eAAeX,MAAMY,QAAQN,SAASO,UAC1CxB,iBAAiB;GACf,GAAGU;GACHH,SAAS;IACP,GAAGG,SAASH;IACZkB,WAAWD,MAAMC;GACnB;EACF,CAAC,CACH,GAEIC,mBAAmB;EAEvB,KAAK,IAAMR,aAAaZ,YAAY;GAClC,IAAIL,kBAAkBiB,SAAS,CAAC,CAACR,QAAQ,GAAG;IAC1CgB,mBAAmB;IACnB;GACF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WAEf,KAAA,IAAAkB,UAAc5B,mBACjB,AAAIE,OAAIC,UAAW,QACjBsB,aAAYE,IAAKzB,OAAID,IAAK;EAOhC,KAAK,IAAA4B,YAAkBlB,QACrBc,aAAYE,IAAKE,QAAQ;EAI3B,KAAK,IAAAC,cAAkBjB,SACrBY,aAAYM,OAAQF,UAAQ;EAC7BZ,AAAAA,EAAA,KAAAJ,SAAAI,EAAA,KAAAN,QAAAM,EAAA,KAAAP,QAAAO,EAAA,KAAAQ;CAAA,OAAAA,eAAAR,EAAA;CAAA,IAAAe;CAAA,AAAAf,EAAA,OAAAQ,gBAAAR,EAAA,OAAAR,SAGMuB,KAAAhC,kBAAiBiC,SAASC,WAC/BT,aAAYU,IAAKjC,OAAID,IAEhB,IAFL,CACK;EAAA,GAAIC,OAAIA;EAAKO,OAASA,SAAA2B;CAAqB,CAAC,IADjD,CAAA,CAGF,GAACnB,EAAA,KAAAQ,cAAAR,EAAA,KAAAR,OAAAQ,EAAA,MAAAe,MAAAA,KAAAf,EAAA;CAlCH,IAAAoB,uBA8BEL,IAKkCM;CAEmB,OAFnBrB,EAAA,QAAAoB,uBAEmBC,KAAArB,EAAA,OAAhDqB,KAAA,oBAAC,iBAAD,EAAwBD,OAAAA,qBAAoB,CAAA,GAAIpB,EAAA,MAAAoB,sBAAApB,EAAA,MAAAqB,KAAhDA;AAAgD;AA3ClD,SAAAF,QAAA;CAAA,OAsC0C;AAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/plugin-typography",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.45",
|
|
4
4
|
"description": "Automatically transform text to typographic variants",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plugin",
|
|
@@ -24,19 +24,21 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
27
28
|
"types": "./dist/index.d.ts",
|
|
28
29
|
"exports": {
|
|
29
30
|
".": "./dist/index.js",
|
|
30
31
|
"./package.json": "./package.json"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@portabletext/plugin-input-rule": "^6.0.
|
|
34
|
+
"@portabletext/plugin-input-rule": "^6.0.14"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
+
"@rolldown/plugin-babel": "^0.2.3",
|
|
38
|
+
"@sanity/pkg-utils": "^12.1.0",
|
|
37
39
|
"@sanity/tsconfig": "^2.1.0",
|
|
38
40
|
"@types/react": "^19.2.17",
|
|
39
|
-
"@vitejs/plugin-react": "^
|
|
41
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
40
42
|
"@vitest/browser": "^4.1.10",
|
|
41
43
|
"@vitest/browser-playwright": "^4.1.10",
|
|
42
44
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
@@ -46,21 +48,21 @@
|
|
|
46
48
|
"react": "^19.2.7",
|
|
47
49
|
"typescript": "6.0.3",
|
|
48
50
|
"typescript-eslint": "^8.62.0",
|
|
49
|
-
"vite": "^
|
|
51
|
+
"vite": "^8.2.0",
|
|
50
52
|
"vitest": "^4.1.10",
|
|
51
|
-
"@portabletext/editor": "^7.10.
|
|
52
|
-
"@portabletext/schema": "^2.2.
|
|
53
|
-
"racejar": "2.0.
|
|
53
|
+
"@portabletext/editor": "^7.10.17",
|
|
54
|
+
"@portabletext/schema": "^2.2.4",
|
|
55
|
+
"racejar": "2.0.11"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
56
|
-
"@portabletext/editor": "^7.10.
|
|
58
|
+
"@portabletext/editor": "^7.10.17",
|
|
57
59
|
"react": "^19.2"
|
|
58
60
|
},
|
|
59
61
|
"engines": {
|
|
60
62
|
"node": ">=20.19 <22 || >=22.12"
|
|
61
63
|
},
|
|
62
64
|
"scripts": {
|
|
63
|
-
"build": "pkg-utils build --strict --check
|
|
65
|
+
"build": "pkg-utils build --strict --check",
|
|
64
66
|
"check:lint": "biome lint .",
|
|
65
67
|
"check:react-compiler": "eslint --cache .",
|
|
66
68
|
"check:types": "tsc",
|