@pinegrow/astro-module 3.0.0-beta.115 → 3.0.0-beta.117

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.cjs CHANGED
@@ -6,7 +6,7 @@ async function getViteConfiguration(moduleOptions) {
6
6
  var _a, _b, _c, _d;
7
7
  let vitePlugin;
8
8
  try {
9
- const { liveDesigner } = await Promise.resolve().then(() => _interopRequireWildcard(require("./live-designer-ZFVVYPVH.cjs")));
9
+ const { liveDesigner } = await Promise.resolve().then(() => _interopRequireWildcard(require("./live-designer-PEHWBCFL.cjs")));
10
10
  vitePlugin = liveDesigner({
11
11
  tailwindcss: {
12
12
  configPath: "tailwind.config.js",
@@ -103,10 +103,58 @@ function createIntegration(moduleOptions) {
103
103
  return {
104
104
  name: "@pinegrow/astro-module",
105
105
  hooks: {
106
- "astro:config:setup": async ({ updateConfig }) => {
106
+ "astro:config:setup": async ({ updateConfig, injectScript }) => {
107
107
  updateConfig({
108
108
  vite: await getViteConfiguration(moduleOptions)
109
109
  });
110
+ const addons = [
111
+ {
112
+ name: "pgia",
113
+ resources: [
114
+ {
115
+ parentResource: "src/assets/pgia",
116
+ injectTo: "head-inline",
117
+ tag: "script",
118
+ children: `
119
+ /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
120
+ },
121
+ {
122
+ parentResource: "src/assets/pgia",
123
+ injectTo: "page",
124
+ tag: "script",
125
+ children: 'import "@/assets/pgia/lib/index.js"'
126
+ }
127
+ ]
128
+ }
129
+ ];
130
+ const injects = [];
131
+ addons.forEach((addon) => {
132
+ addon.resources.forEach((resource) => {
133
+ if (!resource.condition) {
134
+ try {
135
+ let parentResourceExists = true;
136
+ if (resource.parentResource) {
137
+ const projectRoot = process.cwd();
138
+ const resourcePath = _path2.default.resolve(projectRoot, resource.parentResource);
139
+ parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
140
+ }
141
+ if (parentResourceExists) {
142
+ injects.push({
143
+ injectTo: resource.injectTo,
144
+ tag: resource.tag,
145
+ attrs: resource.attrs,
146
+ children: resource.children
147
+ });
148
+ }
149
+ } catch (err) {
150
+ console.log(err);
151
+ }
152
+ }
153
+ });
154
+ });
155
+ injects.filter((inject) => inject.tag === "script").forEach((inject) => {
156
+ injectScript(inject.injectTo, inject.children);
157
+ });
110
158
  },
111
159
  "astro:server:setup": ({ server }) => {
112
160
  const liveDesignerPluginIndex = server.config.plugins.findIndex(
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ async function getViteConfiguration(moduleOptions) {
6
6
  var _a, _b, _c, _d;
7
7
  let vitePlugin;
8
8
  try {
9
- const { liveDesigner } = await import("./live-designer-LATOGT4K.js");
9
+ const { liveDesigner } = await import("./live-designer-TIVRM3WS.js");
10
10
  vitePlugin = liveDesigner({
11
11
  tailwindcss: {
12
12
  configPath: "tailwind.config.js",
@@ -103,10 +103,58 @@ function createIntegration(moduleOptions) {
103
103
  return {
104
104
  name: "@pinegrow/astro-module",
105
105
  hooks: {
106
- "astro:config:setup": async ({ updateConfig }) => {
106
+ "astro:config:setup": async ({ updateConfig, injectScript }) => {
107
107
  updateConfig({
108
108
  vite: await getViteConfiguration(moduleOptions)
109
109
  });
110
+ const addons = [
111
+ {
112
+ name: "pgia",
113
+ resources: [
114
+ {
115
+ parentResource: "src/assets/pgia",
116
+ injectTo: "head-inline",
117
+ tag: "script",
118
+ children: `
119
+ /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
120
+ },
121
+ {
122
+ parentResource: "src/assets/pgia",
123
+ injectTo: "page",
124
+ tag: "script",
125
+ children: 'import "@/assets/pgia/lib/index.js"'
126
+ }
127
+ ]
128
+ }
129
+ ];
130
+ const injects = [];
131
+ addons.forEach((addon) => {
132
+ addon.resources.forEach((resource) => {
133
+ if (!resource.condition) {
134
+ try {
135
+ let parentResourceExists = true;
136
+ if (resource.parentResource) {
137
+ const projectRoot = process.cwd();
138
+ const resourcePath = path.resolve(projectRoot, resource.parentResource);
139
+ parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
140
+ }
141
+ if (parentResourceExists) {
142
+ injects.push({
143
+ injectTo: resource.injectTo,
144
+ tag: resource.tag,
145
+ attrs: resource.attrs,
146
+ children: resource.children
147
+ });
148
+ }
149
+ } catch (err) {
150
+ console.log(err);
151
+ }
152
+ }
153
+ });
154
+ });
155
+ injects.filter((inject) => inject.tag === "script").forEach((inject) => {
156
+ injectScript(inject.injectTo, inject.children);
157
+ });
110
158
  },
111
159
  "astro:server:setup": ({ server }) => {
112
160
  const liveDesignerPluginIndex = server.config.plugins.findIndex(
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/live-designer.mjs
2
+ var _viteplugin = require('@pinegrow/vite-plugin'); var _viteplugin2 = _interopRequireDefault(_viteplugin);
3
+ var liveDesigner = _viteplugin2.default.liveDesigner;
4
+
5
+
6
+ exports.liveDesigner = liveDesigner;
7
+ /*! import { liveDesigner } from '@pinegrow/vite-plugin/dev' */
@@ -0,0 +1,7 @@
1
+ // src/live-designer.mjs
2
+ import pkg from "@pinegrow/vite-plugin";
3
+ var liveDesigner = pkg.liveDesigner;
4
+ export {
5
+ liveDesigner
6
+ };
7
+ /*! import { liveDesigner } from '@pinegrow/vite-plugin/dev' */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/astro-module",
3
- "version": "3.0.0-beta.115",
3
+ "version": "3.0.0-beta.117",
4
4
  "description": "Pinegrow Astro Module",
5
5
  "author": "Pinegrow (http://pinegrow.com/)",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "increment-beta-version": "npm version prerelease --preid=beta"
34
34
  },
35
35
  "dependencies": {
36
- "@pinegrow/vite-plugin": "3.0.0-beta.115",
36
+ "@pinegrow/vite-plugin": "3.0.0-beta.117",
37
37
  "unplugin-vue-components": "^0.24.1",
38
38
  "unplugin-auto-import": "^0.15.2"
39
39
  },