@instructure/platform-modules 0.4.0 → 1.0.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/README.md +3 -2
- package/dist/adapters/canvasGraphql/index.d.ts +4 -14
- package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/normalize.d.ts +6 -75
- package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/queries.d.ts +7 -21
- package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
- package/dist/adapters/inMemory.d.ts +0 -16
- package/dist/adapters/inMemory.d.ts.map +1 -1
- package/dist/adapters/limits.d.ts +3 -24
- package/dist/adapters/limits.d.ts.map +1 -1
- package/dist/adapters/types.d.ts +14 -34
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cache/invalidate.d.ts +0 -23
- package/dist/cache/invalidate.d.ts.map +1 -1
- package/dist/cache/keys.d.ts +3 -14
- package/dist/cache/keys.d.ts.map +1 -1
- package/dist/components/FilterChips.d.ts +4 -11
- package/dist/components/FilterChips.d.ts.map +1 -1
- package/dist/components/ModuleCard.d.ts +0 -9
- package/dist/components/ModuleCard.d.ts.map +1 -1
- package/dist/components/ModuleCard.stories.d.ts +3 -5
- package/dist/components/ModuleCard.stories.d.ts.map +1 -1
- package/dist/components/ModuleItemRow.d.ts +0 -10
- package/dist/components/ModuleItemRow.d.ts.map +1 -1
- package/dist/components/ModuleNumberBadge.d.ts +0 -1
- package/dist/components/ModuleNumberBadge.d.ts.map +1 -1
- package/dist/components/ModulesList.d.ts +0 -31
- package/dist/components/ModulesList.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +11 -69
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/components/StatusPill.d.ts +4 -3
- package/dist/components/StatusPill.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/labels.d.ts +1 -54
- package/dist/components/labels.d.ts.map +1 -1
- package/dist/components/lightThemeDecorator.d.ts +3 -0
- package/dist/components/lightThemeDecorator.d.ts.map +1 -0
- package/dist/config/base.d.ts +0 -5
- package/dist/config/base.d.ts.map +1 -1
- package/dist/config/capabilities.d.ts +8 -0
- package/dist/config/capabilities.d.ts.map +1 -0
- package/dist/config/context.d.ts +1 -1
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/filters.d.ts +15 -0
- package/dist/config/filters.d.ts.map +1 -0
- package/dist/config/formatters.d.ts +15 -0
- package/dist/config/formatters.d.ts.map +1 -0
- package/dist/config/index.d.ts +9 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/itemMeta.d.ts +5 -0
- package/dist/config/itemMeta.d.ts.map +1 -0
- package/dist/config/itemTypes.d.ts +4 -0
- package/dist/config/itemTypes.d.ts.map +1 -0
- package/dist/config/partialModulesConfig.d.ts +0 -1
- package/dist/config/partialModulesConfig.d.ts.map +1 -1
- package/dist/config/registry.d.ts +2 -22
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +0 -4
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/schemas.d.ts +37 -7
- package/dist/config/schemas.d.ts.map +1 -1
- package/dist/config/types.d.ts +8 -11
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/useFormatters.d.ts +10 -0
- package/dist/config/useFormatters.d.ts.map +1 -0
- package/dist/fixtures/generate.d.ts +1 -26
- package/dist/fixtures/generate.d.ts.map +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fixtures/index.d.ts.map +1 -1
- package/dist/fixtures/scenarios.d.ts +1 -6
- package/dist/fixtures/scenarios.d.ts.map +1 -1
- package/dist/hooks/constants.d.ts +6 -23
- package/dist/hooks/constants.d.ts.map +1 -1
- package/dist/hooks/queryOptions.d.ts +2 -5
- package/dist/hooks/queryOptions.d.ts.map +1 -1
- package/dist/hooks/useItemsMode.d.ts +3 -35
- package/dist/hooks/useItemsMode.d.ts.map +1 -1
- package/dist/hooks/useModuleItemQueries.d.ts +1 -7
- package/dist/hooks/useModuleItemQueries.d.ts.map +1 -1
- package/dist/hooks/useModuleItems.d.ts +0 -16
- package/dist/hooks/useModuleItems.d.ts.map +1 -1
- package/dist/hooks/useModules.d.ts +3 -24
- package/dist/hooks/useModules.d.ts.map +1 -1
- package/dist/hooks/useModulesPageData.d.ts +9 -7
- package/dist/hooks/useModulesPageData.d.ts.map +1 -1
- package/dist/i18n.d.ts +6 -36
- package/dist/i18n.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1788 -1405
- package/dist/types/domain.d.ts +4 -27
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/enums.d.ts +3 -25
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/extensions.d.ts +0 -22
- package/dist/types/extensions.d.ts.map +1 -1
- package/dist/types/filterClause.d.ts +18 -0
- package/dist/types/filterClause.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/navigation.d.ts +0 -6
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +0 -5
- package/dist/types/schemas.d.ts.map +1 -1
- package/locales/en.json +14 -3
- package/package.json +14 -13
package/dist/types/domain.d.ts
CHANGED
|
@@ -4,19 +4,16 @@ export type ModuleItemType = z.infer<typeof ModuleItemTypeSchema>;
|
|
|
4
4
|
export type ModuleItemStatus = z.infer<typeof ModuleItemStatusSchema>;
|
|
5
5
|
export type ModuleStatus = z.infer<typeof ModuleStatusSchema>;
|
|
6
6
|
export interface ModuleProgress {
|
|
7
|
-
status
|
|
7
|
+
status?: ModuleStatus;
|
|
8
8
|
requirementsMet: number;
|
|
9
|
-
/** Mirrors `Module.requirementCount`. */
|
|
10
9
|
requirementCount: number;
|
|
11
|
-
/** 0–100, precomputed so every host rounds it the same way. */
|
|
12
10
|
percentComplete: number;
|
|
13
11
|
latestDueAt?: string | null;
|
|
14
|
-
/** Items past due and unsubmitted. */
|
|
15
12
|
missingCount: number;
|
|
13
|
+
incompleteCount: number;
|
|
16
14
|
}
|
|
17
15
|
export type CompletionRequirementType = z.infer<typeof CompletionRequirementTypeSchema>;
|
|
18
16
|
export interface CompletionRequirement {
|
|
19
|
-
/** Canvas's `ModuleCompletionRequirement.id` is the content tag id, i.e. the item id. */
|
|
20
17
|
itemId: string;
|
|
21
18
|
type: CompletionRequirementType;
|
|
22
19
|
minScore?: number | null;
|
|
@@ -27,32 +24,17 @@ export interface ModuleItem {
|
|
|
27
24
|
moduleId: string;
|
|
28
25
|
title: string;
|
|
29
26
|
type: ModuleItemType;
|
|
30
|
-
/** 1-based position within the module, as Canvas reports it. */
|
|
31
27
|
position: number;
|
|
32
28
|
indent: number;
|
|
33
29
|
published: boolean;
|
|
34
30
|
url?: string | null;
|
|
35
|
-
/** Canvas `ContentTag#new_tab`. Absent or null means the item opens in place. */
|
|
36
31
|
newTab?: boolean | null;
|
|
37
32
|
completionRequirement?: CompletionRequirement | null;
|
|
38
|
-
/** ISO 8601. Overrides are already applied by the adapter when applicable. */
|
|
39
33
|
dueAt?: string | null;
|
|
40
|
-
/** Undefined when not fetched — distinct from `'not_started'`. */
|
|
41
34
|
status?: ModuleItemStatus;
|
|
42
|
-
/** Null for types that cannot be graded. */
|
|
43
35
|
pointsPossible?: number | null;
|
|
44
|
-
/** Read through the accessors in `types/extensions.ts`, never by bare key. */
|
|
45
36
|
extensions?: Record<string, unknown>;
|
|
46
37
|
}
|
|
47
|
-
/**
|
|
48
|
-
* A module listed as a prerequisite of another.
|
|
49
|
-
*
|
|
50
|
-
* Mirrors Canvas's unfiltered `prerequisites` (`not_deleted`), which is a
|
|
51
|
-
* superset of the `active_prerequisites` that actually gate the lock, and is not
|
|
52
|
-
* filtered by viewer. It can name unpublished, unassigned and feature-hidden
|
|
53
|
-
* modules, so it is **not safe to render to a student unfiltered** and it is not
|
|
54
|
-
* the lock reason.
|
|
55
|
-
*/
|
|
56
38
|
export interface PrerequisiteModule {
|
|
57
39
|
id: string;
|
|
58
40
|
name: string;
|
|
@@ -62,20 +44,15 @@ export interface Module {
|
|
|
62
44
|
name: string;
|
|
63
45
|
position: number;
|
|
64
46
|
published: boolean;
|
|
65
|
-
/** Independent of how many have been fetched. */
|
|
66
47
|
itemCount: number;
|
|
67
|
-
/** `[]`
|
|
48
|
+
/** Absent means the adapter did not inline them. `[]` means it did, and found none. */
|
|
68
49
|
items?: ModuleItem[];
|
|
69
50
|
unlockAt?: string | null;
|
|
70
|
-
/** Unfiltered and not the lock reason — see `PrerequisiteModule`. */
|
|
71
51
|
prerequisiteModules: PrerequisiteModule[];
|
|
72
52
|
requirementCount?: number | null;
|
|
73
53
|
requireSequentialProgress: boolean;
|
|
74
54
|
completionRequirements?: CompletionRequirement[];
|
|
75
|
-
/**
|
|
76
|
-
* Module-level by design: the pill, the bar and every filter chip read from here, so the
|
|
77
|
-
* filter row works with no item fetched. That is what keeps `onDemand` viable.
|
|
78
|
-
*/
|
|
55
|
+
/** Absent means not fetched. Do not default it — that is not the same as nothing done. */
|
|
79
56
|
progress?: ModuleProgress;
|
|
80
57
|
extensions?: Record<string, unknown>;
|
|
81
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/types/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,MAAM,MAAM,YAAY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;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;CACnB"}
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -9,14 +9,6 @@ export declare const ModuleItemTypeSchema: z.ZodEnum<[
|
|
|
9
9
|
'external_tool',
|
|
10
10
|
'sub_header'
|
|
11
11
|
]>;
|
|
12
|
-
/**
|
|
13
|
-
* Derived by the adapter from submission state, not stored on the item in Canvas. `complete`
|
|
14
|
-
* reports a met completion requirement; `excused` is distinct from `graded` because the
|
|
15
|
-
* student was exempted rather than assessed.
|
|
16
|
-
*
|
|
17
|
-
* No `unknown` member: an unnamed `gradingStatus` falls through to `not_started`, which
|
|
18
|
-
* understates rather than misreports.
|
|
19
|
-
*/
|
|
20
12
|
export declare const ModuleItemStatusSchema: z.ZodEnum<[
|
|
21
13
|
'not_started',
|
|
22
14
|
'in_progress',
|
|
@@ -27,29 +19,15 @@ export declare const ModuleItemStatusSchema: z.ZodEnum<[
|
|
|
27
19
|
'missing',
|
|
28
20
|
'locked'
|
|
29
21
|
]>;
|
|
30
|
-
/**
|
|
31
|
-
* Per-module rollup state.
|
|
32
|
-
*
|
|
33
|
-
* Also from the design annotation: "Not started / In progress / All submitted /
|
|
34
|
-
* All graded / Missing (1+ item past due) / Locked".
|
|
35
|
-
*
|
|
36
|
-
* NOTE: the mock renders a pill reading "All items complete" which is not in that
|
|
37
|
-
* list. Treated as a presentation label over `all_graded`/`all_submitted` until
|
|
38
|
-
* the designer says otherwise — flagged rather than guessed at.
|
|
39
|
-
*/
|
|
40
22
|
export declare const ModuleStatusSchema: z.ZodEnum<[
|
|
41
23
|
'not_started',
|
|
42
24
|
'in_progress',
|
|
43
|
-
'
|
|
44
|
-
'all_graded',
|
|
25
|
+
'complete',
|
|
45
26
|
'missing',
|
|
27
|
+
'incomplete',
|
|
28
|
+
'missing_and_incomplete',
|
|
46
29
|
'locked'
|
|
47
30
|
]>;
|
|
48
|
-
/**
|
|
49
|
-
* Canvas validates the same six exhaustively on save (`app/models/context_module.rb:684,687`),
|
|
50
|
-
* so this is the whole set. `unknown` is the forward-compatibility member — a seventh type
|
|
51
|
-
* shipping in Canvas must not make this package fail to parse a module.
|
|
52
|
-
*/
|
|
53
31
|
export declare const CompletionRequirementTypeSchema: z.ZodEnum<[
|
|
54
32
|
'must_view',
|
|
55
33
|
'must_mark_done',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAC1C;IACE,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,MAAM;IACN,MAAM;IACN,cAAc;IACd,eAAe;IACf,YAAY;CACb,CAUD,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAC5C;IAAC,aAAa;IAAE,aAAa;IAAE,UAAU;IAAE,WAAW;IAAE,QAAQ;IAAE,SAAS;IAAE,SAAS;IAAE,QAAQ;CAAC,CAUjG,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CACxC;IACE,aAAa;IACb,aAAa;IACb,UAAU;IACV,SAAS;IACT,YAAY;IACZ,wBAAwB;IACxB,QAAQ;CACT,CASD,CAAA;AAEF,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CACrD;IACE,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,SAAS;CACV,CASD,CAAA"}
|
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import { ModuleItem } from './domain';
|
|
2
|
-
/**
|
|
3
|
-
* Minutes Canvas Career estimates an item takes.
|
|
4
|
-
*
|
|
5
|
-
* Career-only: Canvas LMS has no such field, does not fetch it, and renders
|
|
6
|
-
* nothing for it. It lives here rather than on `ModuleItem` for exactly that
|
|
7
|
-
* reason — a field that is null for one of the two hosts is not part of the
|
|
8
|
-
* intersection the domain model is supposed to be.
|
|
9
|
-
*
|
|
10
|
-
* Canvas exposes it as an `ISO8601Duration` (`PT45M`); the adapter converts to
|
|
11
|
-
* whole minutes, because that is the only unit either UI renders.
|
|
12
|
-
*/
|
|
13
2
|
export declare const EXT_CAREER_ESTIMATED_DURATION_MINUTES = "career.estimatedDurationMinutes";
|
|
14
|
-
/**
|
|
15
|
-
* @returns the estimate in whole minutes, or `null` when the host did not supply
|
|
16
|
-
* one — including when it supplied something that is not a positive number.
|
|
17
|
-
*/
|
|
18
3
|
export declare function getEstimatedDurationMinutes(item: Pick<ModuleItem, 'extensions'>): number | null;
|
|
19
|
-
/**
|
|
20
|
-
* Merge an estimate into an extensions bag, or leave the bag absent.
|
|
21
|
-
*
|
|
22
|
-
* Returns `undefined` for a null estimate rather than an object holding a null,
|
|
23
|
-
* so an item with nothing host-specific about it carries no `extensions` key at
|
|
24
|
-
* all. That keeps the common case — every Canvas LMS item — free.
|
|
25
|
-
*/
|
|
26
4
|
export declare function withEstimatedDurationMinutes(extensions: Record<string, unknown> | undefined, minutes: number | null | undefined): Record<string, unknown> | undefined;
|
|
27
5
|
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/types/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/types/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,qCAAqC,oCAAoC,CAAA;AAEtF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,GAAG,IAAI,CAI/F;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAGrC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type FilterTarget = 'module' | 'item';
|
|
3
|
+
/** Must stay serializable: it goes in a query key. See `docs/adr/0008-filtering-and-the-data-layer.md`. */
|
|
4
|
+
export interface FilterClause {
|
|
5
|
+
target: FilterTarget;
|
|
6
|
+
field: string;
|
|
7
|
+
op: 'eq' | 'contains';
|
|
8
|
+
value: string | boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const FilterClauseSchema: z.ZodType<FilterClause>;
|
|
11
|
+
export type TargetCapabilities = Readonly<Record<string, ReadonlyArray<FilterClause['op']>>>;
|
|
12
|
+
/** Absent means the transport serves no clause at all. */
|
|
13
|
+
export interface FilterCapabilities {
|
|
14
|
+
module?: TargetCapabilities;
|
|
15
|
+
item?: TargetCapabilities;
|
|
16
|
+
}
|
|
17
|
+
export declare function servesClause(capabilities: FilterCapabilities | undefined, clause: FilterClause): boolean;
|
|
18
|
+
//# sourceMappingURL=filterClause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterClause.d.ts","sourceRoot":"","sources":["../../src/types/filterClause.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5C,2GAA2G;AAC3G,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,IAAI,GAAG,UAAU,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAO5C,CAAA;AAEX,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAE5F,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAC1B;AAED,wBAAgB,YAAY,CAC1B,YAAY,EAAE,kBAAkB,GAAG,SAAS,EAC5C,MAAM,EAAE,YAAY,GACnB,OAAO,CAIT"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { ModuleItemStatus, ModuleProgress, ModuleStatus, CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemType, ModulesPage, PageInfo, PrerequisiteModule, } from './domain';
|
|
2
|
+
export { type FilterCapabilities, type FilterClause, FilterClauseSchema, type FilterTarget, servesClause, type TargetCapabilities, } from './filterClause';
|
|
2
3
|
export type { ModuleItemNavigation } from './navigation';
|
|
3
4
|
export { CompletionRequirementSchema, CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleProgressSchema, ModuleStatusSchema, ModuleItemSchema, ModuleItemsPageSchema, ModuleItemTypeSchema, ModuleSchema, ModulesPageSchema, PageInfoSchema, PrerequisiteModuleSchema, } from './schemas';
|
|
4
5
|
export { EXT_CAREER_ESTIMATED_DURATION_MINUTES, getEstimatedDurationMinutes, withEstimatedDurationMinutes, } from './extensions';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,GACnB,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,GACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,cAAc,CAAA"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
2
|
import { ModuleItem } from './domain';
|
|
3
|
-
/**
|
|
4
|
-
* Optional host navigation for item rows. Titles link to `ModuleItem.url`
|
|
5
|
-
* without it. Pass a stable reference: `ModuleItemRow` is memoized.
|
|
6
|
-
*/
|
|
7
3
|
export interface ModuleItemNavigation {
|
|
8
|
-
/** Rewrite an item's href. Falls back to `item.url` when it returns nullish. */
|
|
9
4
|
getItemHref?: (item: ModuleItem) => string | null | undefined;
|
|
10
|
-
/** Called on click, in addition to the href rather than instead of it. */
|
|
11
5
|
onItemClick?: (item: ModuleItem, event: MouseEvent<HTMLAnchorElement>) => void;
|
|
12
6
|
}
|
|
13
7
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAE7D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC/E"}
|
package/dist/types/schemas.d.ts
CHANGED
|
@@ -6,11 +6,6 @@ export declare const CompletionRequirementSchema: z.ZodType<CompletionRequiremen
|
|
|
6
6
|
export declare const ModuleItemSchema: z.ZodType<ModuleItem>;
|
|
7
7
|
export declare const PrerequisiteModuleSchema: z.ZodType<PrerequisiteModule>;
|
|
8
8
|
export declare const ModuleSchema: z.ZodType<Module>;
|
|
9
|
-
/**
|
|
10
|
-
* `hasNextPage: true` with a null `endCursor` type-checks but renders a "Load more" that can
|
|
11
|
-
* never load: paging is driven by `endCursor`, where null means "done" to TanStack Query.
|
|
12
|
-
* Relay makes it unreachable, but a REST adapter parsing a `Link` header is one bug away.
|
|
13
|
-
*/
|
|
14
9
|
export declare const PageInfoSchema: z.ZodType<PageInfo>;
|
|
15
10
|
export declare const ModulesPageSchema: z.ZodType<ModulesPage>;
|
|
16
11
|
export declare const ModuleItemsPageSchema: z.ZodType<ModuleItemsPage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAQjB,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/types/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAQjB,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAQzD,CAAA;AAEF,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAKvE,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAejD,CAAA;AAEF,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAGjE,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAczC,CAAA;AAEF,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAU3C,CAAA;AAEJ,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAGnD,CAAA;AAEF,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAG3D,CAAA"}
|
package/locales/en.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"expandAll": "Expand all",
|
|
11
11
|
"collapseAll": "Collapse all",
|
|
12
12
|
"searchScopeHint": "Search matches module names only — items of collapsed modules are not loaded.",
|
|
13
|
+
"filterScopeHint": "This filter runs on the modules loaded so far — load more to filter the rest of the course.",
|
|
13
14
|
"modulesLoadErrorAlert": "Modules failed to load: %{message}",
|
|
14
15
|
"modulesLoadingSpinnerLabel": "Loading modules",
|
|
15
16
|
"noModulesEmptyState": "This course has no modules.",
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
"one": "The only loaded module does not match this filter.",
|
|
18
19
|
"other": "None of the %{count} loaded modules match this filter."
|
|
19
20
|
},
|
|
21
|
+
"noFilterMatches": "No modules match this filter.",
|
|
20
22
|
"clearFilters": "Clear filters",
|
|
21
23
|
"loadMoreModulesLoading": "Loading more modules…",
|
|
22
24
|
"loadMoreModules": "Load more modules (%{count} loaded)",
|
|
@@ -47,9 +49,10 @@
|
|
|
47
49
|
"expandModule": "Expand %{name}",
|
|
48
50
|
"moduleStatusNotStarted": "Not started",
|
|
49
51
|
"moduleStatusInProgress": "In progress",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
52
|
+
"moduleStatusComplete": "All completed",
|
|
53
|
+
"moduleStatusMissing": "%{count} Missing",
|
|
54
|
+
"moduleStatusIncomplete": "%{count} Incomplete",
|
|
55
|
+
"moduleStatusMissingAndIncomplete": "%{missing} & %{incomplete}",
|
|
53
56
|
"moduleStatusLocked": "Locked",
|
|
54
57
|
"itemStatusNotStarted": "Not started",
|
|
55
58
|
"itemStatusInProgress": "In progress",
|
|
@@ -67,6 +70,14 @@
|
|
|
67
70
|
"itemTypeExternalUrl": "External URL",
|
|
68
71
|
"itemTypeExternalTool": "External tool",
|
|
69
72
|
"itemTypeSubHeader": "Text header",
|
|
73
|
+
|
|
74
|
+
"metaFieldTypeLabel": "Item type",
|
|
75
|
+
"metaFieldDueAtLabel": "Due date",
|
|
76
|
+
"metaFieldPointsLabel": "Points",
|
|
77
|
+
"metaFieldRequirementLabel": "Requirement",
|
|
78
|
+
"metaFieldDurationLabel": "Estimated duration",
|
|
79
|
+
"metaFieldPublishStateLabel": "Publish state",
|
|
80
|
+
|
|
70
81
|
"requirementMustView": "View the item",
|
|
71
82
|
"requirementMustSubmit": "Submit the assignment",
|
|
72
83
|
"requirementMustContribute": "Contribute to the page",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/platform-modules",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -17,21 +17,22 @@
|
|
|
17
17
|
"locales"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
+
"@instructure/emotion": "^11.0.0",
|
|
20
21
|
"@instructure/ui-a11y-content": "^11.0.0",
|
|
21
|
-
"@instructure/ui-alerts": "^11.
|
|
22
|
-
"@instructure/ui-buttons": "^11.
|
|
23
|
-
"@instructure/ui-flex": "^11.
|
|
24
|
-
"@instructure/ui-heading": "^11.
|
|
22
|
+
"@instructure/ui-alerts": "^11.7.0",
|
|
23
|
+
"@instructure/ui-buttons": "^11.7.0",
|
|
24
|
+
"@instructure/ui-flex": "^11.7.0",
|
|
25
|
+
"@instructure/ui-heading": "^11.7.0",
|
|
25
26
|
"@instructure/ui-icons": "^11.0.0",
|
|
26
|
-
"@instructure/ui-link": "^11.
|
|
27
|
-
"@instructure/ui-menu": "^11.
|
|
28
|
-
"@instructure/ui-pill": "^11.
|
|
27
|
+
"@instructure/ui-link": "^11.7.0",
|
|
28
|
+
"@instructure/ui-menu": "^11.7.0",
|
|
29
|
+
"@instructure/ui-pill": "^11.7.0",
|
|
29
30
|
"@instructure/ui-progress": "^11.7.0",
|
|
30
31
|
"@instructure/ui-responsive": "^11.0.0",
|
|
31
|
-
"@instructure/ui-spinner": "^11.
|
|
32
|
-
"@instructure/ui-text": "^11.
|
|
33
|
-
"@instructure/ui-text-input": "^11.
|
|
34
|
-
"@instructure/ui-view": "^11.
|
|
32
|
+
"@instructure/ui-spinner": "^11.7.0",
|
|
33
|
+
"@instructure/ui-text": "^11.7.0",
|
|
34
|
+
"@instructure/ui-text-input": "^11.7.0",
|
|
35
|
+
"@instructure/ui-view": "^11.7.0",
|
|
35
36
|
"@tanstack/react-query": "^5.0.0",
|
|
36
37
|
"graphql": "^16.0.0",
|
|
37
38
|
"react": "^18.0.0",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"vite-plugin-dts": "^4.0.0",
|
|
78
79
|
"vitest": "^4.0.0",
|
|
79
80
|
"zod": "^3.23.8",
|
|
80
|
-
"@instructure/platform-mock-canvas-api": "0.5.
|
|
81
|
+
"@instructure/platform-mock-canvas-api": "0.5.1"
|
|
81
82
|
},
|
|
82
83
|
"scripts": {
|
|
83
84
|
"build": "vite build",
|