@astl/tokens 0.1.4 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @astl/tokens
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d3b80e3: Help and checks per question. Practice checks each question on its own by default (`checkScope: 'interaction'`, as in `PRACTICE_POLICY`): every graded question has its own "Check" and verdict, with help or without, and the foot has no Check for everything; `checkScope: 'exercise'` keeps that one Check. Once every question has a result the foot shows the overall result, composed from those checks with no request of its own, and "Start over"; "x checks left" counts the attempt's checks once.
8
+
9
+ A page can have a Check of its own: `<astl-page check>` ("Check this page") checks all its questions at once, and only a check of a page (or of everything) brings the page's feedback and explanation, never one question's check. A page with help and without `check`, as 0.1 sources have it, gets that Check all the same, and the warning `PAGE_HELP_UNCHECKED`. `AttemptController.check(page)` now comes as a `page-check` change and leaves `result`, `response` and `astl-result` to whole checks and hand-ins; `player.check(id)` takes a page id too.
10
+
11
+ A hint says what it costs in points ("Hint 1 of 2", "Costs 0.5 points") from the new view attribute `hint-points` (`ElementHelp.hintPoints`), in percent for older views. The editor's card opens with the help for students, its hint cost a select of free, 10%, 25% or 50% of the question's points, shown in points; a page's hints are free (one with a cost from a 0.1 source keeps scoring, with "Make it free"), a hint or the explanation on a page moves into one of its questions with "Move to question...", and the page head has "Check this page".
12
+
13
+ For hosts: `OutlinePage.check`, `Authoring.setPageCheck(source, check, page?)` and `EditorAdapter.setPageCheck?(check, page?)` (one undo step; a document without pages becomes one page with `check`). The chevron of `nativeSelectCss` takes `--astl-select-arrow-color`, `--astl-select-arrow-size`, `--astl-select-arrow-stroke` and `--astl-select-arrow-inset`.
14
+
3
15
  ## 0.1.4
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxD"}
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAwBA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxD"}
package/dist/select.js CHANGED
@@ -1,18 +1,25 @@
1
1
  /**
2
2
  * A native select's chevron. A module of its own: the player's first load takes `tokensCss`, and a bundler keeps all
3
3
  * of a module's exports in one chunk, so this goes only where a select needs it (the kit, a component's chunk).
4
+ *
5
+ * A host themes it with custom properties, which inherit through shadow roots: `--astl-select-arrow-color` (default
6
+ * the text colour), `--astl-select-arrow-size` (half its width, its height; default 0.3125em), `--astl-select-arrow-stroke`
7
+ * (default 0.1em) and `--astl-select-arrow-inset` (from the inner edge; default 0.75rem). The end padding follows the
8
+ * inset and the size, so the text never runs under the chevron.
4
9
  */
5
- /** Half the chevron's width (its height), its distance from the inner edge, and the room between it and the text. */
6
- const ARM = '0.3125em';
7
- const INSET = '0.75rem';
10
+ const ARM = 'var(--astl-select-arrow-size,0.3125em)';
11
+ const INSET = 'var(--astl-select-arrow-inset,0.75rem)';
12
+ const HALF = 'var(--astl-select-arrow-stroke,.1em) / 2';
13
+ const COLOR = 'var(--astl-select-arrow-color,currentColor)';
14
+ /** The room between the chevron and the text. */
8
15
  const ROOM = '0.375rem';
9
16
  /**
10
- * One arm in the chevron's box, which is twice as wide as high: a stroke 0.1em thick, its edges softened by half a
11
- * pixel, along the diagonal from a top corner to the middle of the bottom edge (a third of the way along a 45-degree
12
- * gradient line in such a box). Both arms in one box, so no seam parts them; its bottom edge cuts their tip flat.
17
+ * One arm in the chevron's box, which is twice as wide as high: a stroke, its edges softened by half a pixel, along
18
+ * the diagonal from a top corner to the middle of the bottom edge (a third of the way along a 45-degree gradient line
19
+ * in such a box). Both arms in one box, so no seam parts them; its bottom edge cuts their tip flat.
13
20
  */
