Skip to content

Commit

Permalink
chore: updating other files
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Dec 4, 2024
1 parent e8dd3a2 commit 51d1b87
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @benken @thelukewalton @mikecoomber
* @ZebraDevs/front-end-devs
57 changes: 40 additions & 17 deletions .storybook/extractArgs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Adapted from cem-plugin-better-lit-types: https://github.com/Uscreen-video/cem-plugin-better-lit-types.
*
* See LICENSE_3RD_PARTY file for license information.
*
* See LICENSE_3RD_PARTY for license information.
*/

import { reduceTypes } from "cem-plugin-better-lit-types/storybook";
Expand All @@ -23,7 +23,10 @@ export default (manifest, mapArgs?) => (componentName) => {
Object.assign(
Object.assign(
Object.assign(
Object.assign({}, reduceTypes(declaration.attributes, FIELD.attributes, mapArgs)),
Object.assign(
{},
reduceTypes(declaration.attributes, FIELD.attributes, mapArgs)
),
reduceTypes(declaration.members, FIELD.properties, mapArgs)
),
reduceTypes(declaration.slots, FIELD.slots, mapArgs)
Expand All @@ -43,25 +46,39 @@ export default (manifest, mapArgs?) => (componentName) => {
) {
const name = f!["name"] === "default" ? "" : f!["name"];
if (declaration["slots"].some((e) => e["name"] === name)) {
const decValue = declaration["slots"].find((e) => e["name"] === name);
const decValue = declaration["slots"].find(
(e) => e["name"] === name
);

if (decValue["type"]) f!["type"] = decValue["type"];
}
}

/** Move value of `type.text` to `type`. */
if (f!["type"] && f!["type"]["text"] && !f!["type"]["text"].includes("boolean")) {
if (
f!["type"] &&
f!["type"]["text"] &&
!f!["type"]["text"].includes("boolean")
) {
f!["type"] = f!["type"]["text"];
}

/** Set values for boolean */
if (f!["type"] && f!["type"]["text"] && f!["type"]["text"].includes("boolean")) {
if (
f!["type"] &&
f!["type"]["text"] &&
f!["type"]["text"].includes("boolean")
) {
f!["type"] = "boolean";
f!["control"] = { type: "boolean" };
}

/** Set controls for plain strings. */
if (f!["type"] && typeof f!["type"] === "string" && f!["type"].includes("string")) {
if (
f!["type"] &&
typeof f!["type"] === "string" &&
f!["type"].includes("string")
) {
f!["control"] = { type: "text" };
}

Expand Down Expand Up @@ -113,6 +130,7 @@ const getEvents = (declaration, args) => {
return args;
};


/**
* Gets the declaration for a component based on its manifest and tagName.
* @param {object} manifest - The component's manifest.
Expand All @@ -125,18 +143,23 @@ export const getDeclaration = (manifest, tagName, type = "") => {
let _declaration;
const finder = type === "mixin" ? "name" : "tagName";

(_a = manifest === null || manifest === void 0 ? void 0 : manifest.modules) === null || _a === void 0
(_a =
manifest === null || manifest === void 0 ? void 0 : manifest.modules) ===
null || _a === void 0
? void 0
: _a.forEach((_module) => {
var _a;
(_a = _module === null || _module === void 0 ? void 0 : _module.declarations) === null || _a === void 0
var _a;
(_a =
_module === null || _module === void 0
? void 0
: _a.forEach((declaration) => {
if (declaration[finder] === tagName) {
_declaration = declaration;
}
});
});
: _module.declarations) === null || _a === void 0
? void 0
: _a.forEach((declaration) => {
if (declaration[finder] === tagName) {
_declaration = declaration;
}
});
});

return _declaration;
};
};
57 changes: 57 additions & 0 deletions CODE_OF_CONDUCT
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.
The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant,
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
7 changes: 4 additions & 3 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Before a PR can be reviewed, ensure you have done the following, and fixed any i
- Check formatting: `npm run lint`
- Run unit-tests: `npm run test`

Once a PR is opened, review is required by the Codeowners. It is also required that all status checks pass before a PR can be merged.

## Documentation

Expand All @@ -33,12 +34,12 @@ All parameters, attributes and slots should be documented with brief description

Once code is written, all components should have a story written in Storybook. Single components can use autodocs to create their documentation, but for complex components we may need to create the markdown. We must run `npm run analyze` before writing stories, as this updates [custom-elements.json](./custom-elements.json) which storybook uses.

To create a story, first create a directory under `src/stories` for the component.
To create a story, first create a directory under `src/stories` for the component.

In storybook, always add the `title` parameter as this is used in documentation.

For single components, we should add `tags:['autodocs']` to storybook to generate the documentation.

For complex components, we should create a folder within `src/stories` for this component. In this directory, we create all stories needed and add the same `title` to all.
Then create a `Docs.mdx` file in this folder, alongside all the stories.
Within this we need to import the stories, and the blocks from storybook - see [Badges](./src/stories/Badges/Docs.mdx) for an example. We can then display the canvas, description and ArgTypes for all the components.
Then create a `Docs.mdx` file in this folder, alongside all the stories.
Within this we need to import the stories, and the blocks from storybook - see [Badges](./src/stories/Badges/Docs.mdx) for an example. We can then display the canvas, description and ArgTypes for all the components.
6 changes: 3 additions & 3 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ metadata:
title: Storybook
- url: https://design-zebra.web.app/web/tsdoc/
title: TSDoc
# - url: https://npmjs.com/package/@zebra/zeta-web
# title: npm
- url: https://npmjs.com/package/@zebra-fed/zeta-web
title: npm
tags:
- typescript
- web-components
annotations:
github.com/project-slug: zebratechnologies/zeta-web
github.com/project-slug: ZebraDevs/zeta-web
github.com/team-slug: zebratechnologies/front-end-development
# backstage.io/techdocs-ref: dir:.
spec:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"files": [
"dist",
"custom-elements.json",
"assets"
"assets",
"LICENSE-3RD-PARTY"
],
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down

0 comments on commit 51d1b87

Please sign in to comment.