Skip to content

Commit

Permalink
clean up names
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasrice committed Nov 18, 2020
1 parent c272656 commit bd5d036
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 108 deletions.
149 changes: 74 additions & 75 deletions packages/web-components/fast-foundation/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export interface Configuration {
readonly prefix: string;
// (undocumented)
register(...registrations: ConfigurationRegistry[]): Configuration;
// Warning: (ae-forgotten-export) The symbol "DesignTokenRegistration" needs to be exported by the entry point index.d.ts
registerDesignToken<T>(registration: DesignTokenRegistration<T>): Configuration;
// Warning: (ae-forgotten-export) The symbol "DesignTokenDefinition" needs to be exported by the entry point index.d.ts
registerDesignToken<T>(registration: DesignTokenDefinition<T>): Configuration;
registerElement(type: typeof FASTElement, definition: PartialFASTElementDefinition): Configuration;
setDefaultStylesFor(baseName: string, styles: ElementStyles | null): Configuration;
setDefaultTemplateFor(baseName: string, template: ElementViewTemplate | null): Configuration;
Expand All @@ -244,7 +244,7 @@ export class ConfigurationImpl implements Configuration {
readonly prefix: string;
// (undocumented)
register(...registrations: ConfigurationRegistry[]): this;
registerDesignToken<T>(registration: DesignTokenRegistration<T>): this;
registerDesignToken<T>(registration: DesignTokenDefinition<T>): this;
registerElement(type: typeof FASTElement, definition: PartialFASTElementDefinition): this;
setDefaultStylesFor(name: string, styles: ElementStyles | null): this;
setDefaultTemplateFor(name: string, template: ElementViewTemplate | null): this;
Expand Down Expand Up @@ -365,6 +365,22 @@ export interface CustomPropertyManagerClient extends FASTElement, HTMLElement {
evaluate(definition: CSSCustomPropertyDefinition): string;
}

// @public (undocumented)
export class CustomPropertyManagerImpl {
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "alias"
//
// (undocumented)
alias(key: string, name: string): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "get"
//
// (undocumented)
get(key: string, value: any): ElementStyles;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "name"
//
// (undocumented)
name(key: string): string;
}

// @public
export interface DecoratorDesignSystemPropertyConfiguration extends Omit<DecoratorAttributeConfiguration, "attribute"> {
attribute?: string | false;
Expand Down Expand Up @@ -448,14 +464,65 @@ export const designSystemProvider: typeof defineDesignSystemProvider;
// @public
export const DesignSystemProviderTemplate: import("@microsoft/fast-element").ViewTemplate<DesignSystemProvider, any>;

// Warning: (ae-forgotten-export) The symbol "InheritableDesignTokenLibrary" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class DesignTokenLibraryImpl<T> implements InheritableDesignTokenLibrary<T> {
#constructor(init?: T);
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
delete<K extends keyof T>(key: K): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
get<K extends keyof T>(key: K): T[K] | void;
// Warning: (ae-forgotten-export) The symbol "DesignTokenLibrary" needs to be exported by the entry point index.d.ts
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
handleChange<K extends keyof T>(source: DesignTokenLibrary<T>, keys: Array<K>): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
has<K extends keyof T>(key: K): boolean;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
hasLocal<K extends keyof T>(key: K): boolean;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
keys<K extends keyof T>(): K[];
// (undocumented)
private;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
set<K extends keyof T>(key: K, value: T[K]): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
subscribe(subscriber: Subscriber): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
unsubscribe(subscriber: Subscriber): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
get upstream(): InheritableDesignTokenLibrary<T> | null;
set upstream(target: InheritableDesignTokenLibrary<T> | null);
}

// @public (undocumented)
export const DesignTokenProvider: <TBase extends Constructable<FASTElement & HTMLElement>>(Base: TBase) => {
new (...args: any[]): {
designTokens: FASTDesignTokenLibrary<any>;
customPropertyManager: FASTCustomPropertyManager;
designTokens: DesignTokenLibraryImpl<any>;
customPropertyManager: CustomPropertyManagerImpl;
localSheets: Map<string, ElementStyles>;
connectedCallback(): void;
handleChange(source: FASTDesignTokenLibrary<any>, keys: Array<any>): void;
handleChange(source: DesignTokenLibraryImpl<any>, keys: Array<any>): void;
readonly $fastController: import("@microsoft/fast-element").Controller;
$emit(type: string, detail?: any, options?: Pick<CustomEventInit<any>, "bubbles" | "cancelable" | "composed"> | undefined): boolean | void;
disconnectedCallback(): void;
Expand Down Expand Up @@ -721,7 +788,7 @@ export const DesignTokenProvider: <TBase extends Constructable<FASTElement & HTM
} & TBase;

// @public (undocumented)
export const DesignTokens: InterfaceSymbol<FASTDesignTokenLibrary<any>>;
export const DesignTokens: InterfaceSymbol<DesignTokenLibraryImpl<any>>;

// @public (undocumented)
export const DI: Readonly<{
Expand Down Expand Up @@ -820,74 +887,6 @@ export class FactoryImpl<T extends Constructable = any> implements Factory<T> {
Type: T;
}

// @public (undocumented)
export class FASTCustomPropertyManager {
constructor(selector?: "host" | "root");
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "alias"
//
// (undocumented)
alias(key: string, name: string): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "get"
//
// (undocumented)
get(key: string, value: any): ElementStyles;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: No member was found with name "name"
//
// (undocumented)
name(key: string): string;
}

// Warning: (ae-forgotten-export) The symbol "InheritableDesignTokenLibrary" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class FASTDesignTokenLibrary<T> implements InheritableDesignTokenLibrary<T> {
#constructor(init?: T);
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
delete<K extends keyof T>(key: K): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
get<K extends keyof T>(key: K): T[K] | void;
// Warning: (ae-forgotten-export) The symbol "DesignTokenLibrary" needs to be exported by the entry point index.d.ts
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
handleChange<K extends keyof T>(source: DesignTokenLibrary<T>, keys: Array<K>): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
has<K extends keyof T>(key: K): boolean;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
hasLocal<K extends keyof T>(key: K): boolean;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
keys<K extends keyof T>(): K[];
// (undocumented)
private;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
set<K extends keyof T>(key: K, value: T[K]): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
subscribe(subscriber: Subscriber): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "DesignTokenLibrary"
//
// (undocumented)
unsubscribe(subscriber: Subscriber): void;
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "@microsoft/fast-foundation" does not have an export "InheritableDesignTokenLibrary"
//
// (undocumented)
get upstream(): InheritableDesignTokenLibrary<T> | null;
set upstream(target: InheritableDesignTokenLibrary<T> | null);
}

// @public
export class Flipper extends FASTElement {
direction: FlipperDirection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
CSSCustomPropertyManager,
CustomPropertyManagerImpl,
} from "../css-custom-property-manager";
import { DesignTokens, DesignTokenLibraryImpl } from "../design-tokens";
import { DesignTokenRegistration } from "../design-tokens/configuration";
import { DesignTokenLibraryImpl, DesignTokens } from "../design-tokens";
import { DesignTokenDefinition } from "../design-tokens/configuration";
import { DI, InterfaceSymbol, Key, Registration } from "../di";
import { supportsAdoptedStylesheets } from "../feature-detection";

Expand Down Expand Up @@ -95,7 +95,7 @@ export interface Configuration {
* Register a design token for the applicaiton.
* @param registration The token registration
*/
registerDesignToken<T>(registration: DesignTokenRegistration<T>): Configuration;
registerDesignToken<T>(registration: DesignTokenDefinition<T>): Configuration;

/**
*
Expand Down Expand Up @@ -231,7 +231,7 @@ export class ConfigurationImpl implements Configuration {
}

/** {@inheritdoc Configuration.registerDesignToken} */
public registerDesignToken<T>(registration: DesignTokenRegistration<T>) {
public registerDesignToken<T>(registration: DesignTokenDefinition<T>) {
const { key, value, customProperty } = registration;
this.designTokenRegistry.set(key, registration);

Expand Down Expand Up @@ -277,7 +277,7 @@ export class ConfigurationImpl implements Configuration {
private templateRegistry = new Map<string, ElementViewTemplate | null>();
private stylesRegistry = new Map<string, ElementStyles | null>();
private elementRegistry = new Map<typeof FASTElement, PartialFASTElementDefinition>();
private designTokenRegistry = new Map<string, DesignTokenRegistration<any>>();
private designTokenRegistry = new Map<string, DesignTokenDefinition<any>>();
}

export const ConfigurationInterface: InterfaceSymbol<Key, any> = DI.createInterface(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface DesignTokenRegistration<T> {
export interface DesignTokenDefinition<T> {
/**
* The key for which the token can be accessed.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, expect } from "chai";
import { FASTDesignTokenLibrary } from "./library";
import { DesignTokenLibraryImpl } from "./library";

interface DS {
color: string;
Expand All @@ -9,12 +9,12 @@ interface DS {
describe("FASTDesignTokens", () => {
describe("should initialize", () => {
it("without any properties are no object is provided to the constructor", () => {
const ds = new FASTDesignTokenLibrary();
const ds = new DesignTokenLibraryImpl();

assert(ds.keys().length === 0);
});
it("with any provided properties set to the provided value", () => {
const ds = new FASTDesignTokenLibrary<DS>({
const ds = new DesignTokenLibraryImpl<DS>({
color: "red",
size: 2,
});
Expand All @@ -26,49 +26,49 @@ describe("FASTDesignTokens", () => {
});
describe("should get a property value", () => {
it("that has been set on the implementation", () => {
const ds = new FASTDesignTokenLibrary<DS>();
const ds = new DesignTokenLibraryImpl<DS>();
ds.set("color", "red");

assert(ds.get("color") === "red");
});

it("that is undefined if the value has not been set", () => {
const ds = new FASTDesignTokenLibrary<DS>();
const ds = new DesignTokenLibraryImpl<DS>();

assert(ds.get("color") === undefined);
});

it("that has been set on the upstream when no local implementation is set", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
upstream.set("color", "red");
const downstream = new FASTDesignTokenLibrary<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
downstream.upstream = upstream;

assert(downstream.get("color") === "red");
});

it("from the downstream if it has been set on both the upstream and the downstream", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
upstream.set("color", "red");
const downstream = new FASTDesignTokenLibrary<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
downstream.upstream = upstream;
downstream.set("color", "blue");

assert(downstream.get("color") === "blue");
});

it("from itself when defined both on itself and the downstream", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
upstream.set("color", "red");
const downstream = new FASTDesignTokenLibrary<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
downstream.upstream = upstream;
downstream.set("color", "blue");

assert(upstream.get("color") === "red");
});

it("that is undefined if the property is set and then deleted", () => {
const ds = new FASTDesignTokenLibrary<DS>();
const ds = new DesignTokenLibraryImpl<DS>();
ds.set("color", "red");
ds.delete("color");

Expand All @@ -77,8 +77,8 @@ describe("FASTDesignTokens", () => {
});

it("should not get notified when attaching to an upstream when no properties on the upstream are set", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
let called = false;

downstream.handleChange = (source, keys) => {
Expand All @@ -91,8 +91,8 @@ describe("FASTDesignTokens", () => {
});

it("should get notified with all set properties of the upstream implementation when attaching", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
let called = false,
source = {},
args = [] as any;
Expand All @@ -114,8 +114,8 @@ describe("FASTDesignTokens", () => {
});

it("should get notified of an upstream property change", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
let called = false,
source = {},
args = [] as any;
Expand All @@ -138,8 +138,8 @@ describe("FASTDesignTokens", () => {
});

it("should notify the downstream of property changes after detachment", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
let called = false,
source = {},
args = [] as any;
Expand All @@ -164,8 +164,8 @@ describe("FASTDesignTokens", () => {

describe("should not notify", () => {
it("if a delete doesn't result in a change", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
upstream.set("color", "red");
downstream.set("color", "red");
let calls = 0;
Expand All @@ -187,8 +187,8 @@ describe("FASTDesignTokens", () => {
});

it("if setting a property doesn't result in a change", () => {
const upstream = new FASTDesignTokenLibrary<DS>();
const downstream = new FASTDesignTokenLibrary<DS>();
const upstream = new DesignTokenLibraryImpl<DS>();
const downstream = new DesignTokenLibraryImpl<DS>();
let calls = 0;
const subscriber = {
handleChange: (source, keys) => {
Expand Down
Loading

0 comments on commit bd5d036

Please sign in to comment.