Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline Fall/Winter Update!! #426

Merged
merged 52 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4887050
feat: outline-core-button WIP
Aug 1, 2023
dd335e0
Merge branch 'next' of https://github.com/phase2/outline into issue/o…
shaal Aug 8, 2023
7ea6f10
fix: update styles for slotted button
shaal Aug 8, 2023
4a5f2b1
fix: remove tailwind resets
shaal Aug 8, 2023
e105065
Merge branch 'next' of https://github.com/phase2/outline into issue/o…
shaal Aug 8, 2023
dc8a71c
fix: linting
shaal Aug 8, 2023
c4f91e5
fix: linting
shaal Aug 8, 2023
eba5c8f
fix: adding full button markup in defaultSlot
shaal Aug 8, 2023
1825e37
fix: fixed styling for all button variants, removed link variants
Aug 22, 2023
ea16ab4
Merge branch 'next' of https://github.com/phase2/outline into issue/o…
Sep 12, 2023
7e1737f
fix: core button changes
Oct 3, 2023
3943a09
fix(outline-core-link): Updating to utilize @phase2/outline-adopted-s…
himerus Oct 16, 2023
ee19425
chore(changeset): Adding changeset for outline-core-link updates.
himerus Oct 16, 2023
c89b042
fix(outline-core-link): Update format.
himerus Oct 16, 2023
7f45e72
Merge branch 'next' into feature/outline-core-link-updates
himerus Oct 16, 2023
23412d4
fix(base): Removing extraneous sample component.
himerus Oct 16, 2023
cd398b3
fix(outline-core-link): Removing duplicate invocation of controller.
himerus Oct 16, 2023
b738317
fix(base): Working on updates to build.
himerus Oct 16, 2023
467e80e
feat(base): Adding Astro package for testing new documentation for Ou…
himerus Oct 17, 2023
d7270c9
fix(base): Fix for namespace of new documentation package.
himerus Oct 17, 2023
da6e747
fix(base): Removing Astro/docs folder for now to reduce complexity.
himerus Oct 20, 2023
51d90f0
Merge branch 'next' into feature/outline-octoberfest-updates
himerus Oct 20, 2023
8404ab1
feat(docs): Updating `outline-core-alert` and all mdx docs.
himerus Oct 23, 2023
d33e664
fix: extended button
glitchgirl Oct 24, 2023
97ac001
fix(baseline): Removing and ignoring new defaults.
himerus Oct 25, 2023
413e1c2
fix(outline-core-link): Cleanup.
himerus Oct 25, 2023
b880f15
fix(outline-core-alert): Basic updates and cleanup.
himerus Oct 25, 2023
fe13acc
fix(baseline): Simplification of default configuration.
himerus Oct 25, 2023
f23f892
fix(baseline): Reorganization of documents. Fix for postcss.
himerus Nov 7, 2023
80da0ef
fix(baseline): Reorganization of documents. Updates to alert.
himerus Nov 7, 2023
640c139
fix(baseline): Doc updates.
himerus Nov 7, 2023
3c0c904
fix(baseline): AI updates.
himerus Nov 7, 2023
b3ad22e
fix(baseline): Doc updates.
himerus Nov 7, 2023
a9638ee
fix(baseline): Update Storybook.
himerus Nov 8, 2023
0176860
fix(baseline): Reorganization of documents.
himerus Nov 8, 2023
e6af1a3
fix(baseline): Update story for AI suggestion.
himerus Nov 8, 2023
e5fa0e5
fix(baseline): Simple updates.
himerus Dec 5, 2023
da9f578
feat(outline-core-button): Tweaks for release prep.
himerus Dec 5, 2023
a30f3b6
Merge branch 'next' into issue/outline-core-button
himerus Dec 5, 2023
ba20a64
feat(outline-core-button): Tweaks for release prep.
himerus Dec 5, 2023
5777a40
feat(outline-core-button): Tweaks for release prep.
himerus Dec 5, 2023
d8358c3
feat(outline-core-button): Release 0.0.1.
himerus Dec 5, 2023
cdebe41
fix(baseline): Removing package-lock.json.
himerus Dec 5, 2023
e6a12ad
feat(outline-core-button): Tweaks for release prep.
himerus Dec 5, 2023
56a7da6
feat(outline-core-button): Tweaks for release prep.
himerus Dec 5, 2023
f13e5b9
feat(outline-core-button): Tweaks for release prep.
himerus Jan 18, 2024
75942f6
Merge branch 'next' into feature/outline-core-link-updates
glitchgirl Feb 6, 2024
c88172d
Merge branch 'next' into feature/outline-core-link-updates
himerus Feb 6, 2024
105ceb3
chore(tooling): Updated yarn.lock.
himerus Feb 6, 2024
50dce11
feat(tooling): Update yarn config.
himerus Feb 15, 2024
d1db38f
feat(tooling): Update Storybook.
himerus Feb 15, 2024
3ce056d
chore(changeset): Adding Changeset.
himerus Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"postcss-discard-comments": "5.1.0",
"postcss-import": "14.0.2",
"postcss-loader": "^7.0.1",
"postcss-nested-import": "^1.3.0",
"postcss-preset-env": "^7.8.1",
"prettier": "^2.0.4",
"prettier-plugin-tailwindcss": "^0.1.7",
Expand Down

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions packages/components/outline-core-contained-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { OutlineElement } from '@phase2/outline-core';
import { customElement, property } from 'lit/decorators.js';

