@qti-components/choice-interaction 1.1.4 → 1.1.5

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.
@@ -0,0 +1,6 @@
1
+ import { QtiChoiceInteraction } from './qti-choice-interaction';
2
+ export declare const elements: readonly [{
3
+ readonly tag: "qti-choice-interaction";
4
+ readonly ctor: typeof QtiChoiceInteraction;
5
+ }];
6
+ export { QtiChoiceInteraction };
@@ -0,0 +1,4 @@
1
+ import { QtiChoiceInteraction } from './qti-choice-interaction';
2
+ export const elements = [{ tag: 'qti-choice-interaction', ctor: QtiChoiceInteraction }];
3
+ export { QtiChoiceInteraction };
4
+ //# sourceMappingURL=elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAU,CAAC;AAEjG,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import { QtiChoiceInteraction } from './qti-choice-interaction';\n\nexport const elements = [{ tag: 'qti-choice-interaction', ctor: QtiChoiceInteraction }] as const;\n\nexport { QtiChoiceInteraction };\n"]}
@@ -3,6 +3,28 @@ import type { ChoicesInterface } from '@qti-components/interactions-core/mixins/
3
3
  import type { CSSResultGroup } from 'lit';
4
4
  export type Orientation = 'horizontal' | 'vertical' | undefined;
