@pie-lib/mask-markup 3.1.6-beta.2 → 4.0.0-next.20261002094057

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.
Files changed (96) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +4 -0
  2. package/dist/choices/choice.d.ts +28 -0
  3. package/dist/choices/choice.js +92 -0
  4. package/dist/choices/index.d.ts +29 -0
  5. package/dist/choices/index.js +59 -0
  6. package/dist/componentize.d.ts +12 -0
  7. package/dist/componentize.js +4 -0
  8. package/dist/components/blank.d.ts +45 -0
  9. package/dist/components/blank.js +273 -0
  10. package/dist/components/dropdown.d.ts +37 -0
  11. package/dist/components/dropdown.js +311 -0
  12. package/dist/constructed-response.d.ts +44 -0
  13. package/dist/constructed-response.js +56 -0
  14. package/dist/customizable.d.ts +43 -0
  15. package/dist/customizable.js +8 -0
  16. package/dist/drag-in-the-blank.d.ts +47 -0
  17. package/dist/drag-in-the-blank.js +220 -0
  18. package/dist/index.d.ts +15 -0
  19. package/dist/index.js +7 -0
  20. package/dist/inline-dropdown.d.ts +44 -0
  21. package/dist/inline-dropdown.js +24 -0
  22. package/dist/keyboard-coordinates.d.ts +25 -0
  23. package/dist/keyboard-coordinates.js +49 -0
  24. package/dist/mask.d.ts +30 -0
  25. package/dist/mask.js +95 -0
  26. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  27. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
  28. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
  29. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
  30. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
  31. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
  32. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
  33. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
  34. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
  35. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
  36. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
  37. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
  38. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
  39. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
  40. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
  41. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
  42. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
  43. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
  44. package/dist/serialization.d.ts +34 -0
  45. package/dist/serialization.js +132 -0
  46. package/dist/with-mask.d.ts +55 -0
  47. package/dist/with-mask.js +45 -0
  48. package/package.json +35 -19
  49. package/CHANGELOG.json +0 -17
  50. package/CHANGELOG.md +0 -1256
  51. package/lib/choices/choice.js +0 -120
  52. package/lib/choices/choice.js.map +0 -1
  53. package/lib/choices/index.js +0 -103
  54. package/lib/choices/index.js.map +0 -1
  55. package/lib/componentize.js +0 -21
  56. package/lib/componentize.js.map +0 -1
  57. package/lib/components/blank.js +0 -412
  58. package/lib/components/blank.js.map +0 -1
  59. package/lib/components/correct-input.js +0 -94
  60. package/lib/components/correct-input.js.map +0 -1
  61. package/lib/components/dropdown.js +0 -483
  62. package/lib/components/dropdown.js.map +0 -1
  63. package/lib/components/input.js +0 -50
  64. package/lib/components/input.js.map +0 -1
  65. package/lib/constructed-response.js +0 -101
  66. package/lib/constructed-response.js.map +0 -1
  67. package/lib/customizable.js +0 -42
  68. package/lib/customizable.js.map +0 -1
  69. package/lib/drag-in-the-blank.js +0 -254
  70. package/lib/drag-in-the-blank.js.map +0 -1
  71. package/lib/index.js +0 -55
  72. package/lib/index.js.map +0 -1
  73. package/lib/inline-dropdown.js +0 -40
  74. package/lib/inline-dropdown.js.map +0 -1
  75. package/lib/keyboard-coordinates.js +0 -156
  76. package/lib/mask.js +0 -198
  77. package/lib/mask.js.map +0 -1
  78. package/lib/serialization.js +0 -261
  79. package/lib/serialization.js.map +0 -1
  80. package/lib/with-mask.js +0 -97
  81. package/lib/with-mask.js.map +0 -1
  82. package/src/choices/choice.jsx +0 -100
  83. package/src/choices/index.jsx +0 -64
  84. package/src/componentize.js +0 -13
  85. package/src/components/blank.jsx +0 -431
  86. package/src/components/correct-input.jsx +0 -82
  87. package/src/components/dropdown.jsx +0 -423
  88. package/src/components/input.jsx +0 -48
  89. package/src/constructed-response.jsx +0 -87
  90. package/src/customizable.jsx +0 -34
  91. package/src/drag-in-the-blank.jsx +0 -241
  92. package/src/index.js +0 -16
  93. package/src/inline-dropdown.jsx +0 -29
  94. package/src/mask.jsx +0 -172
  95. package/src/serialization.js +0 -260
  96. package/src/with-mask.jsx +0 -75
package/src/with-mask.jsx DELETED
@@ -1,75 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import Mask from './mask';
4
- import componentize from './componentize';
5
- import { deserialize } from './serialization';
6
-
7
- export const buildLayoutFromMarkup = (markup, type) => {
8
- const { markup: processed } = componentize(markup, type);
9
- const value = deserialize(processed);
10
- return value.document;
11
- };
12
-
13
- export const withMask = (type, renderChildren) => {
14
- return class WithMask extends React.Component {
15
- static propTypes = {
16
- /**
17
- * At the start we'll probably work with markup
18
- */
19
- markup: PropTypes.string,
20
- /**
21
- * Once we start authoring, it may make sense for use to us layout, which will be a simple js object that maps to `slate.Value`.
22
- */
23
- layout: PropTypes.object,
24
- value: PropTypes.object,
25
- onChange: PropTypes.func,
26
- customMarkMarkupComponent: PropTypes.func,
27
- elementType: PropTypes.string,
28
- };
29
-
30
- constructor(props) {
31
- super(props);
32
- this.containerRef = React.createRef();
33
- }
34
-
35
- componentDidUpdate(prevProps) {
36
- if (this.props.markup !== prevProps.markup) {
37
- const domNode = this.containerRef.current;
38
- const mathElements = domNode && domNode.querySelectorAll('[data-latex][data-math-handled="true"]');
39
-
40
- // Clean up for fresh MathJax processing
41
- (mathElements || []).forEach((el) => {
42
- // Remove the MathJax container to allow for clean updates
43
- const mjxContainer = el.querySelector('mjx-container');
44
-
45
- if (mjxContainer) {
46
- el.removeChild(mjxContainer);
47
- }
48
-
49
- // Update the innerHTML to match the raw LaTeX data, ensuring it is reprocessed correctly
50
- const latexCode = el.getAttribute('data-raw');
51
- el.innerHTML = latexCode;
52
-
53
- // Remove the attribute to signal that MathJax should reprocess this element
54
- el.removeAttribute('data-math-handled');
55
- });
56
- }
57
- }
58
-
59
- render() {
60
- const { markup, layout, value, onChange, elementType } = this.props;
61
-
62
- const maskLayout = layout ? layout : buildLayoutFromMarkup(markup, type);
63
- return (
64
- <Mask
65
- containerRef={this.containerRef}
66
- elementType={elementType}
67
- layout={maskLayout}
68
- value={value}
69
- onChange={onChange}
70
- renderChildren={renderChildren(this.props)}
71
- />
72
- );
73
- }
74
- };
75
- };