@instructure/platform-modules 0.1.1 → 0.3.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 +113 -3
- package/dist/adapters/canvasGraphql/index.d.ts +1 -1
- package/dist/adapters/canvasGraphql/normalize.d.ts +7 -6
- package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/queries.d.ts +2 -2
- package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
- package/dist/adapters/inMemory.d.ts +4 -4
- package/dist/adapters/limits.d.ts +4 -4
- package/dist/adapters/types.d.ts +6 -6
- package/dist/cache/keys.d.ts +1 -1
- package/dist/components/FilterChips.d.ts +10 -8
- package/dist/components/FilterChips.d.ts.map +1 -1
- package/dist/components/ModuleCard.d.ts +18 -6
- package/dist/components/ModuleCard.d.ts.map +1 -1
- package/dist/components/ModuleCard.stories.d.ts +12 -0
- package/dist/components/ModuleCard.stories.d.ts.map +1 -0
- package/dist/components/ModuleItemRow.d.ts +4 -2
- package/dist/components/ModuleItemRow.d.ts.map +1 -1
- package/dist/components/ModuleNumberBadge.d.ts +8 -0
- package/dist/components/ModuleNumberBadge.d.ts.map +1 -0
- package/dist/components/ModulesList.d.ts +4 -1
- package/dist/components/ModulesList.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +36 -8
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/labels.d.ts +9 -13
- package/dist/components/labels.d.ts.map +1 -1
- package/dist/config/base.d.ts +8 -0
- package/dist/config/base.d.ts.map +1 -0
- package/dist/config/context.d.ts +11 -0
- package/dist/config/context.d.ts.map +1 -0
- package/dist/config/index.d.ts +6 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/partialModulesConfig.d.ts +4 -0
- package/dist/config/partialModulesConfig.d.ts.map +1 -0
- package/dist/config/registry.d.ts +3 -0
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +7 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/schemas.d.ts +2 -0
- package/dist/config/schemas.d.ts.map +1 -1
- package/dist/config/types.d.ts +32 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/fixtures/generate.d.ts +1 -1
- 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 +5 -0
- package/dist/fixtures/scenarios.d.ts.map +1 -1
- package/dist/hooks/constants.d.ts +1 -1
- package/dist/hooks/queryOptions.d.ts +1 -1
- package/dist/hooks/useModuleItemQueries.d.ts +1 -1
- package/dist/hooks/useModuleItems.d.ts +1 -1
- package/dist/hooks/useModules.d.ts +1 -1
- package/dist/i18n.d.ts +33 -63
- package/dist/i18n.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1135 -867
- package/dist/types/domain.d.ts +5 -3
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/enums.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/navigation.d.ts +13 -0
- package/dist/types/navigation.d.ts.map +1 -0
- package/dist/types/schemas.d.ts +1 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/locales/en.json +102 -0
- package/package.json +11 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,mBAAm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BAAqB,GAC3B,MAAM,cAAc,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { TranslateFunction } from '../i18n';
|
|
2
2
|
import { CompletionRequirement, Module, ModuleItemType } from '../types';
|
|
3
|
-
/** A locale-aware number formatter, cached. Exported so components share the cache. */
|
|
4
|
-
export declare function numberFormatterFor(locale?: string): Intl.NumberFormat;
|
|
5
3
|
/** Whole calendar days between two dates, ignoring the time of day. */
|
|
6
4
|
export declare function calendarDayDiff(a: Date, b: Date): number;
|
|
7
5
|
/**
|
|
@@ -20,25 +18,23 @@ export declare function formatDueByline(t: TranslateFunction, iso: string, today
|
|
|
20
18
|
/** The module header byline when the module is locked. */
|
|
21
19
|
export declare function formatUnlockByline(t: TranslateFunction, iso: string, today: Date, locale?: string): string;
|
|
22
20
|
/**
|
|
23
|
-
* "01", "02", … "120".
|
|
24
|
-
*
|
|
25
|
-
* Localised through `Intl.NumberFormat` rather than `String(n).padStart`, because
|
|
26
|
-
* the badge is a number and locales that use different digits should show theirs.
|
|
21
|
+
* "01", "02", … "120". `Intl` rather than `padStart` so a locale's own digits show.
|
|
22
|
+
* Anything but a positive integer is an unknown position and returns `null`.
|
|
27
23
|
*/
|
|
28
|
-
export declare function formatModuleNumber(position: number, locale?: string): string;
|
|
24
|
+
export declare function formatModuleNumber(position: number, locale?: string): string | null;
|
|
29
25
|
export declare function itemTypeLabel(t: TranslateFunction, type: ModuleItemType): string;
|
|
30
26
|
/** "10 pts". Null/undefined points render nothing at all, not "0 pts". */
|
|
31
|
-
export declare function formatPoints(t: TranslateFunction, pointsPossible: number | null | undefined
|
|
27
|
+
export declare function formatPoints(t: TranslateFunction, pointsPossible: number | null | undefined): string | null;
|
|
32
28
|
/**
|
|
33
29
|
* The requirement column, e.g. "Submit the assignment".
|
|
34
30
|
*
|
|
35
31
|
* Exhaustive over `CompletionRequirementType` — no `default`, so adding a member
|
|
36
|
-
* to the enum is a compile error here rather than a silently
|
|
32
|
+
* to the enum is a compile error here rather than a silently unlabeled row. The
|
|
37
33
|
* `unknown` member is what absorbs a seventh Canvas type, and it still renders
|
|
38
|
-
* something: an
|
|
34
|
+
* something: an unlabeled requirement would look like *no* requirement, which
|
|
39
35
|
* is the wrong failure.
|
|
40
36
|
*/
|
|
41
|
-
export declare function requirementLabel(t: TranslateFunction, requirement: CompletionRequirement
|
|
37
|
+
export declare function requirementLabel(t: TranslateFunction, requirement: CompletionRequirement): string;
|
|
42
38
|
/**
|
|
43
39
|
* "75% | 3 of 4 requirements met", straight off the design.
|
|
44
40
|
*
|
|
@@ -47,7 +43,7 @@ export declare function requirementLabel(t: TranslateFunction, requirement: Comp
|
|
|
47
43
|
* either skip it or announce "vertical bar". Left as one key because splitting it
|
|
48
44
|
* changes the design's copy; flagged rather than quietly restructured.
|
|
49
45
|
*/
|
|
50
|
-
export declare function progressSummary(t: TranslateFunction, percentComplete: number, met: number, total: number
|
|
46
|
+
export declare function progressSummary(t: TranslateFunction, percentComplete: number, met: number, total: number): string;
|
|
51
47
|
export type ModulesFilterId = 'all' | 'in_progress' | 'complete' | 'due_this_week' | 'missing';
|
|
52
48
|
/**
|
|
53
49
|
* The chip order the design draws, as ids only.
|
|
@@ -79,7 +75,7 @@ export declare function moduleMatchesFilter(module: Module, filter: ModulesFilte
|
|
|
79
75
|
*
|
|
80
76
|
* Same reason as the filters: with `onDemand` pagination the items of collapsed
|
|
81
77
|
* modules are not in memory, so an item-level search would silently under-report
|
|
82
|
-
* — the one thing this package exists to prevent. The input is
|
|
78
|
+
* — the one thing this package exists to prevent. The input is labeled
|
|
83
79
|
* "Search module names" so the limit is on screen rather than in a comment.
|
|
84
80
|
*
|
|
85
81
|
* `toLocaleLowerCase` rather than `toLowerCase`: the Turkish dotless i is the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/components/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAA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;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,GAAG,MAAM,CAqBjG;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,iBAAiB,EACpB,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAID,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,aAAa,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAAA;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAMxD,CAAA;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,eAAe,GAAG,MAAM,CAa7E;AAED,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAqCjG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAI3F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModulesConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The starting point every host resolves against. Empty until each mechanism
|
|
4
|
+
* lands; `docs/adr/0001-customization.md` decides what each key then carries.
|
|
5
|
+
* Frozen: it is what `useModulesConfig` returns with no provider mounted.
|
|
6
|
+
*/
|
|
7
|
+
export declare const baseModulesConfig: ModulesConfig;
|
|
8
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/config/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAS/B,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ModulesConfig } from './types';
|
|
3
|
+
export interface ModulesConfigProviderProps {
|
|
4
|
+
value: ModulesConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Optional. Without it the package renders against `baseModulesConfig`. */
|
|
8
|
+
export declare function ModulesConfigProvider({ value, children }: ModulesConfigProviderProps): ReactNode;
|
|
9
|
+
/** The resolved config, falling back to `baseModulesConfig`. */
|
|
10
|
+
export declare function useModulesConfig(): ModulesConfig;
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/config/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI5C,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,0BAA0B,GAAG,SAAS,CAEhG;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export { baseModulesConfig } from './base';
|
|
2
|
+
export { ModulesConfigProvider, type ModulesConfigProviderProps, useModulesConfig, } from './context';
|
|
3
|
+
export { partialModulesConfig } from './partialModulesConfig';
|
|
1
4
|
export { mergeRegistry, visibleEntries, type Registry, type RegistryOverride, type VisibleEntry, } from './registry';
|
|
2
|
-
export {
|
|
5
|
+
export { resolveModulesConfig } from './resolve';
|
|
6
|
+
export { ModulesConfigSchema, registrySchema, RegistryEntrySchema, type RegistryEntry, } from './schemas';
|
|
7
|
+
export type { ModulesConfig, ModulesConfigOverride, ModulesFormatters, ModulesNavigation, } from './types';
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EACL,aAAa,EACb,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partialModulesConfig.d.ts","sourceRoot":"","sources":["../../src/config/partialModulesConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEnE,wDAAwD;AACxD,wBAAgB,oBAAoB,CAAC,QAAQ,GAAE,qBAA0B,GAAG,aAAa,CAExF"}
|
|
@@ -10,6 +10,9 @@ export type RegistryOverride<E extends RegistryEntry = RegistryEntry> = Record<s
|
|
|
10
10
|
export type VisibleEntry<E extends RegistryEntry = RegistryEntry> = E & {
|
|
11
11
|
key: string;
|
|
12
12
|
};
|
|
13
|
+
export declare const hasOwn: (target: object, key: string) => boolean;
|
|
14
|
+
/** Spread one object over another, skipping explicit `undefined` so a stated key cannot blank an inherited value. */
|
|
15
|
+
export declare function overlay<T extends object>(base: Partial<T>, over: Partial<T> | undefined): T;
|
|
13
16
|
/**
|
|
14
17
|
* Fold an override over a base registry, one entry at a time:
|
|
15
18
|
* `{ ...base[key], ...override[key] }`. A key the base has is an overlay; a key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/config/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE9C;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAEjF,6IAA6I;AAC7I,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAElG,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/config/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE9C;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAEjF,6IAA6I;AAC7I,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAElG,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvF,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,KAAG,OACF,CAAA;AAEnD,qHAAqH;AACrH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAI3F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,aAAa,EACnD,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,QAAQ,GAAE,gBAAgB,CAAC,CAAC,CAAM,GACjC,QAAQ,CAAC,CAAC,CAAC,CAYb;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GACpB,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAKhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModulesConfig, ModulesConfigOverride } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Fold an override over a base config, one key at a time, and validate the
|
|
4
|
+
* result.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveModulesConfig(base: ModulesConfig, override?: ModulesConfigOverride): ModulesConfig;
|
|
7
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEnE;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,GAAE,qBAA0B,GACnC,aAAa,CAwBf"}
|
package/dist/config/schemas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ModulesConfig } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* The shape every registry entry shares, schema first so the type is inferred
|
|
4
5
|
* from one list of fields — same inversion as `types/enums.ts`.
|
|
@@ -13,4 +14,5 @@ export declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
13
14
|
}>;
|
|
14
15
|
export type RegistryEntry = z.infer<typeof RegistryEntrySchema>;
|
|
15
16
|
export declare function registrySchema<E extends RegistryEntry>(entrySchema: z.ZodType<E>): z.ZodRecord<z.ZodString, z.ZodType<E>>;
|
|
17
|
+
export declare const ModulesConfigSchema: z.ZodType<ModulesConfig>;
|
|
16
18
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/config/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/config/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,SAAS,CAAA;IAClB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAA;IAClB,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;CACpC,CASC,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAExC;AAID,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CASvD,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Registry, RegistryOverride } from './registry';
|
|
2
|
+
/** Pure display functions over domain values. */
|
|
3
|
+
export interface ModulesFormatters {
|
|
4
|
+
}
|
|
5
|
+
/** Where a click on a module or an item goes. */
|
|
6
|
+
export interface ModulesNavigation {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Everything a host can customize. Not customizable means nothing to set.
|
|
10
|
+
*/
|
|
11
|
+
export interface ModulesConfig {
|
|
12
|
+
formatters: ModulesFormatters;
|
|
13
|
+
itemTypes: Registry;
|
|
14
|
+
itemStatuses: Registry;
|
|
15
|
+
itemMeta: Registry;
|
|
16
|
+
filters: Registry;
|
|
17
|
+
moduleActions: Registry;
|
|
18
|
+
itemActions: Registry;
|
|
19
|
+
navigation: ModulesNavigation;
|
|
20
|
+
}
|
|
21
|
+
/** A host writes only the surfaces it wants different from the base. */
|
|
22
|
+
export interface ModulesConfigOverride {
|
|
23
|
+
formatters?: Partial<ModulesFormatters>;
|
|
24
|
+
itemTypes?: RegistryOverride;
|
|
25
|
+
itemStatuses?: RegistryOverride;
|
|
26
|
+
itemMeta?: RegistryOverride;
|
|
27
|
+
filters?: RegistryOverride;
|
|
28
|
+
moduleActions?: RegistryOverride;
|
|
29
|
+
itemActions?: RegistryOverride;
|
|
30
|
+
navigation?: Partial<ModulesNavigation>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE5D,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;CAAG;AAErC,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;CAAG;AAErC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,EAAE,QAAQ,CAAA;IACtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,CAAA;IACjB,aAAa,EAAE,QAAQ,CAAA;IACvB,WAAW,EAAE,QAAQ,CAAA;IACrB,UAAU,EAAE,iBAAiB,CAAA;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACvC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,aAAa,CAAC,EAAE,gBAAgB,CAAA;IAChC,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACxC"}
|
|
@@ -21,7 +21,7 @@ export declare const FIXTURE_COURSE_ID = "1";
|
|
|
21
21
|
*
|
|
22
22
|
* - `student` — everything is published, and every module carries a `progress`
|
|
23
23
|
* with every item a `status`. A student's module list contains no unpublished
|
|
24
|
-
* content at all; that is exactly why
|
|
24
|
+
* content at all; that is exactly why normalization rule 2 reads a null
|
|
25
25
|
* `published` as `true` for a viewer without manage permission.
|
|
26
26
|
* - `teacher` — publish state varies, and nothing carries progress. Canvas
|
|
27
27
|
* resolves `progression` to null for a viewer with no progression record, so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/fixtures/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAQV,YAAY,EACb,MAAM,iBAAiB,CAAA;AA4DxB;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,YAAY,EAOtD,CAAA;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/fixtures/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAQV,YAAY,EACb,MAAM,iBAAiB,CAAA;AA4DxB;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,YAAY,EAOtD,CAAA;AA6BD,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,MAAM,CAAA;AA4PpC;;;GAGG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAA;AAE/C,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAgBD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,OAAO,GAAE,mBAAwB,GAChC,eAAe,CAiBjB"}
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { buildFixture, type BuildFixtureOptions, FIXTURE_COURSE_ID, type FixtureView, MODULE_STATUS_CYCLE, } from './generate';
|
|
2
|
-
export { courseEmpty, courseFatModule, courseLarge, courseSmall, FAT_MODULE_ITEM_COUNT, FAT_MODULE_SIBLING_ITEM_COUNT, LARGE_ITEMS_PER_MODULE, LARGE_MODULE_COUNT, SMALL_ITEMS_PER_MODULE, SMALL_MODULE_COUNT, } from './scenarios';
|
|
2
|
+
export { courseEmpty, courseFatModule, courseItemLinks, courseLarge, courseSmall, FAT_MODULE_ITEM_COUNT, FAT_MODULE_SIBLING_ITEM_COUNT, LARGE_ITEMS_PER_MODULE, LARGE_MODULE_COUNT, SMALL_ITEMS_PER_MODULE, SMALL_MODULE_COUNT, } from './scenarios';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,KAAK,WAAW,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,KAAK,WAAW,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAA"}
|
|
@@ -39,4 +39,9 @@ export declare function courseLarge(): InMemoryFixture;
|
|
|
39
39
|
export declare function courseFatModule(): InMemoryFixture;
|
|
40
40
|
/** No modules at all. The empty state exists before the designs specify it. */
|
|
41
41
|
export declare function courseEmpty(): InMemoryFixture;
|
|
42
|
+
/**
|
|
43
|
+
* The item-title edge cases, hand-authored: linked, new tab, sub-header, no url,
|
|
44
|
+
* a very long title, and locked.
|
|
45
|
+
*/
|
|
46
|
+
export declare function courseItemLinks(): InMemoryFixture;
|
|
42
47
|
//# sourceMappingURL=scenarios.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../src/fixtures/scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../src/fixtures/scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAO3D;;;;GAIG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAmC,CAAA;AACpE,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,MAAM,CAAA;AACxC,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAE9C;;;GAGG;AACH,wBAAgB,WAAW,IAAI,eAAe,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,eAAe,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,eAAe,CAMjD;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,IAAI,eAAe,CAE7C;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,eAAe,CA8CjD"}
|
|
@@ -22,7 +22,7 @@ export declare const DEFAULT_ITEM_CONCURRENCY: number;
|
|
|
22
22
|
* Why this is not zero.
|
|
23
23
|
*
|
|
24
24
|
* With `staleTime: 0` every re-enable of a query — which is what re-expanding a
|
|
25
|
-
* module is — counts as stale and refetches. That is the
|
|
25
|
+
* module is — counts as stale and refetches. That is the behavior this package
|
|
26
26
|
* exists to remove. Five minutes is long enough that expand/collapse within a
|
|
27
27
|
* sitting is free, short enough that coming back to the tab later is honest.
|
|
28
28
|
*/
|
|
@@ -15,7 +15,7 @@ import { ModuleItemsPage, ModulesPage } from '../types/domain';
|
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
17
17
|
* The page cursor. `null` is the first page — the adapter contract forbids
|
|
18
|
-
*
|
|
18
|
+
* synthesizing cursors, so this is only ever `null` or something a server said.
|
|
19
19
|
*/
|
|
20
20
|
export type ModulesCursor = string | null;
|
|
21
21
|
export type ModulesQueryOptions = InfiniteQueryObserverOptions<ModulesPage, Error, InfiniteData<ModulesPage, ModulesCursor>, ModulesListKey, ModulesCursor>;
|
|
@@ -48,7 +48,7 @@ export interface ModuleItemQueries {
|
|
|
48
48
|
export declare function useModuleItemQueries(
|
|
49
49
|
/** Modules whose items should be fetching right now. */
|
|
50
50
|
activeModuleIds: readonly string[],
|
|
51
|
-
/** Must be referentially stable —
|
|
51
|
+
/** Must be referentially stable — memoize it in the caller. */
|
|
52
52
|
buildOptions: (moduleId: string, enabled: boolean) => ModuleItemsQueryOptions,
|
|
53
53
|
/** @see DEFAULT_RETAIN_COLLAPSED_LIMIT */
|
|
54
54
|
retainCollapsedLimit?: number): ModuleItemQueries;
|
|
@@ -31,7 +31,7 @@ export interface UseModuleItemsResult {
|
|
|
31
31
|
* One module's items, paged explicitly, keyed per module.
|
|
32
32
|
*
|
|
33
33
|
* The query's `AbortSignal` is handed to the adapter (in `queryOptions.ts`), so
|
|
34
|
-
*
|
|
34
|
+
* canceling the query — which is what collapsing a module does — aborts the
|
|
35
35
|
* request rather than letting a response nobody wants land in the cache.
|
|
36
36
|
*
|
|
37
37
|
* `useModulesPageData` is the hook a page should use; this one is for a caller
|
|
@@ -42,7 +42,7 @@ export interface UseModulesResult {
|
|
|
42
42
|
*
|
|
43
43
|
* Deliberately *not* `useAllPages`: that helper walks every page on mount and
|
|
44
44
|
* again on every invalidation, which is the mechanism behind Canvas's
|
|
45
|
-
* "expand a module, refetch the course"
|
|
45
|
+
* "expand a module, refetch the course" behavior. Here one call is one page,
|
|
46
46
|
* and `hasNextPage` is surfaced so an unfetched remainder is visible to the
|
|
47
47
|
* caller instead of silently dropped.
|
|
48
48
|
*/
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,92 +1,62 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { default as en } from '../locales/en.json';
|
|
2
3
|
/**
|
|
3
4
|
* The i18n seam.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `TranslateFunction` as defined in `packages/provider/src/i18n.ts`.
|
|
6
|
+
* Named keys resolved against the shipped `locales/en.json`, with plural forms
|
|
7
|
+
* selected per locale. See `docs/adr/0003-i18n-named-keys.md` and
|
|
8
|
+
* `docs/adr/0004-i18n-plurals.md`.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Two properties later work depends on, so change them deliberately: a missing key
|
|
11
|
+
* renders English rather than blank or throwing, and an unknown key passes through
|
|
12
|
+
* as its own text, which is how a host-registered registry label reaches the screen
|
|
13
|
+
* (`docs/adr/0001-customization.md`).
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* The divergence is deliberate and argued in `docs/adr/modules-i18n.md`. In short:
|
|
18
|
-
* ADR 0011 marks itself provisional and lists "large interface: 100+ keys and
|
|
19
|
-
* growing" and "host must provide all keys; missing keys fail silently or throw"
|
|
20
|
-
* as its own known costs. Using the English source string as the key removes both
|
|
21
|
-
* — there is no key surface to keep in sync, and a missing translation degrades to
|
|
22
|
-
* readable English rather than to a blank or a throw.
|
|
23
|
-
*
|
|
24
|
-
* ## Keys are the English source string
|
|
25
|
-
*
|
|
26
|
-
* `t('Load more items (%{loaded} of %{total} loaded)', { loaded, total })`.
|
|
27
|
-
*
|
|
28
|
-
* The package therefore renders correctly with no provider at all — the default
|
|
29
|
-
* `t` interpolates the key itself — so Storybook, tests and a host mid-migration
|
|
30
|
-
* all work.
|
|
31
|
-
*
|
|
32
|
-
* One thing this does *not* buy, contrary to what this comment used to say:
|
|
33
|
-
* automatic extraction. Canvas's i18nliner cannot see a literal passed at runtime,
|
|
34
|
-
* which is exactly why `platformBridge.tsx` maintains a `LITERAL_THUNKS` list — and
|
|
35
|
-
* it already carries `'%{points} pts'`, the same literal `labels.ts` uses. A Canvas
|
|
36
|
-
* host adopting this package adds its literals there. That is a real cost of this
|
|
37
|
-
* shape and belongs on the record.
|
|
38
|
-
*
|
|
39
|
-
* ## Why the locale rides along
|
|
40
|
-
*
|
|
41
|
-
* `labels.ts` formats dates and numbers through `Intl`, which needs a locale.
|
|
42
|
-
* Translating the words while hard-pinning `en-US` would produce German text beside
|
|
43
|
-
* American dates, so the two travel together.
|
|
44
|
-
*
|
|
45
|
-
* `timezone` is deliberately absent, and not because the package cannot reach one:
|
|
46
|
-
* it is on provider context (`CanvasUiProvider.tsx:26-27,63-65`) and Canvas passes
|
|
47
|
-
* `ENV.TIMEZONE` through `platformBridge.tsx`. Consuming it means either depending
|
|
48
|
-
* on `usePlatformUi()`, which throws without a provider and would cost this package
|
|
49
|
-
* its render-anywhere property, or a host passing it in alongside `locale`. The
|
|
50
|
-
* latter is the right shape; the timezone-aware formatting behind it is not built,
|
|
51
|
-
* so the prop does not exist yet rather than existing unused.
|
|
15
|
+
* `timezone` is deliberately absent: reading it means depending on `usePlatformUi()`,
|
|
16
|
+
* which throws without a provider and would cost this package its render-anywhere
|
|
17
|
+
* property. A host passing it alongside `locale` is the right shape, and the
|
|
18
|
+
* formatting behind it is not built.
|
|
52
19
|
*/
|
|
20
|
+
export type ModulesTranslationKey = keyof typeof en;
|
|
21
|
+
/** CLDR plural categories, keyed as `Intl.PluralRules` selects them. */
|
|
22
|
+
export type PluralForms = Partial<Record<Intl.LDMLPluralRule, string>>;
|
|
53
23
|
/**
|
|
54
|
-
*
|
|
24
|
+
* A host may supply plural forms for any key, or collapse any key to one string.
|
|
55
25
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* straight through.
|
|
26
|
+
* Which keys `en.json` ships forms for is a judgment about English, so it does
|
|
27
|
+
* not constrain a translator whose language divides them differently.
|
|
59
28
|
*/
|
|
60
|
-
export type
|
|
29
|
+
export type ModulesTranslations = Record<ModulesTranslationKey, PluralForms | string>;
|
|
61
30
|
/**
|
|
62
|
-
*
|
|
31
|
+
* Translate a named key, interpolating `%{named}` placeholders.
|
|
63
32
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* data.
|
|
33
|
+
* The union accepts the arbitrary string a host-registered registry label
|
|
34
|
+
* resolves through, while keeping completion on our own keys.
|
|
67
35
|
*/
|
|
36
|
+
export type TranslateFunction = (key: ModulesTranslationKey | (string & {}), options?: Record<string, unknown>) => string;
|
|
37
|
+
export declare const DEFAULT_LOCALE = "en-US";
|
|
38
|
+
export declare function createTranslate(translations?: Partial<ModulesTranslations>, locale?: string): TranslateFunction;
|
|
39
|
+
/** Resolves from `locales/en.json` alone, in `en-US`. */
|
|
68
40
|
export declare const defaultTranslate: TranslateFunction;
|
|
69
41
|
export interface ModulesI18n {
|
|
70
42
|
t: TranslateFunction;
|
|
71
43
|
/** BCP 47 tag for `Intl` formatting. */
|
|
72
44
|
locale: string;
|
|
73
45
|
}
|
|
74
|
-
export declare const DEFAULT_LOCALE = "en-US";
|
|
75
46
|
export interface ModulesI18nProviderProps {
|
|
76
|
-
/**
|
|
77
|
-
|
|
47
|
+
/** Partial; anything omitted falls back to `locales/en.json`. Memoize it. */
|
|
48
|
+
translations?: Partial<ModulesTranslations>;
|
|
78
49
|
/** Omit for `en-US`. */
|
|
79
50
|
locale?: string;
|
|
80
51
|
children: ReactNode;
|
|
81
52
|
}
|
|
82
53
|
/**
|
|
83
|
-
* Supplies the host's
|
|
54
|
+
* Supplies the host's catalog and locale.
|
|
84
55
|
*
|
|
85
|
-
* Optional
|
|
86
|
-
*
|
|
87
|
-
* would make the seam harder to adopt than the hardcoded strings it replaces.
|
|
56
|
+
* Optional — without it the package renders English, which is what makes the seam
|
|
57
|
+
* adoptable incrementally.
|
|
88
58
|
*/
|
|
89
|
-
export declare function ModulesI18nProvider({
|
|
90
|
-
/** The translate function and locale, falling back to
|
|
59
|
+
export declare function ModulesI18nProvider({ translations, locale, children, }: ModulesI18nProviderProps): ReactNode;
|
|
60
|
+
/** The translate function and locale, falling back to English. */
|
|
91
61
|
export declare function useModulesI18n(): ModulesI18n;
|
|
92
62
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEnC;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,EAAE,CAAA;AAEnD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAErF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,GAAG,EAAE,qBAAqB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,MAAM,CAAA;AAMX,eAAO,MAAM,cAAc,UAAU,CAAA;AA8ErC,wBAAgB,eAAe,CAC7B,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAC3C,MAAM,GAAE,MAAuB,GAC9B,iBAAiB,CAEnB;AAED,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,EAAE,iBAAqC,CAAA;AAEpE,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,iBAAiB,CAAA;IACpB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAA;CACf;AAMD,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC3C,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,MAAM,EACN,QAAQ,GACT,EAAE,wBAAwB,GAAG,SAAS,CAMtC;AAED,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
* `useModulesPageData`. Everything else is exported for testing, for hosts
|
|
6
6
|
* that want finer control, or for the track that owns it.
|
|
7
7
|
*/
|
|
8
|
-
export type { CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemStatus, ModuleItemType, ModuleProgress, ModulesPage, ModuleStatus, PageInfo, } from './types';
|
|
8
|
+
export type { CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemNavigation, ModuleItemsPage, ModuleItemStatus, ModuleItemType, ModuleProgress, ModulesPage, ModuleStatus, PageInfo, } from './types';
|
|
9
9
|
export { CompletionRequirementSchema, CompletionRequirementTypeSchema, ModuleItemSchema, ModuleItemsPageSchema, ModuleItemStatusSchema, ModuleItemTypeSchema, ModuleProgressSchema, ModuleSchema, ModulesPageSchema, ModuleStatusSchema, PageInfoSchema, } from './types';
|
|
10
10
|
export { EXT_CAREER_ESTIMATED_DURATION_MINUTES, getEstimatedDurationMinutes, withEstimatedDurationMinutes, } from './types';
|
|
11
11
|
export type { ListModuleItemsArgs, ListModulesArgs, ModulesDataAdapter } from './adapters';
|
|
12
12
|
export { createInMemoryAdapter, InMemoryCourseMismatchError, INLINE_ITEM_LIMIT, type InMemoryAdapterOptions, type InMemoryFixture, type InMemoryRequest, } from './adapters';
|
|
13
13
|
export { type CanvasGraphqlAdapterOptions, createCanvasGraphqlAdapter, INLINE_QUERY_NODE_BUDGET, type ExecuteQuery, GET_MODULE_ITEMS, GET_MODULES, PartialCanvasResponseError, type PartialResponseSubject, type UnsupportedModuleItem, } from './adapters/canvasGraphql';
|
|
14
|
+
export { baseModulesConfig, mergeRegistry, type ModulesConfig, type ModulesConfigOverride, ModulesConfigProvider, type ModulesConfigProviderProps, ModulesConfigSchema, type ModulesFormatters, type ModulesNavigation, partialModulesConfig, type Registry, type RegistryEntry, RegistryEntrySchema, type RegistryOverride, registrySchema, resolveModulesConfig, useModulesConfig, type VisibleEntry, visibleEntries, } from './config';
|
|
14
15
|
export { DEFAULT_INLINE_THRESHOLD, DEFAULT_ITEM_CONCURRENCY, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_RETAIN_COLLAPSED_LIMIT, DEFAULT_STALE_TIME_MS, type InlineQueryShape, type ItemsMode, type ModuleItemsSource, type ModuleItemsState, type ResolvedItemsMode, useModuleItems, type UseModuleItemsOptions, type UseModuleItemsResult, useModules, type UseModulesOptions, useModulesPageData, type UseModulesPageDataOptions, type UseModulesPageDataResult, type UseModulesResult, } from './hooks';
|
|
15
16
|
export { invalidateCourse, invalidateModuleItems, invalidateModuleList, moduleItemsPrefix, type ModuleItemsKeyOptions, modulesKeys, modulesListPrefix, type ModulesListKeyOptions, type ModulesView, } from './cache';
|
|
16
|
-
export { filterLabel, FilterChips, type FilterChipsProps, ModuleCard, type ModuleCardProps, ModuleItemRow, type ModuleItemRowProps, moduleItemStatusLabel, ModuleItemStatusPill, type ModuleItemStatusPillProps, MODULES_FILTER_IDS, type ModulesFilterId, ModulesList, type ModulesListProps, type ModulesRequestCounts, moduleStatusLabel, ModuleStatusPill, type ModuleStatusPillProps, } from './components';
|
|
17
|
-
export { DEFAULT_LOCALE, defaultTranslate, type ModulesI18n, ModulesI18nProvider, type ModulesI18nProviderProps, type TranslateFunction, useModulesI18n, } from './i18n';
|
|
18
|
-
export { buildFixture, type BuildFixtureOptions, courseEmpty, courseFatModule, courseLarge, courseSmall, FIXTURE_COURSE_ID, type FixtureView, } from './fixtures';
|
|
17
|
+
export { filterLabel, FilterChips, type FilterChipsProps, ModuleCard, type ModuleCardProps, ModuleItemRow, type ModuleItemRowProps, moduleItemStatusLabel, ModuleItemStatusPill, type ModuleItemStatusPillProps, ModuleNumberBadge, type ModuleNumberBadgeProps, MODULES_FILTER_IDS, type ModulesFilterId, ModulesList, type ModulesListProps, type ModulesRequestCounts, moduleStatusLabel, ModuleStatusPill, type ModuleStatusPillProps, } from './components';
|
|
18
|
+
export { createTranslate, DEFAULT_LOCALE, defaultTranslate, type ModulesI18n, ModulesI18nProvider, type ModulesI18nProviderProps, type ModulesTranslationKey, type ModulesTranslations, type PluralForms, type TranslateFunction, useModulesI18n, } from './i18n';
|
|
19
|
+
export { buildFixture, type BuildFixtureOptions, courseEmpty, courseFatModule, courseItemLinks, courseLarge, courseSmall, FIXTURE_COURSE_ID, type FixtureView, } from './fixtures';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,SAAS,CAAA;AAOhB,OAAO,EACL,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,SAAS,CAAA;AAIhB,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC1F,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,2BAA2B,EAChC,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,YAAY,EACjB,gBAAgB,EAChB,WAAW,EACX,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,YAAY,EACV,qBAAqB,EACrB,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