@pure-ds/core 0.5.16 → 0.5.18
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/package.json
CHANGED
|
@@ -335,10 +335,8 @@ settingsBtn.addEventListener('click', () => {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
function buildPdsConfig() {
|
|
338
|
-
return `
|
|
339
|
-
|
|
340
|
-
const defaultEnhancers = Array.isArray(PDS.defaultEnhancers)
|
|
341
|
-
? PDS.defaultEnhancers
|
|
338
|
+
return `const defaultEnhancers = Array.isArray(globalThis.PDS?.defaultEnhancers)
|
|
339
|
+
? globalThis.PDS.defaultEnhancers
|
|
342
340
|
: [];
|
|
343
341
|
|
|
344
342
|
export const config = {
|
|
@@ -156,9 +156,45 @@ async function ensurePdsConfig(consumerRoot, force = false) {
|
|
|
156
156
|
// File doesn't exist, create it
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const defaultConfig = `
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
const defaultConfig = `const defaultEnhancers = Array.isArray(globalThis.PDS?.defaultEnhancers)
|
|
160
|
+
? globalThis.PDS.defaultEnhancers
|
|
161
|
+
: [];
|
|
162
|
+
|
|
163
|
+
export const config = {
|
|
164
|
+
mode: "static",
|
|
165
|
+
preset: "social-feed",
|
|
166
|
+
|
|
167
|
+
autoDefine: {
|
|
168
|
+
predefine: ["pds-icon", "pds-drawer", "pds-toaster"],
|
|
169
|
+
|
|
170
|
+
// Custom component paths
|
|
171
|
+
mapper: (tag) => {
|
|
172
|
+
if (tag.startsWith("my-")) return "/assets/my/\${tag}.js";
|
|
173
|
+
|
|
174
|
+
// Return nothing to use PDS default mapping
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
enhancers: [
|
|
178
|
+
...defaultEnhancers,
|
|
179
|
+
{
|
|
180
|
+
selector: ".hero",
|
|
181
|
+
description: "Adds tooltip on hover",
|
|
182
|
+
run: (element) => {
|
|
183
|
+
// make the border-gradient in PDS rotate slowly
|
|
184
|
+
let angle = 135;
|
|
185
|
+
const speed = 0.5; // degrees per frame (~30 degrees/second at 60fps)
|
|
186
|
+
|
|
187
|
+
function animate() {
|
|
188
|
+
angle = (angle + speed) % 360;
|
|
189
|
+
element.style.setProperty("--gradient-angle", \`\${angle}deg\`);
|
|
190
|
+
requestAnimationFrame(animate);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
animate();
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
162
198
|
|
|
163
199
|
// Uncomment to override preset design tokens:
|
|
164
200
|
// design: {
|
|
@@ -177,35 +213,8 @@ async function ensurePdsConfig(consumerRoot, force = false) {
|
|
|
177
213
|
// baseUnit: 8,
|
|
178
214
|
// scaleRatio: 1.5
|
|
179
215
|
// }
|
|
180
|
-
// },
|
|
181
|
-
|
|
182
|
-
// Uncomment to add custom progressive enhancers:
|
|
183
|
-
// enhancers: [
|
|
184
|
-
// {
|
|
185
|
-
// selector: '[data-tooltip]',
|
|
186
|
-
// description: 'Adds tooltip on hover',
|
|
187
|
-
// run: (element) => {
|
|
188
|
-
// const text = element.dataset.tooltip;
|
|
189
|
-
// element.addEventListener('mouseenter', () => {
|
|
190
|
-
// // Show tooltip implementation
|
|
191
|
-
// });
|
|
192
|
-
// }
|
|
193
|
-
// }
|
|
194
|
-
// ],
|
|
195
|
-
|
|
196
|
-
// Uncomment to customize lazy-loaded web components:
|
|
197
|
-
// autoDefine: {
|
|
198
|
-
// baseURL: '/pds/components/',
|
|
199
|
-
// predefine: ['pds-icon', 'pds-drawer', 'pds-toaster'],
|
|
200
|
-
//
|
|
201
|
-
// // Custom component paths
|
|
202
|
-
// mapper: (tag) => {
|
|
203
|
-
// if (tag.startsWith('my-')) {
|
|
204
|
-
// return \`/components/\${tag}.js\`;
|
|
205
|
-
// }
|
|
206
|
-
// // Return nothing to use PDS default mapping
|
|
207
|
-
// }
|
|
208
216
|
// }
|
|
217
|
+
|
|
209
218
|
};
|
|
210
219
|
`;
|
|
211
220
|
|