File tree Expand file tree Collapse file tree 10 files changed +28
-19
lines changed
Expand file tree Collapse file tree 10 files changed +28
-19
lines changed Original file line number Diff line number Diff line change 1313 </ head >
1414 < body >
1515 < oscd-shell locale ="de "> </ oscd-shell >
16- < script type ="module " src ="index.js "> </ script >
16+ < script type ="module ">
17+ // Known issue, scoped registry polyfill doesn't load as fast as oscd-shell, causing oscs-shell to fail.
18+ // To safeguard, we await the polyfill first, then load the rest.
19+ await import ( '@webcomponents/scoped-custom-element-registry' ) ;
20+ await import ( '../dist/oscd-shell.js' ) ;
21+ await import ( './index.js' ) ;
22+ </ script >
1723
1824 < style >
1925 * {
Original file line number Diff line number Diff line change 1- import '@webcomponents/scoped-custom-element-registry' ;
2- import '../dist/oscd-shell.js' ;
1+ // import '@webcomponents/scoped-custom-element-registry';
2+ // import '../dist/oscd-shell.js';
33import OscdMenuOpen from '@omicronenergy/oscd-menu-open' ;
44import OscdMenuSave from '@omicronenergy/oscd-menu-save' ;
55import {
Original file line number Diff line number Diff line change 3838 "localize" : " lit-localize build" ,
3939 "build" : " rimraf dist && mkdir dist && npm run extract && npm run localize && npm run analyze -- --exclude dist && tsc " ,
4040 "bundle" : " rimraf dist && npm run extract && npm run localize && rollup -c rollup.config.js" ,
41- "start" : " npm run build && concurrently -k -r \" tsc --watch --preserveWatchOutput\" \" wds --open '/demo/' --node-resolve\" " ,
42- "start:bundle" : " npm run bundle && concurrently -k -r \" rollup -c rollup.config.js --watch\" \" wds --open '/dist /demo/' --watch\" " ,
41+ "start" : " npm run build && concurrently -k \" tsc --watch --preserveWatchOutput\" \" wds --open '/demo/' --node-resolve\" " ,
42+ "start:bundle" : " npm run bundle && concurrently -k -r \" rollup -c rollup.config.js --watch\" \" wds --root-dir dist --app-index demo/index.html -- open '/demo/' --watch\" " ,
4343 "test" : " npm run build && wtr --coverage --group unit" ,
4444 "test:watch" : " npm run build && concurrently -k -r \" tsc --watch --preserveWatchOutput\" \" wtr --coverage --watch --group unit\" " ,
4545 "analyze" : " cem analyze --litelement --exclude demo/* --exclude dist/* --exclude *.spec.ts --exclude *.test.ts --exclude coverage/*" ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const locales = readdirSync('src/locales').map(locale => ({
2626} ) ) ;
2727
2828export default [
29+ ...locales ,
2930 {
3031 input : 'src/oscd-shell.ts' ,
3132 output : {
@@ -39,6 +40,7 @@ export default [
3940 /** Resolve bare module imports */
4041 nodeResolve ( ) ,
4142 typescript ( ) ,
43+ importMetaAssets ( { warnOnError : true } ) ,
4244 ] ,
4345 } ,
4446 {
@@ -54,6 +56,7 @@ export default [
5456 /** Resolve bare module imports */
5557 nodeResolve ( ) ,
5658 typescript ( ) ,
59+ importMetaAssets ( { warnOnError : true } ) ,
5760 ] ,
5861 } ,
5962 {
@@ -65,20 +68,23 @@ export default [
6568 } ) ,
6669 copy ( {
6770 targets : [
68- { src : 'demo/*.*' , dest : 'dist/demo' } ,
69- // Add more patterns if you have more assets
71+ {
72+ src : 'demo/*.*' ,
73+ dest : 'dist/demo' ,
74+ ignore : [ 'demo/index.js' , 'demo/index.html' ] ,
75+ } ,
7076 ] ,
7177 verbose : true ,
7278 flatten : false ,
7379 } ) ,
7480 nodeResolve ( ) ,
7581 typescript ( demoTsconfig ) ,
76- importMetaAssets ( ) ,
82+ importMetaAssets ( { warnOnError : true } ) ,
7783 ] ,
7884 output : {
7985 dir : 'dist/demo' ,
8086 format : 'es' ,
8187 sourcemap : true ,
8288 } ,
8389 } ,
84- ] . concat ( locales ) ;
90+ ] ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
77import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js' ;
88
99import { PluginEntry } from '../oscd-shell.js' ;
10- import { LocaleTag } from '../utils/ localization.js' ;
10+ import { LocaleTag } from '../localization.js' ;
1111import { OscdElevation } from '@omicronenergy/oscd-ui/elevation/OscdElevation.js' ;
1212
1313declare global {
Original file line number Diff line number Diff line change 11import { configureLocalization } from '@lit/localize' ;
2- import { allLocales , sourceLocale , targetLocales } from '.. /locales.js' ;
2+ import { allLocales , sourceLocale , targetLocales } from './locales.js' ;
33export type LocaleTag = ( typeof allLocales ) [ number ] ;
44export type Translation = ( typeof targetLocales ) [ number ] ;
55export type Translations = Record < Translation , string > ;
@@ -19,10 +19,7 @@ const { getLocale, setLocale } =
1919 sourceLocale,
2020 targetLocales,
2121 loadLocale : _locale => {
22- return import (
23- /* @vite -ignore */ new URL ( `./locales/${ _locale } .js` , import . meta. url )
24- . href
25- ) ;
22+ return import ( new URL ( `./locales/de.js` , import . meta. url ) . href ) ;
2623 } ,
2724 } ) ;
2825
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { OscdMenu } from '@omicronenergy/oscd-ui/menu/OscdMenu.js';
88import { OscdMenuItem } from '@omicronenergy/oscd-ui/menu/OscdMenuItem.js' ;
99import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js' ;
1010
11- import { LocaleTag } from '../utils/ localization.js' ;
11+ import { LocaleTag } from '../localization.js' ;
1212
1313declare global {
1414 interface HTMLElementTagNameMap {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
88import { OscdMenu } from '@omicronenergy/oscd-ui/menu/OscdMenu.js' ;
99import { OscdMenuItem } from '@omicronenergy/oscd-ui/menu/OscdMenuItem.js' ;
1010
11- import { LocaleTag , Translation } from '../utils/ localization.js' ;
11+ import { LocaleTag , Translation } from '../localization.js' ;
1212import { PluginEntry } from '../oscd-shell.js' ;
1313
1414declare global {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import {
2020 LocaleTag ,
2121 setLocale ,
2222 Translations ,
23- } from './utils/ localization.js' ;
23+ } from './localization.js' ;
2424import { theming } from './theming.js' ;
2525import { EditorPluginsPanel } from './side-panel/editor-plugins-panel.js' ;
2626import { PluginsMenu } from './menus/plugins-menu.js' ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
88import { OscdList } from '@omicronenergy/oscd-ui/list/OscdList.js' ;
99import { OscdListItem } from '@omicronenergy/oscd-ui/list/OscdListItem.js' ;
1010
11- import { LocaleTag , Translation } from '../utils/ localization.js' ;
11+ import { LocaleTag , Translation } from '../localization.js' ;
1212import { classMap } from 'lit/directives/class-map.js' ;
1313import { PluginEntry } from '../oscd-shell.js' ;
1414
You can’t perform that action at this time.
0 commit comments