@customElement('outline-core-contained-element')
export class OutlineCoreContainedElement extends OutlineElement {
@property({ type: String, reflect: true })
padding: string;
@property({ type: String, reflect: true, attribute: 'padding-bottom' })
paddingBottom: string;
@property({ type: String, reflect: true, attribute: 'padding-top' })
paddingTop: string;
@property({ type: String, attribute: 'padding-left' })
paddingLeft: string;
@property({ type: String, reflect: true, attribute: 'padding-right' })
paddingRight: string;
@property({ type: String, reflect: true, attribute: 'padding-inline' })
paddingInline: string;
@property({ type: String, reflect: true, attribute: 'padding-block' })
paddingBlock: string;

@property({ type: String, reflect: true })
margin: string;
@property({ type: String, reflect: true, attribute: 'margin-bottom' })
marginBottom: string;
@property({ type: String, reflect: true, attribute: 'margin-top' })
marginTop: string;
@property({ type: String, reflect: true, attribute: 'margin-left' })
marginLeft: string;
@property({ type: String, reflect: true, attribute: 'margin-right' })
marginRight: string;
@property({ type: String, reflect: true, attribute: 'margin-inline' })
marginInline: string;
@property({ type: String, reflect: true, attribute: 'margin-block' })
marginBlock: string;

updated(changedProperties: Map<string | number | symbol, unknown>): void {
changedProperties.forEach((_, propName) => {
if (
typeof propName === 'string' &&
(propName.startsWith('padding') || propName.startsWith('margin'))
) {
const value = this[propName as keyof this] as string;

if (value && this.isValidCSSValue(value)) {
// Set the style property directly
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.style as any)[propName] = value;
} else {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.style as any)[propName] = null;
}
}
});
}
himerus marked this conversation as resolved.
Show resolved Hide resolved

private isValidCSSValue(value: string): boolean {
if (value === '' || value === null || value === undefined) return false;
const cssUnits = [
'em',
'rem',
'%',
'px',
'vh',
'vw',
'vmin',
'vmax',
'ex',
'ch',
'cm',
'mm',
'in',
'pt',
'pc',
];
const values = value.split(' ').filter(v => v.trim() !== ''); // split by space and filter out any empty strings
if (values.length > 4) return false;

return values.every(
v => cssUnits.some(unit => v.endsWith(unit)) || !isNaN(Number(v))
);
}
himerus marked this conversation as resolved.
Show resolved Hide resolved
}

declare global {
interface HTMLElementTagNameMap {
'outline-core-contained-element': OutlineCoreContainedElement;
}
}
Empty file.
2 changes: 1 addition & 1 deletion packages/components/outline-core-link/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { OutlineCoreLink } from './src/outline-core-link';
export { default as linkVars } from './src/css-variables/vars-link.css.lit';
export { default as linkVars } from './src/style/outline-core-link.vars.css.lit';
export type { LinkTargetType, LinkRelType } from './src/config';
3 changes: 3 additions & 0 deletions packages/components/outline-core-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
},
"exports": {
".": "./index.ts"
},
"devDependencies": {
"postcss-nested-import": "^1.3.0"
}
}

This file was deleted.

35 changes: 0 additions & 35 deletions packages/components/outline-core-link/src/outline-core-link.css

This file was deleted.

52 changes: 38 additions & 14 deletions packages/components/outline-core-link/src/outline-core-link.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { html, TemplateResult, CSSResultGroup } from 'lit';
import { html, TemplateResult, CSSResultGroup, css } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';

// Our base component, which all others extend.
import { OutlineElement } from '@phase2/outline-core';
import { AdoptedStyleSheets } from '@phase2/outline-adopted-stylesheets-controller';
import componentStyles from './style/outline-core-link.css.lit';
import componentVars from './style/outline-core-link.vars.css.lit';
import globalStyles from './style/outline-core-link.lightDom.css.lit';

import type { LinkTargetType, LinkRelType } from './config';
import componentStyles from './outline-core-link.css.lit';