5
5
  declare const QtiChoiceInteraction_base: (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
6
+ /**
7
+ * A single-response or multiple-response choice interaction.
8
+ *
9
+ * @customElement qti-choice-interaction
10
+ *
11
+ * @attr {string} response-identifier - Required. Identifier of the bound response variable.
12
+ * @attr {number} [max-choices=1] - Maximum selectable choices. `1` is a single-response
13
+ * item; `0` means unlimited and makes it a multiple-response item.
14
+ * @attr {number} [min-choices=0] - Minimum selectable choices for a valid response.
15
+ * @attr {'horizontal'|'vertical'} [orientation=vertical] - Deprecated by QTI in favour of
16
+ * the `qti-orientation-*` class vocabulary.
17
+ * @attr {boolean} [shuffle=false] - Requests choice shuffling. Applied by the transform
18
+ * pipeline (`qti-transformers`), not by this element.
19
+ * @attr {'qti-orientation-horizontal'|'qti-orientation-vertical'|'qti-choices-stacking-1'|'qti-choices-stacking-2'|'qti-choices-stacking-3'|'qti-choices-stacking-4'|'qti-choices-stacking-5'|'qti-labels-none'|'qti-labels-decimal'|'qti-labels-lower-alpha'|'qti-labels-upper-alpha'|'qti-labels-suffix-none'|'qti-labels-suffix-period'|'qti-labels-suffix-parenthesis'|'qti-input-control-hidden'} class - QTI shared presentation vocabulary. Space-separated; takes precedence over `orientation`.
20
+ *
21
+ * @slot prompt - The prompt shown above the choices.
22
+ * @slot - Default slot for `qti-simple-choice` elements.
23
+ *
24
+ * @csspart prompt - Wrapper around the prompt slot.
25
+ * @csspart slot - Wrapper around the default slot containing the choices.
26
+ * @csspart message - Live validation message region (role="alert").
27
+ */
6
28
  export declare class QtiChoiceInteraction extends QtiChoiceInteraction_base implements ChoicesInterface {
7
29
  #private;
8
30
  static styles: CSSResultGroup;
@@ -10,6 +10,28 @@ import { Interaction } from '@qti-components/base';
10
10
  import { ChoicesMixin } from '@qti-components/interactions-core/mixins/choices/choices.mixin';
11
11
  import { VocabularyMixin } from '@qti-components/interactions-core/mixins/vocabulary/vocabulary-mixin';
12
12
  import styles from './qti-choice-interaction.styles';
13
+ /**
14
+ * A single-response or multiple-response choice interaction.
15
+ *
16
+ * @customElement qti-choice-interaction
17
+ *
18
+ * @attr {string} response-identifier - Required. Identifier of the bound response variable.
19
+ * @attr {number} [max-choices=1] - Maximum selectable choices. `1` is a single-response
20
+ * item; `0` means unlimited and makes it a multiple-response item.
21
+ * @attr {number} [min-choices=0] - Minimum selectable choices for a valid response.
22
+ * @attr {'horizontal'|'vertical'} [orientation=vertical] - Deprecated by QTI in favour of
23
+ * the `qti-orientation-*` class vocabulary.
24
+ * @attr {boolean} [shuffle=false] - Requests choice shuffling. Applied by the transform
25
+ * pipeline (`qti-transformers`), not by this element.
26
+ * @attr {'qti-orientation-horizontal'|'qti-orientation-vertical'|'qti-choices-stacking-1'|'qti-choices-stacking-2'|'qti-choices-stacking-3'|'qti-choices-stacking-4'|'qti-choices-stacking-5'|'qti-labels-none'|'qti-labels-decimal'|'qti-labels-lower-alpha'|'qti-labels-upper-alpha'|'qti-labels-suffix-none'|'qti-labels-suffix-period'|'qti-labels-suffix-parenthesis'|'qti-input-control-hidden'} class - QTI shared presentation vocabulary. Space-separated; takes precedence over `orientation`.
27
+ *
28
+ * @slot prompt - The prompt shown above the choices.
29
+ * @slot - Default slot for `qti-simple-choice` elements.
30
+ *
31
+ * @csspart prompt - Wrapper around the prompt slot.
32
+ * @csspart slot - Wrapper around the default slot containing the choices.
33
+ * @csspart message - Live validation message region (role="alert").
34
+ */
13
35
  export class QtiChoiceInteraction extends VocabularyMixin(ChoicesMixin(Interaction, 'qti-simple-choice'), 'qti-simple-choice') {
14
36
  constructor() {
15
37
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"qti-choice-interaction.js","sourceRoot":"","sources":["../src/qti-choice-interaction.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gEAAgE,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAEvG,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAMrD,MAAM,OAAO,oBACX,SAAQ,eAAe,CAAC,YAAY,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAD9F;;QAME,0FAA0F;QAEnF,gBAAW,GAAgB,UAAU,CAAC;IAe/C,CAAC;aAnBiB,WAAM,GAAmB,MAAM,AAAzB,CAA0B;IAMhD,iBAAiB;QACf,4EAA4E;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;sCAEuB,IAAI,CAAC,iBAAiB;;KAEvD,CAAC;IACJ,CAAC;;AAdM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDACkB","sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { Interaction } from '@qti-components/base';\nimport { ChoicesMixin } from '@qti-components/interactions-core/mixins/choices/choices.mixin';\nimport { VocabularyMixin } from '@qti-components/interactions-core/mixins/vocabulary/vocabulary-mixin';\n\nimport styles from './qti-choice-interaction.styles';\n\nimport type { ChoicesInterface } from '@qti-components/interactions-core/mixins/choices/choices.mixin';\nimport type { CSSResultGroup } from 'lit';\n\nexport type Orientation = 'horizontal' | 'vertical' | undefined;\nexport class QtiChoiceInteraction\n extends VocabularyMixin(ChoicesMixin(Interaction, 'qti-simple-choice'), 'qti-simple-choice')\n implements ChoicesInterface\n{\n static override styles: CSSResultGroup = styles;\n\n /** @deprecated, use 'qti-orientation-horizontal' or 'qti-orientation-vertical' instead */\n @property({ type: String })\n public orientation: Orientation = 'vertical';\n\n #handleSlotChange() {\n // count the number of choices, set a css variable for the number of choices\n const choices = this.querySelectorAll('qti-simple-choice');\n this.style.setProperty('--item-count', choices.length.toString());\n }\n\n override render() {\n return html`\n <slot part=\"prompt\" name=\"prompt\"></slot>\n <slot part=\"slot\" @slotchange=${this.#handleSlotChange}></slot>\n <div part=\"message\" role=\"alert\" id=\"validation-message\"></div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-choice-interaction': QtiChoiceInteraction;\n }\n}\n"]}
1
+ {"version":3,"file":"qti-choice-interaction.js","sourceRoot":"","sources":["../src/qti-choice-interaction.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gEAAgE,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAEvG,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAOrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,oBACX,SAAQ,eAAe,CAAC,YAAY,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAD9F;;QAME,0FAA0F;QAEnF,gBAAW,GAAgB,UAAU,CAAC;IAe/C,CAAC;aAnBiB,WAAM,GAAmB,MAAM,AAAzB,CAA0B;IAMhD,iBAAiB;QACf,4EAA4E;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;sCAEuB,IAAI,CAAC,iBAAiB;;KAEvD,CAAC;IACJ,CAAC;;AAdM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDACkB","sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { Interaction } from '@qti-components/base';\nimport { ChoicesMixin } from '@qti-components/interactions-core/mixins/choices/choices.mixin';\nimport { VocabularyMixin } from '@qti-components/interactions-core/mixins/vocabulary/vocabulary-mixin';\n\nimport styles from './qti-choice-interaction.styles';\n\nimport type { ChoicesInterface } from '@qti-components/interactions-core/mixins/choices/choices.mixin';\nimport type { CSSResultGroup } from 'lit';\n\nexport type Orientation = 'horizontal' | 'vertical' | undefined;\n\n/**\n * A single-response or multiple-response choice interaction.\n *\n * @customElement qti-choice-interaction\n *\n * @attr {string} response-identifier - Required. Identifier of the bound response variable.\n * @attr {number} [max-choices=1] - Maximum selectable choices. `1` is a single-response\n * item; `0` means unlimited and makes it a multiple-response item.\n * @attr {number} [min-choices=0] - Minimum selectable choices for a valid response.\n * @attr {'horizontal'|'vertical'} [orientation=vertical] - Deprecated by QTI in favour of\n * the `qti-orientation-*` class vocabulary.\n * @attr {boolean} [shuffle=false] - Requests choice shuffling. Applied by the transform\n * pipeline (`qti-transformers`), not by this element.\n * @attr {'qti-orientation-horizontal'|'qti-orientation-vertical'|'qti-choices-stacking-1'|'qti-choices-stacking-2'|'qti-choices-stacking-3'|'qti-choices-stacking-4'|'qti-choices-stacking-5'|'qti-labels-none'|'qti-labels-decimal'|'qti-labels-lower-alpha'|'qti-labels-upper-alpha'|'qti-labels-suffix-none'|'qti-labels-suffix-period'|'qti-labels-suffix-parenthesis'|'qti-input-control-hidden'} class - QTI shared presentation vocabulary. Space-separated; takes precedence over `orientation`.\n *\n * @slot prompt - The prompt shown above the choices.\n * @slot - Default slot for `qti-simple-choice` elements.\n *\n * @csspart prompt - Wrapper around the prompt slot.\n * @csspart slot - Wrapper around the default slot containing the choices.\n * @csspart message - Live validation message region (role=\"alert\").\n */\nexport class QtiChoiceInteraction\n extends VocabularyMixin(ChoicesMixin(Interaction, 'qti-simple-choice'), 'qti-simple-choice')\n implements ChoicesInterface\n{\n static override styles: CSSResultGroup = styles;\n\n /** @deprecated, use 'qti-orientation-horizontal' or 'qti-orientation-vertical' instead */\n @property({ type: String })\n public orientation: Orientation = 'vertical';\n\n #handleSlotChange() {\n // count the number of choices, set a css variable for the number of choices\n const choices = this.querySelectorAll('qti-simple-choice');\n this.style.setProperty('--item-count', choices.length.toString());\n }\n\n override render() {\n return html`\n <slot part=\"prompt\" name=\"prompt\"></slot>\n <slot part=\"slot\" @slotchange=${this.#handleSlotChange}></slot>\n <div part=\"message\" role=\"alert\" id=\"validation-message\"></div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-choice-interaction': QtiChoiceInteraction;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- declare const _default: import("lit").CSSResult;
1
+ declare const _default: import("lit").CSSResult[];
2
2
  export default _default;
@@ -1,116 +1,75 @@
1
1
  import { css } from 'lit';
2
- export default css `
3
- :host {
4
- display: block;
5
- }
2
+ import { boxSizing, validationMessage } from '@qti-components/base';
3
+ export default [
4
+ boxSizing,
5
+ validationMessage,
6
+ css `
7
+ :host {
8
+ display: block;
9
+ }
6
10
 
7
- [part='slot'] {
8
- display: grid;
9
- gap: 10px;
10
- }
11
+ [part='slot'] {
12
+ display: grid;
13
+ gap: 10px;
14
+ }
11
15
 
12
- /* Define the number of columns dynamically */
13
- :host([class*='qti-choices-stacking-']) [part='slot'] {
14
- grid-template-columns: repeat(var(--stacking-count, 1), 1fr);
15
- }
16
+ /* Define the number of columns dynamically */
17
+ :host([class*='qti-choices-stacking-']) [part='slot'] {
18
+ grid-template-columns: repeat(var(--stacking-count, 1), 1fr);
19
+ }
16
20
 
17
- /* Apply dynamic stacking count based on class */
18
- :host(.qti-choices-stacking-1) {
19
- --stacking-count: 1;
20
- }
21
- :host(.qti-choices-stacking-2) {
22
- --stacking-count: 2;
23
- }
24
- :host(.qti-choices-stacking-3) {
25
- --stacking-count: 3;
26
- }
27
- :host(.qti-choices-stacking-4) {
28
- --stacking-count: 4;
29
- }
30
- :host(.qti-choices-stacking-5) {
31
- --stacking-count: 5;
32
- }
33
- :host(.qti-choices-stacking-6) {
34
- --stacking-count: 6;
35
- }
21
+ /* Apply dynamic stacking count based on class */
22
+ :host(.qti-choices-stacking-1) {
23
+ --stacking-count: 1;
24
+ }
25
+ :host(.qti-choices-stacking-2) {
26
+ --stacking-count: 2;
27
+ }
28
+ :host(.qti-choices-stacking-3) {
29
+ --stacking-count: 3;
30
+ }
31
+ :host(.qti-choices-stacking-4) {
32
+ --stacking-count: 4;
33
+ }
34
+ :host(.qti-choices-stacking-5) {
35
+ --stacking-count: 5;
36
+ }
36
37
 
37
- /* Default slot item layout */
38
- ::slotted(qti-simple-choice) {
39
- display: flex;
40
- align-items: center;
41
- white-space: normal;
42
- }
38
+ /* Default slot item layout */
39
+ ::slotted(qti-simple-choice) {
40
+ display: flex;
41
+ align-items: center;
42
+ white-space: normal;
43
+ }
43
44
 
44
- /* Orientation styles */
45
- :host(.qti-orientation-horizontal) [part='slot'] {
46
- grid-auto-flow: dense column;
47
- grid-auto-columns: 1fr;
48
- }
45
+ /* Orientation styles */
46
+ :host(.qti-orientation-horizontal) [part='slot'] {
47
+ grid-auto-flow: dense column;
48
+ grid-auto-columns: 1fr;
49
+ }
49
50
 
50
- :host(.qti-orientation-vertical) [part='slot'] {
51
- grid-auto-flow: row;
52
- }
51
+ :host(.qti-orientation-vertical) [part='slot'] {
52
+ grid-auto-flow: row;
53
+ }
53
54
 
54
- /* Vertical and horizontal stacking logic */
55
- :host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part='slot'] {
56
- grid-auto-flow: dense column;
57
- grid-auto-columns: 1fr;
58
- grid-template-columns: repeat(var(--stacking-count), 1fr);
59
- grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);
60
- }
55
+ /* Vertical and horizontal stacking logic */
56
+ :host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part='slot'] {
57
+ grid-auto-flow: dense column;
58
+ grid-auto-columns: 1fr;
59
+ grid-template-columns: repeat(var(--stacking-count), 1fr);
60
+ grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);
61
+ }
61
62
 
62
- :host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part='slot'] {
63
- grid-auto-flow: row;
64
- grid-template-columns: repeat(var(--stacking-count), 1fr);
65
- grid-template-rows: unset;
66
- }
63
+ :host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part='slot'] {
64
+ grid-auto-flow: row;
65
+ grid-template-columns: repeat(var(--stacking-count), 1fr);
66
+ grid-template-rows: unset;
67
+ }
67
68
 
