@pie-element/complex-rubric 6.0.0-beta.1 → 6.0.0-next.0

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 (124) hide show
  1. package/CHANGELOG.md +0 -11
  2. package/configure/CHANGELOG.md +0 -11
  3. package/configure/lib/defaults.js +9 -0
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/index.js +8 -8
  6. package/configure/lib/index.js.map +1 -1
  7. package/configure/package.json +9 -9
  8. package/configure/src/__tests__/index.test.js +15 -0
  9. package/configure/src/__tests__/main.test.jsx +7 -0
  10. package/configure/src/defaults.js +3 -0
  11. package/configure/src/index.js +1 -1
  12. package/controller/package.json +1 -1
  13. package/module/configure.js +1 -0
  14. package/module/controller.js +262 -0
  15. package/module/demo.js +221 -0
  16. package/module/element.js +1 -0
  17. package/module/index.html +21 -0
  18. package/module/manifest.json +22 -0
  19. package/module/print-demo.js +259 -0
  20. package/module/print.html +18 -0
  21. package/module/print.js +1 -0
  22. package/package.json +10 -6
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +0 -1
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +0 -2491
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +0 -55
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +0 -1
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +0 -2333
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +0 -429
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +0 -1
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +0 -181
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +0 -1
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +0 -157
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +0 -1
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +0 -455
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +0 -1
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +0 -206
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +0 -1
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +0 -451
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +0 -1
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +0 -275
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +0 -1
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +0 -233
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +0 -1
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +0 -87
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +0 -1
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +0 -24
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +0 -1
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +0 -1571
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +0 -18
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +0 -1
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +0 -158
  52. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +0 -1
  53. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +0 -11
  54. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +0 -1
  55. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +0 -14
  56. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +0 -1628
  57. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +0 -1202
  58. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +0 -8
  59. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +0 -117
  60. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +0 -1
  61. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +0 -6
  62. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +0 -861
  63. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +0 -614
  64. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +0 -54
  65. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +0 -1
  66. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +0 -123
  67. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +0 -1
  68. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +0 -248
  69. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +0 -1
  70. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +0 -83
  71. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +0 -1
  72. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +0 -32
  73. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
  74. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -2774
  75. package/configure/node_modules/@pie-element/rubric/README.md +0 -3
  76. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
  77. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +0 -2541
  78. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -67
  79. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +0 -1
  80. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +0 -135
  81. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
  82. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +0 -103
  83. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +0 -1
  84. package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -24
  85. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +0 -178
  86. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +0 -42
  87. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -139
  88. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -87
  89. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
  90. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -1564
  91. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +0 -15
  92. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +0 -1
  93. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -46
  94. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
  95. package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -12
  96. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -33
  97. package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +0 -8
  98. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -41
  99. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -712
  100. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -532
  101. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +0 -8
  102. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
  103. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -2
  104. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -391
  105. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -281
  106. package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -52
  107. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
  108. package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -210
  109. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
  110. package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -71
  111. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
  112. package/configure/node_modules/@pie-element/rubric/package.json +0 -30
  113. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -2641
  114. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -49
  115. package/configure/node_modules/@pie-element/rubric/src/index.js +0 -48
  116. package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -226
  117. package/configure/node_modules/@pie-element/rubric/src/print.js +0 -74
  118. package/configure/node_modules/clsx/clsx.d.ts +0 -6
  119. package/configure/node_modules/clsx/dist/clsx.js +0 -1
  120. package/configure/node_modules/clsx/dist/clsx.m.js +0 -1
  121. package/configure/node_modules/clsx/dist/clsx.min.js +0 -1
  122. package/configure/node_modules/clsx/license +0 -9
  123. package/configure/node_modules/clsx/package.json +0 -37
  124. package/configure/node_modules/clsx/readme.md +0 -88
