Skip to content

Commit

Permalink
export text, update node resolution to 16 and fix object.keys for siz…
Browse files Browse the repository at this point in the history
…e to object.values
  • Loading branch information
chrisdholt committed Jan 11, 2023
1 parent 935ce00 commit 7fc847c
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 12 deletions.
81 changes: 79 additions & 2 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,85 @@
```ts

// @public (undocumented)
export const empty = "";
import { ElementStyles } from '@microsoft/fast-element';
import { ElementViewTemplate } from '@microsoft/fast-element';
import { FASTElement } from '@microsoft/fast-element';
import { FASTElementDefinition } from '@microsoft/fast-element';

// @public
class Text_2 extends FASTElement {
align: TextAlign;
block: boolean;
font: TextFont;
italic: boolean;
nowrap: boolean;
size: TextSize;
strikethrough: boolean;
truncate: boolean;
underline: boolean;
weight: TextWeight;
}
export { Text_2 as Text }

// @public
export const TextAlign: {
readonly start: "start";
readonly end: "end";
readonly center: "center";
readonly justify: "justify";
};

// @public
export type TextAlign = typeof TextAlign[keyof typeof TextAlign];

// @public
export const TextDefinition: FASTElementDefinition<typeof Text_2>;

// @public
export const TextFont: {
readonly base: "base";
readonly numeric: "numeric";
readonly monospace: "monospace";
};

// @public
export type TextFont = typeof TextFont[keyof typeof TextFont];

// @public
export const TextSize: {
readonly _100: "100";
readonly _200: "200";
readonly _300: "300";
readonly _400: "400";
readonly _500: "500";
readonly _600: "600";
readonly _700: "700";
readonly _800: "800";
readonly _900: "900";
readonly _1000: "1000";
};

// @public
export type TextSize = typeof TextSize[keyof typeof TextSize];

// @public
export const TextStyles: ElementStyles;

// Warning: (ae-internal-missing-underscore) The name "TextTemplate" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export const TextTemplate: ElementViewTemplate<Text_2>;

// @public
export const TextWeight: {
readonly medium: "medium";
readonly regular: "regular";
readonly semibold: "semibold";
readonly bold: "bold";
};

// @public
export type TextWeight = typeof TextWeight[keyof typeof TextWeight];

// (No @packageDocumentation comment for this package)

Expand Down
10 changes: 10 additions & 0 deletions packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
"main": "dist/esm/index.js",
"types": "dist/web-components.d.ts",
"unpkg": "dist/web-components.min.js",
"exports": {
".": {
"types": "./dist/dts/index.d.ts",
"default": "./dist/esm/index.js"
},
"./text": {
"types": "./dist/esm/text/define.d.ts",
"default": "./dist/esm/text/define.js"
}
},
"scripts": {
"tsc": "tsc",
"api-extractor": "api-extractor",
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/index-rollup.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './index';
export * from './index.js';
2 changes: 1 addition & 1 deletion packages/web-components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const empty = '';
export * from './text/index.js';
4 changes: 2 additions & 2 deletions packages/web-components/src/text/text.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Args, Meta } from '@storybook/html';
import { renderComponent } from '../__test__/helpers.js';
import type { Text as FluentText } from './text.js';
import './define.js';
import { TextAlign, TextFont, TextSize, TextWeight } from './text.options';
import { TextAlign, TextFont, TextSize, TextWeight } from './text.options.js';

type TextStoryArgs = Args & FluentText;
type TextStoryMeta = Meta<TextStoryArgs>;
Expand Down Expand Up @@ -73,7 +73,7 @@ export default {
},
},
size: {
options: Object.keys(TextSize),
options: Object.values(TextSize),
control: {
type: 'select',
},
Expand Down
3 changes: 3 additions & 0 deletions packages/web-components/src/text/text.template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { ElementViewTemplate, html } from '@microsoft/fast-element';
import type { Text } from './text.js';

/**
* @internal
*/
export const template: ElementViewTemplate<Text> = html<Text>`<slot></slot>`;
3 changes: 2 additions & 1 deletion packages/web-components/src/text/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { attr, FASTElement } from '@microsoft/fast-element';
import type { TextAlign, TextFont, TextSize, TextWeight } from './text.options.js';

/**
* @internal
* The base class used for constructing a fluent-text custom element
* @public
*/
export class Text extends FASTElement {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './design-tokens';
export { setTheme } from './set-theme';
export * from './design-tokens.js';
export { setTheme } from './set-theme.js';
2 changes: 1 addition & 1 deletion packages/web-components/src/theme/set-theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Theme } from '@fluentui/tokens';
import * as tokens from './design-tokens';
import * as tokens from './design-tokens.js';

const tokenNames = Object.keys(tokens);

Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/theme/theme.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DesignToken } from '@microsoft/fast-foundation';
import * as tokens from '../theme/design-tokens';
import * as tokens from '../theme/design-tokens.js';

DesignToken.registerDefaultStyleTarget();

Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "Node16",
"declarationDir": "dist/dts",
"outDir": "dist/esm",
"strictNullChecks": true,
Expand Down

0 comments on commit 7fc847c

Please sign in to comment.