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

Specifying lib: DOM and WebWorker should not be mutually exclusive #20595

Open
armandn opened this issue Dec 9, 2017 · 24 comments
Open

Specifying lib: DOM and WebWorker should not be mutually exclusive #20595

armandn opened this issue Dec 9, 2017 · 24 comments
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@armandn
Copy link

armandn commented Dec 9, 2017

I got myself into a situation similar to #11093.

My project is designed to work either in the "main thread", with access to DOM, or as a WebWorker, where a different behavior kicks in. This was done for compatibility reasons and to have only one distributable js file and it's been working fine for the last two years.

In all this time I never specified the lib compiler option, only target ES5.

Today, as I'm experimenting some ES2015 stuff, I see that if I specify targets DOM,ES5,WebWorker,ES2015.Promise all hell breaks loose with errors. - Duplicate identifier, Subsequent variable declarations must have the same type.

Shouldn't this kind of mix be allowed in a project?

@DanielRosenwasser
Copy link
Member

Unfortunately the base APIs for WebWorker and DOM are actually meaningfully different, and it's not clear at this point how to write a clean separation of global scopes between different parts of your project other than splitting your project into multiple parts.

@DanielRosenwasser DanielRosenwasser added the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Dec 12, 2017
@kitsonk
Copy link
Contributor

kitsonk commented Dec 12, 2017

We have found that what is meaningful in the global scope of a web worker is significantly more narrow than we find out of the DOM. So we tend to author with "lib": [ "dom" ] and then just declare the handful of APIs we require to make a web worker work, or we obtain a reference to the global object, treat it as any, and pick off certain properties from the global scope and type them at the point where we pick them off.

While it isn't ideal, it saves us from the only other realistic option, splitting the code. If you have modular code, and pick off parts of a global scope and type them, and you are using modular code, you should be able to author isomorphic modules fairly easily. Here is an example of the most "bullet proof" way to get a reference to the global scope, which avoids any issues with CSP:

const globalObject: any = (function (): any {
	if (typeof global !== 'undefined') {
		// global spec defines a reference to the global object called 'global'
		// https://github.com/tc39/proposal-global
		// `global` is also defined in NodeJS
		return global;
	}
	else if (typeof window !== 'undefined') {
		// window is defined in browsers
		return window;
	}
	else if (typeof self !== 'undefined') {
		// self is defined in WebWorkers
		return self;
	}
})();

@shamhub
Copy link

shamhub commented May 18, 2018

@kitsonk But, do I need to write your above code in every file? and use globalObject for referring properties
How do I handle this scenario in here?

@charlesbodman
Copy link

charlesbodman commented May 18, 2018

@shamhub , no, you would use the global object instead of self

import globalObject from 'globalObject'

globalObject.postMessage({});

That being said, in your case, you don't need the global object. If you want to get around the typing errors, you can just use

const ctx: Worker = self as any;
ctx.postMessage();

@shamhub
Copy link

shamhub commented May 19, 2018

@charlesbodman I have used second option but I get error No webworker support as mentioned here

@charlesbodman
Copy link

@shamhub , it's because you're checking for worker support inside of the worker. No need.

@shamhub
Copy link

shamhub commented May 21, 2018

@charlesbodman Yes it works now. In JS, we have SharedWorker object. Am trying to execute the same code using let worker: SharedWorker = new SharedWorker('worker.js'); but I see the error Cannot find name 'SharedWorker'

@mhegazy
Copy link
Contributor

mhegazy commented May 21, 2018

SharedWorker needs to have its own lib file. mind filing a new ticket to track creating that.

@mhegazy
Copy link
Contributor

mhegazy commented May 22, 2018

logged #24323 to track adding SharedWorker support

@filipesilva
Copy link
Contributor

@mhegazy @DanielRosenwasser we're also running into the incompatible dom and webworker typings in Angular CLI projects and that leaves us in a tricky spot. I have described the situation in angular/angular-cli#14188 (comment).

I suppose the "right" approach would be for IDE support to better approximate compilation support by supporting multiple tsconfigs on the same folder that affect different combination of files. But that sounds hard and needs to be supported by the IDE proper as well.

I'm not sure what the correct approach is right now.

@DanielRosenwasser
Copy link
Member

(Heads up, @mhegazy is no longer on the team. CCing @RyanCavanaugh)

@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus Suggestion An idea for TypeScript and removed Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Apr 18, 2019
@RyanCavanaugh
Copy link
Member

We should reorganize this a bunch

  • lib.browser.d.ts is things you can access from WW or DOM contexts
  • lib.window.d.ts is just the definition of Window
  • lib.window.globals.d.ts adds the existing arbitrarily-selected global values from Window
  • lib.webworkers.d.ts is browser + ww-specific stuff
  • lib.dom.d.ts is (for back compat) window + browser + window.globals

@jacobbogers
Copy link

Any progress on this? I am having the same issue

jahow added a commit to jahow/openlayers that referenced this issue Sep 23, 2019
The worker self object is simply cast to any to make sure typescript
does not complain.
Actual typecheck may be restored once the following issue is fixed:
microsoft/TypeScript#20595
@yGuy
Copy link

