@prosefly/astro-components 0.2.1 → 0.4.0

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/README.md CHANGED
@@ -104,25 +104,25 @@ import '@prosefly/astro-components/markdown/image-gallery.css';
104
104
 
105
105
  ## Styling
106
106
 
107
- Consumers can theme the components with `--pl-*` custom properties:
108
-
109
- - `--pl-text-strong`
110
- - `--pl-text`
111
- - `--pl-text-muted`
112
- - `--pl-background`
113
- - `--pl-surface`
114
- - `--pl-accent`
115
- - `--pl-accent-soft`
116
- - `--pl-accent-contrast`
117
- - `--pl-{info|success|warning|danger}`
118
- - `--pl-{info|success|warning|danger}-soft`
119
- - `--pl-{info|success|warning|danger}-ink`
120
- - `--pl-{info|success|warning|danger}-contrast`
121
- - `--pl-callout-{note|tip|warning|danger}-{color|ink|bg}`
122
- - `--pl-border-subtle`
123
- - `--pl-font-sans`
124
- - `--pl-font-mono`
125
- - `--pl-radius-sm`
126
- - `--pl-radius-md`
127
- - `--pl-radius-lg`
128
- - `--pl-radius-full`
107
+ Consumers can theme the components with `--pf-*` custom properties:
108
+
109
+ - `--pf-text-strong`
110
+ - `--pf-text`
111
+ - `--pf-text-muted`
112
+ - `--pf-background`
113
+ - `--pf-surface`
114
+ - `--pf-accent`
115
+ - `--pf-accent-soft`
116
+ - `--pf-accent-contrast`
117
+ - `--pf-{info|success|warning|danger}`
118
+ - `--pf-{info|success|warning|danger}-soft`
119
+ - `--pf-{info|success|warning|danger}-ink`
120
+ - `--pf-{info|success|warning|danger}-contrast`
121
+ - `--pf-callout-{note|tip|warning|danger}-{color|ink|bg}`
122
+ - `--pf-border-subtle`
123
+ - `--pf-font-sans`
124
+ - `--pf-font-mono`
125
+ - `--pf-radius-sm`
126
+ - `--pf-radius-md`
127
+ - `--pf-radius-lg`
128
+ - `--pf-radius-full`
@@ -1,6 +1,6 @@
1
1
  export {};
2
2
  function getItems(root) {
3
- return [...root.querySelectorAll(':scope > [data-pl-accordion]')].filter((item) => item instanceof HTMLDetailsElement);
3
+ return [...root.querySelectorAll(':scope > [data-pf-accordion]')].filter((item) => item instanceof HTMLDetailsElement);
4
4
  }
5
5
  function closeSiblings(root, activeItem) {
6
6
  if (root.hasAttribute('data-multiple'))
@@ -11,7 +11,7 @@ function closeSiblings(root, activeItem) {
11
11
  }
12
12
  }
