@astl/engine 0.0.0 → 0.1.1
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 +43 -0
- package/LICENSE +202 -0
- package/README.md +41 -0
- package/dist/analyse.d.ts +68 -0
- package/dist/analyse.d.ts.map +1 -0
- package/dist/analyse.js +1179 -0
- package/dist/analyse.js.map +1 -0
- package/dist/checker.d.ts +19 -0
- package/dist/checker.d.ts.map +1 -0
- package/dist/checker.js +103 -0
- package/dist/checker.js.map +1 -0
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +329 -0
- package/dist/compile.js.map +1 -0
- package/dist/conformance.d.ts +35 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +101 -0
- package/dist/conformance.js.map +1 -0
- package/dist/engine.d.ts +13 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +231 -0
- package/dist/engine.js.map +1 -0
- package/dist/grade.d.ts +9 -0
- package/dist/grade.d.ts.map +1 -0
- package/dist/grade.js +192 -0
- package/dist/grade.js.map +1 -0
- package/dist/guard.d.ts +45 -0
- package/dist/guard.d.ts.map +1 -0
- package/dist/guard.js +327 -0
- package/dist/guard.js.map +1 -0
- package/dist/help.d.ts +32 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +120 -0
- package/dist/help.js.map +1 -0
- package/dist/html.d.ts +31 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +246 -0
- package/dist/html.js.map +1 -0
- package/dist/ids.d.ts +35 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +126 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/attributes.d.ts +6 -0
- package/dist/kit/attributes.d.ts.map +1 -0
- package/dist/kit/attributes.js +20 -0
- package/dist/kit/attributes.js.map +1 -0
- package/dist/kit/index.d.ts +43 -0
- package/dist/kit/index.d.ts.map +1 -0
- package/dist/kit/index.js +118 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/limits.d.ts +17 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +173 -0
- package/dist/limits.js.map +1 -0
- package/dist/messages/en.json +48 -0
- package/dist/messages/pl.json +48 -0
- package/dist/messages.d.ts +4 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +9 -0
- package/dist/messages.js.map +1 -0
- package/dist/round.d.ts +3 -0
- package/dist/round.d.ts.map +1 -0
- package/dist/round.js +5 -0
- package/dist/round.js.map +1 -0
- package/dist/slot-kinds.d.ts +58 -0
- package/dist/slot-kinds.d.ts.map +1 -0
- package/dist/slot-kinds.js +151 -0
- package/dist/slot-kinds.js.map +1 -0
- package/dist/text.d.ts +23 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +236 -0
- package/dist/text.js.map +1 -0
- package/package.json +51 -4
- package/src/analyse.ts +1396 -0
- package/src/checker.ts +132 -0
- package/src/compile.ts +394 -0
- package/src/conformance.ts +120 -0
- package/src/engine.ts +274 -0
- package/src/grade.ts +229 -0
- package/src/guard.ts +356 -0
- package/src/help.ts +141 -0
- package/src/html.ts +274 -0
- package/src/ids.ts +144 -0
- package/src/index.ts +12 -0
- package/src/kit/attributes.ts +21 -0
- package/src/kit/index.ts +140 -0
- package/src/limits.ts +153 -0
- package/src/messages/en.json +48 -0
- package/src/messages/pl.json +48 -0
- package/src/messages.ts +9 -0
- package/src/round.ts +4 -0
- package/src/slot-kinds.ts +212 -0
- package/src/text.ts +234 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Attribute value grammar shared by validation and the definition kit. Attribute numbers always use a dot. */
|
|
2
|
+
export declare function parseIntegerValue(value: string): number | null;
|
|
3
|
+
export declare function parseDecimalValue(value: string): number | null;
|
|
4
|
+
/** HTML boolean attribute syntax: empty, or the attribute's own name (any case). */
|
|
5
|
+
export declare function isBooleanValue(name: string, value: string): boolean;
|
|
6
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/kit/attributes.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAK/G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Attribute value grammar shared by validation and the definition kit. Attribute numbers always use a dot. */
|
|
2
|
+
const INTEGER = /^-?\d+$/;
|
|
3
|
+
const DECIMAL = /^-?(\d+(\.\d+)?|\.\d+)$/;
|
|
4
|
+
export function parseIntegerValue(value) {
|
|
5
|
+
if (!INTEGER.test(value))
|
|
6
|
+
return null;
|
|
7
|
+
const n = Number(value);
|
|
8
|
+
return Number.isSafeInteger(n) ? n : null;
|
|
9
|
+
}
|
|
10
|
+
export function parseDecimalValue(value) {
|
|
11
|
+
if (!DECIMAL.test(value))
|
|
12
|
+
return null;
|
|
13
|
+
const n = Number(value);
|
|
14
|
+
return Number.isFinite(n) ? n : null;
|
|
15
|
+
}
|
|
16
|
+
/** HTML boolean attribute syntax: empty, or the attribute's own name (any case). */
|
|
17
|
+
export function isBooleanValue(name, value) {
|
|
18
|
+
return value === '' || value.toLowerCase() === name;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../src/kit/attributes.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,MAAM,OAAO,GAAG,SAAS,CAAC;AAC1B,MAAM,OAAO,GAAG,yBAAyB,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAa;IACxD,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for component definitions. Elements reaching a definition are already sanitised and validated against
|
|
3
|
+
* the manifest, so the readers below only parse; they never report.
|
|
4
|
+
*/
|
|
5
|
+
import { type CompileContext, type ComponentManifest, type ElementNode } from '@astl/core';
|
|
6
|
+
/** The attribute value, or null when absent. */
|
|
7
|
+
export declare function stringAttr(el: ElementNode, name: string): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* A `url` attribute, or null when absent or blank. The sanitiser has already passed it through the engine's URL
|
|
10
|
+
* policy, so a blocked URL never reaches a definition.
|
|
11
|
+
*/
|
|
12
|
+
export declare function urlAttr(el: ElementNode, name: string): string | null;
|
|
13
|
+
/** HTML boolean attribute: present = true. */
|
|
14
|
+
export declare function boolAttr(el: ElementNode, name: string): boolean;
|
|
15
|
+
/** A decimal number (dot separator), or null when absent or not a number. */
|
|
16
|
+
export declare function numberAttr(el: ElementNode, name: string): number | null;
|
|
17
|
+
/** An integer, or null when absent or not an integer. */
|
|
18
|
+
export declare function intAttr(el: ElementNode, name: string): number | null;
|
|
19
|
+
/** One of `values`, else `fallback` (absent or unknown value). */
|
|
20
|
+
export declare function enumAttr<T extends string>(el: ElementNode, name: string, values: readonly T[], fallback: T): T;
|
|
21
|
+
/** Element children with the given tag, in order. */
|
|
22
|
+
export declare function children(el: ElementNode, tag: string): ElementNode[];
|
|
23
|
+
/** Elements with the given tag anywhere inside `el`, in document order: the inline children of a rich block. */
|
|
24
|
+
export declare function descendants(el: ElementNode, tag: string): ElementNode[];
|
|
25
|
+
/** Text of an element and its descendants, as written. */
|
|
26
|
+
export declare function text(el: ElementNode): string;
|
|
27
|
+
/**
|
|
28
|
+
* What an element says to a student: its text with each picture's `alt` in its place (screen readers read it out),
|
|
29
|
+
* whitespace runs collapsed, trimmed. Empty when there is no text and every picture is decorative (`alt=""`), so
|
|
30
|
+
* definitions can tell an option or a card that shows only a picture from an empty one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function label(el: ElementNode): string;
|
|
33
|
+
/** Whether the element shows a picture (an `img` anywhere inside it). */
|
|
34
|
+
export declare function hasPicture(el: ElementNode): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The generic public view of an element: `id` (opaque) and `v` (manifest version) first, then the public attributes
|
|
37
|
+
* as written plus `lang` and `dir`; private attributes and private children are dropped; public children keep their
|
|
38
|
+
* public attributes (local `id`-typed values become opaque ids) and their sanitised content. A rich block
|
|
39
|
+
* (`content: 'flow'`) keeps its content, with the same rules for the children in it. Definitions add derived
|
|
40
|
+
* attributes or reorder children on top of it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function publicView(el: ElementNode, manifest: ComponentManifest, ctx: CompileCont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D,wBAAgB,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAS7C;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,EAAE,cAAc,GAAG,WAAW,CAqBzG"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for component definitions. Elements reaching a definition are already sanitised and validated against
|
|
3
|
+
* the manifest, so the readers below only parse; they never report.
|
|
4
|
+
*/
|
|
5
|
+
import { allAttributes, CONTENT_ATTRIBUTES, childElements, element, textContent, } from '@astl/core';
|
|
6
|
+
import { parseDecimalValue, parseIntegerValue } from './attributes.js';
|
|
7
|
+
/** The attribute value, or null when absent. */
|
|
8
|
+
export function stringAttr(el, name) {
|
|
9
|
+
return Object.hasOwn(el.attrs, name) ? (el.attrs[name] ?? null) : null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A `url` attribute, or null when absent or blank. The sanitiser has already passed it through the engine's URL
|
|
13
|
+
* policy, so a blocked URL never reaches a definition.
|
|
14
|
+
*/
|
|
15
|
+
export function urlAttr(el, name) {
|
|
16
|
+
const value = stringAttr(el, name);
|
|
17
|
+
return value === null || value.trim() === '' ? null : value;
|
|
18
|
+
}
|
|
19
|
+
/** HTML boolean attribute: present = true. */
|
|
20
|
+
export function boolAttr(el, name) {
|
|
21
|
+
return Object.hasOwn(el.attrs, name);
|
|
22
|
+
}
|
|
23
|
+
/** A decimal number (dot separator), or null when absent or not a number. */
|
|
24
|
+
export function numberAttr(el, name) {
|
|
25
|
+
const value = stringAttr(el, name);
|
|
26
|
+
return value === null ? null : parseDecimalValue(value);
|
|
27
|
+
}
|
|
28
|
+
/** An integer, or null when absent or not an integer. */
|
|
29
|
+
export function intAttr(el, name) {
|
|
30
|
+
const value = stringAttr(el, name);
|
|
31
|
+
return value === null ? null : parseIntegerValue(value);
|
|
32
|
+
}
|
|
33
|
+
/** One of `values`, else `fallback` (absent or unknown value). */
|
|
34
|
+
export function enumAttr(el, name, values, fallback) {
|
|
35
|
+
const value = stringAttr(el, name);
|
|
36
|
+
return value !== null && values.includes(value) ? value : fallback;
|
|
37
|
+
}
|
|
38
|
+
/** Element children with the given tag, in order. */
|
|
39
|
+
export function children(el, tag) {
|
|
40
|
+
return childElements(el, tag);
|
|
41
|
+
}
|
|
42
|
+
/** Elements with the given tag anywhere inside `el`, in document order: the inline children of a rich block. */
|
|
43
|
+
export function descendants(el, tag) {
|
|
44
|
+
return el.children.flatMap((n) => n.type !== 'element' ? [] : n.tag === tag ? [n, ...descendants(n, tag)] : descendants(n, tag));
|
|
45
|
+
}
|
|
46
|
+
/** Text of an element and its descendants, as written. */
|
|
47
|
+
export function text(el) {
|
|
48
|
+
return textContent(el);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What an element says to a student: its text with each picture's `alt` in its place (screen readers read it out),
|
|
52
|
+
* whitespace runs collapsed, trimmed. Empty when there is no text and every picture is decorative (`alt=""`), so
|
|
53
|
+
* definitions can tell an option or a card that shows only a picture from an empty one.
|
|
54
|
+
*/
|
|
55
|
+
export function label(el) {
|
|
56
|
+
const parts = [];
|
|
57
|
+
const visit = (node) => {
|
|
58
|
+
if (node.type === 'text')
|
|
59
|
+
parts.push(node.value);
|
|
60
|
+
else if (node.tag === 'img')
|
|
61
|
+
parts.push(` ${node.attrs.alt ?? ''} `);
|
|
62
|
+
else
|
|
63
|
+
for (const child of node.children)
|
|
64
|
+
visit(child);
|
|
65
|
+
};
|
|
66
|
+
visit(el);
|
|
67
|
+
return parts.join('').replace(/\s+/gu, ' ').trim();
|
|
68
|
+
}
|
|
69
|
+
/** Whether the element shows a picture (an `img` anywhere inside it). */
|
|
70
|
+
export function hasPicture(el) {
|
|
71
|
+
return el.children.some((n) => n.type === 'element' && (n.tag === 'img' || hasPicture(n)));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The generic public view of an element: `id` (opaque) and `v` (manifest version) first, then the public attributes
|
|
75
|
+
* as written plus `lang` and `dir`; private attributes and private children are dropped; public children keep their
|
|
76
|
+
* public attributes (local `id`-typed values become opaque ids) and their sanitised content. A rich block
|
|
77
|
+
* (`content: 'flow'`) keeps its content, with the same rules for the children in it. Definitions add derived
|
|
78
|
+
* attributes or reorder children on top of it.
|
|
79
|
+
*/
|
|
80
|
+
export function publicView(el, manifest, ctx) {
|
|
81
|
+
const specs = allAttributes(manifest);
|
|
82
|
+
const attrs = { id: ctx.opaque(), v: String(manifest.version) };
|
|
83
|
+
for (const [name, value] of Object.entries(el.attrs)) {
|
|
84
|
+
if (name === 'id' || name === 'v')
|
|
85
|
+
continue;
|
|
86
|
+
if (CONTENT_ATTRIBUTES.has(name)) {
|
|
87
|
+
attrs[name] = value;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const spec = specs.find((s) => s.name === name);
|
|
91
|
+
if (spec?.visibility === 'public')
|
|
92
|
+
attrs[name] = spec.type === 'id' ? ctx.opaque(value) : value;
|
|
93
|
+
}
|
|
94
|
+
const flow = manifest.content === 'flow';
|
|
95
|
+
const content = (nodes) => nodes.flatMap((child) => {
|
|
96
|
+
if (child.type !== 'element')
|
|
97
|
+
return flow ? [child] : [];
|
|
98
|
+
const spec = manifest.children.find((c) => c.tag === child.tag);
|
|
99
|
+
if (spec !== undefined)
|
|
100
|
+
return spec.visibility === 'public' ? [publicChild(child, spec, ctx)] : [];
|
|
101
|
+
return flow ? [element(child.tag, child.attrs, content(child.children))] : [];
|
|
102
|
+
});
|
|
103
|
+
return element(manifest.tag, attrs, content(el.children));
|
|
104
|
+
}
|
|
105
|
+
function publicChild(child, spec, ctx) {
|
|
106
|
+
const attrs = {};
|
|
107
|
+
for (const [name, value] of Object.entries(child.attrs)) {
|
|
108
|
+
if (CONTENT_ATTRIBUTES.has(name)) {
|
|
109
|
+
attrs[name] = value;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const attr = spec.attributes.find((a) => a.name === name);
|
|
113
|
+
if (attr?.visibility === 'public')
|
|
114
|
+
attrs[name] = attr.type === 'id' ? ctx.opaque(value) : value;
|
|
115
|
+
}
|
|
116
|
+
return element(child.tag, attrs, child.children);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,aAAa,EAEb,kBAAkB,EAGlB,aAAa,EAEb,OAAO,EAEP,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,gDAAgD;AAChD,MAAM,UAAU,UAAU,CAAC,EAAe,EAAE,IAAY;IACtD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EAAe,EAAE,IAAY;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9D,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,QAAQ,CAAC,EAAe,EAAE,IAAY;IACpD,OAAO,MAAM,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AC;IAClG,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/limits.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-parse limits. The HTML tokenizer compares every new attribute with the earlier ones on the same tag, so a tag
|
|
3
|
+
* with tens of thousands of attributes takes quadratic time; this scan finds such tags in one pass, before parsing.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The largest number of attributes on any start or end tag, counted as the HTML tokenizer counts them, stopping
|
|
7
|
+
* early once a tag has more than `limit`.
|
|
8
|
+
*
|
|
9
|
+
* Every `<` or `</` followed by a letter is read as a possible tag, also inside comments, raw text such as
|
|
10
|
+
* `<script>` and attribute values: whether the tokenizer reads such text as markup depends on tree construction
|
|
11
|
+
* (SVG, MathML, `<select>`, script escapes), and a wrong guess could hide a real tag. All possible tags are followed
|
|
12
|
+
* at once with the tokenizer's attribute states; two in the same state behave the same from then on, so they merge
|
|
13
|
+
* and keep the higher count. That keeps the scan linear, and every real tag is counted from its own start, so the
|
|
14
|
+
* result is never too low. It is too high only for text with hundreds of attribute-like words in one tag-shaped run.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mostAttributes(html: string, limit: number): number;
|
|
17
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqFH;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAsClE"}
|
package/dist/limits.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-parse limits. The HTML tokenizer compares every new attribute with the earlier ones on the same tag, so a tag
|
|
3
|
+
* with tens of thousands of attributes takes quadratic time; this scan finds such tags in one pass, before parsing.
|
|
4
|
+
*/
|
|
5
|
+
const TAB = 9;
|
|
6
|
+
const LF = 10;
|
|
7
|
+
const FF = 12;
|
|
8
|
+
const CR = 13;
|
|
9
|
+
const SPACE = 32;
|
|
10
|
+
const DOUBLE_QUOTE = 34;
|
|
11
|
+
const SINGLE_QUOTE = 39;
|
|
12
|
+
const SLASH = 47;
|
|
13
|
+
const LESS = 60;
|
|
14
|
+
const EQUALS = 61;
|
|
15
|
+
const GREATER = 62;
|
|
16
|
+
// The tokenizer's states inside a tag.
|
|
17
|
+
const TAG_NAME = 0;
|
|
18
|
+
const BEFORE_NAME = 1;
|
|
19
|
+
const NAME = 2;
|
|
20
|
+
const AFTER_NAME = 3;
|
|
21
|
+
const BEFORE_VALUE = 4;
|
|
22
|
+
const DOUBLE_QUOTED = 5;
|
|
23
|
+
const SINGLE_QUOTED = 6;
|
|
24
|
+
const UNQUOTED = 7;
|
|
25
|
+
const AFTER_QUOTED = 8;
|
|
26
|
+
const SELF_CLOSING = 9;
|
|
27
|
+
const STATES = 10;
|
|
28
|
+
const DONE = -1;
|
|
29
|
+
function isSpace(c) {
|
|
30
|
+
return c === SPACE || c === LF || c === TAB || c === FF || c === CR;
|
|
31
|
+
}
|
|
32
|
+
function isAlpha(c) {
|
|
33
|
+
return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
|
|
34
|
+
}
|
|
35
|
+
/** Next state for character `c`; `starts` is set when an attribute name starts. */
|
|
36
|
+
function step(state, c, out) {
|
|
37
|
+
out.starts = false;
|
|
38
|
+
switch (state) {
|
|
39
|
+
case TAG_NAME:
|
|
40
|
+
if (c === GREATER)
|
|
41
|
+
return DONE;
|
|
42
|
+
if (c === SLASH)
|
|
43
|
+
return SELF_CLOSING;
|
|
44
|
+
return isSpace(c) ? BEFORE_NAME : TAG_NAME;
|
|
45
|
+
case BEFORE_NAME:
|
|
46
|
+
case SELF_CLOSING:
|
|
47
|
+
if (c === GREATER)
|
|
48
|
+
return DONE;
|
|
49
|
+
if (c === SLASH)
|
|
50
|
+
return SELF_CLOSING;
|
|
51
|
+
if (isSpace(c))
|
|
52
|
+
return BEFORE_NAME;
|
|
53
|
+
out.starts = true;
|
|
54
|
+
return NAME;
|
|
55
|
+
case NAME:
|
|
56
|
+
if (c === GREATER)
|
|
57
|
+
return DONE;
|
|
58
|
+
if (c === SLASH)
|
|
59
|
+
return SELF_CLOSING;
|
|
60
|
+
if (c === EQUALS)
|
|
61
|
+
return BEFORE_VALUE;
|
|
62
|
+
return isSpace(c) ? AFTER_NAME : NAME;
|
|
63
|
+
case AFTER_NAME:
|
|
64
|
+
if (c === GREATER)
|
|
65
|
+
return DONE;
|
|
66
|
+
if (c === SLASH)
|
|
67
|
+
return SELF_CLOSING;
|
|
68
|
+
if (c === EQUALS)
|
|
69
|
+
return BEFORE_VALUE;
|
|
70
|
+
if (isSpace(c))
|
|
71
|
+
return AFTER_NAME;
|
|
72
|
+
out.starts = true;
|
|
73
|
+
return NAME;
|
|
74
|
+
case BEFORE_VALUE:
|
|
75
|
+
if (c === GREATER)
|
|
76
|
+
return DONE;
|
|
77
|
+
if (c === DOUBLE_QUOTE)
|
|
78
|
+
return DOUBLE_QUOTED;
|
|
79
|
+
if (c === SINGLE_QUOTE)
|
|
80
|
+
return SINGLE_QUOTED;
|
|
81
|
+
return isSpace(c) ? BEFORE_VALUE : UNQUOTED;
|
|
82
|
+
case DOUBLE_QUOTED:
|
|
83
|
+
return c === DOUBLE_QUOTE ? AFTER_QUOTED : DOUBLE_QUOTED;
|
|
84
|
+
case SINGLE_QUOTED:
|
|
85
|
+
return c === SINGLE_QUOTE ? AFTER_QUOTED : SINGLE_QUOTED;
|
|
86
|
+
case UNQUOTED:
|
|
87
|
+
if (c === GREATER)
|
|
88
|
+
return DONE;
|
|
89
|
+
return isSpace(c) ? BEFORE_NAME : UNQUOTED;
|
|
90
|
+
default:
|
|
91
|
+
// AFTER_QUOTED: without a space, the next character starts the next attribute.
|
|
92
|
+
if (c === GREATER)
|
|
93
|
+
return DONE;
|
|
94
|
+
if (c === SLASH)
|
|
95
|
+
return SELF_CLOSING;
|
|
96
|
+
if (isSpace(c))
|
|
97
|
+
return BEFORE_NAME;
|
|
98
|
+
out.starts = true;
|
|
99
|
+
return NAME;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The largest number of attributes on any start or end tag, counted as the HTML tokenizer counts them, stopping
|
|
104
|
+
* early once a tag has more than `limit`.
|
|
105
|
+
*
|
|
106
|
+
* Every `<` or `</` followed by a letter is read as a possible tag, also inside comments, raw text such as
|
|
107
|
+
* `<script>` and attribute values: whether the tokenizer reads such text as markup depends on tree construction
|
|
108
|
+
* (SVG, MathML, `<select>`, script escapes), and a wrong guess could hide a real tag. All possible tags are followed
|
|
109
|
+
* at once with the tokenizer's attribute states; two in the same state behave the same from then on, so they merge
|
|
110
|
+
* and keep the higher count. That keeps the scan linear, and every real tag is counted from its own start, so the
|
|
111
|
+
* result is never too low. It is too high only for text with hundreds of attribute-like words in one tag-shaped run.
|
|
112
|
+
*/
|
|
113
|
+
export function mostAttributes(html, limit) {
|
|
114
|
+
let counts = new Int32Array(STATES).fill(-1);
|
|
115
|
+
let next = new Int32Array(STATES).fill(-1);
|
|
116
|
+
const out = { starts: false };
|
|
117
|
+
let live = 0;
|
|
118
|
+
let most = 0;
|
|
119
|
+
for (let p = 0; p < html.length; p++) {
|
|
120
|
+
const c = html.charCodeAt(p);
|
|
121
|
+
const startsName = isAlpha(c) && p > 0 && startsTagAt(html, p);
|
|
122
|
+
if (live === 0 && !startsName) {
|
|
123
|
+
// Nothing to follow: move to just before the next possible tag name.
|
|
124
|
+
const before = nextNameStart(html, p) - 1;
|
|
125
|
+
if (before < 0)
|
|
126
|
+
break;
|
|
127
|
+
p = before;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
next.fill(-1);
|
|
131
|
+
live = 0;
|
|
132
|
+
for (let state = 0; state < STATES; state++) {
|
|
133
|
+
const count = counts[state] ?? -1;
|
|
134
|
+
if (count < 0)
|
|
135
|
+
continue;
|
|
136
|
+
const to = step(state, c, out);
|
|
137
|
+
const total = out.starts ? count + 1 : count;
|
|
138
|
+
if (total > most)
|
|
139
|
+
most = total;
|
|
140
|
+
if (to === DONE)
|
|
141
|
+
continue;
|
|
142
|
+
if ((next[to] ?? -1) < total) {
|
|
143
|
+
if ((next[to] ?? -1) < 0)
|
|
144
|
+
live++;
|
|
145
|
+
next[to] = total;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (most > limit)
|
|
149
|
+
return most;
|
|
150
|
+
if (startsName && (next[TAG_NAME] ?? -1) < 0) {
|
|
151
|
+
live++;
|
|
152
|
+
next[TAG_NAME] = 0;
|
|
153
|
+
}
|
|
154
|
+
[counts, next] = [next, counts];
|
|
155
|
+
}
|
|
156
|
+
return most;
|
|
157
|
+
}
|
|
158
|
+
/** Whether the letter at `p` starts a tag name: it follows `<` or `</`. */
|
|
159
|
+
function startsTagAt(html, p) {
|
|
160
|
+
const before = html.charCodeAt(p - 1);
|
|
161
|
+
return before === LESS || (before === SLASH && p > 1 && html.charCodeAt(p - 2) === LESS);
|
|
162
|
+
}
|
|
163
|
+
/** Index of the first letter at or after `from` that starts a tag name, or -1. */
|
|
164
|
+
function nextNameStart(html, from) {
|
|
165
|
+
for (let lt = html.indexOf('<', from); lt >= 0; lt = html.indexOf('<', lt + 1)) {
|
|
166
|
+
if (isAlpha(html.charCodeAt(lt + 1)))
|
|
167
|
+
return lt + 1;
|
|
168
|
+
if (html.charCodeAt(lt + 1) === SLASH && isAlpha(html.charCodeAt(lt + 2)))
|
|
169
|
+
return lt + 2;
|
|
170
|
+
}
|
|
171
|
+
return -1;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],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AAG,CAAC,CAAC,CAAC;YAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"SOURCE_TOO_LARGE": "The document is too long. It can have at most {max, number} characters, so split it into several exercises.",
|
|
3
|
+
"SOURCE_TOO_DEEP": "Elements are nested more than {max, plural, one {# level} other {# levels}} deep. Simplify the structure, for example by removing wrapper elements.",
|
|
4
|
+
"SOURCE_TOO_COMPLEX": "An element in the document has more than {max, plural, one {# attribute} other {# attributes}}. Remove the attributes it does not need.",
|
|
5
|
+
"DOC_ROOT_INVALID": "Put the whole exercise inside one <astl-doc> element, with nothing outside it.",
|
|
6
|
+
"DOC_FORMAT_UNSUPPORTED": "Content format “{format}” is not supported. Use format=\"1\" or leave the attribute out.",
|
|
7
|
+
"DOC_LANG_MISSING": "Add the content language to <astl-doc>, for example lang=\"en\".",
|
|
8
|
+
"DOC_LANG_INVALID": "“{lang}” is not a language tag. Use a tag such as en, pl or pt-BR.",
|
|
9
|
+
"DOC_EMPTY": "The document is empty. Add some text or an exercise element.",
|
|
10
|
+
"DOC_MIXED_PAGES": "Some content is outside the pages. Put everything inside <astl-page> elements, or use no pages at all.",
|
|
11
|
+
"NO_COMPONENTS": "Nothing in this document is graded yet. Add at least one exercise element.",
|
|
12
|
+
"PAGE_EMPTY": "Page {page}{titled, select, yes { (“{title}”)} other {}} is empty. Add content or delete the page.",
|
|
13
|
+
"PAGE_NESTED": "A page is inside other content{page, select, 0 {} other { on page {page}{titled, select, yes { (“{title}”)} other {}}}}. Place pages directly inside <astl-doc>.",
|
|
14
|
+
"ID_MISSING": "Element {tag} has no id. Add an id attribute.",
|
|
15
|
+
"ID_INVALID": "“{id}” is not a valid id for element {tag}. Start with a letter and use only a-z, A-Z, 0-9, - and _ (at most 64 characters).",
|
|
16
|
+
"ID_DUPLICATE": "The id “{id}” is used more than once. Give every element its own id.",
|
|
17
|
+
"ELEMENT_UNKNOWN": "Unknown element {tag}. Check the spelling, or register the component that defines it.",
|
|
18
|
+
"ELEMENT_REMOVED": "Element {tag} is not allowed and was removed.",
|
|
19
|
+
"ATTRIBUTE_REMOVED": "Attribute {attribute} is not allowed on element {tag} and was removed.",
|
|
20
|
+
"ATTRIBUTE_INVALID": "Attribute {attribute} on element {tag} has an invalid value: “{value}”.{type, select, enum { Use one of: {values}.} other {}}",
|
|
21
|
+
"ATTRIBUTE_REQUIRED": "Element {tag} needs the {attribute} attribute.",
|
|
22
|
+
"CHILD_UNEXPECTED": "{child, select, text {Element {tag} contains loose text it does not accept. Remove it or put it inside an allowed child element.} other {Element {tag} does not accept <{child}>. Remove it or move it out.}}",
|
|
23
|
+
"CHILD_OUTSIDE": "Element <{child}> only goes inside {parents}. Move it into one, or remove it.",
|
|
24
|
+
"CHILD_COUNT": "Element {tag} {count, plural, =0 {has no {child} elements} one {has # {child} element} other {has # {child} elements}}, but {max, select, -1 {needs at least {min}} 1 {{min, select, 1 {needs exactly 1} other {allows at most 1}}} other {{min, select, 0 {allows at most {max}} other {needs {min} to {max}}}}}.",
|
|
25
|
+
"PLACEMENT_INVALID": "Element {tag} cannot be placed here. Put inline elements inside text (a paragraph, heading or list item) and block elements directly on a page.",
|
|
26
|
+
"COMPONENT_NESTED": "Element {tag} cannot be placed inside element {parent}. Move it out.",
|
|
27
|
+
"URL_BLOCKED": "{tag, select, img {The picture address “{url}” is not allowed, so the picture cannot be shown. Use an address the exercise's URL policy accepts (by default https: or http:).} other {The link “{url}” is not allowed and was removed. Use a web or email link (https:, http: or mailto:).}}",
|
|
28
|
+
"IMG_ALT_MISSING": "A picture has no alt text. Describe in alt what the picture shows, or write alt=\"\" when it is only decoration.",
|
|
29
|
+
"FIGURE_INVALID": "A figure holds exactly one picture (<img>) and at most one caption (<figcaption>), and nothing else.",
|
|
30
|
+
"SCORING_MODE_INVALID": "Element {tag} has no scoring mode “{mode}”. Use one of: {modes}.",
|
|
31
|
+
"POINTS_INVALID": "“{value}” is not a valid number of points. Use a number from 0.01 to 1000.",
|
|
32
|
+
"VERSION_UNSUPPORTED": "Element {tag} uses version {version}, which this version of Astrolabe does not support. Update Astrolabe or check the v attribute.",
|
|
33
|
+
"STYLE_TEMPLATE_UNKNOWN": "Style template “{name}” cannot be used on element {tag}: it is not registered, or not made for this element, so it is ignored.",
|
|
34
|
+
"STYLE_REMOVED": "The style of element {tag} sets {property}, which an exercise may not use, or to a value it may not use, so that declaration is removed.",
|
|
35
|
+
"STYLE_TOO_LONG": "The style of element {tag} is longer than {max} characters, so it is removed.",
|
|
36
|
+
"STYLE_UNKNOWN": "Element {tag} uses the style “{class}”, which no <astl-style> defines.",
|
|
37
|
+
"STYLE_NAME_INVALID": "The rule <astl-style> “{name}” cannot be used: it needs either a name (letters, digits, - and _, starting with a letter, not starting with astl-, tiptap or prosemirror, and used once) or a for naming an element of the format.",
|
|
38
|
+
"STYLE_RULES_TOO_MANY": "An exercise can have at most {max} <astl-style> rules.",
|
|
39
|
+
"STYLE_TOO_LARGE": "The <astl-style> rules write more than {max} characters of styles into the exercise. Use fewer rules, or shorter ones.",
|
|
40
|
+
"STYLE_LOW_CONTRAST": "The text of element {tag} is hard to read on its background: contrast {ratio}:1, at least {min}:1 is recommended.",
|
|
41
|
+
"COLUMNS_INVALID": "Element {tag} is not a valid layout: <astl-columns> goes directly on a page and holds 2 to 4 <astl-column> elements, with nothing else between them, and layouts do not nest.",
|
|
42
|
+
"HELP_UNGRADED": "Element <{tag}> works only inside a graded interaction or on a page with one. Move it there: for now it is left out.",
|
|
43
|
+
"HELP_EMPTY": "Element <{tag}> is empty, so it is left out. Write its text or remove it.",
|
|
44
|
+
"HINT_COST_INVALID": "The cost of a hint is a fraction of the points from 0 to 1, such as 0.25, not “{value}”.",
|
|
45
|
+
"FEEDBACK_WHEN_INVALID": "Feedback is for one verdict: when=\"correct\", \"incorrect\", \"partial\" or \"omitted\", not “{value}”.",
|
|
46
|
+
"FEEDBACK_DUPLICATE": "There are two feedback texts for the verdict “{when}” here. Keep one.",
|
|
47
|
+
"EXPLANATION_DUPLICATE": "There are two explanations here. Keep one."
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"SOURCE_TOO_LARGE": "Dokument jest za długi. Może mieć najwyżej {max, number} znaków, więc podziel go na kilka ćwiczeń.",
|
|
3
|
+
"SOURCE_TOO_DEEP": "Elementy są zagnieżdżone na więcej niż {max, plural, one {# poziomie} few {# poziomach} many {# poziomach} other {# poziomu}}. Uprość strukturę, na przykład usuń zbędne elementy otaczające.",
|
|
4
|
+
"SOURCE_TOO_COMPLEX": "Element w dokumencie ma więcej niż {max, plural, one {# atrybut} few {# atrybuty} many {# atrybutów} other {# atrybutu}}. Usuń atrybuty, których nie potrzebuje.",
|
|
5
|
+
"DOC_ROOT_INVALID": "Umieść całe ćwiczenie w jednym elemencie <astl-doc> i nie dodawaj niczego poza nim.",
|
|
6
|
+
"DOC_FORMAT_UNSUPPORTED": "Format treści „{format}” nie jest obsługiwany. Wpisz format=\"1\" albo usuń ten atrybut.",
|
|
7
|
+
"DOC_LANG_MISSING": "Dodaj język treści do elementu <astl-doc>, na przykład lang=\"pl\".",
|
|
8
|
+
"DOC_LANG_INVALID": "„{lang}” nie jest kodem języka. Użyj kodu takiego jak pl, en albo pt-BR.",
|
|
9
|
+
"DOC_EMPTY": "Dokument jest pusty. Dodaj tekst albo element ćwiczenia.",
|
|
10
|
+
"DOC_MIXED_PAGES": "Część treści jest poza stronami. Umieść całą treść w elementach <astl-page> albo nie używaj stron wcale.",
|
|
11
|
+
"NO_COMPONENTS": "W tym dokumencie nic jeszcze nie jest oceniane. Dodaj co najmniej jeden element ćwiczenia.",
|
|
12
|
+
"PAGE_EMPTY": "Strona {page}{titled, select, yes { („{title}”)} other {}} jest pusta. Dodaj treść albo usuń stronę.",
|
|
13
|
+
"PAGE_NESTED": "Strona jest wewnątrz innej treści{page, select, 0 {} other { na stronie {page}{titled, select, yes { („{title}”)} other {}}}}. Umieszczaj strony bezpośrednio w <astl-doc>.",
|
|
14
|
+
"ID_MISSING": "Element {tag} nie ma identyfikatora. Dodaj atrybut id.",
|
|
15
|
+
"ID_INVALID": "„{id}” nie jest poprawnym identyfikatorem elementu {tag}. Zacznij od litery i używaj tylko znaków a-z, A-Z, 0-9, - oraz _ (najwyżej 64 znaki).",
|
|
16
|
+
"ID_DUPLICATE": "Identyfikator „{id}” występuje więcej niż raz. Nadaj każdemu elementowi inny identyfikator.",
|
|
17
|
+
"ELEMENT_UNKNOWN": "Nieznany element {tag}. Sprawdź pisownię albo zarejestruj komponent, który go definiuje.",
|
|
18
|
+
"ELEMENT_REMOVED": "Element {tag} jest niedozwolony i został usunięty.",
|
|
19
|
+
"ATTRIBUTE_REMOVED": "Atrybut {attribute} jest niedozwolony w elemencie {tag} i został usunięty.",
|
|
20
|
+
"ATTRIBUTE_INVALID": "Atrybut {attribute} w elemencie {tag} ma niepoprawną wartość: „{value}”.{type, select, enum { Użyj jednej z wartości: {values}.} other {}}",
|
|
21
|
+
"ATTRIBUTE_REQUIRED": "Element {tag} wymaga atrybutu {attribute}.",
|
|
22
|
+
"CHILD_UNEXPECTED": "{child, select, text {Element {tag} zawiera luźny tekst, którego nie przyjmuje. Usuń go albo umieść w dozwolonym elemencie.} other {Element {tag} nie przyjmuje <{child}>. Usuń go albo przenieś poza ten element.}}",
|
|
23
|
+
"CHILD_OUTSIDE": "Element <{child}> może być tylko wewnątrz: {parents}. Przenieś go tam albo usuń.",
|
|
24
|
+
"CHILD_COUNT": "Element {tag} {count, plural, =0 {nie zawiera żadnego elementu {child}} one {zawiera # element {child}} few {zawiera # elementy {child}} many {zawiera # elementów {child}} other {zawiera # elementu {child}}}, a {max, select, -1 {musi mieć co najmniej {min}} 1 {{min, select, 1 {musi mieć dokładnie 1} other {może mieć najwyżej 1}}} other {{min, select, 0 {może mieć najwyżej {max}} other {musi mieć od {min} do {max}}}}}.",
|
|
25
|
+
"PLACEMENT_INVALID": "Elementu {tag} nie można tu umieścić. Elementy w tekście wstawiaj do akapitu, nagłówka lub punktu listy, a elementy blokowe bezpośrednio na stronę.",
|
|
26
|
+
"COMPONENT_NESTED": "Elementu {tag} nie można umieścić wewnątrz elementu {parent}. Przenieś go na zewnątrz.",
|
|
27
|
+
"URL_BLOCKED": "{tag, select, img {Adres obrazka „{url}” jest niedozwolony, więc obrazka nie można pokazać. Użyj adresu, który przyjmuje polityka adresów ćwiczenia (domyślnie https: albo http:).} other {Link „{url}” jest niedozwolony i został usunięty. Użyj adresu strony lub e-maila (https:, http: albo mailto:).}}",
|
|
28
|
+
"IMG_ALT_MISSING": "Obrazek nie ma tekstu alternatywnego. Opisz w alt, co przedstawia, albo wpisz alt=\"\", jeśli jest tylko ozdobą.",
|
|
29
|
+
"FIGURE_INVALID": "Element figure zawiera dokładnie jeden obrazek (<img>) i najwyżej jeden podpis (<figcaption>), nic więcej.",
|
|
30
|
+
"SCORING_MODE_INVALID": "Element {tag} nie ma trybu punktacji „{mode}”. Użyj jednego z: {modes}.",
|
|
31
|
+
"POINTS_INVALID": "„{value}” nie jest poprawną liczbą punktów. Użyj liczby od 0,01 do 1000.",
|
|
32
|
+
"VERSION_UNSUPPORTED": "Element {tag} używa wersji {version}, której ta wersja Astrolabe nie obsługuje. Zaktualizuj Astrolabe albo sprawdź atrybut v.",
|
|
33
|
+
"STYLE_TEMPLATE_UNKNOWN": "Szablonu stylu „{name}” nie można użyć w elemencie {tag}: nie jest zarejestrowany albo nie jest przeznaczony dla tego elementu, więc zostanie pominięty.",
|
|
34
|
+
"STYLE_REMOVED": "Styl elementu {tag} ustawia {property}, czego ćwiczenie nie może używać, albo używa niedozwolonej wartości, więc ta deklaracja zostanie usunięta.",
|
|
35
|
+
"STYLE_TOO_LONG": "Styl elementu {tag} jest dłuższy niż {max} znaków, więc zostanie usunięty.",
|
|
36
|
+
"STYLE_UNKNOWN": "Element {tag} używa stylu „{class}”, którego nie definiuje żadne <astl-style>.",
|
|
37
|
+
"STYLE_NAME_INVALID": "Reguły <astl-style> „{name}” nie można użyć: potrzebuje albo nazwy (litery, cyfry, - i _, na początku litera, bez przedrostków astl-, tiptap i prosemirror, użytej raz), albo atrybutu for z elementem formatu.",
|
|
38
|
+
"STYLE_RULES_TOO_MANY": "Ćwiczenie może mieć najwyżej {max} reguł <astl-style>.",
|
|
39
|
+
"STYLE_TOO_LARGE": "Reguły <astl-style> wpisują do ćwiczenia ponad {max} znaków stylów. Użyj mniejszej liczby reguł albo krótszych.",
|
|
40
|
+
"STYLE_LOW_CONTRAST": "Tekst elementu {tag} jest trudny do odczytania na swoim tle: kontrast {ratio}:1, zalecane co najmniej {min}:1.",
|
|
41
|
+
"COLUMNS_INVALID": "Element {tag} nie tworzy poprawnego układu: <astl-columns> stoi bezpośrednio na stronie i zawiera od 2 do 4 elementów <astl-column>, bez niczego między nimi, a układów nie można zagnieżdżać.",
|
|
42
|
+
"HELP_UNGRADED": "Element <{tag}> działa tylko w ocenianym zadaniu albo na stronie z takim zadaniem. Przenieś go tam: na razie jest pominięty.",
|
|
43
|
+
"HELP_EMPTY": "Element <{tag}> jest pusty, więc jest pominięty. Wpisz jego treść albo go usuń.",
|
|
44
|
+
"HINT_COST_INVALID": "Koszt podpowiedzi to część punktów od 0 do 1, np. 0.25, a nie „{value}”.",
|
|
45
|
+
"FEEDBACK_WHEN_INVALID": "Informacja zwrotna dotyczy jednego wyniku: when=\"correct\", \"incorrect\", \"partial\" albo \"omitted\", a nie „{value}”.",
|
|
46
|
+
"FEEDBACK_DUPLICATE": "Są tu dwie informacje zwrotne dla wyniku „{when}”. Zostaw jedną.",
|
|
47
|
+
"EXPLANATION_DUPLICATE": "Są tu dwa wyjaśnienia. Zostaw jedno."
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAInE,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,SAAS,cAAc,EAGnD,CAAC"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ENGINE_NAMESPACE } from '@astl/core';
|
|
2
|
+
import en from './messages/en.json' with { type: 'json' };
|
|
3
|
+
import pl from './messages/pl.json' with { type: 'json' };
|
|
4
|
+
/** Messages for every engine issue code (namespace `astl.engine`). */
|
|
5
|
+
export const engineMessages = [
|
|
6
|
+
{ namespace: ENGINE_NAMESPACE, locale: 'en', messages: en },
|
|
7
|
+
{ namespace: ENGINE_NAMESPACE, locale: 'pl', messages: pl },
|
|
8
|
+
];
|
|
9
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1D,OAAO,EAAE,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE1D,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3D,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;CAC5D,CAAC"}
|
package/dist/round.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round.d.ts","sourceRoot":"","sources":["../src/round.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
package/dist/round.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round.js","sourceRoot":"","sources":["../src/round.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
|