@pie-lib/mask-markup 3.0.4-next.31 → 3.0.4-next.32
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/_virtual/_rolldown/runtime.js +4 -0
- package/dist/choices/choice.d.ts +24 -0
- package/dist/choices/choice.js +77 -0
- package/dist/choices/index.d.ts +25 -0
- package/dist/choices/index.js +49 -0
- package/dist/componentize.d.ts +12 -0
- package/dist/componentize.js +4 -0
- package/dist/components/blank.d.ts +39 -0
- package/dist/components/blank.js +240 -0
- package/dist/components/correct-input.d.ts +11 -0
- package/dist/components/dropdown.d.ts +37 -0
- package/dist/components/dropdown.js +320 -0
- package/dist/components/input.d.ts +37 -0
- package/dist/constructed-response.d.ts +44 -0
- package/dist/constructed-response.js +55 -0
- package/dist/customizable.d.ts +43 -0
- package/dist/customizable.js +8 -0
- package/dist/drag-in-the-blank.d.ts +37 -0
- package/dist/drag-in-the-blank.js +164 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7 -0
- package/dist/inline-dropdown.d.ts +44 -0
- package/dist/inline-dropdown.js +24 -0
- package/dist/mask.d.ts +30 -0
- package/dist/mask.js +99 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +132 -0
- package/dist/with-mask.d.ts +55 -0
- package/dist/with-mask.js +45 -0
- package/package.json +39 -20
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1256
- package/LICENSE.md +0 -5
- package/lib/choices/choice.js +0 -116
- package/lib/choices/choice.js.map +0 -1
- package/lib/choices/index.js +0 -103
- package/lib/choices/index.js.map +0 -1
- package/lib/componentize.js +0 -21
- package/lib/componentize.js.map +0 -1
- package/lib/components/blank.js +0 -371
- package/lib/components/blank.js.map +0 -1
- package/lib/components/correct-input.js +0 -94
- package/lib/components/correct-input.js.map +0 -1
- package/lib/components/dropdown.js +0 -483
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/input.js +0 -50
- package/lib/components/input.js.map +0 -1
- package/lib/constructed-response.js +0 -101
- package/lib/constructed-response.js.map +0 -1
- package/lib/customizable.js +0 -42
- package/lib/customizable.js.map +0 -1
- package/lib/drag-in-the-blank.js +0 -254
- package/lib/drag-in-the-blank.js.map +0 -1
- package/lib/index.js +0 -55
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -40
- package/lib/inline-dropdown.js.map +0 -1
- package/lib/mask.js +0 -198
- package/lib/mask.js.map +0 -1
- package/lib/serialization.js +0 -261
- package/lib/serialization.js.map +0 -1
- package/lib/with-mask.js +0 -97
- package/lib/with-mask.js.map +0 -1
- package/src/__tests__/drag-in-the-blank.test.js +0 -111
- package/src/__tests__/index.test.js +0 -38
- package/src/__tests__/mask.test.js +0 -381
- package/src/__tests__/serialization.test.js +0 -54
- package/src/__tests__/utils.js +0 -1
- package/src/__tests__/with-mask.test.js +0 -76
- package/src/choices/__tests__/index.test.js +0 -75
- package/src/choices/choice.jsx +0 -97
- package/src/choices/index.jsx +0 -64
- package/src/componentize.js +0 -13
- package/src/components/__tests__/blank.test.js +0 -199
- package/src/components/__tests__/correct-input.test.js +0 -90
- package/src/components/__tests__/dropdown.test.js +0 -129
- package/src/components/__tests__/input.test.js +0 -102
- package/src/components/blank.jsx +0 -386
- package/src/components/correct-input.jsx +0 -82
- package/src/components/dropdown.jsx +0 -423
- package/src/components/input.jsx +0 -48
- package/src/constructed-response.jsx +0 -87
- package/src/customizable.jsx +0 -34
- package/src/drag-in-the-blank.jsx +0 -241
- package/src/index.js +0 -16
- package/src/inline-dropdown.jsx +0 -29
- package/src/mask.jsx +0 -172
- package/src/serialization.js +0 -260
- 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
|
-
};
|