14
- const arm = (angle) => `linear-gradient(${angle},transparent calc(100% / 3 - .05em - .5px),currentColor calc(100% / 3 - .05em) ` +
15
- 'calc(100% / 3 + .05em),transparent calc(100% / 3 + .05em + .5px))';
21
+ const arm = (angle) => `linear-gradient(${angle},transparent calc(100% / 3 - ${HALF} - .5px),${COLOR} calc(100% / 3 - ${HALF}) ` +
22
+ `calc(100% / 3 + ${HALF}),transparent calc(100% / 3 + ${HALF} + .5px))`;
16
23
  /**
17
24
  * Native selects with a chevron of their own, inset from the inline end: the platform's arrow keeps a few pixels from
18
25
  * the border whatever the padding (Chromium), so `appearance: none` drops it and two gradients draw a chevron in the
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qHAAqH;AACrH,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB;;;;GAIG;AACH,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CACpC,mBAAmB,KAAK,iFAAiF;IACzG,mEAAmE,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,CACL,GAAG,QAAQ,4CAA4C,KAAK,UAAU,GAAG,MAAM,IAAI,IAAI;QACvF,oBAAoB,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,6BAA6B,GAAG,KAAK,GAAG,GAAG;QAC5F,yDAAyD,KAAK,UAAU;QACxE,GAAG,QAAQ,sCAAsC,KAAK,UAAU;QAChE,iCAAiC,QAAQ,0CAA0C,CACpF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,GAAG,GAAG,wCAAwC,CAAC;AACrD,MAAM,KAAK,GAAG,wCAAwC,CAAC;AACvD,MAAM,IAAI,GAAG,0CAA0C,CAAC;AACxD,MAAM,KAAK,GAAG,6CAA6C,CAAC;AAC5D,iDAAiD;AACjD,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB;;;;GAIG;AACH,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CACpC,mBAAmB,KAAK,gCAAgC,IAAI,YAAY,KAAK,oBAAoB,IAAI,IAAI;IACzG,mBAAmB,IAAI,iCAAiC,IAAI,WAAW,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,CACL,GAAG,QAAQ,4CAA4C,KAAK,UAAU,GAAG,MAAM,IAAI,IAAI;QACvF,oBAAoB,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,6BAA6B,GAAG,KAAK,GAAG,GAAG;QAC5F,yDAAyD,KAAK,UAAU;QACxE,GAAG,QAAQ,sCAAsC,KAAK,UAAU;QAChE,iCAAiC,QAAQ,0CAA0C,CACpF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astl/tokens",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Neutral design tokens (--astl-*) and themes for the Astrolabe player and editor.",
5
5
  "keywords": [
6
6
  "astrolabe",
package/src/select.ts CHANGED
@@ -1,19 +1,26 @@
1
1
  /**
2
2
  * A native select's chevron. A module of its own: the player's first load takes `tokensCss`, and a bundler keeps all
3
3
  * of a module's exports in one chunk, so this goes only where a select needs it (the kit, a component's chunk).
4
+ *
5
+ * A host themes it with custom properties, which inherit through shadow roots: `--astl-select-arrow-color` (default
6
+ * the text colour), `--astl-select-arrow-size` (half its width, its height; default 0.3125em), `--astl-select-arrow-stroke`
7
+ * (default 0.1em) and `--astl-select-arrow-inset` (from the inner edge; default 0.75rem). The end padding follows the
8
+ * inset and the size, so the text never runs under the chevron.
4
9
  */
5
- /** Half the chevron's width (its height), its distance from the inner edge, and the room between it and the text. */
6
- const ARM = '0.3125em';
7
- const INSET = '0.75rem';
10
+ const ARM = 'var(--astl-select-arrow-size,0.3125em)';
11
+ const INSET = 'var(--astl-select-arrow-inset,0.75rem)';
12
+ const HALF = 'var(--astl-select-arrow-stroke,.1em) / 2';
13
+ const COLOR = 'var(--astl-select-arrow-color,currentColor)';
14
+ /** The room between the chevron and the text. */
8
15
  const ROOM = '0.375rem';
9
16
  /**
10
- * One arm in the chevron's box, which is twice as wide as high: a stroke 0.1em thick, its edges softened by half a
11
- * pixel, along the diagonal from a top corner to the middle of the bottom edge (a third of the way along a 45-degree
12
- * gradient line in such a box). Both arms in one box, so no seam parts them; its bottom edge cuts their tip flat.
17
+ * One arm in the chevron's box, which is twice as wide as high: a stroke, its edges softened by half a pixel, along
18
+ * the diagonal from a top corner to the middle of the bottom edge (a third of the way along a 45-degree gradient line
19
+ * in such a box). Both arms in one box, so no seam parts them; its bottom edge cuts their tip flat.
13
20
  */
14
21
  const arm = (angle: string): string =>
15
- `linear-gradient(${angle},transparent calc(100% / 3 - .05em - .5px),currentColor calc(100% / 3 - .05em) ` +
16
- 'calc(100% / 3 + .05em),transparent calc(100% / 3 + .05em + .5px))';
22
+ `linear-gradient(${angle},transparent calc(100% / 3 - ${HALF} - .5px),${COLOR} calc(100% / 3 - ${HALF}) ` +
23
+ `calc(100% / 3 + ${HALF}),transparent calc(100% / 3 + ${HALF} + .5px))`;
17
24
 
18
25
  /**
19
26
  * Native selects with a chevron of their own, inset from the inline end: the platform's arrow keeps a few pixels from