@portabletext/plugin-typography 8.0.51 → 9.0.1

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 CHANGED
@@ -112,93 +112,93 @@ declare const oneQuarterRule: InputRule<true>;
112
112
  */
113
113
  declare const threeQuartersRule: InputRule<true>;
114
114
  declare const defaultRuleConfig: readonly [{
115
- readonly name: "emDash";
115
+ readonly name: 'emDash';
116
116
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
117
- readonly state: "on";
117
+ readonly state: 'on';
118
118
  }, {
119
- readonly name: "ellipsis";
119
+ readonly name: 'ellipsis';
120
120
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
121
- readonly state: "on";
121
+ readonly state: 'on';
122
122
  }, {
123
- readonly name: "openingDoubleQuote";
123
+ readonly name: 'openingDoubleQuote';
124
124
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
125
- readonly state: "on";
125
+ readonly state: 'on';
126
126
  }, {
127
- readonly name: "closingDoubleQuote";
127
+ readonly name: 'closingDoubleQuote';
128
128
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
129
- readonly state: "on";
129
+ readonly state: 'on';
130
130
  }, {
131
- readonly name: "openingSingleQuote";
131
+ readonly name: 'openingSingleQuote';
132
132
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
133
- readonly state: "on";
133
+ readonly state: 'on';
134
134
  }, {
135
- readonly name: "closingSingleQuote";
135
+ readonly name: 'closingSingleQuote';
136
136
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
137
- readonly state: "on";
137
+ readonly state: 'on';
138
138
  }, {
139
- readonly name: "leftArrow";
139
+ readonly name: 'leftArrow';
140
140
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
141
- readonly state: "on";
141
+ readonly state: 'on';
142
142
  }, {
143
- readonly name: "rightArrow";
143
+ readonly name: 'rightArrow';
144
144
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
145
- readonly state: "on";
145
+ readonly state: 'on';
146
146
  }, {
147
- readonly name: "copyright";
147
+ readonly name: 'copyright';
148
148
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
149
- readonly state: "on";
149
+ readonly state: 'on';
150
150
  }, {
151
- readonly name: "trademark";
151
+ readonly name: 'trademark';
152
152
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
153
- readonly state: "on";
153
+ readonly state: 'on';
154
154
  }, {
155
- readonly name: "servicemark";
155
+ readonly name: 'servicemark';
156
156
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
157
- readonly state: "on";
157
+ readonly state: 'on';
158
158
  }, {
159
- readonly name: "registeredTrademark";
159
+ readonly name: 'registeredTrademark';
160
160
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
161
- readonly state: "on";
161
+ readonly state: 'on';
162
162
  }, {
163
- readonly name: "oneHalf";
163
+ readonly name: 'oneHalf';
164
164
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
165
- readonly state: "off";
165
+ readonly state: 'off';
166
166
  }, {
167
- readonly name: "plusMinus";
167
+ readonly name: 'plusMinus';
168
168
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
169
- readonly state: "off";
169
+ readonly state: 'off';
170
170
  }, {
171
- readonly name: "laquo";
171
+ readonly name: 'laquo';
172
172
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
173
- readonly state: "off";
173
+ readonly state: 'off';
174
174
  }, {
175
- readonly name: "notEqual";
175
+ readonly name: 'notEqual';
176
176
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
177
- readonly state: "off";
177
+ readonly state: 'off';
178
178
  }, {
179
- readonly name: "raquo";
179
+ readonly name: 'raquo';
180
180
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
181
- readonly state: "off";
181
+ readonly state: 'off';
182
182
  }, {
183
- readonly name: "multiplication";
183
+ readonly name: 'multiplication';
184
184
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
185
- readonly state: "off";
185
+ readonly state: 'off';
186
186
  }, {
187
- readonly name: "superscriptTwo";
187
+ readonly name: 'superscriptTwo';
188
188
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
189
- readonly state: "off";
189
+ readonly state: 'off';
190
190
  }, {
191
- readonly name: "superscriptThree";
191
+ readonly name: 'superscriptThree';
192
192
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
193
- readonly state: "off";
193
+ readonly state: 'off';
194
194
  }, {
195
- readonly name: "oneQuarter";
195
+ readonly name: 'oneQuarter';
196
196
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
197
- readonly state: "off";
197
+ readonly state: 'off';
198
198
  }, {
199
- readonly name: "threeQuarters";
199
+ readonly name: 'threeQuarters';
200
200
  readonly rule: import("@portabletext/plugin-input-rule").InputRule<true>;
201
- readonly state: "off";
201
+ readonly state: 'off';
202
202
  }];
