@pantoken/scaffold-base 0.2.1 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +11 -4
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -79,10 +79,16 @@ function parseSelector(selector) {
79
79
  };
80
80
  if (selector.startsWith("&")) return null;
81
81
  const optional = selector.includes(":optional");
82
- const attrMatch = /^([a-z]*)\[([\w-]+)(?:~|)=(?:"([^"]*)"|'([^']*)')\]/i.exec(selector);
82
+ const attrMatch = /^([a-z]*)\[([\w-]+)(?:~|)=(?:"([^"]*)"|'([^']*)')\](?:\.([\w-]+))?/i.exec(selector);
83
83
  if (attrMatch) {
84
- const [, tag, attrName, dq, sq] = attrMatch;
84
+ const [, tag, attrName, dq, sq, trailingClass] = attrMatch;
85
85
  const value = dq ?? sq ?? "";
86
+ if (tag === "slot") return {
87
+ tag: "div",
88
+ attrs: { "data-slot": value },
89
+ className: trailingClass,
90
+ optional
91
+ };
86
92
  if (attrName === "class") return {
87
93
  tag: tag || "div",
88
94
  className: value,
@@ -91,6 +97,7 @@ function parseSelector(selector) {
91
97
  return {
92
98
  tag: tag || "div",
93
99
  attrs: { [attrName]: value },
100
+ className: trailingClass,
94
101
  optional
95
102
  };
96
103
  }
@@ -134,7 +141,7 @@ function parseWrapperLayout() {
134
141
  /** Placeholder text injected at specific parts, keyed by class name. */
135
142
  const PART_TEXT = {
136
143
  title: "{{projectName}}",
137
- description: "Styled with <code>@pantoken/components</code> and laid out with the <code>wrapper</code> layout from <code>@pantoken/plugin-layouts</code>."
144
+ description: "Styled with <code>@pantoken/components</code>."
138
145
  };
139
146
  /** The `slot[name="content"]` part gets the platform's actual getting-started content, per format. */
140
147
  const MAIN_CONTENT = {
@@ -157,7 +164,7 @@ function renderNode(node, format, depth) {
157
164
  const openTag = `<${node.tag}${attrs.length ? ` ${attrs.join(" ")}` : ""}>`;
158
165
  const closeTag = `</${node.tag}>`;
159
166
  const optionalNote = node.optional ? ` ${comment(format, "optional")}` : "";
160
- const isMainSlot = node.tag === "slot" && node.attrs?.name === "content";
167
+ const isMainSlot = node.attrs?.["data-slot"] === "content";
161
168
  const text = PART_TEXT[node.className ?? ""] ?? (isMainSlot ? MAIN_CONTENT[format] : void 0);
162
169
  const childLines = node.children.map((child) => renderNode(child, format, depth + 1));
163
170
  const bodyPad = " ".repeat(depth + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantoken/scaffold-base",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Shared bingo-stratum Base for pantoken's scaffold presets: common options, the cssdoc.json block, and wrapper-layout markup context.",
5
5
  "homepage": "https://pantoken.app",
6
6
  "bugs": "https://github.com/thedannywahl/pantoken/issues",
@@ -24,15 +24,15 @@
24
24
  "provenance": true
25
25
  },
26
26
  "dependencies": {
27
- "@pantoken/plugin-layouts": "0.3.0",
27
+ "@pantoken/plugin-layouts": "0.3.1",
28
28
  "bingo-stratum": "^0.5.13",
29
29
  "zod": "^3.25.76"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^26.5.0",
32
+ "@types/node": "^26.5.1",
33
33
  "typescript": "^7.0.2",
34
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
35
- "vite-plus": "0.3.1"
34
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.2",
35
+ "vite-plus": "0.3.2"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=22.18.0"