@pantoken/scaffold-base 0.2.1 → 0.3.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/dist/index.mjs +11 -4
- package/package.json +1 -1
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-]+)(?:~|)=(?:"([^"]*)"|'([^']*)')\]
|
|
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
|
|
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.
|
|
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.
|
|
3
|
+
"version": "0.3.0",
|
|
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",
|