Skip to content

Commit

Permalink
trying to fix for offline compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
drkpxl committed Feb 2, 2025
1 parent e8bc6b9 commit 7dfe5aa
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 26 deletions.
4 changes: 2 additions & 2 deletions dist/printwatch-card.js

Large diffs are not rendered by default.

74 changes: 56 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"author": "Steven Hubert",
"license": "MIT",
"dependencies": {
"lit": "^2.0.0 || ^3.0.0 || ^4.0.0",
"@lit/reactive-element": "^1.0.0 || ^2.0.0 || ^3.0.0",
"lit-html": "^2.0.0 || ^3.0.0"
"lit": "^2.8.0",
"@lit/reactive-element": "^2.0.0",
"lit-html": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0 || ^8.0.0",
Expand Down
22 changes: 20 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export default {
resolve({
browser: true,
preferBuiltins: false,
extensions: ['.js', '.json']
extensions: ['.js', '.json'],
moduleDirectories: ['node_modules'],
mainFields: ['browser', 'module', 'main']
}),
commonjs(),
json({
Expand All @@ -44,7 +46,23 @@ export default {
}),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**'
exclude: 'node_modules/**',
presets: [
['@babel/preset-env', {
targets: {
browsers: [
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Safari versions',
'last 2 iOS versions',
'last 1 Android version',
'last 1 ChromeAndroid version',
'ie 11'
]
},
modules: false
}]
]
}),
terser({
format: {
Expand Down
14 changes: 13 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import PrintWatchCard from './components/printwatch-card';
import { html, css, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';

// Ensure global availability of Lit core functions
window.LitElement = LitElement;
window.html = html;
window.css = css;

// Add version and build timestamp to window for debugging
window.PRINTWATCH_VERSION = process.env.VERSION;
Expand All @@ -10,4 +17,9 @@ if (!customElements.get('printwatch-card')) {
}

// Export for potential reuse
export { PrintWatchCard };
export {
PrintWatchCard,
html,
css,
LitElement
};

0 comments on commit 7dfe5aa

Please sign in to comment.