/** The element name, reused throughout the codebase */
const componentName = 'outline-core-link';
Expand All @@ -30,7 +33,9 @@ const componentName = 'outline-core-link';
*/
@customElement(componentName)
export class OutlineCoreLink extends OutlineElement {
static styles: CSSResultGroup = [componentStyles];
static styles: CSSResultGroup = [componentVars, componentStyles];
adoptedStylesheets: AdoptedStyleSheets;
debug = false;

/**
* Link url
Expand All @@ -56,6 +61,34 @@ export class OutlineCoreLink extends OutlineElement {
@property({ type: String, attribute: 'link-rel' })
linkRel: LinkRelType;

/**
* The `connectedCallback` method is called whenever the element is inserted into the DOM.
* In this method, we're creating an instance of `AdoptedStyleSheets` and adding it as a controller.
*
* Adding the `connectedCallback` controller via more efficient than creating the instance and adding the controller in the constructor.
* The reason is that it delays these operations until the element is actually inserted into the DOM.
* If you have many such elements that are created but not immediately added to the DOM,
* this can improve the startup performance of your application.
*/
connectedCallback() {
super.connectedCallback();
this.adoptedStylesheets = new AdoptedStyleSheets(css`
${componentVars}

${globalStyles}
`);
this.adoptedStylesheets = new AdoptedStyleSheets(globalStyles);
this.addController(this.adoptedStylesheets);
}

himerus marked this conversation as resolved.
Show resolved Hide resolved
render(): TemplateResult {
if (this.linkHref) {
return this.generateLink();
} else {
return this.fullMarkupInSlot();
}
}

/**
* Check to see if the link is external, pass target="_blank" and rel="external" if so. Returns true if the link is external.
*/
Expand Down Expand Up @@ -163,21 +196,12 @@ export class OutlineCoreLink extends OutlineElement {
* @returns HTMLSlotElement
*/
fullMarkupInSlot(): TemplateResult {
if (this.isValidTopLevelSlottedLink()) {
this.adjustSlottedContent();
} else {
this.adjustSlottedContent();
if (this.debug) {
this.debugSlottedContent();
}
return html` <slot></slot> `;
}

himerus marked this conversation as resolved.
Show resolved Hide resolved
render(): TemplateResult {
if (this.linkHref) {
return this.generateLink();
} else {
return this.fullMarkupInSlot();
}
}
}

declare global {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
:host {
@nested-import './outline-core-link.vars.css';
}

a {
font-family: var(--ff-body);
text-decoration: var(--outline-core-link--text-decoration--computed);
color: var(--outline-core-link--color--computed);
transition-property: var(--outline-core-link--transition-property--computed);
transition-timing-function: var(
--outline-core-link--transition-timing-function--computed
);
transition-duration: var(--outline-core-link--transition-duration--computed);
}

a:hover {
text-decoration: var(--outline-core-link--text-decoration-hover--computed);
color: var(--outline-core-link--color-hover--computed);
}

a:focus {
text-decoration: var(--outline-core-link--text-decoration-focus--computed);
color: var(--outline-core-link--color-focus--computed);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
outline-core-link {
@nested-import './outline-core-link.vars.css';

a {
font-family: var(--ff-body);
text-decoration: var(--outline-core-link--text-decoration--computed);
color: var(--outline-core-link--color--computed);
transition-property: var(
--outline-core-link--transition-property--computed
);
transition-timing-function: var(
--outline-core-link--transition-timing-function--computed
);
transition-duration: var(
--outline-core-link--transition-duration--computed
);
}

a:hover {
text-decoration: var(--outline-core-link--text-decoration-hover--computed);
color: var(--outline-core-link--color-hover--computed);
}

a:focus {
text-decoration: var(--outline-core-link--text-decoration-focus--computed);
color: var(--outline-core-link--color-focus--computed);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--outline-core-link--color--computed: var(
--outline-core-link--color,
var(--outline-blue-600)
);
--outline-core-link--text-decoration--computed: var(
--outline-core-link--text-decoration,
none
);
--outline-core-link--color-hover--computed: var(
--outline-core-link--color-hover,
var(--outline-gray-600)
);
--outline-core-link--text-decoration-hover--computed: var(
--outline-core-link--text-decoration-hover,
underline
);
--outline-core-link--color-focus--computed: var(
--outline-core-link--color-focus,
var(--outline-gray-600)
);
--outline-core-link--text-decoration-focus--computed: var(
--outline-core-link--text-decoration-focus,
underline
);
--outline-core-link--transition-property--computed: var(
--outline-core-link--transition-property,
color,
background-color,
border-color,
text-decoration-color,
fill,
stroke
);
--outline-core-link--transition-duration--computed: var(
--outline-core-link--transition-duration,
150ms
);
--outline-core-link--transition-timing-function--computed: var(
--outline-core-link--transition-timing-function,
cubic-bezier(0.4, 0, 0.2, 1)
);
Loading
Loading