yGuy commented Jan 13, 2020

There is a related problem that library developers (typings/d.ts file providers) are facing. For libraries that actually work well in both the DOM and the webworker contexts, I don't see how it's possible to program against such a library in a webworker context, because whenever the library (only the d.ts file! not the source to be compiled!) contains a reference to a DOM type (like HTMLElement), the compiler will bail out with a TS2304, stating that the type cannot be found, even if the respective API is not used at all in the code to be compiled.

The only workaround I can see is to target "DOM" inside the webworker code (and declare all the webworker APIs that you need to use in order to make it compile) or to patch all the typings files and generate separate versions for use in webworkers, only. Although feasible, I don't like those workarounds. I would rather see the compiler be more lenient with respect to unused (with respect to the sources to are being compiled) declarations in a d.ts file.

@yGuy
Copy link

yGuy commented Jan 16, 2020

To add to my previous comment above: For libraries, there actually is a work around: It's also an all-or-nothing flag, so really having more control over this would be appreciated: Use the skipLibCheck option to disable checking of the .d.ts files that only compile cleanly in the "other" lib context.

@TroyAlford
Copy link

Though it is a little bit ugly, here is a method I've gotten to work:

(self as unknown as Worker).postMessage(/* message */)

This actually makes the intellisense work on the postMessage correctly as well in VSCode, by correctly forcing recognition of the type of self. I dislike the as unknown in the middle, but without that, I get a different TS error:

Conversion of type 'Window & typeof globalThis' to type 'Worker' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

If there's a cleaner syntax for this, I'd love a hint. :)

@sandersn
Copy link
Member

sandersn commented May 6, 2020

@orta and I put our heads together on this to see if @RyanCavanaugh's proposed solution is workable. So far, we think Yes, with some caveats that we need to investigate. Here's are some notes; we'll work more on this soon.

  1. The core problem is that people need to include webworker at the same time as DOM, but several of the declarations conflict. (16 of them, currently).
  2. When you look at the difference between webworker and DOM, the differences fall into 3 buckets:
    a. New types and values specific to webworker. We believe this is most of what people want from including webworker.
    b. Missing values and types that don't make sense for webworker. eg webworker doesn't have the type HTMLOrSVGImageElement. This is nice to exclude but not the highest priority.
    c. Types that conflict and values with conflicting types.
  3. @RyanCavanaugh's proposal to create a new dependent, lib.browser.d.ts, would solve (a) and (b) -- just put the core things into browser and let webworker or dom respectively extend the core.
  4. The conflicts in webworker could be fixed in the following ways
  • A few are just out of date, like DOMMatrixReadOnly, CrytoKeyPairs
  • A few, like FormData's constructor or ImageBitmapRenderingContext.canvas, could extend a base in browser in an unsound way.
  • Callbacks like onlanguagechange, onoffline, ononline, onrejectionhandled, onunhandledrejection, could be made compatible with the DOM by removing the this parameter.
  • This leaves onerror and self.
  • self is defined in the same way for both files, but webworker uses the much smaller type WorkerGlobalScope instead of Window. If it used the name Window instead it would probably merge cleanly with the DOM's self, although I haven't tested this yet.
  • onerror has a this parameter for webworker, and doesn't allow strings as event names, nor does it have 4 trailing optional parameters. But it might be worthwhile to change it if it's the only conflict left.
  1. With the conflicts resolved, people would be able to have both dom and webworker for their lib.
  2. All these types are built in the types exported from Edge, so changing them would require a lot of work in TSJS-lib-generator, manually converting the webidl declarations into the JSON override format. So testing this change will be labour-intensive.

@fatcerberus
Copy link

Having just discussed this on Gitter, I realized that the general problem here isn't just about dom and webworker, despite appearances; that's just a symptom. JS is ubiquitous nowadays and I'd expect it's not uncommon to have code for a few different platforms existing within the same source tree. But you only get one tsconfig.json (for the purposes of IDE support and IntelliSense, at least), and lib is global.

I actually have a similar problem to this today with miniSphere: the vast majority of a game will use the Sphere typings, but the build script--Cellscript.js uses the Cell API, which like Web Workers vs. DOM, is generally distinct but shares a few select classes in common.

So if there were a way to use separate typings per-file or even just per-directory, that would be an elegant solution to this problem, I think, and probably wouldn't even require modifying the .d.ts files as they're currently written.

@cecilemuller
Copy link

cecilemuller commented Jan 20, 2021

In the meantime, the workaround I use is typing self in the worker file:

/* eslint-env worker */
const worker: Worker = self as any;

worker.addEventListener("message", (e) => {
  worker.postMessage({hello: "world"});
});

You can even go further and type the messages:

worker.ts

/* eslint-env worker */

type TRequest = {
  myrequest: number;
};
type TResponse = {
  myresponse: number;
};