13
13
  function openItem(item) {
14
- const root = item.closest('[data-pl-accordions]');
14
+ const root = item.closest('[data-pf-accordions]');
15
15
  item.open = true;
16
16
  if (root)
17
17
  closeSiblings(root, item);
@@ -21,17 +21,17 @@ function openHashTarget() {
21
21
  return;
22
22
  const id = decodeURIComponent(location.hash.slice(1));
23
23
  const item = document.getElementById(id);
24
- if (item instanceof HTMLDetailsElement && item.matches('[data-pl-accordion]')) {
24
+ if (item instanceof HTMLDetailsElement && item.matches('[data-pf-accordion]')) {
25
25
  openItem(item);
26
26
  }
27
27
  }
28
28
  if (!window.__proseflyAccordionsInit) {
29
29
  window.__proseflyAccordionsInit = () => {
30
- document.querySelectorAll('[data-pl-accordions]').forEach((root) => {
31
- if (!(root instanceof HTMLElement) || root.dataset.plAccordionsReady === 'true') {
30
+ document.querySelectorAll('[data-pf-accordions]').forEach((root) => {
31
+ if (!(root instanceof HTMLElement) || root.dataset.pfAccordionsReady === 'true') {
32
32
  return;
33
33
  }
34
- root.dataset.plAccordionsReady = 'true';
34
+ root.dataset.pfAccordionsReady = 'true';
35
35
  let defaultValues = [];
36
36
  try {
37
37
  defaultValues = JSON.parse(root.getAttribute('data-default-values') || '[]');
@@ -44,7 +44,7 @@ if (!window.__proseflyAccordionsInit) {
44
44
  openItem(item);
45
45
  }
46
46
  item.addEventListener('click', (event) => {
47
- if (!(event.target instanceof Element) || !event.target.closest('[data-pl-accordion-trigger]')) {
47
+ if (!(event.target instanceof Element) || !event.target.closest('[data-pf-accordion-trigger]')) {
48
48
  return;
49
49
  }
50
50
  if (item.getAttribute('data-disabled') === 'true') {
@@ -29,7 +29,7 @@ function getItemLeft(track, item) {
29
29
  return item.getBoundingClientRect().left - track.getBoundingClientRect().left + track.scrollLeft;
30
30
  }
31
31
  function scrollToAdjacentItem(track, direction) {
32
- const items = [...track.querySelectorAll('.pl-image-gallery__item')].filter((item) => item instanceof HTMLElement);
32
+ const items = [...track.querySelectorAll('.pf-image-gallery__item')].filter((item) => item instanceof HTMLElement);
33
33
  const currentLeft = track.scrollLeft;
34
34
  const positions = items.map((item) => getItemLeft(track, item));
35
35
  const target = direction === 'previous'
@@ -41,7 +41,7 @@ function scrollToAdjacentItem(track, direction) {
41
41
  });
42
42
  }
43
43
  function measureGallery(gallery, track) {
44
- const items = [...track.querySelectorAll('.pl-image-gallery__item')].filter((item) => item instanceof HTMLElement);
44
+ const items = [...track.querySelectorAll('.pf-image-gallery__item')].filter((item) => item instanceof HTMLElement);
45
45
  const images = items
46
46
  .map((item) => item.querySelector('img'))
47
47
  .filter((image) => image instanceof HTMLImageElement);
@@ -57,14 +57,14 @@ function measureGallery(gallery, track) {
57
57
  const resolvedRatios = ratios;
58
58
  const styles = getComputedStyle(track);
59
59
  const gap = Number.parseFloat(styles.columnGap || styles.gap || '0') || 0;
60
- const previewWidth = resolveCssLength(getComputedStyle(gallery).getPropertyValue('--pl-image-gallery-preview-width'), gallery);
60
+ const previewWidth = resolveCssLength(getComputedStyle(gallery).getPropertyValue('--pf-image-gallery-preview-width'), gallery);
61
61
  const firstRatio = resolvedRatios[0];
62
62
  const targetHeight = Math.max((track.clientWidth - previewWidth - gap) / firstRatio, 1);
63
- gallery.style.setProperty('--pl-image-gallery-height', `${targetHeight.toFixed(2)}px`);
64
- gallery.dataset.plImageGalleryMeasured = 'true';
63
+ gallery.style.setProperty('--pf-image-gallery-height', `${targetHeight.toFixed(2)}px`);
64
+ gallery.dataset.pfImageGalleryMeasured = 'true';
65
65
  items.forEach((item, index) => {
66
66
  const ratio = resolvedRatios[index];
67
- item.style.setProperty('--pl-image-gallery-ratio', ratio.toFixed(5));
67
+ item.style.setProperty('--pf-image-gallery-ratio', ratio.toFixed(5));
68
68
  item.style.height = `${targetHeight.toFixed(2)}px`;
69
69
  item.style.width = `${Math.max(targetHeight * ratio, 1).toFixed(2)}px`;
70
70
  });
@@ -72,25 +72,25 @@ function measureGallery(gallery, track) {
72
72
  if (typeof window !== 'undefined') {
73
73
  if (!window.__proseflyImageGalleryInit) {
74
74
  window.__proseflyImageGalleryInit = () => {
75
- document.querySelectorAll('[data-pl-image-gallery]').forEach((gallery) => {
76
- if (!(gallery instanceof HTMLElement) || gallery.dataset.plImageGalleryReady) {
75
+ document.querySelectorAll('[data-pf-image-gallery]').forEach((gallery) => {
76
+ if (!(gallery instanceof HTMLElement) || gallery.dataset.pfImageGalleryReady) {
77
77
  return;
78
78
  }
79
- const track = gallery.querySelector('[data-pl-image-gallery-track]');
79
+ const track = gallery.querySelector('[data-pf-image-gallery-track]');
80
80
  if (!(track instanceof HTMLElement)) {
81
81
  return;
82
82
  }
83
- gallery.dataset.plImageGalleryReady = 'true';
83
+ gallery.dataset.pfImageGalleryReady = 'true';
84
84
  const measure = () => measureGallery(gallery, track);
85
85
  const images = [...track.querySelectorAll('img')].filter((image) => image instanceof HTMLImageElement);
86
86
  Promise.all(images.map(imageReady)).then(measure);
87
87
  new ResizeObserver(measure).observe(track);
88
- gallery.querySelectorAll('[data-pl-image-gallery-button]').forEach((button) => {
88
+ gallery.querySelectorAll('[data-pf-image-gallery-button]').forEach((button) => {
89
89
  if (!(button instanceof HTMLButtonElement)) {
90
90
  return;
91
91
  }
92
92
  button.addEventListener('click', () => {
93
- const direction = button.getAttribute('data-pl-image-gallery-button');
93
+ const direction = button.getAttribute('data-pf-image-gallery-button');
94
94
  scrollToAdjacentItem(track, direction === 'previous' ? 'previous' : 'next');
95
95
  });
96
96
  });
@@ -3,7 +3,7 @@ function getStoredLabel(syncKey) {
3
3
  if (!syncKey)
4
4
  return undefined;
5
5
  try {
6
- return localStorage.getItem(`pl-tabs:${syncKey}`) ?? undefined;
6
+ return localStorage.getItem(`pf-tabs:${syncKey}`) ?? undefined;
7
7
  }
8
8
  catch {
9
9
  return undefined;
@@ -13,7 +13,7 @@ function storeLabel(syncKey, label) {
13
13
  if (!syncKey || !label)
14
14
  return;
15
15
  try {
16
- localStorage.setItem(`pl-tabs:${syncKey}`, label);
16
+ localStorage.setItem(`pf-tabs:${syncKey}`, label);
17
17
  }
18
18
  catch {
19
19
  // Ignore storage failures in restricted browsing contexts.
@@ -27,26 +27,26 @@ async function writeClipboard(text) {
27
27
  throw new Error('Clipboard API is not available.');
28
28
  }
29
29
  function setCopyState(button, copied) {
30
- const copyIcon = button.querySelector('[data-pl-tabs-copy-icon="copy"]');
31
- const checkIcon = button.querySelector('[data-pl-tabs-copy-icon="check"]');
30
+ const copyIcon = button.querySelector('[data-pf-tabs-copy-icon="copy"]');
31
+ const checkIcon = button.querySelector('[data-pf-tabs-copy-icon="check"]');
32
32
  copyIcon?.toggleAttribute('hidden', copied);
33
33
  checkIcon?.toggleAttribute('hidden', !copied);
34
34
  button.setAttribute('aria-label', copied ? 'Copied' : 'Copy code');
35
35
  button.setAttribute('title', copied ? 'Copied' : 'Copy code');
36
36
  }
37
37
  function getActiveCode(root) {
38
- const activePanel = root.querySelector('.pl-tabs__panel:not([hidden])');
38
+ const activePanel = root.querySelector('.pf-tabs__panel:not([hidden])');
39
39
  const code = activePanel?.querySelector('pre code');
40
40
  return code?.textContent ?? '';
41
41
  }
42
42
  function setActiveIcon(root, panelId) {
43
- const iconContainer = root.querySelector('.pl-tabs__active-icons');
44
- const icons = [...root.querySelectorAll('[data-pl-tabs-icon-for]')];
43
+ const iconContainer = root.querySelector('.pf-tabs__active-icons');
44
+ const icons = [...root.querySelectorAll('[data-pf-tabs-icon-for]')];
45
45
  if (!(iconContainer instanceof HTMLElement))
46
46
  return;
47
47
  let hasActiveIcon = false;
48
48
  icons.forEach((icon) => {
49
- const isActive = icon.getAttribute('data-pl-tabs-icon-for') === panelId;
49
+ const isActive = icon.getAttribute('data-pf-tabs-icon-for') === panelId;
50
50
  icon.toggleAttribute('hidden', !isActive);
51
51
  hasActiveIcon ||= isActive;
52
52
  });
@@ -56,8 +56,8 @@ function activate(root, trigger, options = {}) {
56
56
  const panelId = trigger.getAttribute('data-tab-panel');
57
57
  const label = trigger.getAttribute('data-tab-label');
58
58
  const syncKey = root.getAttribute('data-sync-key');
59
- const triggers = [...root.querySelectorAll('[data-pl-tabs-trigger]')];
60
- const panels = [...root.querySelectorAll('.pl-tabs__panel')];
59
+ const triggers = [...root.querySelectorAll('[data-pf-tabs-trigger]')];
60
+ const panels = [...root.querySelectorAll('.pf-tabs__panel')];
61
61
  triggers.forEach((button) => {
62
62
  const isActive = button === trigger;
63
63
  button.setAttribute('aria-selected', isActive ? 'true' : 'false');
@@ -77,12 +77,12 @@ function activate(root, trigger, options = {}) {
77
77
  if (!syncKey || !label) {
78
78
  return;
79
79
  }
80
- document.querySelectorAll('[data-pl-tabs]').forEach((otherRoot) => {
80
+ document.querySelectorAll('[data-pf-tabs]').forEach((otherRoot) => {
81
81
  if (otherRoot === root || otherRoot.getAttribute('data-sync-key') !== syncKey) {
82
82
  return;
83
83
  }
84
84
  const matchingTrigger = [
85
- ...otherRoot.querySelectorAll('[data-pl-tabs-trigger]'),
85
+ ...otherRoot.querySelectorAll('[data-pf-tabs-trigger]'),
86
86
  ].find((button) => button.getAttribute('data-tab-label') === label);
87
87
  if (matchingTrigger) {
88
88
  activate(otherRoot, matchingTrigger, { persist: false });
@@ -91,11 +91,11 @@ function activate(root, trigger, options = {}) {
91
91
  }
92
92
  if (!window.__proseflyTabsInit) {
93
93
  window.__proseflyTabsInit = () => {
94
- document.querySelectorAll('[data-pl-tabs]').forEach((root) => {
95
- if (root instanceof HTMLElement && root.dataset.plTabsReady === 'true') {
94
+ document.querySelectorAll('[data-pf-tabs]').forEach((root) => {
95
+ if (root instanceof HTMLElement && root.dataset.pfTabsReady === 'true') {
96
96
  return;
97
97
  }
98
- const triggers = [...root.querySelectorAll('[data-pl-tabs-trigger]')];
98
+ const triggers = [...root.querySelectorAll('[data-pf-tabs-trigger]')];
99
99
  const syncKey = root.getAttribute('data-sync-key');
100
100
  const storedLabel = getStoredLabel(syncKey);
101
101
  const storedTrigger = storedLabel
@@ -105,7 +105,7 @@ if (!window.__proseflyTabsInit) {
105
105
  triggers.find((button) => button.getAttribute('aria-selected') === 'true') ??
106
106
  triggers[0];
107
107
  if (root instanceof HTMLElement) {
108
- root.dataset.plTabsReady = 'true';
108
+ root.dataset.pfTabsReady = 'true';
109
109
  }
110
110
  if (selectedTrigger) {
111
111
  activate(root, selectedTrigger, { persist: false });
@@ -133,7 +133,7 @@ if (!window.__proseflyTabsInit) {
133
133
  activate(root, nextTrigger, { focus: true });
134
134
  });
135
135
  });
136
- root.querySelectorAll('[data-pl-tabs-copy]').forEach((button) => {
136
+ root.querySelectorAll('[data-pf-tabs-copy]').forEach((button) => {
137
137
  if (!(button instanceof HTMLButtonElement)) {
138
138
  return;
139
139
  }
@@ -0,0 +1,3 @@
1
+ import type { RemarkPlugin } from '@astrojs/markdown-remark';
2
+ export declare const remarkCalloutDirectives: RemarkPlugin;
3
+ //# sourceMappingURL=callout-directives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callout-directives.d.ts","sourceRoot":"","sources":["../../src/markdown/callout-directives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoC7D,eAAO,MAAM,uBAAuB,EAAE,YA0BrC,CAAC"}
@@ -0,0 +1,130 @@
1
+ import remarkDirective from 'remark-directive';
2
+ const importStatement = "import { Callout as ProseflyDirectiveCallout } from '@prosefly/astro-components';";
3
+ const calloutTypes = new Map([
4
+ ['caution', 'warning'],
5
+ ['danger', 'danger'],
6
+ ['note', 'note'],
7
+ ['tip', 'tip'],
8
+ ['warning', 'warning'],
9
+ ]);
10
+ export const remarkCalloutDirectives = function () {
11
+ this.use(remarkDirective);
12
+ return (tree) => {
13
+ const root = tree;
14
+ let transformed = false;
15
+ visitChildren(root, (node, parent, index) => {
16
+ if (!parent?.children ||
17
+ index === undefined ||
18
+ !isCalloutDirective(node)) {
19
+ return;
20
+ }
21
+ parent.children[index] = createCalloutNode(node);
22
+ transformed = true;
23
+ });
24
+ if (transformed && !hasCalloutDirectiveImport(root)) {
25
+ root.children.unshift(createImportNode());
26
+ }
27
+ };
28
+ };
29
+ function visitChildren(node, visitor, parent, index) {
30
+ visitor(node, parent, index);
31
+ if (!node.children) {
32
+ return;
33
+ }
34
+ node.children.forEach((child, childIndex) => {
35
+ visitChildren(child, visitor, node, childIndex);
36
+ });
37
+ }
38
+ function isCalloutDirective(node) {
39
+ return ((node.type === 'containerDirective' || node.type === 'leafDirective') &&
40
+ typeof node.name === 'string' &&
41
+ calloutTypes.has(node.name) &&
42
+ Array.isArray(node.children));
43
+ }
44
+ function createCalloutNode(node) {
45
+ const { title, children } = getCalloutContent(node);
46
+ const type = calloutTypes.get(node.name) ?? 'note';
47
+ const attributes = [
48
+ {
49
+ type: 'mdxJsxAttribute',
50
+ name: 'type',
51
+ value: type,
52
+ },
53
+ ];
54
+ if (title) {
55
+ attributes.push({
56
+ type: 'mdxJsxAttribute',
57
+ name: 'title',
58
+ value: title,
59
+ });
60
+ }
61
+ return {
62
+ type: 'mdxJsxFlowElement',
63
+ name: 'ProseflyDirectiveCallout',
64
+ attributes,
65
+ children,
66
+ };
67
+ }
68
+ function getCalloutContent(node) {
69
+ const title = getAttributeTitle(node) ?? getDirectiveLabel(node);
70
+ const children = title
71
+ ? node.children.filter((child) => !isDirectiveLabel(child))
72
+ : node.children;
73
+ return { children, title };
74
+ }
75
+ function getAttributeTitle(node) {
76
+ const title = node.attributes?.title;
77
+ return typeof title === 'string' && title.trim() ? title : undefined;
78
+ }
79
+ function getDirectiveLabel(node) {
80
+ const label = node.children.find(isDirectiveLabel);
81
+ if (!label?.children) {
82
+ return undefined;
83
+ }
84
+ const text = label.children.map(getPlainText).join('').trim();
85
+ return text || undefined;
86
+ }
87
+ function isDirectiveLabel(node) {
88
+ return node.type === 'paragraph' && node.data?.directiveLabel === true;
89
+ }
90
+ function getPlainText(node) {
91
+ if (typeof node.value === 'string') {
92
+ return node.value;
93
+ }
94
+ return node.children?.map(getPlainText).join('') ?? '';
95
+ }
96
+ function createImportNode() {
97
+ return {
98
+ type: 'mdxjsEsm',
99
+ value: importStatement,
100
+ data: {
101
+ estree: {
102
+ type: 'Program',
103
+ sourceType: 'module',
104
+ body: [
105
+ {
106
+ type: 'ImportDeclaration',
107
+ specifiers: [
108
+ {
109
+ type: 'ImportSpecifier',
110
+ imported: { type: 'Identifier', name: 'Callout' },
111
+ local: { type: 'Identifier', name: 'ProseflyDirectiveCallout' },
112
+ },
113
+ ],
114
+ source: {
115
+ type: 'Literal',
116
+ value: '@prosefly/astro-components',
117
+ raw: "'@prosefly/astro-components'",
118
+ },
119
+ },
120
+ ],
121
+ },
122
+ },
123
+ };
124
+ }
125
+ function hasCalloutDirectiveImport(tree) {
126
+ return tree.children.some((node) => node.type === 'mdxjsEsm' &&
127
+ typeof node.value === 'string' &&
128
+ node.value.includes('ProseflyDirectiveCallout'));
129
+ }
130
+ //# sourceMappingURL=callout-directives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callout-directives.js","sourceRoot":"","sources":["../../src/markdown/callout-directives.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAE/C,MAAM,eAAe,GACnB,mFAAmF,CAAC;AAEtF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,KAAK,EAAE,KAAK,CAAC;IACd,CAAC,SAAS,EAAE,SAAS,CAAC;CACvB,CAAC,CAAC;AAwBH,MAAM,CAAC,MAAM,uBAAuB,GAAiB;IAGnD,IAAI,CAAC,GAAG,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S,EAAE;gCACjD,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,0BAA0B,EAAE;6BAChE;yBACF;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,SAAS;4BACf,KAAK,EAAE,4BAA4B;4BACnC,GAAG,EAAE,8BAA8B;yBACpC;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAc;IAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CACvB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,KAAK,UAAU;QACxB,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAClD,CAAC;AACJ,CAAC"}
@@ -41,7 +41,7 @@ function createImageGallery(images) {
41
41
  type: 'element',
42
42
  tagName: 'figure',
43
43
  properties: {
44
- className: ['pl-image-gallery'],
44
+ className: ['pf-image-gallery'],
45
45
  dataImageCount: String(imageCount),
46
46
  },
47
47
  children: images,
@@ -51,9 +51,9 @@ function createImageGallery(images) {
51
51
  type: 'element',
52
52
  tagName: 'figure',
53
53
  properties: {
54
- className: ['pl-image-gallery'],
54
+ className: ['pf-image-gallery'],
55
55
  dataImageCount: String(imageCount),
56
- dataPlImageGallery: '',
56
+ dataPfImageGallery: '',
57
57
  },
58
58
  children: [
59
59
  createGalleryButton('previous'),
@@ -61,8 +61,8 @@ function createImageGallery(images) {
61
61
  type: 'element',
62
62
  tagName: 'div',
63
63
  properties: {
64
- className: ['pl-image-gallery__track'],
65
- dataPlImageGalleryTrack: '',
64
+ className: ['pf-image-gallery__track'],
65
+ dataPfImageGalleryTrack: '',
66
66
  },
67
67
  children: images.map(createGalleryItem),
68
68
  },
@@ -75,7 +75,7 @@ function createGalleryItem(image) {
75
75
  type: 'element',
76
76
  tagName: 'span',
77
77
  properties: {
78
- className: ['pl-image-gallery__item'],
78
+ className: ['pf-image-gallery__item'],
79
79
  },
80
80
  children: [image],
81
81
  };
@@ -86,8 +86,8 @@ function createGalleryButton(direction) {
86
86
  tagName: 'button',
87
87
  properties: {
88
88
  ariaLabel: direction === 'previous' ? 'Previous image' : 'Next image',
89
- className: ['pl-image-gallery__button'],
90
- dataPlImageGalleryButton: direction,
89
+ className: ['pf-image-gallery__button'],
90
+ dataPfImageGalleryButton: direction,
91
91
  type: 'button',
92
92
  },
93
93
  children: [createChevronIcon(direction)],
@@ -99,7 +99,7 @@ function createChevronIcon(direction) {
99
99
  tagName: 'svg',
100
100
  properties: {
101
101
  ariaHidden: 'true',
102
- className: ['pl-image-gallery__button-icon'],
102
+ className: ['pf-image-gallery__button-icon'],
103
103
  fill: 'none',
104
104
  height: '20',
105
105
  stroke: 'currentColor',
@@ -1,19 +1,21 @@
1
- .pl-image-gallery {
1
+ @import "../theme-tokens.css";
2
+
3
+ .pf-image-gallery {
2
4
  margin-inline: 0;
3
5
  }
4
6
 
5
- .pl-image-gallery img {
7
+ .pf-image-gallery img {
6
8
  display: block;
7
9
  margin: 0;
8
10
  width: 100%;
9
11
  }
10
12
 
11
- .pl-image-gallery:not([data-image-count="1"]) {
12
- --pl-image-gallery-preview-width: 4rem;
13
+ .pf-image-gallery:not([data-image-count="1"]) {
14
+ --pf-image-gallery-preview-width: 4rem;
13
15
  position: relative;
14
16
  }
15
17
 
16
- .pl-image-gallery__track {
18
+ .pf-image-gallery__track {
17
19
  align-items: flex-start;
18
20
  display: flex;
19
21
  gap: 0.75rem;
@@ -26,23 +28,23 @@
26
28
  scrollbar-width: none;
27
29
  }
28
30
 
29
- .pl-image-gallery__track::-webkit-scrollbar {
31
+ .pf-image-gallery__track::-webkit-scrollbar {
30
32
  display: none;
31
33
  }
32
34
 
33
- .pl-image-gallery__item {
35
+ .pf-image-gallery__item {
34
36
  align-items: center;
35
- aspect-ratio: var(--pl-image-gallery-ratio, 3 / 2);
36
- border-radius: min(var(--pl-radius-lg, 0.75rem), 1rem);
37
+ aspect-ratio: var(--pf-image-gallery-ratio, 3 / 2);
38
+ border-radius: min(var(--pf-radius-lg, 0.75rem), 1rem);
37
39
  display: flex;
38
40
  flex: 0 0 auto;
39
41
  justify-content: center;
40
42
  overflow: hidden;
41
43
  scroll-snap-align: start;
42
- width: calc(100% - var(--pl-image-gallery-preview-width));
44
+ width: calc(100% - var(--pf-image-gallery-preview-width));
43
45
  }
44
46
 
45
- .pl-image-gallery__item img {
47
+ .pf-image-gallery__item img {
46
48
  border-radius: inherit;
47
49
  height: 100%;
48
50
  object-fit: contain;
@@ -50,19 +52,19 @@
50
52
  }
51
53
 
52
54
  @media (max-width: 640px) {
53
- .pl-image-gallery:not([data-image-count="1"]) {
54
- --pl-image-gallery-preview-width: 2.75rem;
55
+ .pf-image-gallery:not([data-image-count="1"]) {
56
+ --pf-image-gallery-preview-width: 2.75rem;
55
57
  }
56
58
  }
57
59
 
58
- .pl-image-gallery__button {
60
+ .pf-image-gallery__button {
59
61
  align-items: center;
60
62
  appearance: none;
61
63
  backdrop-filter: blur(8px);
62
- background: color-mix(in oklab, var(--pl-background, #ffffff) 82%, transparent);
63
- border: 1px solid color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
64
- border-radius: var(--pl-radius-full, 999px);
65
- color: var(--pl-text-strong, var(--pl-text, #182230));
64
+ background: color-mix(in oklab, var(--pf-background, #ffffff) 82%, transparent);
65
+ border: 1px solid color-mix(in oklab, var(--pf-text-muted, #667085) 18%, transparent);
66
+ border-radius: var(--pf-radius-full, 999px);
67
+ color: var(--pf-text-strong, var(--pf-text, #182230));
66
68
  cursor: pointer;
67
69
  display: inline-flex;
68
70
  height: 2rem;
@@ -81,38 +83,38 @@
81
83
  z-index: 1;
82
84
  }
83
85
 
84
- .pl-image-gallery__button[data-pl-image-gallery-button="previous"] {
86
+ .pf-image-gallery__button[data-pf-image-gallery-button="previous"] {
85
87
  inset-inline-start: 0.75rem;
86
88
  }
87
89
 
88
- .pl-image-gallery__button[data-pl-image-gallery-button="next"] {
90
+ .pf-image-gallery__button[data-pf-image-gallery-button="next"] {
89
91
  inset-inline-end: 0.75rem;
90
92
  }
91
93
 
92
- .pl-image-gallery__button:hover {
93
- background: color-mix(in oklab, var(--pl-background, #ffffff) 94%, transparent);
94
- border-color: color-mix(in oklab, var(--pl-text-muted, #667085) 30%, transparent);
94
+ .pf-image-gallery__button:hover {
95
+ background: color-mix(in oklab, var(--pf-background, #ffffff) 94%, transparent);
96
+ border-color: color-mix(in oklab, var(--pf-text-muted, #667085) 30%, transparent);
95
97
  }
96
98
 
97
- .pl-image-gallery__button:focus-visible {
98
- outline: 2px solid var(--pl-accent, #4f46e5);
99
+ .pf-image-gallery__button:focus-visible {
100
+ outline: 2px solid var(--pf-accent, #3e7e55);
99
101
  outline-offset: 2px;
100
102
  }
101
103
 
102
- .pl-image-gallery__button-icon {
104
+ .pf-image-gallery__button-icon {
103
105
  display: block;
104
106
  height: 1.125rem;
105
107
  width: 1.125rem;
106
108
  }
107
109
 
108
110
  @media (hover: hover) {
109
- .pl-image-gallery__button {
111
+ .pf-image-gallery__button {
110
112
  opacity: 0;
111
113
  pointer-events: none;
112
114
  }
113
115
 
114
- .pl-image-gallery:hover .pl-image-gallery__button,
115
- .pl-image-gallery:focus-within .pl-image-gallery__button {
116
+ .pf-image-gallery:hover .pf-image-gallery__button,
117
+ .pf-image-gallery:focus-within .pf-image-gallery__button {
116
118
  opacity: 1;
117
119
  pointer-events: auto;
118
120
  }
@@ -1,3 +1,5 @@
1
+ export { unified } from '@astrojs/markdown-remark';
1
2
  export { rehypeImageGallery } from './image-gallery-plugin.js';
3
+ export { remarkCalloutDirectives } from './callout-directives.js';
2
4
  export { remarkPackageManagerTabs } from './package-manager-tabs.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,3 +1,5 @@
1
+ export { unified } from '@astrojs/markdown-remark';
1
2
  export { rehypeImageGallery } from './image-gallery-plugin.js';
3
+ export { remarkCalloutDirectives } from './callout-directives.js';
2
4
  export { remarkPackageManagerTabs } from './package-manager-tabs.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -288,7 +288,7 @@ function createPackageManagerCodeElement(code, language) {
288
288
  {
289
289
  type: 'mdxJsxAttribute',
290
290
  name: 'className',
291
- value: 'pl-package-manager-code',
291
+ value: 'pf-package-manager-code',
292
292
  },
293
293
  {
294
294
  type: 'mdxJsxAttribute',