203
203
  type RuleName = (typeof defaultRuleConfig)[number]['name'];
204
204
  /**
@@ -1 +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,g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C1C;WAAmB,gDAAI;WAAiB;;WACxC;WAAmB,gDAAI;WAAiB;;WACxC;WAAqB,gDAAI;WAAmB;;WAC5C;WAA6B,gDAAI;WAA2B;;WAC5D;WAAiB,gDAAI;WAAe;;WACpC;WAAmB,gDAAI;WAAiB;;WACxC;WAAe,gDAAI;WAAa;;WAChC;WAAkB,gDAAI;WAAgB;;WACtC;WAAe,gDAAI;WAAa;;WAChC;WAAwB,gDAAI;WAAsB;;WAClD;WAAwB,gDAAI;WAAsB;;WAClD;WAA0B,gDAAI;WAAwB;;WACtD;WAAoB,gDAAI;WAAkB;;WAC1C;WAAuB,gDAAI;WAAqB;;KAG9C,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
@@ -2,7 +2,6 @@ import { getSelectedSpans, isActiveDecorator } from "@portabletext/editor/select
2
2
  import { getPathSubSchema } from "@portabletext/editor/traversal";
3
3
  import { InputRulePlugin, defineTextTransformRule } from "@portabletext/plugin-input-rule";
4
4
  import { c } from "react/compiler-runtime";
5
- import "react";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  /**
8
7
  * @public
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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;GAEA,IAAIJ,aAAaK,MAAMC,SAASA,KAAKC,KAAKC,OAAOX,SAASD,SAAS,CAAC,GAAG;IACrEQ,mBAAmB;IACnB;GACF;EACF;EAEA,OAAO,CAACA;CACV;AACF;;;;AC9DA,MAAaO,aAAaF,wBAAwB;CAChDG,IAAI;CACJC,iBAAiB;AACnB,CAAC,GAKYC,eAAeL,wBAAwB;CAClDG,IAAI;CACJC,iBAAiB;AACnB,CAAC,GAKYE,yBAAyBN,wBAAwB;CAC5D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A,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"}
1
+ {"version":3,"file":"index.js","names":["preset = 'default'","enable = []","disable = []","rule","ruleName","defaultRuleConfig.flatMap((rule) =>\n enabledRules.has(rule.name)\n ? [{...rule.rule, guard: guard ?? (() => true)}]\n : [],\n )","() => true","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])","<InputRulePlugin rules={configuredInputRules} />"],"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,SAAgB,qBAAqB,QAMlB;CACjB,QAAQ,EAAC,UAAU,YAAW;EAC5B,IAAM,YAAY,iBAAiB,UAAU,MAAM,WAAW,IAAI,GAC5D,oBAAoB,OAAO,WAAW,EAC1C,SAAS,EACP,QAAQ,UACV,EACF,CAAC,GACK,aAAa,UAAU,WAAW,SAAS,cAC/C,kBAAkB,SAAS,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CACnE;EAEA,IAAI,WAAW,WAAW,GACxB,OAAO;EAGT,IAAM,eAAe,MAAM,QAAQ,SAAS,UAC1C,iBAAiB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KAAA,kBAAkB,SAAS,WAChC,aAAa,IAAIF,OAAK,IAAI,IACtB,CAAC;EAAC,GAAGA,OAAK;EAAM,OAAO,SAAUG;CAAW,CAAC,IAC7C,CAAC,CACP,GAHE,EAAA,KAAA,cAC2B,EAAA,KAAA;CAhC/B,IAAM,uBAAuBC,IAqCtBC;CAAP,OAA+B,EAAA,QAAA,qCAAxB,KAAA,oBAAC,iBAAD,EAAiB,OAAO,qBAAuB,CAAA,GAAvB,EAAA,MAAA,mCAAxBA;AACT;AAN2C,SAAA,QAAA;CAAM,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/plugin-typography",
3
- "version": "8.0.51",
3
+ "version": "9.0.1",
4
4
  "description": "Automatically transform text to typographic variants",
5
5
  "keywords": [
6
6
  "plugin",
@@ -23,53 +23,43 @@
23
23
  ],
24
24
  "type": "module",
25
25
  "sideEffects": false,
26
- "main": "./dist/index.js",
27
- "module": "./dist/index.js",
28
26
  "types": "./dist/index.d.ts",
29
27
  "exports": {
30
28
  ".": "./dist/index.js",
31
29
  "./package.json": "./package.json"
32
30
  },
33
31
  "dependencies": {
34
- "@portabletext/plugin-input-rule": "^6.0.20"
32
+ "@portabletext/plugin-input-rule": "^7.0.1"
35
33
  },
36
34
  "devDependencies": {
37
- "@rolldown/plugin-babel": "^0.2.3",
38
- "@sanity/pkg-utils": "^12.1.0",
35
+ "@sanity/pkg-utils": "^12.3.0",
39
36
  "@sanity/tsconfig": "^2.1.0",
40
37
  "@types/react": "^19.2.17",
41
- "@vitejs/plugin-react": "^6.0.5",
38
+ "@vitejs/plugin-react": "^6.1.0",
42
39
  "@vitest/browser": "^4.1.10",
43
40
  "@vitest/browser-playwright": "^4.1.10",
44
- "babel-plugin-react-compiler": "^1.0.0",
45
- "eslint": "^9.39.4",
46
- "eslint-formatter-gha": "^1.6.0",
47
- "eslint-plugin-react-hooks": "^7.1.1",
41
+ "oxc-transform-react": "^0.145.0",
48
42
  "react": "^19.2.8",
49
- "typescript": "6.0.3",
50
- "typescript-eslint": "^8.62.0",
43
+ "typescript": "^7.0.2",
51
44
  "vite": "^8.2.0",
52
45
  "vitest": "^4.1.10",
53
- "@portabletext/schema": "^2.2.4",
54
- "@portabletext/editor": "^7.12.2",
55
- "racejar": "2.0.11"
46
+ "@portabletext/editor": "^8.0.1",
47
+ "@portabletext/schema": "^3.0.0",
48
+ "racejar": "3.0.0"
56
49
  },
57
50
  "peerDependencies": {
58
- "@portabletext/editor": "^7.12.2",
51
+ "@portabletext/editor": "^8.0.1",
59
52
  "react": "^19.2"
60
53
  },
61
54
  "engines": {
62
- "node": ">=20.19 <22 || >=22.12"
55
+ "node": ">=22.12"
63
56
  },
64
57
  "scripts": {
65
58
  "build": "pkg-utils build --strict --check",
66
- "check:lint": "biome lint .",
67
- "check:react-compiler": "eslint --cache .",
68
59
  "check:types": "tsc",
69
60
  "check:types:watch": "tsc --watch",
70
61
  "clean": "del .turbo && del lib && del node_modules",
71
62
  "dev": "pkg-utils watch",
72
- "lint:fix": "biome lint --write .",
73
63
  "test": "vitest --run",
74
64
  "test:browser": "vitest --run --project browser",
75
65
  "test:browser:chromium": "vitest run --project \"browser (chromium)\"",