68
- /* Ensure even distribution in vertical mode */
69
- :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
70
- grid-row: auto;
71
- }
72
- `;
73
- // export default css`
74
- // [part='slot'] {
75
- // display: flex;
76
- // flex-direction: column;
77
- // gap: var(--qti-gap-size);
78
- // flex-wrap: wrap;
79
- // }
80
- // ::slotted(qti-simple-choice) {
81
- // flex: 0 0
82
- // calc((100% - (var(--qti-gap-size) * var(--choice-interactions-stacking))) / var(--choice-interactions-stacking)) !important;
83
- // box-sizing: border-box !important;
84
- // }
85
- // :host(.qti-choices-stacking-1) [part='slot'] {
86
- // flex-direction: row;
87
- // --choice-interactions-stacking: 1;
88
- // }
89
- // :host(.qti-choices-stacking-2) [part='slot'] {
90
- // flex-direction: row;
91
- // --choice-interactions-stacking: 2;
92
- // }
93
- // :host(.qti-choices-stacking-3) [part='slot'] {
94
- // flex-direction: row;
95
- // --choice-interactions-stacking: 3;
96
- // }
97
- // :host(.qti-choices-stacking-4) [part='slot'] {
98
- // flex-direction: row;
99
- // --choice-interactions-stacking: 4;
100
- // }
101
- // :host(.qti-choices-stacking-5) [part='slot'] {
102
- // flex-direction: row;
103
- // --choice-interactions-stacking: 5;
104
- // }
105
- // :host([orientation='horizontal']) [part='slot'] {
106
- // flex-direction: row;
107
- // }
108
- // :host(.qti-orientation-horizontal) [part='slot'] {
109
- // flex-direction: row;
110
- // flex-wrap: nowrap;
111
- // }
112
- // :host(.qti-orientation-horizontal) ::slotted(qti-simple-choice) {
113
- // flex: 1 1 auto !important;
114
- // }
115
- // `;
69
+ /* Ensure even distribution in vertical mode */
70
+ :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
71
+ grid-row: auto;
72
+ }
73
+ `
74
+ ];
116
75
  //# sourceMappingURL=qti-choice-interaction.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qti-choice-interaction.styles.js","sourceRoot":"","sources":["../src/qti-choice-interaction.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEjB,CAAC;AAEF,sBAAsB;AACtB,oBAAoB;AACpB,qBAAqB;AACrB,8BAA8B;AAC9B,gCAAgC;AAChC,uBAAuB;AACvB,MAAM;AAEN,mCAAmC;AACnC,gBAAgB;AAChB,qIAAqI;AACrI,yCAAyC;AACzC,MAAM;AAEN,mDAAmD;AACnD,2BAA2B;AAC3B,yCAAyC;AACzC,MAAM;AAEN,mDAAmD;AACnD,2BAA2B;AAC3B,yCAAyC;AACzC,MAAM;AACN,mDAAmD;AACnD,2BAA2B;AAC3B,yCAAyC;AACzC,MAAM;AACN,mDAAmD;AACnD,2BAA2B;AAC3B,yCAAyC;AACzC,MAAM;AACN,mDAAmD;AACnD,2BAA2B;AAC3B,yCAAyC;AACzC,MAAM;AACN,sDAAsD;AACtD,2BAA2B;AAC3B,MAAM;AAEN,uDAAuD;AACvD,2BAA2B;AAC3B,yBAAyB;AACzB,MAAM;AAEN,sEAAsE;AACtE,iCAAiC;AACjC,MAAM;AACN,KAAK","sourcesContent":["import { css } from 'lit';\n\nexport default css`\n :host {\n display: block;\n }\n\n [part='slot'] {\n display: grid;\n gap: 10px;\n }\n\n /* Define the number of columns dynamically */\n :host([class*='qti-choices-stacking-']) [part='slot'] {\n grid-template-columns: repeat(var(--stacking-count, 1), 1fr);\n }\n\n /* Apply dynamic stacking count based on class */\n :host(.qti-choices-stacking-1) {\n --stacking-count: 1;\n }\n :host(.qti-choices-stacking-2) {\n --stacking-count: 2;\n }\n :host(.qti-choices-stacking-3) {\n --stacking-count: 3;\n }\n :host(.qti-choices-stacking-4) {\n --stacking-count: 4;\n }\n :host(.qti-choices-stacking-5) {\n --stacking-count: 5;\n }\n :host(.qti-choices-stacking-6) {\n --stacking-count: 6;\n }\n\n /* Default slot item layout */\n ::slotted(qti-simple-choice) {\n display: flex;\n align-items: center;\n white-space: normal;\n }\n\n /* Orientation styles */\n :host(.qti-orientation-horizontal) [part='slot'] {\n grid-auto-flow: dense column;\n grid-auto-columns: 1fr;\n }\n\n :host(.qti-orientation-vertical) [part='slot'] {\n grid-auto-flow: row;\n }\n\n /* Vertical and horizontal stacking logic */\n :host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part='slot'] {\n grid-auto-flow: dense column;\n grid-auto-columns: 1fr;\n grid-template-columns: repeat(var(--stacking-count), 1fr);\n grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);\n }\n\n :host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part='slot'] {\n grid-auto-flow: row;\n grid-template-columns: repeat(var(--stacking-count), 1fr);\n grid-template-rows: unset;\n }\n\n /* Ensure even distribution in vertical mode */\n :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {\n grid-row: auto;\n }\n`;\n\n// export default css`\n// [part='slot'] {\n// display: flex;\n// flex-direction: column;\n// gap: var(--qti-gap-size);\n// flex-wrap: wrap;\n// }\n\n// ::slotted(qti-simple-choice) {\n// flex: 0 0\n// calc((100% - (var(--qti-gap-size) * var(--choice-interactions-stacking))) / var(--choice-interactions-stacking)) !important;\n// box-sizing: border-box !important;\n// }\n\n// :host(.qti-choices-stacking-1) [part='slot'] {\n// flex-direction: row;\n// --choice-interactions-stacking: 1;\n// }\n\n// :host(.qti-choices-stacking-2) [part='slot'] {\n// flex-direction: row;\n// --choice-interactions-stacking: 2;\n// }\n// :host(.qti-choices-stacking-3) [part='slot'] {\n// flex-direction: row;\n// --choice-interactions-stacking: 3;\n// }\n// :host(.qti-choices-stacking-4) [part='slot'] {\n// flex-direction: row;\n// --choice-interactions-stacking: 4;\n// }\n// :host(.qti-choices-stacking-5) [part='slot'] {\n// flex-direction: row;\n// --choice-interactions-stacking: 5;\n// }\n// :host([orientation='horizontal']) [part='slot'] {\n// flex-direction: row;\n// }\n\n// :host(.qti-orientation-horizontal) [part='slot'] {\n// flex-direction: row;\n// flex-wrap: nowrap;\n// }\n\n// :host(.qti-orientation-horizontal) ::slotted(qti-simple-choice) {\n// flex: 1 1 auto !important;\n// }\n// `;\n"]}
