xpine 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -694,8 +694,8 @@ var plugin2 = (opts = {}) => {
694
694
  },
695
695
  OnceExit(root) {
696
696
  root.append([
697
- `body:before {`,
698
- `content: "default"; display: none; visibility: hidden;`,
697
+ `:root {`,
698
+ `--active-breakpoint: "default";`,
699
699
  `}`
700
700
  ].join(""));
701
701
  const nodeValuesMapped = nodeValues.sort((a, b) => {
@@ -703,8 +703,8 @@ var plugin2 = (opts = {}) => {
703
703
  }).map(({ breakpoint, value }) => {
704
704
  return [
705
705
  `@media (min-width: ${value}) {`,
706
- `body:before {`,
707
- `content: "${breakpoint}";`,
706
+ `:root {`,
707
+ `--active-breakpoint: "${breakpoint}";`,
708
708
  `}`,
709
709
  `}`
710
710
  ].join("");
@@ -503,8 +503,8 @@ var plugin2 = (opts = {}) => {
503
503
  },
504
504
  OnceExit(root) {
505
505
  root.append([
506
- `body:before {`,
507
- `content: "default"; display: none; visibility: hidden;`,
506
+ `:root {`,
507
+ `--active-breakpoint: "default";`,
508
508
  `}`
509
509
  ].join(""));
510
510
  const nodeValuesMapped = nodeValues.sort((a, b) => {
@@ -512,8 +512,8 @@ var plugin2 = (opts = {}) => {
512
512
  }).map(({ breakpoint, value }) => {
513
513
  return [
514
514
  `@media (min-width: ${value}) {`,
515
- `body:before {`,
516
- `content: "${breakpoint}";`,
515
+ `:root {`,
516
+ `--active-breakpoint: "${breakpoint}";`,
517
517
  `}`,
518
518
  `}`
519
519
  ].join("");
@@ -510,8 +510,8 @@ var plugin2 = (opts = {}) => {
510
510
  },
511
511
  OnceExit(root) {
512
512
  root.append([
513
- `body:before {`,
514
- `content: "default"; display: none; visibility: hidden;`,
513
+ `:root {`,
514
+ `--active-breakpoint: "default";`,
515
515
  `}`
516
516
  ].join(""));
517
517
  const nodeValuesMapped = nodeValues.sort((a, b) => {
@@ -519,8 +519,8 @@ var plugin2 = (opts = {}) => {
519
519
  }).map(({ breakpoint, value }) => {
520
520
  return [
521
521
  `@media (min-width: ${value}) {`,
522
- `body:before {`,
523
- `content: "${breakpoint}";`,
522
+ `:root {`,
523
+ `--active-breakpoint: "${breakpoint}";`,
524
524
  `}`,
525
525
  `}`
526
526
  ].join("");
@@ -169,7 +169,14 @@ function replaceAttributesOnDocumentBody(dom) {
169
169
  }
170
170
  }
171
171
  async function handleBackButton() {
172
+ if (window.xpineIgnorePopState) return;
172
173
  await getNewPageContent(window.history.state?.targetHref || window.location.href);
174
+ const event = new CustomEvent("spa-popstate", {
175
+ detail: {
176
+ href: window.history.state?.targetHref || window.location.href
177
+ }
178
+ });
179
+ window.dispatchEvent(event);
173
180
  }
174
181
  function isRelativeURL(url) {
175
182
  if (typeof url !== "string") return false;
@@ -201,7 +208,7 @@ function handleBreakpointEvents() {
201
208
  let lastSentBreakpoint = "";
202
209
  let initial = true;
203
210
  return function() {
204
- const breakpoint = window.getComputedStyle(document.body, ":before")?.content?.replace(/[\'\"]/g, "") || "";
211
+ const breakpoint = window.getComputedStyle(document.documentElement).getPropertyValue("--active-breakpoint")?.replace(/[\'\"]/g, "")?.trim() || "";
205
212
  if (breakpoint !== lastSentBreakpoint) {
206
213
  const event = new CustomEvent("breakpoint-change", {
207
214
  detail: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpine",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-secrets-manager": "^3.758.0",