export interface IRequestWorker {
  postMessage: (message: TRequest) => void;
  onmessage: (message: MessageEvent<TResponse>) => void;
}
interface IResponseWorker {
  postMessage: (message: TResponse) => void;
  onmessage: (message: MessageEvent<TRequest>) => void;
}

const worker: IResponseWorker = self as any;

// Receive from the main thread
worker.onmessage = ({data: {myrequest}}) => {
  console.log(myrequest);

  // Send to the main thread
  worker.postMessage({myresponse: 222});
};

main.ts

/* eslint-env browser */
import type {IRequestWorker} from "./worker.ts";

const worker = new Worker(new URL("./worker.ts", import.meta.url)) as IRequestWorker;

// Receive from the worker
worker.onmessage = ({data: {myresponse}}) => {
  console.log(myresponse);
};

// Send to the worker
worker.postMessage({myrequest: 111});

export {};

@cameron-martin
Copy link

cameron-martin commented Oct 28, 2021

Having just discussed this on Gitter, I realized that the general problem here isn't just about dom and webworker, despite appearances; that's just a symptom. JS is ubiquitous nowadays and I'd expect it's not uncommon to have code for a few different platforms existing within the same source tree. But you only get one tsconfig.json (for the purposes of IDE support and IntelliSense, at least), and lib is global.

I actually have a similar problem to this today with miniSphere: the vast majority of a game will use the Sphere typings, but the build script--Cellscript.js uses the Cell API, which like Web Workers vs. DOM, is generally distinct but shares a few select classes in common.

So if there were a way to use separate typings per-file or even just per-directory, that would be an elegant solution to this problem, I think, and probably wouldn't even require modifying the .d.ts files as they're currently written.

This issue also manifests its self when using test frameworks that declare globals. It makes these globals available in each file even though they are not at runtime. It also means when you use multiple test frameworks that each declare globals of the same name, you get conflicting global definitions.

Having a mechanism for specifying different types for different file patterns sounds like a good solution to me.

@capnmidnight
Copy link

As a stop-gap, it would be nice if there were a library called "DOMAndWebWorker" that was the intersection of the "DOM" and "WebWorker" libraries.

But to solve the problem in general, we can see from the fact that including "DOM" and "WebWorker" in compilerOptions.lib results in an OR operation between the two libraries, that what we need is some way to do AND operations between libraries. Maybe the compilerOptions.lib property could be set as a string, something like "ESNext | (DOM & WebWorker)".

aarongable pushed a commit to chromium/chromium that referenced this issue Feb 28, 2023
This CL does a couple of things:

1. Moves the worker script into its own ts_library because it needs
   a different tsconfig.json than the rest of the code. Ideally we would
   be able to use the same target for both, but declarations in the
   lib.webworker.d.ts conflict with lib.dom.d.ts. See
   microsoft/TypeScript#20595

2. The tsconfig.json needs 'webworker' for web worker APIs.

3. In the worker script, add an empty export so we can re-declare
   `self` and re-declare `self` as SharedWorkerGlobalScope so we can
   use shared worker APIs. See
   microsoft/TypeScript#14877

4. Fixes shared worker creation to work with trusted types. We loose
   some type safety when we create the worker because lib.dom.d.ts
   doesn't support Trusted Types yet. See
   microsoft/TypeScript#30024

5. Random fixes for the linter and typescript compilation.

Change-Id: I1d21e67f58b5f3d6b879c21af9e18c18aa6025fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4289336
Reviewed-by: Zain Afzal <[email protected]>
Commit-Queue: Giovanni Ortuno Urquidi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1110774}
@muhamedkarajic
Copy link

So I guess I'm here after 6 years just wondering if there is some workaround cause all I would like is execute my classes and functions inside the webworker but in a typescript nice way. Is there a solution for that if I have e.g. a module and then want to import things from that module inside my worker?

All posts I saw seemed to be workarounds by waiting for webpack to compile it and then grab a specific module etc.

@cuixiping
Copy link

cuixiping commented Apr 12, 2023

If one file need work on both dom and web worker, how to config the compilerOptions.lib?

For example:

if (typeof importScripts == 'function' && typeof window=='undefined') {
   // some code for web worker
  importScripts('abc.js');
} else {
  // some code for dom
  alert(document.title);
}

egasimus added a commit to hackbg/cosmjs-esm that referenced this issue Aug 10, 2023
@MattiasMartens
Copy link

If one file need work on both dom and web worker, how to config the compilerOptions.lib?

The current state seems to be that there is no correct type-safe way to do this.

The only available option for module authors is to maintain two modules, one compiled for web worker and one compiled for DOM, and then a "dispatcher" module that imports both as un-typed javascript, uses a non-type-safe environment tester function to determine which one to call, and dispatches module consumer function calls to one or the other. That dispatcher module can then type itself, without referencing either "dom" or "webworker" definitions, and hide the kludge from consumers.

bennypowers added a commit to RedHat-UX/red-hat-design-system that referenced this issue Sep 9, 2024
bennypowers added a commit to RedHat-UX/red-hat-design-system that referenced this issue Sep 11, 2024
* feat(code-block): wip client-side highlighting

* style: type linting