1
+ {"version":3,"file":"qti-choice-interaction.styles.js","sourceRoot":"","sources":["../src/qti-choice-interaction.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,eAAe;IACb,SAAS;IACT,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEF;CACF,CAAC","sourcesContent":["import { css } from 'lit';\n\nimport { boxSizing, validationMessage } from '@qti-components/base';\n\nexport default [\n boxSizing,\n validationMessage,\n css`\n :host {\n display: block;\n }\n\n [part='slot'] {\n display: grid;\n gap: 10px;\n }\n\n /* Define the number of columns dynamically */\n :host([class*='qti-choices-stacking-']) [part='slot'] {\n grid-template-columns: repeat(var(--stacking-count, 1), 1fr);\n }\n\n /* Apply dynamic stacking count based on class */\n :host(.qti-choices-stacking-1) {\n --stacking-count: 1;\n }\n :host(.qti-choices-stacking-2) {\n --stacking-count: 2;\n }\n :host(.qti-choices-stacking-3) {\n --stacking-count: 3;\n }\n :host(.qti-choices-stacking-4) {\n --stacking-count: 4;\n }\n :host(.qti-choices-stacking-5) {\n --stacking-count: 5;\n }\n\n /* Default slot item layout */\n ::slotted(qti-simple-choice) {\n display: flex;\n align-items: center;\n white-space: normal;\n }\n\n /* Orientation styles */\n :host(.qti-orientation-horizontal) [part='slot'] {\n grid-auto-flow: dense column;\n grid-auto-columns: 1fr;\n }\n\n :host(.qti-orientation-vertical) [part='slot'] {\n grid-auto-flow: row;\n }\n\n /* Vertical and horizontal stacking logic */\n :host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part='slot'] {\n grid-auto-flow: dense column;\n grid-auto-columns: 1fr;\n grid-template-columns: repeat(var(--stacking-count), 1fr);\n grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);\n }\n\n :host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part='slot'] {\n grid-auto-flow: row;\n grid-template-columns: repeat(var(--stacking-count), 1fr);\n grid-template-rows: unset;\n }\n\n /* Ensure even distribution in vertical mode */\n :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {\n grid-row: auto;\n }\n `\n];\n"]}
package/dist/register.js CHANGED
@@ -1,3 +1,7 @@
1
- import { QtiChoiceInteraction } from './qti-choice-interaction';
2
- customElements.define('qti-choice-interaction', QtiChoiceInteraction);
1
+ import { elements } from './elements';
2
+ for (const { tag, ctor } of elements) {
3
+ if (!customElements.get(tag)) {
4
+ customElements.define(tag, ctor);
5
+ }
6
+ }
3
7
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { QtiChoiceInteraction } from './qti-choice-interaction';\ncustomElements.define('qti-choice-interaction', QtiChoiceInteraction);\n"]}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,QAAQ,EAAE,CAAC;IACrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;AACH,CAAC","sourcesContent":["import { elements } from './elements';\n\nfor (const { tag, ctor } of elements) {\n if (!customElements.get(tag)) {\n customElements.define(tag, ctor);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@qti-components/choice-interaction",
3
3
  "description": "QTI choice-interaction interaction",
4
- "version": "1.1.4",
4
+ "version": "1.1.5",
5
5
  "author": "",
6
6
  "dependencies": {
7
- "@qti-components/base": "^1.4.3",
8
- "@qti-components/interactions-core": "^1.1.4",
7
+ "@qti-components/base": "^2.0.0",
8
+ "@qti-components/interactions-core": "^2.0.0",
9
9
  "@qti-components/utilities": "^1.3.3"
10
10
  },
11
11
  "devDependencies": {
@@ -45,6 +45,10 @@
45
45
  "./styles": {
46
46
  "types": "./dist/qti-choice-interaction.styles.d.ts",
47
47
  "import": "./dist/qti-choice-interaction.styles.js"
48
+ },
49
+ "./elements": {
50
+ "types": "./dist/elements.d.ts",
51
+ "import": "./dist/elements.js"
48
52
  }
49
53
  },
50
54
  "repository": {
@@ -55,6 +59,8 @@
55
59
  "scripts": {
56
60
  "attw": "attw --profile esm-only --pack",
57
61
  "build": "tsc --paths null",
58
- "clean": "rm -rf dist"
62
+ "clean": "rm -rf dist",
63
+ "yalc": "yalc publish",
64
+ "yalc:push": "yalc push"
59
65
  }
60
66
  }