@@ -1,49 +0,0 @@
1
- import { mount } from 'enzyme';
2
- import React from 'react';
3
- import Rubric from '../main';
4
-
5
- describe('rubric viewer', () => {
6
- const wrapper = (extras) => {
7
- const props = {
8
- value: {
9
- points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
10
- sampleAnswers: [null, 'just right', 'not left', null],
11
- excludeZero: false,
12
- ...extras,
13
- },
14
- };
15
-
16
- return mount(<Rubric {...props} />);
17
- };
18
-
19
- describe('snapshot', () => {
20
- it('renders', () => {
21
- const w = wrapper();
22
- expect(w).toMatchSnapshot();
23
- });
24
- });
25
-
26
- describe('expanded snapshot', () => {
27
- it('renders', () => {
28
- const w = wrapper();
29
- w.find('#rubric-toggle').simulate('click');
30
- expect(w).toMatchSnapshot();
31
- });
32
- });
33
-
34
- describe('exclude zeros', () => {
35
- it('renders correctly with excluded zeroes', () => {
36
- let w = wrapper({
37
- excludeZero: true,
38
- points: ['a teeny bit right', 'mostly right', 'bingo'],
39
- sampleAnswers: ['just right', 'not left', null]
40
- });
41
- w.find('#rubric-toggle').simulate('click');
42
- expect(w.find('li').length).toEqual(5);
43
-
44
- w = wrapper({excludeZero: false});
45
- w.find('#rubric-toggle').simulate('click');
46
- expect(w.find('li').length).toEqual(6);
47
- });
48
- });
49
- });
@@ -1,48 +0,0 @@
1
- import Rubric from './main';
2
- import React from 'react';
3
- import { createRoot } from 'react-dom/client';
4
- import debug from 'debug';
5
- import { renderMath } from '@pie-lib/math-rendering';
6
-
7
- export default class RubricRender extends HTMLElement {
8
- constructor() {
9
- super();
10
- debug.log('constructor called');
11
- this.onModelChanged = this.onModelChanged.bind(this);
12
- this._root = null;
13
- }
14
-
15
- set model(s) {
16
- this._model = s;
17
- this._render();
18
- }
19
-
20
- onModelChanged(m) {
21
- this._model = m;
22
- this._render();
23
- }
24
-
25
- connectedCallback() {
26
- this._render();
27
- }
28
-
29
- _render() {
30
- if (this._model) {
31
- const el = React.createElement(Rubric, { value: this._model });
32
-
33
- if (!this._root) {
34
- this._root = createRoot(this);
35
- }
36
- this._root.render(el);
37
- queueMicrotask(() => {
38
- renderMath(this);
39
- });
40
- }
41
- }
42
-
43
- disconnectedCallback() {
44
- if (this._root) {
45
- this._root.unmount();
46
- }
47
- }
48
- }
@@ -1,226 +0,0 @@
1
- import React from 'react';
2
- import { styled } from '@mui/material/styles';
3
- import ListItem from '@mui/material/ListItem';
4
- import List from '@mui/material/List';
5
- import Collapse from '@mui/material/Collapse';
6
- import { color, UiLayout } from '@pie-lib/render-ui';
7
- import PropTypes from 'prop-types';
8
-
9
- const StyledUiLayout = styled(UiLayout)(({ theme }) => ({
10
- color: color.text(),
11
- backgroundColor: color.background(),
12
- // apply styles to tables to match the rest of the UI
13
- '&:not(.MathJax) table': {
14
- borderCollapse: 'collapse',
15
- },
16
- '&:not(.MathJax) table td, &:not(.MathJax) table th': {
17
- padding: '8px 12px',
18
- textAlign: 'left',
19
- },
20
- // reset paragraph margins and line-height inside lists to override client styles
21
- '& ul p, & ol p': {
22
- marginBottom: 0,
23
- marginTop: 0,
24
- lineHeight: 'normal',
25
- },
26
- }));
27
-
28
- const StyledListItem = styled(ListItem)({
29
- display: 'flex',
30
- flexDirection: 'column',
31
- alignItems: 'flex-start',
32
- padding: '12px 0px',
33
- });
34
-
35
- const Text = styled('div')({
36
- color: color.text(),
37
- });
38
-
39
- const TitleText = styled('h3')({
40
- color: color.text(),
41
- fontSize: '16px',
42
- fontWeight: '700',
43
- margin: 0,
44
- paddingBottom: '6px',
45
- });
46
-
47
- const SampleTitleText = styled('h4')({
48
- color: color.text(),
49
- fontSize: '16px',
50
- fontWeight: 'normal',
51
- margin: 0,
52
- paddingBottom: '6px',
53
- });
54
-
55
- const RubricToggle = styled('h2')(({ theme }) => ({
56
- display: 'flex',
57
- alignItems: 'center',
58
- cursor: 'pointer',
59
- userSelect: 'none',
60
- fontSize: theme.typography.fontSize,
61
- fontWeight: '500',
62
- color: color.tertiary(),
63
- margin: 0,
64
- }));
65
-
66
- const ChevronStyle = styled('span')({
67
- display: 'inline-flex',
68
- transition: 'transform 0.2s',
69
- marginLeft: 2,
70
- alignSelf: 'center',
71
- });
72
-
73
- const HiddenScreenReader = styled('h2')({
74
- position: 'absolute',
75
- width: '1px',
76
- height: '1px',
77
- padding: 0,
78
- margin: '-1px',
79
- overflow: 'hidden',
80
- clip: 'rect(0,0,0,0)',
81
- border: 0,
82
- whiteSpace: 'nowrap',
83
- });
84
-
85
- export const RubricType = PropTypes.shape({
86
- excludeZero: PropTypes.bool,
87
- points: PropTypes.arrayOf(PropTypes.string),
88
- sampleAnswers: PropTypes.arrayOf(PropTypes.string),
89
- animationsDisabled: PropTypes.bool,
90
- });
91
-
92
- class Rubric extends React.Component {
93
- dudUrl = 'javascript:;';
94
-
95
- constructor(props) {
96
- super(props);
97
- this.state = {
98
- rubricOpen: false,
99
- linkPrefix: 'Show',
100
- };
101
- this.toggleRubric = this.toggleRubric.bind(this);
102
- }
103
-
104
- static propTypes = {
105
- model: PropTypes.object.isRequired,
106
- animationsDisabled: PropTypes.bool,
107
- value: RubricType,
108
- };
109
-
110
- toggleRubric() {
111
- this.setState({ rubricOpen: !this.state.rubricOpen });
112
- this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
113
- }
114
-
115
- shouldRenderPoint = (index, value) => {
116
- if (!value.excludeZero) {
117
- return true;
118
- } else {
119
- return index !== 0;
120
- }
121
- };
122
-
123
- render() {
124
- const { model, value } = this.props;
125
- let { animationsDisabled } = this.props;
126
- animationsDisabled = animationsDisabled || value.animationsDisabled;
127
-
128
- if (value && value.points) {
129
- const { extraCSSRules } = model || {};
130
- const { points, sampleAnswers } = value;
131
-
132
- const rubricList = (
133
- <List component="nav">
134
- {points
135
- .slice(0)
136
- .reverse()
137
- .map((desc, index) => {
138
- index = points.length - index - 1;
139
- const pointsLabel = value.excludeZero ? index + 1 : index;
140
-
141
- return (
142
- <React.Fragment key={index}>
143
- <StyledListItem key={`P${index}`}>
144
- <TitleText>
145
- {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}
146
- </TitleText>
147
- <Text dangerouslySetInnerHTML={{ __html: desc }} />
148
- </StyledListItem>
149
-
150
- {sampleAnswers && sampleAnswers[index] && (
151
- <StyledListItem key={`S${index}`}>
152
- <SampleTitleText>
153
- Sample Answer
154
- </SampleTitleText>
155
- <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
156
- </StyledListItem>
157
- )}
158
- </React.Fragment>
159
- );
160
- })}
161
- </List>
162
- );
163
-
164
- return (
165
- <StyledUiLayout extraCSSRules={extraCSSRules}>
166
- {/* screen reader only heading for navigation as per PD-5057 */}
167
- <HiddenScreenReader>Rubric</HiddenScreenReader>
168
- {!animationsDisabled ? (
169
- <React.Fragment>
170
- <RubricToggle
171
- id={'rubric-toggle'}
172
- tabIndex={0}
173
- role="button"
174
- aria-expanded={this.state.rubricOpen}
175
- onClick={this.toggleRubric}
176
- onKeyPress={(e) => {
177
- if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();
178
- }}
179
- >
180
- {this.state.linkPrefix} Rubric
181
- <ChevronStyle aria-hidden="true">
182
- {this.state.rubricOpen ? (
183
- <svg
184
- width="20"
185
- height="20"
186
- viewBox="0 0 24 24"
187
- fill="none"
188
- stroke="currentColor"
189
- strokeWidth="2"
190
- strokeLinecap="round"
191
- strokeLinejoin="round"
192
- >
193
- <polyline points="18 15 12 9 6 15"></polyline>
194
- </svg>
195
- ) : (
196
- <svg
197
- width="20"
198
- height="20"
199
- viewBox="0 0 24 24"
200
- fill="none"
201
- stroke="currentColor"
202
- strokeWidth="2"
203
- strokeLinecap="round"
204
- strokeLinejoin="round"
205
- >
206
- <polyline points="6 9 12 15 18 9"></polyline>
207
- </svg>
208
- )}
209
- </ChevronStyle>
210
- </RubricToggle>
211
- <Collapse in={this.state.rubricOpen} timeout={{ enter: 225, exit: 195 }}>
212
- {rubricList}
213
- </Collapse>
214
- </React.Fragment>
215
- ) : (
216
- rubricList
217
- )}
218
- </StyledUiLayout>
219
- );
220
- } else {
221
- return null;
222
- }
223
- }
224
- }
225
-
226
- export default Rubric;
@@ -1,74 +0,0 @@
1
- import React from 'react';
2
- import { createRoot } from 'react-dom/client';
3
- import debounce from 'lodash/debounce';
4
- import Main from './main';
5
- import { renderMath } from '@pie-lib/math-rendering';
6
- import debug from 'debug';
7
-
8
- const log = debug('pie-element:rubric:print');
9
-
10
- const preparePrintModel = (model, opts) => {
11
- const instr = opts.role === 'instructor';
12
-
13
- if (!instr) {
14
- return {};
15
- }
16
-
17
- model.value = { ...model };
18
- model.mode = 'evaluate';
19
- model.animationsDisabled = true;
20
-
21
- return model;
22
- };
23
-
24
- export default class RubricPrint extends HTMLElement {
25
- constructor() {
26
- super();
27
- this._options = null;
28
- this._model = null;
29
- this._session = [];
30
- this._root = null;
31
- this._rerender = debounce(
32
- () => {
33
- if (this._model && this._session) {
34
- const printModel = preparePrintModel(this._model, this._options);
35
-
36
- const element =
37
- this._options &&
38
- React.createElement(Main, {
39
- ...printModel,
40
- });
41
-
42
- if (!this._root) {
43
- this._root = createRoot(this);
44
- }
45
- this._root.render(element);
46
- queueMicrotask(() => {
47
- log('render complete - render math');
48
- renderMath(this);
49
- });
50
- } else {
51
- log('skip');
52
- }
53
- },
54
- 50,
55
- { leading: false, trailing: true },
56
- );
57
- }
58
- set options(o) {
59
- this._options = o;
60
- }
61
-
62
- set model(s) {
63
- this._model = s;
64
- this._rerender();
65
- }
66
-
67
- connectedCallback() {}
68
-
69
- disconnectedCallback() {
70
- if (this._root) {
71
- this._root.unmount();
72
- }
73
- }
74
- }
@@ -1,6 +0,0 @@
1
- export type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
2
- export type ClassDictionary = Record<string, any>;
3
- export type ClassArray = ClassValue[];
4
-
5
- export declare function clsx(...inputs: ClassValue[]): string;
6
- export default clsx;
@@ -1 +0,0 @@
1
- function e(r){var o,t,f="";if("string"==typeof r||"number"==typeof r)f+=r;else if("object"==typeof r)if(Array.isArray(r))for(o=0;o<r.length;o++)r[o]&&(t=e(r[o]))&&(f&&(f+=" "),f+=t);else for(o in r)r[o]&&(f&&(f+=" "),f+=o);return f}function r(){for(var r,o,t=0,f="";t<arguments.length;)(r=arguments[t++])&&(o=e(r))&&(f&&(f+=" "),f+=o);return f}module.exports=r,module.exports.clsx=r;
@@ -1 +0,0 @@
1
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}export function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}export default clsx;
@@ -1 +0,0 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.clsx=n()}(this,(function(){function e(n){var t,f,o="";if("string"==typeof n||"number"==typeof n)o+=n;else if("object"==typeof n)if(Array.isArray(n))for(t=0;t<n.length;t++)n[t]&&(f=e(n[t]))&&(o&&(o+=" "),o+=f);else for(t in n)n[t]&&(o&&(o+=" "),o+=t);return o}function n(){for(var n,t,f=0,o="";f<arguments.length;)(n=arguments[f++])&&(t=e(n))&&(o&&(o+=" "),o+=t);return o}return n.clsx=n,n}));
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,37 +0,0 @@
1
- {
2
- "name": "clsx",
3
- "version": "1.2.1",
4
- "repository": "lukeed/clsx",
5
- "description": "A tiny (228B) utility for constructing className strings conditionally.",
6
- "module": "dist/clsx.m.js",
7
- "unpkg": "dist/clsx.min.js",
8
- "main": "dist/clsx.js",
9
- "types": "clsx.d.ts",
10
- "license": "MIT",
11
- "author": {
12
- "name": "Luke Edwards",
13
- "email": "luke.edwards05@gmail.com",
14
- "url": "https://lukeed.com"
15
- },
16
- "engines": {
17
- "node": ">=6"
18
- },
19
- "scripts": {
20
- "build": "node bin",
21
- "test": "uvu -r esm test"
22
- },
23
- "files": [
24
- "*.d.ts",
25
- "dist"
26
- ],
27
- "keywords": [
28
- "classes",
29
- "classname",
30
- "classnames"
31
- ],
32
- "devDependencies": {
33
- "esm": "3.2.25",
34
- "terser": "4.8.0",
35
- "uvu": "0.5.4"
36
- }
37
- }
@@ -1,88 +0,0 @@
1
- # clsx [![CI](https://github.com/lukeed/clsx/workflows/CI/badge.svg)](https://github.com/lukeed/clsx/actions?query=workflow%3ACI) [![codecov](https://badgen.net/codecov/c/github/lukeed/clsx)](https://codecov.io/gh/lukeed/clsx)
2
-
3
- > A tiny (228B) utility for constructing `className` strings conditionally.<Br>Also serves as a [faster](/bench) & smaller drop-in replacement for the `classnames` module.
4
-
5
- This module is available in three formats:
6
-
7
- * **ES Module**: `dist/clsx.m.js`
8
- * **CommonJS**: `dist/clsx.js`
9
- * **UMD**: `dist/clsx.min.js`
10
-
11
-
12
- ## Install
13
-
14
- ```
15
- $ npm install --save clsx
16
- ```
17
-
18
-
19
- ## Usage
20
-
21
- ```js
22
- import clsx from 'clsx';
23
- // or
24
- import { clsx } from 'clsx';
25
-
26
- // Strings (variadic)
27
- clsx('foo', true && 'bar', 'baz');
28
- //=> 'foo bar baz'
29
-
30
- // Objects
31
- clsx({ foo:true, bar:false, baz:isTrue() });
32
- //=> 'foo baz'
33
-
34
- // Objects (variadic)
35
- clsx({ foo:true }, { bar:false }, null, { '--foobar':'hello' });
36
- //=> 'foo --foobar'
37
-
38
- // Arrays
39
- clsx(['foo', 0, false, 'bar']);
40
- //=> 'foo bar'
41
-
42
- // Arrays (variadic)
43
- clsx(['foo'], ['', 0, false, 'bar'], [['baz', [['hello'], 'there']]]);
44
- //=> 'foo bar baz hello there'
45
-
46
- // Kitchen sink (with nesting)
47
- clsx('foo', [1 && 'bar', { baz:false, bat:null }, ['hello', ['world']]], 'cya');
48
- //=> 'foo bar hello world cya'
49
- ```
50
-
51
-
52
- ## API
53
-
54
- ### clsx(...input)
55
- Returns: `String`
56
-
57
- #### input
58
- Type: `Mixed`
59
-
60
- The `clsx` function can take ***any*** number of arguments, each of which can be an Object, Array, Boolean, or String.
61
-
62
- > **Important:** _Any_ falsey values are discarded!<br>Standalone Boolean values are discarded as well.
63
-
64
- ```js
65
- clsx(true, false, '', null, undefined, 0, NaN);
66
- //=> ''
67
- ```
68
-
69
- ## Benchmarks
70
-
71
- For snapshots of cross-browser results, check out the [`bench`](/bench) directory~!
72
-
73
- ## Support
74
-
75
- All versions of Node.js are supported.
76
-
77
- All browsers that support [`Array.isArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Browser_compatibility) are supported (IE9+).
78
-
79
- >**Note:** For IE8 support and older, please install `clsx@1.0.x` and beware of [#17](https://github.com/lukeed/clsx/issues/17).
80
-
81
-
82
- ## Related
83
-
84
- - [obj-str](https://github.com/lukeed/obj-str) - A smaller (96B) and similiar utility that only works with Objects.
85
-
86
- ## License
87
-
88
- MIT © [Luke Edwards](https://lukeed.com)