* chore: appease typescript for the sake of prism

see microsoft/TypeScript#20595

* docs: prism in 11ty

* fix(code-block): prism css module

* docs: eleventy prism import map

* docs: more import map shenanigans

* fix(code-block): highlighted line numbers

* docs: changeset

* docs(code-block): documentation for new attrs

* fix(code-block): disclosure aria

* fix(code-block): comment colors

* fix(code-block): tabindex

* fix: update elements/rh-code-block/rh-code-block.ts
zeroedin added a commit to RedHat-UX/red-hat-design-system that referenced this issue Sep 30, 2024
* style: remove extra line from `.gitattributes` file

* docs(tokens): remove copy button from value col

* feat(skip-link): href attr (#1813)

* feat(skip-link): href attr

* docs: skip-link no-anchor

* docs: update elements/rh-skip-link/demo/href-attribute.html

Co-authored-by: Adam Johnson <[email protected]>

---------

Co-authored-by: Adam Johnson <[email protected]>

* fix: remove rti from navigations (#1821)

* docs: remove RTI from sidenav

* fix(subnav): remove rti, add accessible-label attr

* fix(navigation-secondary): remove rti, add accessible-label attr

* chore: add changesets

* chore(subnav): update changeset

* chore(navigation-secondary): remove orphaned code

* docs: readd rti to sidenav taken care of in seperate docs pr

* docs(navigation-secondary): add accessible-label documentation

* docs(subnav): add accessible-label documentation

* chore(subnav): remove unused ifDefined import

* fix(navigation-secondary): remvoe preventDefault to allow tab to move to next tabstop

* fix(accordion): remove rti

* chore(navigation-secondary): update changeset

* chore(accordion): add changeet

* docs: update changesets

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* fix(accordion): bold accordion headers (#1806)

* fix(accordion): bold `rh-accordion-header` text

* fix(accordion): appease nanocss

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
Co-authored-by: Benny Powers <[email protected]>

* feat: theme properties (#1792)

* docs: theming

WIP, picking up where #1298 left off

* docs: pattern shortcode splits out css

* docs: pattern showcase element layout

* feat(card): header background theme props

* docs(card): asset patterns

* docs: pattern elements in typescript

* feat: themable surfaces

adds:
- `--rh-color-surface`
- `--rh-color-text-primary`
- `--rh-color-border-subtle`
- `--rh-color-border-strong`
- `--rh-color-border-interactive`

* docs(card): patterns with themable properties

* style(card): template

* docs(card): use themable properties

* fix(context): more themable props

* style: sort props

* feat: add --rh-color-theme-inverse

* chore: dev server layouts

* refactor(accordion): themable tokens

* chore: minor perf improvement for dev server

we still have a major problem of trace performance in
generator.htmlInject to work through

* feat: link colours

* docs: port uxdot-installation-tabs to typescript

* chore: wireit dependencies

* fix: update tokens stuff

* chore: deps

* chore: stylelint rules

* chore: temporarily patch tokens

* fix: port element styles

* fix(lib): port element styles

* docs: port tokens

* chore: update temporary patch

* style: lint css

* refactor(pagination): css

* chore: use tokens prerelease

* chore: use prerelease tokens

* docs: load rhds packages locally

* docs: handle theme tokens

* fix(context): use new tokens repo

* docs: load tokens from node_modules

* chore: tokens deps

* chore: update tokens prerelease

* chore: update prerelease tokens

* chore: update prerelease tokens

* style: config

* chore: update deps

* fix: lint css files

* chore: prerelease tokens

* fix(context-picker): dont swallow event

* fix(surface): make it a consumer

* docs: token theme swatches

* docs: tokens toc, alt-card for themes

* docs: ssr the lightness of token swatches

* docs: fix tokens page

* docs: fancier tags

* style: lint

* docs: demo dsd fix

* docs: icon color themables

* fix(surface): act as a pseudo-consumer

don't swallow the context-request event, but still propate your own
color values

* chore: docs server perf

* docs: icon,border,etc

* perf: remove unused decorator

* docs: tokens tables

* docs: typography tokens

* docs: bodge up token tables

these files are due for a serious refactor, but like... another day

* docs: themable tokens changeset

* docs: update theming prose

* test(surface): typescript nudges

* test(surface): fix tests

* test: console logs

* docs: tokens demo

* docs: fix tokens

* docs: nicer ids

* docs: refactor tokens table code

* fix(table): theme tokens

* docs: refactor token collection

* docs: refactor patterns, move links and scripts to head

* fix(subnav): use theme tokens

* fix(tile): use theme tokens

* docs: header, tile patterns

* fix(card): host display block

* docs: tile patterns and theming

* fix(card): surface tokens

* fix(tile): surface tokens

* fix(subnav): force color palette per guidelines

* fix(tile): use theme tokens

* feat(context-picker): pass an element ref

* docs(tile): theming patterns

* style: lint

* test: more sleep

* style: lint

* test: fix audio player tests

* docs: element pattern in color palette docs

* fix(cta): primary color

* fix(tabs): color context

* fix(context-demo): import specifier

* fix(tile): override surface colors

* docs: copy styles over

* docs: theming prose

* chore: simplify dev server config

* docs: footnotes

* docs: lint styles

* style: lint element css

* style: lint css comments

* docs: lint css

* fix(cta): context css

* chore: workaround in dev server for jspm limitation

* style: lint

* docs: tile lightdom

* docs: pullquote margins

* docs: bodge for audio-player layouts

see also #1264

* docs: fix import map?

* docs: remove url filter

* docs: theme collage

* docs: theming patterns

* docs: theming bordeaux example

* fix(card): color palettes and layouts

* docs(card): color palettes

* docs: more theming prose

* docs: more theming

* docs: bordeaux

* fix(code-block): styles

* fix(context-demo): context

* fix(blockquote): theme tokens

---------

Co-authored-by: Mark Caron <[email protected]>

* perf(audio-player): easier to ssr

* feat(code-block): client-side highlighting (#1837)

* feat(code-block): wip client-side highlighting

* style: type linting

* chore: appease typescript for the sake of prism

see microsoft/TypeScript#20595

* docs: prism in 11ty

* fix(code-block): prism css module

* docs: eleventy prism import map

* docs: more import map shenanigans

* fix(code-block): highlighted line numbers

* docs: changeset

* docs(code-block): documentation for new attrs

* fix(code-block): disclosure aria

* fix(code-block): comment colors

* fix(code-block): tabindex

* fix: update elements/rh-code-block/rh-code-block.ts

* style: lint

* chore: lit css nesting (#1845)

chore: lit-css ts transform

allow css nesting syntax in shadow css. it will be unrolled with postcss

* fix: theming for elements (#1853)

* docs: picker targets

* fix(surface): set but don't inherit surface colors

* docs(card): bar pattern

* fix(accordion): style guidelines

* fix(alert): theme tokens

* fix(badge): context, styles

doesn't implement status tokens, yet

* fix(button): disabled on dark

does not add semantic tokens

* fix(blockquote): border style

* fix(health-index): border colors

* fix(tabs): context in panel

* docs(tabs): links in demo

* fix(icon): container size

* fix(badge): tests and backgrounds

* docs(card): links

* docs(theming): backgrounds

* docs(theming): stub for developer

* docs: deps

* docs: more prose

* feat(tag): context, compact, href, desaturated

Closes #1843

* docs: tag

* fix(tag): spacing

* fix(tag): spacing

* docs(tag): live samples

* test(tag): tests pass

* fix(blockquote): on

* docs(tag): slotted icon

* fix(blockquote): on

* fix(accordion): drop shadow

also refactors expand/collapse code

* fix(alert): use rh-icon

* fix(tabs): always on

* fix(tile): font-weight

* docs: copy demo assets

* docs: demo assets

* fix(alert): missing id

* docs(accordion): disclosure link trailing slash

* perf: use node-native glob

* perf: replace cheerio with parse5

* feat(button): icon set (#1859)

* fix(button): use rh-icon

* fix(button): narrow type of icon and set

* fix(footer): document accepted icons in social links

* chore: max out netlify's card

* perf(button): lazy-load icon

* fix(button): icon layouts

* fix(button): fancy icon layouts, etc

* docs(button): icon usage

* perf(button): shadow classes

* feat(tile): link styles (#1860)

* feat(tile): private link

Closes #1470

* fix(tile): private icon

* feat(tile): link="external"

* docs: icon sets (#1844)

* docs: stubbed icons page

* docs: icons prose

* chore: tslib

* docs: max out the card

* docs: icon page layout

* docs: tokens on color page (#1866)

* docs: tokens on color page

Closes #1757

* docs(color): swatch styles

* docs(color): swatch styles

* docs(tokens): duplicate IDs

Closes #1742

* chore: align style use between docs and demo (#1862)

* chore: align style use between docs and demo/dev-server use cases

* chore: add tokens layer to layer cascade

* chore: organize demo/dev-server styles

* chore: correct stylesheet name

* chore: call individiual layers instead of styles.css as a whole

* chore: remove demo layer forgot to remove last commit

* fix: ignore tokens loaded from node_modules in litcssOptions

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* docs: remove prism css from dev-server.css (#1868)

docs: remove prism css from dev-server

* fix(audio-player) corrected focused on menu button after escape pressed (#1869)

* fix(audio-player): return focus to menu button when escape is pressed on menu

* chore(audio-player): add changeset

* chore(audio-player): changeset typo

* fix(audio-player): theming, icon, playback rate (#1854)

* fix(audio-player): theme tokens

* fix(audio-player): make menu buttons inert when closed

Fixes #1764

* refactor(audio-player): shadow classes and nesting

* docs(audio-player): customization demo styles

* feat(audio-player): mini player rate stepper

* fix(audio-player): use rh-icon

* docs: changesets

* fix: play button icon color

* fix: audio player tokens

* fix: keyboard access to steppers in menu

* fix: remove errant log

* test(audio-player): update tests

* fix(audio-player): restore custom icons

Closes #1871

* fix(switch): reversed

removes anonymous slot (no longer used now that we have message slots)

* fix(switch): remove unused label prop

* fix(switch): refactor css, document props

* fix(button): apply color context

* fix(site-status): apply color context

* fix(switch): checked styles on dark

* docs(card): demo whitespace

* style: lint css

* test(switch): use rh-icon

* docs(alert): toast method

* fix(cta): restore color and spacing (#1879)

* docs: icon design update (#1880)

* docs: icon design update

* docs: move icons to foundations

* docs(icon): feedback footer

* docs(icon): list styles

* docs(icon): fix a whoopsie

* docs(icon): layouts

* docs: copy assets

* docs(icons): fix permalink

* docs(icon): copy

* docs: icons feedback

* docs: change title of page and update section heading case

* docs: iconography order

* docs: align buttons

---------

Co-authored-by: marionnegp <[email protected]>

* docs(audio-player): more demos

* style(card): minor refactors

* docs(context): jsdoc

* fix(context): claim events

* docs(audio-player): context demo

* fix(context-picker): weird layout science

* docs(pattern): always use an allowed pattern

* docs: simplify installation tabs (#1690)

* docs: simplify installation tabs

* docs: fix import map on installation page

* docs: jspm import maps

* docs: no pfe version

* docs: install tabs

* chore: patch prism-esm see if that lets build complete

see KonnorRogers/prism-esm#3

* docs: fail more gracefully when JSPM can't cope

* chore: lint nonsense

* docs: link to install info

* docs: installation tabs styles

* feat(table): adding automatic data-labels on col-scoped tables (#1804)

* feat: adding automatic data-labels on col-scoped tables

* Update elements/rh-table/rh-table.ts

Co-authored-by: Adam Johnson <[email protected]>

* style(rh-table): linting error on extra curly brace

* Update elements/rh-table/rh-table.ts

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* Update elements/rh-table/rh-table.ts

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* feat(table): responsive attr, plus some style linting

* docs(table): updating prop definition

* refactor: prefer optional chaining to ternary

* refactor(table): use hammer operator and dataset to reduce footprint

* docs(table): adding responsive table instructions

* feat(table): making responsive layout default. Adjusting docs to reflect this.

* chore(table): adding changeset

* docs: update .changeset/khaki-rings-confess.md

* fix(table): mo

---------

Co-authored-by: Adam Johnson <[email protected]>
Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
Co-authored-by: Benny Powers <[email protected]>

* fix(table): add container query support (#1881)

* fix(table): container query, css nesting, logical properties

* chore(table): add changeset

* chore(table): lint

* docs(table): revise prose around container sizes

* docs: add edit this page link (#1882)

* docs: add edit this page link

* docs: add edit this page to pattern template

* docs: edit this page trim leading dot

* fix(back-to-top): reconfigure pointer events to be on the trigger not host

* docs: disambiguate variable names in TOC template

* docs(card): update Style subpage (#1664)

* docs(card): update Color section

* docs: add margin between rh-card in a figure and the caption

* docs(card): update copy for Theme sections and update Theme images

* docs(card): update dark theme card image

* docs(card): fix incorrect black color in dark theme image

* docs(card): fix thumbnail bg color in light theme card image

* docs(card): add color-palette attribute to parent element for card examples

* docs(card): change one dark color palette to use dark alt surface color

* Revert "docs(card): change one dark color palette to use dark alt surface color"

This reverts commit 0e3654c.

* docs(card): Fix copy under white card example

* docs(card): move styles to card page

* docs(card): remove url filters

---------

Co-authored-by: Benny Powers <[email protected]>

* feat(table): adding fail-safe for complex tables and updating docs (#1891)

feat(table): adding fail-safe for complex tables and updating docs to reflect

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* fix(card): slotted link colours

this doesn't cover *every* scenario, but it's a nice safety net

Fixes #1717

* docs: changeset

* docs: purple planned tags

Closes #1736

* fix(site-status): use rh-icon (#1889)

Closes #1615

* style: lint table

* docs: include attribute name in table on elements code pages (#1893)

Co-authored-by: Steven Spriggs <[email protected]>

* fix(accordion): regression for initially-expanded headers

* docs: axe xd (#1890)

* docs: axe xd

Closes #1883

* docs: spacing

* Revert "docs: spacing"

This reverts commit d13ce5e.

* docs: spacing tables

* style: lint

* style: lint

* docs: correct jsdoc syntax

Fixes #1548

* fix(alert): hide empty header (#1895)

Fixes #1530

* docs: background picker in dev server (#1887)

* docs: move demo template into file

it's not used elsewhere

* fix(context-picker): restoring state, types

* chore: update deps, types

* docs: dev server context picker, styles

* chore: ts lib

* chore: config niceties

* chore: tsconfig

---------

Co-authored-by: Steven Spriggs <[email protected]>

* chore: update prism-esm dep

* chore: update icons

* chore: remove prism-esm patch, fixed with version update

* docs: fix duplicate `summary` IDREF  (#1898)

docs: fix duplicate `summary` IDREF's for "On this page" nav

* docs: fix 11ty demo styles

* docs: lightdomcss install shortcode (#1902)

* docs: adding lightdom CSS installation render shortcode

* docs: adding missing path-to

* docs: adding SLA to the lightdom css shim

* docs: lightdom css shim typo

* docs: reorder SLA alert

* chore: struggle with web-dev-server import map generator

* docs: adding screen reader testing page (#1798)

* Initial general content

* Updated screen reader section with new link

* Updated page title

* Updated meta data and links

* Added computer and macOS sections

* Added NVDA section

* Added JAWS section

* Added Narrator section

* Added Orca section

* Added mobile sr section

* Added VoiceOver section

* Added TalkBack section

* Updated link on assistive tech page

* Trimmed modifier key text

* Got rid of a rogue parenthesis

* Changed page title and minor text  updates

* VoiceOver section cleanup

* Text updates and reworked heading structure

* Text and punctuation cleanup

* Minor text fixes

* Broke a ton of paragraphs into ULs and OLs

* Changed errant ULs to OLs.

* And switching some OLs back to ULs

* Detypoing typos

* VoiceOver text cleanup

* Text updates in browser pairing section

* Typo and grammar fixes

* Typo fix

* chore: revert merge conflict

---------

Co-authored-by: Benny Powers <[email protected]>

* chore: itty bitty dev server config refactor

* feat(code-block): prism prerendered highlighting (#1906)

* fix(code-block): client-side line numbers

* feat(code-block): server-side prerendered prism

* fix(code-block): badge padding

* fix: change prism-prerendered to prerendered

* docs: fix design code status table

* docs: fix whitespace and markdown rendering in tables (#1915)

* fix(table): improve color contrast of hover state (#1896)

* fix(table): change row hover background colors for light color palettes

* fix: use relative color

* fix: use relative color

* fix(table): move vars to shadow

* fix(table): cross root closest

it's a hack and we should get rid of it

* docs(table): add link in contrast demo

* feat(table): change gray hover color for light theme tables

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
Co-authored-by: Benny Powers <[email protected]>

* fix(tabs): interaction states, css refactor/nesting (#1904)

* fix(tabs): fix interaction states, css nesting and cleanup

* chore(tabs): add changetset

* fix(tabs): add non box vertical hover styles

* test(tabs): update selectors that were changed

* fix(tabs): clean up styles at overflow and breakpoints with vertical

* docs(tabs): add icons size to tabs icon style to text and icons demo

* fix(tabs): correct padding when panel is inset and not vertical

* fix(tabs): correct padding when panel is inset and not vertical (again)

* style(tab): refactor shadow ids

* docs: remove changeset

since the bug was introduced on clefairy branch, we don't need a
changeset for the fix

* chore(tabs): add changeset (container queries)

* docs: update large-geese-suffer.md

* fix(tabs): move padding to panel host

* fix(tabs): fix margin when overflowed and inset

* fix(tabs): inset padding shoudl only shift on overflow

* fix(tabs): correct box/inset inactive tab background color on dark

* fix(tabs): correct inline padding for tab buttons in vertical orientation

* fix(tabs): correct disabled overflow icon color value

* style: lint css

* chore: update deps

---------

Co-authored-by: Benny Powers <[email protected]>
Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* fix(subnav): ssr compat

Closes #1668

* docs: remove unused file

* docs: remove unused shortcode

* docs: refactor elements.njk

* docs: fix getElementDescription filter (#1920)

* fix(tabs): add display contents to panel container (#1918)

* fix(tabs): add display contents to container, remove ctx

* chore(tabs): add changeset

* docs: `uxdot-repo-status-list` missing border (#1922)

docs: repos-status-list border fix

* docs: fix header element causing horizontal scroll bars (#1924)

* docs: fix header element causing horizontal scroll bars

* docs: uxdot-header remove h1 margin

* docs: remove url filters (#1925)

* docs: remove url filters

* docs: catch url in lightdom files links regex didnt catch

* docs: update tags docs  (#1930)

* docs: update tags docs

* docs: ninjar some css fixes in, duplicate styles, incorrect placement

* docs: ssr compatible 11ty demos

* docs(tag): review notes

---------

Co-authored-by: Benny Powers <[email protected]>

* docs: elaborate on developer theming (#1897)

* docs: take 1 at elaborating on dev themeing

* docs: update developers, fix typos

* docs: revisions, formatting

* docs(theming): develoeprs

* docs(theming): wrastle with 11ty templating

* docs(theming): stubs for other sections

* docs: add example of themeable container, expand on color-palette attribute

* style: lint examples

* docs(theming): prerendered code blocks, tabs

* docs: elaborate more on theming

* docs: swap patterns and theming sidenav items

* docs: themeable, theming

* docs(theming): elaborate yet more

* docs(release-notes): md tables

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
Co-authored-by: Benny Powers <[email protected]>

* fix(tile): remove `display: block` on image slot (#1928)

* fix(tile): remove display rule on image slotted element

* chore(tile): add changeset

* docs: expand on a11y features of devtools, add CI/CD intro (#1903)

* docs: expand on a11y features of devtools

* docs: add intro to Chai A11y aXe and `a11ySnapshot`

* docs: update `a11ySnapshot` example to include Chai a11y helpers

* docs: use branded annotation numbers for accessibility pane image

* docs: add max width to a11y devtools screenshots

* docs: restructure / add pages to a11y docs

* docs: improve layout of images and blockquotes in a11y docs

* docs: add lighthouse image to a11y tools page

* docs: sidenav capitalization for abbrs

* docs(accessibility): code blocks

---------

Co-authored-by: Benny Powers <[email protected]>

* docs: rhcodeblock fenced gfm block

* docs: code-block ssr

* docs(color): change minimum column width of color token swatches (#1901)

* docs(color): change minimum column width of color token swatches

* fix: improve how columns resize at different container widths

* docs(color): update status color table (#1929)

* docs(color): update info in status tokens table to match tokens

* docs(color): add note about deprecated status name

* docs(color): remove "error" as a status name

* docs: color table

* chore: patch core for ssr

see patternfly/patternfly-elements#2859

---------

Co-authored-by: Benny Powers <[email protected]>
Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

* docs: update "About the design system" page (#1914)

* docs(about): update content on "About the design system" page

* docs(about): delete "How we build" page

* docs: update about page

* docs: whitespace

* docs: icon size

* docs: card contents

* docs: whitespace, ref links

---------

Co-authored-by: Benny Powers <[email protected]>

* docs: fix all patterns page

* docs: patterns page data

exclude index, use correct title

* feat(alert): dpo tokens (#1905)

* feat(alert): dpo tokens

* fix: handle deprecated statuses

* fix: recombobulate status names

* docs: update jsdoc

* docs: ssr compatible 11ty demos

* fix(alert): ssr compat

* fix(alert): neutral grays

* fix(alert): crayons for headings

* fix(alert): typo in css

* docs: theming dev header style fix (#1936)

docs: scope rh-surface band example css, reduce card text

* docs: a11y dev

* fix(badge): dpo tokens (#1912)

* fix(badge): dpo tokens

* test(badge): update test cases for DPO tokens

* chore: update deps

* test(badge): update specs for DPO tokens

* fix(badge) status states for docs and changeset update

* docs(badge): align variant names on the Guidelines page and update `state` attributes on Overview page

* docs(badge): update changeset + improve formatting

* fix(badge): update deprecated aliases per guidance

* docs(badge): make `deprecated` visible for legacy `critical` state

* docs(badge): update images that had old badge colors

* feat(badge): add back the minimum width

* fix(badge): corrected states in caution badge demo

* fix(badge): corrected states in color-context demo

---------

Co-authored-by: Mark Caron <[email protected]>
Co-authored-by: marionnegp <[email protected]>
Co-authored-by: Adam Johnson <[email protected]>
Co-authored-by: Adam Johnson <[email protected]>

* Updated Theming Overview page and images (#1938)

* docs(theming): updating overview page and adding graphics

* doc(theming): removing overview h2

* docs: developer theming wording, grammar, typo fixes (#1937)

* docs: developer theming wording, grammar, typo fixes

* docs: make list in dev theme docs

* docs: reword dev theming docs about consumer and provider

* docs: punctuation and grammar for theming docs

* docs: dev theming grammar and colon

* docs: dev theming add colon

* docs: dev theming spell themeable correctly

* docs: dev theming add comma

* docs: dev theming SVG to SVGs

* docs: dev theming tense changes

* docs: dev theming parentheticals and grammar

* docs: dev theming pluralize proper noun

* docs: dev theming clarify sentence

* docs: moar dev theming grammar and wording

* docs: write out `underscore` in dev theming docs

---------

Co-authored-by: Steven Spriggs <[email protected]>

* docs: fix styles on pattern,element pages

* docs(alert): revert #1857

* docs: revert some backpage.css changes

These to be reviewed and reimplemented after release

* chore: update tokens package

* style(tile): refactor css, remove --_text-color

* docs(surface): specify that surface interjects context

* docs: fix uxdotPattern shortcode

* docs(theming): fix up examples

* docs(tile): fix pattern docs

* docs(logo-wall): fix art direction

* docs: Clefairy release notes (#1942)

* docs(release-notes): adding 2.1.0 release notes

* docs(release-notes): taking advantage of the compact tag in the tables

* docs(release-notes): fixing typos and adding periods

* docs(release-notes): rewording container query descriptions

* docs: adjust changesets to align language around container query support (#1944)

* fix(card): computed context (#1943)

* fix(card): compute context

* fix(card): refactor computedContext to a getter

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
Co-authored-by: Benny Powers <[email protected]>
Co-authored-by: Steven Spriggs <[email protected]>
Co-authored-by: Mark Caron <[email protected]>
Co-authored-by: marionnegp <[email protected]>
Co-authored-by: Marionne Patel <[email protected]>
Co-authored-by: Greg Gibson <[email protected]>
Co-authored-by: Mark Caron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests