-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Move monaco-editor to a seperate package, to keep all building and transformations once, and in a seperate place. - hole-punch monaco to work around: - microsoft/monaco-editor#3217 - and other various issues: https://github.com/microsoft/monaco-editor/issues?q=shadow - Remove `codeTheme` as it is no-longer compatible with monaco's new css bundling. - Add codicons.ttf in an assetPath - Add `es-hole-punch to` `es-components`. - Standardize rollup usage across libs
- Loading branch information
1 parent
615feb2
commit 20dcceb
Showing
41 changed files
with
1,013 additions
and
3,924 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@eventstore-ui/router': patch | ||
'@eventstore-ui/stores': patch | ||
'@eventstore-ui/forms': patch | ||
'@eventstore-ui/theme': patch | ||
'@eventstore-ui/utils': patch | ||
--- | ||
|
||
Standardization of builds across design system libraries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
'@eventstore-ui/editor': major | ||
--- | ||
|
||
Monaco editor has been moved to a seperate package: `@eventstore-ui/monaco-editor`. | ||
|
||
## Breaking changes: | ||
|
||
### `assetsPath` | ||
|
||
You must now also copy `assetsPath` as well as `workersPath`, into your served assets. | ||
|
||
```ts | ||
import * as editor from '@eventstore-ui/editor/configure'; | ||
|
||
// ... | ||
|
||
{ | ||
src: editor.assetsPath, | ||
dest: 'assets', | ||
}, | ||
{ | ||
src: editor.workerPath, | ||
dest: 'workers', | ||
}, | ||
// ... | ||
``` | ||
|
||
### `IStandaloneEditorConstructionOptions` | ||
|
||
`es-editor`'s options prop may required different arguments, due to changes in monaco's `IStandaloneEditorConstructionOptions` | ||
|
||
### `codeTheme` | ||
|
||
Child theme `codeTheme` has been removed, and is no-longer added to the global theme. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@eventstore-ui/components': minor | ||
--- | ||
|
||
Adds the `es-hole-puncher` element, to pass children through to the light DOM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,6 @@ if (Build.isServer) { | |
observe() {} | ||
unobserve() {} | ||
}; | ||
|
||
global.UIEvent = class {} as any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/components/src/components/es-hole-puncher/es-hole-puncher.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Component, h, Element, Prop, Host } from '@stencil/core'; | ||
|
||
/** | ||
* Punches a hole through all parent shadow DOMs into the light DOM. | ||
* Any slotted chlid will be moved into the light, and a chain of slots | ||
* brings the slotted children back into position. | ||
*/ | ||
@Component({ | ||
tag: 'es-hole-puncher', | ||
shadow: true, | ||
}) | ||
export class EsHolePuncher { | ||
@Element() host!: Element; | ||
|
||
/** The unique ID to use for the slot path */ | ||
@Prop() uniqueId!: string; | ||
|
||
private slotChain: HTMLSlotElement[] = []; | ||
private slottedElements: Element[] = []; | ||
|
||
componentDidLoad() { | ||
let $parent = this.host; | ||
let $host = ($parent.getRootNode() as ShadowRoot).host; | ||
|
||
while ($host) { | ||
const $slot = document.createElement('slot'); | ||
$slot.setAttribute('name', this.uniqueId); | ||
$slot.setAttribute('slot', this.uniqueId); | ||
$parent.appendChild($slot); | ||
|
||
this.slotChain.push($slot); | ||
|
||
$parent = $host; | ||
$host = ($parent.getRootNode() as ShadowRoot).host; | ||
} | ||
|
||
const slot = this.host.shadowRoot!.querySelector('slot'); | ||
if (!slot) throw new Error('No slot found'); | ||
|
||
slot.assignedNodes({ flatten: true }) | ||
.filter( | ||
($node): $node is Element => | ||
$node.nodeType === Node.ELEMENT_NODE, | ||
) | ||
.forEach(($el) => { | ||
$el.setAttribute('slot', this.uniqueId); | ||
$parent.appendChild($el); | ||
this.slottedElements.push($el); | ||
}); | ||
} | ||
|
||
disconnectedCallback() { | ||
this.slotChain.forEach(($slot) => $slot.remove()); | ||
this.slotChain = []; | ||
|
||
const slot = this.host.shadowRoot!.querySelector('slot')!; | ||
this.slottedElements.forEach(($node) => { | ||
slot.appendChild($node); | ||
}); | ||
this.slottedElements = []; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<slot /> | ||
<slot name={this.uniqueId} /> | ||
</Host> | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/components/src/components/es-hole-puncher/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# es-hole-puncher | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Overview | ||
|
||
Punches a hole through all parent shadow DOMs into the light DOM. | ||
Any slotted chlid will be moved into the light, and a chain of slots | ||
brings the slotted children back into position. | ||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ----------------------- | ----------- | -------------------------------------- | -------- | ----------- | | ||
| `uniqueId` _(required)_ | `unique-id` | The unique ID to use for the slot path | `string` | `undefined` | | ||
|
||
|
||
---------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'monaco-editor'; | ||
export * from '@eventstore-ui/monaco-editor'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.