@nimtech/nimpress 2.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.
- package/.claude/rules/changelog-entries.md +229 -0
- package/.claude/rules/chunk-cycles.md +23 -0
- package/.claude/rules/component-modules.md +152 -0
- package/.claude/rules/dbml-pages.md +118 -0
- package/.claude/rules/deploy.md +47 -0
- package/.claude/rules/doc-pages.md +93 -0
- package/.claude/rules/docs-authoring.md +90 -0
- package/.claude/rules/docs-sync.md +59 -0
- package/.claude/rules/file-layout.md +49 -0
- package/.claude/rules/frontmatter.md +91 -0
- package/.claude/rules/page-types.md +108 -0
- package/.claude/rules/paths.md +27 -0
- package/.claude/rules/roadmap-entries.md +154 -0
- package/.claude/rules/style.md +61 -0
- package/LICENSE +201 -0
- package/README.md +137 -0
- package/bin/nimpress.mjs +7 -0
- package/config.schema.json +555 -0
- package/dist/DbmlNote-CTwTd5vM.js +21 -0
- package/dist/DbmlTable-BXIyJnLV.js +209 -0
- package/dist/cli.es.js +1265 -0
- package/dist/nimpress.es.js +8896 -0
- package/dist/plugin-DQtunTIv.js +8268 -0
- package/dist/plugin.es.js +23 -0
- package/dist/src/api/CodeExamples.svelte.d.ts +1 -0
- package/dist/src/api/MethodBadge.svelte.d.ts +1 -0
- package/dist/src/api/OpenApiRoot.svelte.d.ts +1 -0
- package/dist/src/api/Operation.svelte.d.ts +1 -0
- package/dist/src/api/ParamRow.svelte.d.ts +1 -0
- package/dist/src/api/Schema.svelte.d.ts +1 -0
- package/dist/src/api/TryDialog.svelte.d.ts +1 -0
- package/dist/src/api/TryPanel.svelte.d.ts +1 -0
- package/dist/src/api/refs.d.ts +12 -0
- package/dist/src/api/refs.d.ts.map +1 -0
- package/dist/src/api/tryState.d.ts +21 -0
- package/dist/src/api/tryState.d.ts.map +1 -0
- package/dist/src/api/types.d.ts +63 -0
- package/dist/src/api/types.d.ts.map +1 -0
- package/dist/src/auth/AccountMenu.svelte.d.ts +1 -0
- package/dist/src/auth/guard.d.ts +5 -0
- package/dist/src/auth/guard.d.ts.map +1 -0
- package/dist/src/auth/session.d.ts +8 -0
- package/dist/src/auth/session.d.ts.map +1 -0
- package/dist/src/banner.d.ts +23 -0
- package/dist/src/banner.d.ts.map +1 -0
- package/dist/src/cli/export.d.ts +4 -0
- package/dist/src/cli/export.d.ts.map +1 -0
- package/dist/src/cli/guard.d.ts +3 -0
- package/dist/src/cli/guard.d.ts.map +1 -0
- package/dist/src/cli/init.d.ts +2 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/lint.d.ts +11 -0
- package/dist/src/cli/lint.d.ts.map +1 -0
- package/dist/src/cli/modules.d.ts +3 -0
- package/dist/src/cli/modules.d.ts.map +1 -0
- package/dist/src/cli/shared.d.ts +6 -0
- package/dist/src/cli/shared.d.ts.map +1 -0
- package/dist/src/cli/site.d.ts +7 -0
- package/dist/src/cli/site.d.ts.map +1 -0
- package/dist/src/cli.d.ts +5 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/config/base.d.ts +4 -0
- package/dist/src/config/base.d.ts.map +1 -0
- package/dist/src/config/chunkCycles.d.ts +10 -0
- package/dist/src/config/chunkCycles.d.ts.map +1 -0
- package/dist/src/config/defaults.d.ts +4 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/html.d.ts +3 -0
- package/dist/src/config/html.d.ts.map +1 -0
- package/dist/src/config/load.d.ts +20 -0
- package/dist/src/config/load.d.ts.map +1 -0
- package/dist/src/config/paths.d.ts +8 -0
- package/dist/src/config/paths.d.ts.map +1 -0
- package/dist/src/config/schema.d.ts +1238 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/viteConfig.d.ts +11 -0
- package/dist/src/config/viteConfig.d.ts.map +1 -0
- package/dist/src/dbml/erd.d.ts +59 -0
- package/dist/src/dbml/erd.d.ts.map +1 -0
- package/dist/src/framework/configStore.d.ts +7 -0
- package/dist/src/framework/configStore.d.ts.map +1 -0
- package/dist/src/framework/createNimpressApp.d.ts +10 -0
- package/dist/src/framework/createNimpressApp.d.ts.map +1 -0
- package/dist/src/framework/gated.d.ts +5 -0
- package/dist/src/framework/gated.d.ts.map +1 -0
- package/dist/src/framework/hashSpy.d.ts +7 -0
- package/dist/src/framework/hashSpy.d.ts.map +1 -0
- package/dist/src/framework/pageMeta.d.ts +4 -0
- package/dist/src/framework/pageMeta.d.ts.map +1 -0
- package/dist/src/framework/pageStyles.d.ts +2 -0
- package/dist/src/framework/pageStyles.d.ts.map +1 -0
- package/dist/src/framework/router.d.ts +5 -0
- package/dist/src/framework/router.d.ts.map +1 -0
- package/dist/src/framework/stores/feed.d.ts +8 -0
- package/dist/src/framework/stores/feed.d.ts.map +1 -0
- package/dist/src/framework/stores/sidebar.d.ts +4 -0
- package/dist/src/framework/stores/sidebar.d.ts.map +1 -0
- package/dist/src/framework/stores/theme.d.ts +6 -0
- package/dist/src/framework/stores/theme.d.ts.map +1 -0
- package/dist/src/framework/stores/viewer.d.ts +6 -0
- package/dist/src/framework/stores/viewer.d.ts.map +1 -0
- package/dist/src/icons/FullscreenIcon.svelte.d.ts +1 -0
- package/dist/src/icons/IconAdd.svelte.d.ts +1 -0
- package/dist/src/icons/IconChevron.svelte.d.ts +1 -0
- package/dist/src/icons/IconClear.svelte.d.ts +1 -0
- package/dist/src/icons/IconConsole.svelte.d.ts +1 -0
- package/dist/src/icons/IconDock.svelte.d.ts +1 -0
- package/dist/src/icons/IconDownload.svelte.d.ts +1 -0
- package/dist/src/icons/IconJson.svelte.d.ts +1 -0
- package/dist/src/icons/IconMinus.svelte.d.ts +1 -0
- package/dist/src/icons/IconMock.svelte.d.ts +1 -0
- package/dist/src/icons/IconMoon.svelte.d.ts +1 -0
- package/dist/src/icons/IconOpen.svelte.d.ts +1 -0
- package/dist/src/icons/IconReload.svelte.d.ts +1 -0
- package/dist/src/icons/IconRemove.svelte.d.ts +1 -0
- package/dist/src/icons/IconShadow.svelte.d.ts +1 -0
- package/dist/src/icons/IconSun.svelte.d.ts +1 -0
- package/dist/src/index.d.ts +44 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/layout/App.svelte.d.ts +1 -0
- package/dist/src/layout/AppRoot.svelte.d.ts +1 -0
- package/dist/src/layout/BackToTop.svelte.d.ts +1 -0
- package/dist/src/layout/Breadcrumbs.svelte.d.ts +1 -0
- package/dist/src/layout/GatedPage.svelte.d.ts +1 -0
- package/dist/src/layout/Header.svelte.d.ts +1 -0
- package/dist/src/layout/HomePage.svelte.d.ts +1 -0
- package/dist/src/layout/RightToc.svelte.d.ts +1 -0
- package/dist/src/layout/Sidebar.svelte.d.ts +1 -0
- package/dist/src/layout/SidebarNode.svelte.d.ts +1 -0
- package/dist/src/markdown/Actions.svelte.d.ts +1 -0
- package/dist/src/markdown/CalloutCheck.svelte.d.ts +1 -0
- package/dist/src/markdown/CalloutInfo.svelte.d.ts +1 -0
- package/dist/src/markdown/CalloutNote.svelte.d.ts +1 -0
- package/dist/src/markdown/CalloutTip.svelte.d.ts +1 -0
- package/dist/src/markdown/CalloutWarning.svelte.d.ts +1 -0
- package/dist/src/markdown/Card.svelte.d.ts +1 -0
- package/dist/src/markdown/CardGroup.svelte.d.ts +1 -0
- package/dist/src/markdown/ChangelogPage.svelte.d.ts +1 -0
- package/dist/src/markdown/CodeBlock.svelte.d.ts +1 -0
- package/dist/src/markdown/CodeEditor.svelte.d.ts +1 -0
- package/dist/src/markdown/CodeGroup.svelte.d.ts +1 -0
- package/dist/src/markdown/ComponentEmbed.svelte.d.ts +1 -0
- package/dist/src/markdown/ComponentPage.svelte.d.ts +1 -0
- package/dist/src/markdown/ControlNode.svelte.d.ts +1 -0
- package/dist/src/markdown/DBMLBlock.svelte.d.ts +1 -0
- package/dist/src/markdown/DbmlNote.svelte.d.ts +1 -0
- package/dist/src/markdown/DbmlPage.svelte.d.ts +1 -0
- package/dist/src/markdown/DbmlTable.svelte.d.ts +1 -0
- package/dist/src/markdown/DragDivider.svelte.d.ts +1 -0
- package/dist/src/markdown/Feature.svelte.d.ts +1 -0
- package/dist/src/markdown/FeatureGrid.svelte.d.ts +1 -0
- package/dist/src/markdown/HeroPage.svelte.d.ts +1 -0
- package/dist/src/markdown/MermaidBlock.svelte.d.ts +1 -0
- package/dist/src/markdown/Page.svelte.d.ts +1 -0
- package/dist/src/markdown/PlanetFooter.svelte.d.ts +1 -0
- package/dist/src/markdown/RoadmapBlob.svelte.d.ts +1 -0
- package/dist/src/markdown/RoadmapNode.svelte.d.ts +1 -0
- package/dist/src/markdown/RoadmapPage.svelte.d.ts +1 -0
- package/dist/src/markdown/SubscribeDialog.svelte.d.ts +1 -0
- package/dist/src/mock/index.d.ts +42 -0
- package/dist/src/mock/index.d.ts.map +1 -0
- package/dist/src/modules/autoStory.d.ts +5 -0
- package/dist/src/modules/autoStory.d.ts.map +1 -0
- package/dist/src/modules/componentData.d.ts +14 -0
- package/dist/src/modules/componentData.d.ts.map +1 -0
- package/dist/src/modules/harness.d.ts +25 -0
- package/dist/src/modules/harness.d.ts.map +1 -0
- package/dist/src/modules/importStorybook.d.ts +12 -0
- package/dist/src/modules/importStorybook.d.ts.map +1 -0
- package/dist/src/modules/lint.d.ts +3 -0
- package/dist/src/modules/lint.d.ts.map +1 -0
- package/dist/src/modules/pages.d.ts +10 -0
- package/dist/src/modules/pages.d.ts.map +1 -0
- package/dist/src/modules/parse/dts.d.ts +4 -0
- package/dist/src/modules/parse/dts.d.ts.map +1 -0
- package/dist/src/modules/parse/svelte.d.ts +3 -0
- package/dist/src/modules/parse/svelte.d.ts.map +1 -0
- package/dist/src/modules/parse/typeMembers.d.ts +64 -0
- package/dist/src/modules/parse/typeMembers.d.ts.map +1 -0
- package/dist/src/modules/parse/vue.d.ts +3 -0
- package/dist/src/modules/parse/vue.d.ts.map +1 -0
- package/dist/src/modules/resolve.d.ts +9 -0
- package/dist/src/modules/resolve.d.ts.map +1 -0
- package/dist/src/modules/schema.d.ts +53 -0
- package/dist/src/modules/schema.d.ts.map +1 -0
- package/dist/src/modules/stories.d.ts +4 -0
- package/dist/src/modules/stories.d.ts.map +1 -0
- package/dist/src/search/SearchModal.svelte.d.ts +1 -0
- package/dist/src/search/indexer.d.ts +5 -0
- package/dist/src/search/indexer.d.ts.map +1 -0
- package/dist/src/story/index.d.ts +17 -0
- package/dist/src/story/index.d.ts.map +1 -0
- package/dist/src/subscribe/subscribe.d.ts +5 -0
- package/dist/src/subscribe/subscribe.d.ts.map +1 -0
- package/dist/src/types.d.ts +531 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/story.es.js +10 -0
- package/dist/style.css +1 -0
- package/dist/tailwind.preset.d.ts +4 -0
- package/dist/tailwind.preset.d.ts.map +1 -0
- package/dist/tailwind.preset.es.js +67 -0
- package/dist/typeMembers-CNvE92EX.js +538 -0
- package/package.json +125 -0
- package/src/harness/svelte/ComponentHarness.svelte +12 -0
- package/src/harness/svelte/ComponentHarnessEffects.svelte +24 -0
- package/src/harness/svelte/ComponentHarnessOverlay.svelte +9 -0
- package/src/harness/svelte/ComponentStory.svelte +9 -0
- package/src/harness/svelte/DefaultHarness.svelte +15 -0
- package/src/harness/svelte/HarnessRoot.svelte +22 -0
- package/src/harness/svelte/context.svelte.ts +33 -0
- package/src/harness/svelte/index.ts +12 -0
- package/src/harness/vue/ComponentHarness.vue +16 -0
- package/src/harness/vue/ComponentHarnessEffects.vue +27 -0
- package/src/harness/vue/ComponentHarnessOverlay.vue +12 -0
- package/src/harness/vue/ComponentStory.vue +16 -0
- package/src/harness/vue/DefaultHarness.vue +14 -0
- package/src/harness/vue/context.ts +37 -0
- package/src/harness/vue/index.ts +11 -0
- package/src/mock/index.ts +88 -0
- package/src/styles/app.css +3 -0
- package/src/styles/preflight.css +540 -0
- package/src/styles/theme.css +81 -0
- package/src/styles/tokens.css +150 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
function M(t) {
|
|
2
|
+
const n = String(t ?? "/").trim();
|
|
3
|
+
if (!n || n === "/") return "/";
|
|
4
|
+
const e = n.startsWith("/") ? n : `/${n}`;
|
|
5
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
6
|
+
}
|
|
7
|
+
function Mt(t, n) {
|
|
8
|
+
const e = M(t);
|
|
9
|
+
return e === "/" || !n.startsWith("/") || n.startsWith("//") || n === e.slice(0, -1) || n.startsWith(e) ? n : e.slice(0, -1) + n;
|
|
10
|
+
}
|
|
11
|
+
function Ct(t, n) {
|
|
12
|
+
const e = M(t);
|
|
13
|
+
return e === "/" ? n : n === e.slice(0, -1) ? "/" : n.startsWith(e) ? "/" + n.slice(e.length) : n;
|
|
14
|
+
}
|
|
15
|
+
const H = ["Luke Skywalker", "Leia Organa", "Han Solo", "Obi-Wan Kenobi", "Ahsoka Tano", "Lando Calrissian", "Din Djarin", "Padmé Amidala"], C = ["Luke", "Leia", "Han", "Ahsoka", "Din", "Padmé", "Lando", "Obi-Wan"], R = ["Skywalker", "Organa", "Solo", "Kenobi", "Tano", "Calrissian", "Amidala", "Djarin"], z = ["Tatooine", "Coruscant", "Endor", "Hoth", "Naboo", "Dagobah", "Mos Eisley", "Bespin"], E = ["Millennium Falcon", "X-Wing", "Razor Crest", "Lightsaber", "Holocron", "Beskar Ingot", "Astromech Droid", "Sarlacc Pit"], g = [
|
|
16
|
+
"Bantha fodder drifts across the dune sea beyond Mos Eisley.",
|
|
17
|
+
"A hyperdrive hums softly as the freighter clears the asteroid field.",
|
|
18
|
+
"Womp rats scatter when the landspeeder skims Beggar’s Canyon.",
|
|
19
|
+
"The council convened on Coruscant to debate the blockade of Naboo.",
|
|
20
|
+
"Moisture vaporators line the ridge above the homestead on Tatooine.",
|
|
21
|
+
"A protocol droid recites etiquette while the astromech beeps in protest.",
|
|
22
|
+
"Snow swirls over the shield generator on the plains of Hoth.",
|
|
23
|
+
"The cantina band strikes up as smugglers haggle over spice."
|
|
24
|
+
], k = ["bantha", "kyber", "hyperdrive", "womp-rat", "sabacc", "holocron", "beskar", "porg"], U = ["leia.organa@rebellion.org", "luke.skywalker@jedi.temple", "han.solo@falcon.crew", "ahsoka.tano@fulcrum.net"], Z = ["#ffe81f", "#2e67f8", "#e5484d", "#30a46c", "#8a63d2"];
|
|
25
|
+
function P(t) {
|
|
26
|
+
let n = 0;
|
|
27
|
+
for (let e = 0; e < t.length; e++) n = n * 31 + t.charCodeAt(e) >>> 0;
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
function f(t, n = 0) {
|
|
31
|
+
return t[(P(String(n)) + n) % t.length];
|
|
32
|
+
}
|
|
33
|
+
function V(t) {
|
|
34
|
+
return !!t && typeof t == "object" && typeof t.__nimpressFn == "string";
|
|
35
|
+
}
|
|
36
|
+
function A(t) {
|
|
37
|
+
return `(...args) => {
|
|
38
|
+
console.log(${JSON.stringify(t || "handler")}, ...args)
|
|
39
|
+
}`;
|
|
40
|
+
}
|
|
41
|
+
const K = (t = 0) => f(H, t), X = (t = 0) => f(C, t), Y = (t = 0) => f(R, t), G = (t = 0) => `${f(C, t).toLowerCase()}_${f(k, t + 1)}`, Q = (t = 0) => f(U, t), tt = (t = 0) => `${f(k, t)}-${f(E, t + 1).replace(/\s+/g, "")}`, I = (t = 0) => f(k, t), nt = (t = 0) => f(E, t), T = (t = 0) => f(g, t), et = (t = 0) => `${f(g, t)} ${f(g, t + 1)} ${f(g, t + 2)}`, rt = (t = 0) => f(z, t), ot = (t = 0) => `https://holonet.example/${f(k, t)}`, it = (t = 0) => `https://holonet.example/${f(k, t)}.png`, st = (t = 0) => f(Z, t), at = () => "pi pi-star", ut = () => "1977-05-25", mt = () => "09:41", ct = () => "+47 555 01138", ft = (t = 0) => `${f(k, t)}-1138`, lt = (t = 0) => f(k, t), dt = (t = 0) => ({
|
|
42
|
+
[f(k, t)]: f(g, t),
|
|
43
|
+
[f(k, t + 3)]: f(g, t + 3)
|
|
44
|
+
}), kt = (t = 0) => [f(k, t), f(k, t + 3)], pt = () => !0, yt = () => 42, bt = () => 0, gt = () => 1.618, ht = () => 7, $t = () => 66, vt = () => 320, jt = () => 240, wt = () => 199, xt = () => 1977, Ot = () => 29, St = (t = [], n = 0, e = []) => {
|
|
45
|
+
const o = t.filter((r) => !e.includes(r));
|
|
46
|
+
return o.length ? o[(P(String(n)) + n) % o.length] : void 0;
|
|
47
|
+
}, B = (t = "handler") => ({
|
|
48
|
+
__nimpressFn: A(t)
|
|
49
|
+
}), Tt = (t = "event") => B(t), At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
50
|
+
__proto__: null,
|
|
51
|
+
fnSource: A,
|
|
52
|
+
isFnValue: V,
|
|
53
|
+
mockAge: Ot,
|
|
54
|
+
mockArray: kt,
|
|
55
|
+
mockBoolean: pt,
|
|
56
|
+
mockColor: st,
|
|
57
|
+
mockCount: ht,
|
|
58
|
+
mockDate: ut,
|
|
59
|
+
mockEmail: Q,
|
|
60
|
+
mockEvent: Tt,
|
|
61
|
+
mockFamilyName: Y,
|
|
62
|
+
mockFirstName: X,
|
|
63
|
+
mockFloat: gt,
|
|
64
|
+
mockFullName: K,
|
|
65
|
+
mockFunction: B,
|
|
66
|
+
mockHeight: jt,
|
|
67
|
+
mockIcon: at,
|
|
68
|
+
mockId: ft,
|
|
69
|
+
mockImageUrl: it,
|
|
70
|
+
mockIndex: bt,
|
|
71
|
+
mockInt: yt,
|
|
72
|
+
mockObject: dt,
|
|
73
|
+
mockOption: St,
|
|
74
|
+
mockParagraph: et,
|
|
75
|
+
mockPassword: tt,
|
|
76
|
+
mockPercent: $t,
|
|
77
|
+
mockPhone: ct,
|
|
78
|
+
mockPlace: rt,
|
|
79
|
+
mockPrice: wt,
|
|
80
|
+
mockSentence: T,
|
|
81
|
+
mockSlug: lt,
|
|
82
|
+
mockTime: mt,
|
|
83
|
+
mockTitle: nt,
|
|
84
|
+
mockUrl: ot,
|
|
85
|
+
mockUsername: G,
|
|
86
|
+
mockWidth: vt,
|
|
87
|
+
mockWord: I,
|
|
88
|
+
mockYear: xt
|
|
89
|
+
}, Symbol.toStringTag, { value: "Module" })), O = 12;
|
|
90
|
+
function Wt(t) {
|
|
91
|
+
const n = {}, e = (c, l) => {
|
|
92
|
+
const p = t.match(new RegExp(`@${c}\\s+(-?[0-9.]+)`));
|
|
93
|
+
p && (n[l] = Number(p[1]));
|
|
94
|
+
};
|
|
95
|
+
e("minimum", "minimum"), e("maximum", "maximum"), e("exclusiveMinimum", "exclusiveMinimum"), e("exclusiveMaximum", "exclusiveMaximum"), e("multipleOf", "multipleOf"), e("minLength", "minLength"), e("maxLength", "maxLength"), e("minItems", "minItems"), e("maxItems", "maxItems");
|
|
96
|
+
const o = (c) => {
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(c);
|
|
99
|
+
} catch {
|
|
100
|
+
return c;
|
|
101
|
+
}
|
|
102
|
+
}, r = t.match(/@pattern\s+(.+)/);
|
|
103
|
+
r && (n.pattern = r[1].trim());
|
|
104
|
+
const s = t.match(/@format\s+(\S+)/);
|
|
105
|
+
s && (n.format = s[1]);
|
|
106
|
+
const i = t.match(/@default\s+(.+)/);
|
|
107
|
+
i && (n.default = o(i[1].trim()));
|
|
108
|
+
const a = [...t.matchAll(/@examples?\s+(.+)/g)].map((c) => o(c[1].trim()));
|
|
109
|
+
a.length && (n.examples = a), /@deprecated\b/.test(t) && (n.deprecated = !0), /@readonly\b|@readOnly\b/.test(t) && (n.readOnly = !0), /@uniqueItems\b/.test(t) && (n.uniqueItems = !0);
|
|
110
|
+
const u = t.replace(/^\s*@\w+.*$/gm, "").trim(), m = t.match(/@mock\s+(\w+)/)?.[1];
|
|
111
|
+
return { description: u, annotations: n, mock: m };
|
|
112
|
+
}
|
|
113
|
+
function W(t) {
|
|
114
|
+
let n, e, o, r = t;
|
|
115
|
+
for (; ; ) {
|
|
116
|
+
const s = r.match(/^\/\*\*?([\s\S]*?)\*\/\s*/);
|
|
117
|
+
if (s) {
|
|
118
|
+
const a = s[1].replace(/^\s*\*\s?/gm, "").trim(), u = Wt(a);
|
|
119
|
+
n = u.description || void 0, Object.keys(u.annotations).length && (e = u.annotations), o = u.mock, r = r.slice(s[0].length);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const i = r.match(/^\/\/\s*([^\n]*)(?:\n\s*|$)/);
|
|
123
|
+
if (i) {
|
|
124
|
+
n = i[1].trim(), r = r.slice(i[0].length);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
return { description: n, annotations: e, mock: o, member: r };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function qt(t) {
|
|
131
|
+
const n = [];
|
|
132
|
+
let e = 0, o = "", r = "";
|
|
133
|
+
const s = () => {
|
|
134
|
+
const u = o.trim();
|
|
135
|
+
if (o = "", !u) return;
|
|
136
|
+
const { description: m, annotations: c, mock: l, member: p } = W(u), d = p.match(/^(?:readonly\s+)?([A-Za-z_$][\w$]*)(\?)?\s*:\s*([\s\S]+)$/);
|
|
137
|
+
d && n.push({ name: d[1], optional: d[2] === "?", type: d[3].trim(), description: m, annotations: c, mock: l });
|
|
138
|
+
};
|
|
139
|
+
let i = !1;
|
|
140
|
+
const a = [...t];
|
|
141
|
+
for (let u = 0; u < a.length; u++) {
|
|
142
|
+
const m = a[u];
|
|
143
|
+
if (!i && m === "/" && a[u + 1] === "*" && (i = !0), i && m === "/" && a[u - 1] === "*" && (i = !1), !i) {
|
|
144
|
+
if (m === "{" || m === "(" || m === "[" ? e++ : m === "}" || m === ")" || m === "]" ? e-- : m === "<" && r !== "=" ? e++ : m === ">" && r !== "=" && e--, (m === ";" || m === ",") && e === 0) {
|
|
145
|
+
s(), r = m;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (m === `
|
|
149
|
+
` && e === 0) {
|
|
150
|
+
if (W(o.trim()).member === "") {
|
|
151
|
+
o += m, r = m;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
s(), r = m;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
o += m, r = m;
|
|
159
|
+
}
|
|
160
|
+
return s(), n;
|
|
161
|
+
}
|
|
162
|
+
function Et(t) {
|
|
163
|
+
const n = [];
|
|
164
|
+
let e = 0, o = "";
|
|
165
|
+
for (const r of t) {
|
|
166
|
+
if (r === "{" || r === "(" || r === "[" ? e++ : (r === "}" || r === ")" || r === "]") && e--, r === "," && e === 0) {
|
|
167
|
+
o.trim() && n.push(o.trim()), o = "";
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
o += r;
|
|
171
|
+
}
|
|
172
|
+
return o.trim() && n.push(o.trim()), n;
|
|
173
|
+
}
|
|
174
|
+
function q(t) {
|
|
175
|
+
const n = [];
|
|
176
|
+
let e = 0, o = "", r = "";
|
|
177
|
+
for (const s of t) {
|
|
178
|
+
if (s === "{" || s === "(" || s === "[" ? e++ : s === "}" || s === ")" || s === "]" ? e-- : s === "<" && r !== "=" ? e++ : s === ">" && r !== "=" && e--, s === "|" && e === 0) {
|
|
179
|
+
o.trim() && n.push(o.trim()), o = "", r = s;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
o += s, r = s;
|
|
183
|
+
}
|
|
184
|
+
return o.trim() && n.push(o.trim()), n.filter((s) => s !== "undefined" && s !== "null");
|
|
185
|
+
}
|
|
186
|
+
function L(t) {
|
|
187
|
+
const n = t.split("|").map((o) => o.trim()).filter((o) => o !== "" && o !== "undefined" && o !== "null");
|
|
188
|
+
if (!n.length) return null;
|
|
189
|
+
const e = [];
|
|
190
|
+
for (const o of n) {
|
|
191
|
+
const r = o.match(/^['"]([^'"]*)['"]$/);
|
|
192
|
+
if (!r) return null;
|
|
193
|
+
e.push(r[1]);
|
|
194
|
+
}
|
|
195
|
+
return e;
|
|
196
|
+
}
|
|
197
|
+
function F(t, n) {
|
|
198
|
+
const e = t.trim();
|
|
199
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(e)) return t;
|
|
200
|
+
const o = new RegExp(`(?:export\\s+)?type\\s+${e}\\s*=\\s*([^\\n;]*(?:\\n\\s*\\|[^\\n;]+)*)`), s = n.match(o)?.[1]?.replace(/\s+/g, " ").trim();
|
|
201
|
+
return s || t;
|
|
202
|
+
}
|
|
203
|
+
function D(t) {
|
|
204
|
+
return `{ ${t.map((e) => `${e.name}${e.required ? "" : "?"}: ${e.shape ?? e.type}`).join("; ")} }`;
|
|
205
|
+
}
|
|
206
|
+
function Lt(t) {
|
|
207
|
+
if (t.format) return t.format;
|
|
208
|
+
if (t.kind !== "text" && t.kind !== "slot") return;
|
|
209
|
+
const n = `${t.name} ${t.description ?? ""}`.toLowerCase();
|
|
210
|
+
if (/email/.test(n)) return "email";
|
|
211
|
+
if (/url|href|link|website/.test(n)) return "uri";
|
|
212
|
+
if (/date-time|datetime|timestamp/.test(n)) return "date-time";
|
|
213
|
+
if (/date/.test(t.name.toLowerCase()) || /\bdates?\b/.test((t.description ?? "").toLowerCase())) return "date";
|
|
214
|
+
if (/uuid/.test(n)) return "uuid";
|
|
215
|
+
}
|
|
216
|
+
function J(t, n) {
|
|
217
|
+
const e = t.toLowerCase(), o = n.type, r = typeof n.format == "string" ? n.format : void 0;
|
|
218
|
+
if (n.enum) return "mockOption";
|
|
219
|
+
if (o === "boolean") return "mockBoolean";
|
|
220
|
+
if (o === "number" || o === "integer")
|
|
221
|
+
return /index|offset|position/.test(e) ? "mockIndex" : /count|total|amount|quantity/.test(e) ? "mockCount" : /percent|progress|opacity/.test(e) ? "mockPercent" : /width/.test(e) ? "mockWidth" : /height/.test(e) ? "mockHeight" : /price|cost/.test(e) ? "mockPrice" : /year/.test(e) ? "mockYear" : /^age$|(^|[^a-z])age$/.test(e) ? "mockAge" : o === "integer" ? "mockInt" : "mockFloat";
|
|
222
|
+
if (o === "string")
|
|
223
|
+
return r === "email" || /email/.test(e) ? "mockEmail" : /password/.test(e) ? "mockPassword" : /image|avatar|photo|thumbnail|poster|banner|logo|cover/.test(e) ? "mockImageUrl" : r === "uri" || /url|href|link/.test(e) ? "mockUrl" : r === "date" || r === "date-time" || /date/.test(e) ? "mockDate" : r === "uuid" || /uuid|slug/.test(e) ? "mockId" : /color|colour/.test(e) ? "mockColor" : /icon/.test(e) ? "mockIcon" : /username|handle|login/.test(e) ? "mockUsername" : /firstname|first_name/.test(e) ? "mockFirstName" : /lastname|last_name|surname|familyname|family_name/.test(e) ? "mockFamilyName" : /name/.test(e) ? "mockFullName" : /title|label|heading|headline/.test(e) ? "mockTitle" : /description|content|detail|body|paragraph|message|caption|subtitle|placeholder|text|summary/.test(e) ? "mockSentence" : "mockWord";
|
|
224
|
+
if (o === "object") return "mockObject";
|
|
225
|
+
if (o === "array") return "mockArray";
|
|
226
|
+
const s = typeof n.tsType == "string" ? n.tsType : "";
|
|
227
|
+
return s.includes("=>") ? "mockEvent" : s.endsWith("[]") || s.startsWith("Array<") ? "mockArray" : s && s !== "unknown" ? "mockObject" : "mockWord";
|
|
228
|
+
}
|
|
229
|
+
function v(t) {
|
|
230
|
+
const n = {};
|
|
231
|
+
if (t.description && (n.description = t.description), t.default !== void 0 && (n.default = t.default), t.kind === "select") n.enum = t.options ?? [];
|
|
232
|
+
else if (t.kind === "boolean") n.type = "boolean";
|
|
233
|
+
else if (t.kind === "number") n.type = "number";
|
|
234
|
+
else if (t.kind === "text" || t.kind === "slot") {
|
|
235
|
+
n.type = "string";
|
|
236
|
+
const e = Lt(t);
|
|
237
|
+
e && (n.format = e);
|
|
238
|
+
} else if (t.kind === "array")
|
|
239
|
+
n.type = "array", n.items = t.item ? v(t.item) : {};
|
|
240
|
+
else if (t.kind === "record")
|
|
241
|
+
n.type = "object", n.additionalProperties = t.item ? v(t.item) : {};
|
|
242
|
+
else if (t.kind === "object") {
|
|
243
|
+
n.type = "object", n.properties = Object.fromEntries((t.members ?? []).map((o) => [o.name, v(o)]));
|
|
244
|
+
const e = (t.members ?? []).filter((o) => o.required).map((o) => o.name);
|
|
245
|
+
e.length && (n.required = e);
|
|
246
|
+
} else
|
|
247
|
+
n.tsType = t.type;
|
|
248
|
+
t.bindable && (n.bindable = !0);
|
|
249
|
+
for (const [e, o] of Object.entries(t.annotations ?? {}))
|
|
250
|
+
e in n || (n[e] = o);
|
|
251
|
+
return n;
|
|
252
|
+
}
|
|
253
|
+
function Pt(t, n) {
|
|
254
|
+
return n.mock && !t.mock && (t.mock = n.mock), n.annotations && (t.annotations = n.annotations, typeof n.annotations.format == "string" && (t.format = n.annotations.format), n.annotations.default !== void 0 && t.default === void 0 && (t.default = n.annotations.default)), t;
|
|
255
|
+
}
|
|
256
|
+
function _(t, n) {
|
|
257
|
+
const e = v(n), o = n.mock ?? (n.kind === "function" || n.kind === "event" ? "mockEvent" : J(t, e));
|
|
258
|
+
return { ...e, mock: o };
|
|
259
|
+
}
|
|
260
|
+
function It(t, n, e = [], o = []) {
|
|
261
|
+
return {
|
|
262
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
263
|
+
title: t,
|
|
264
|
+
type: "object",
|
|
265
|
+
properties: Object.fromEntries(n.map((r) => [r.name, _(r.name, r)])),
|
|
266
|
+
required: n.filter((r) => r.required).map((r) => r.name),
|
|
267
|
+
slots: Object.fromEntries(e.map((r) => [r.name, _(r.name, r)])),
|
|
268
|
+
emits: o
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function Ft(t) {
|
|
272
|
+
return t === "array" || t.endsWith("[]") || t.startsWith("Array<") ? "mockArray" : /\bDate\b/.test(t) ? "mockDate" : t === "unknown" ? "mockWord" : "mockObject";
|
|
273
|
+
}
|
|
274
|
+
function $(t, n = 0, e = []) {
|
|
275
|
+
if (t.kind === "function" || t.kind === "event") return { __nimpressFn: A(t.name) };
|
|
276
|
+
if (t.default !== void 0 && t.kind !== "object" && t.kind !== "array" && t.kind !== "record") {
|
|
277
|
+
const i = t.default;
|
|
278
|
+
return typeof i == "object" && i !== null ? JSON.parse(JSON.stringify(i)) : i;
|
|
279
|
+
}
|
|
280
|
+
if (t.kind === "object") {
|
|
281
|
+
const i = {};
|
|
282
|
+
for (const a of t.members ?? []) {
|
|
283
|
+
const u = $(a, n);
|
|
284
|
+
u !== void 0 && (i[a.name] = u);
|
|
285
|
+
}
|
|
286
|
+
return Object.keys(i).length ? i : void 0;
|
|
287
|
+
}
|
|
288
|
+
if (t.kind === "array") {
|
|
289
|
+
if (!t.item) return;
|
|
290
|
+
const i = t.item.kind === "number" && !t.item.annotations && t.annotations ? { ...t.item, annotations: t.annotations } : t.item, a = $(i, n, e);
|
|
291
|
+
if (a === void 0) return;
|
|
292
|
+
const u = $(i, n + 1, [...e, a]);
|
|
293
|
+
return u === void 0 ? [a] : [a, u];
|
|
294
|
+
}
|
|
295
|
+
if (t.kind === "record") {
|
|
296
|
+
const i = {};
|
|
297
|
+
for (let a = 0; a < 2; a++) {
|
|
298
|
+
const u = I(n + a);
|
|
299
|
+
i[u] = t.item ? $(t.item, n + a) ?? T(n + a) : T(n + a);
|
|
300
|
+
}
|
|
301
|
+
return i;
|
|
302
|
+
}
|
|
303
|
+
const o = t.mock ?? (t.kind === "select" ? "mockOption" : t.kind === "json" ? Ft(t.type) : J(t.name, {
|
|
304
|
+
type: t.kind === "boolean" ? "boolean" : t.kind === "number" ? "number" : "string",
|
|
305
|
+
format: t.format
|
|
306
|
+
})), r = At[o];
|
|
307
|
+
if (typeof r != "function") return;
|
|
308
|
+
if (o === "mockOption") return r(t.options ?? [], n, e);
|
|
309
|
+
const s = r(n);
|
|
310
|
+
if (t.kind === "number" && typeof s == "number") {
|
|
311
|
+
const i = typeof t.annotations?.minimum == "number" ? t.annotations.minimum : void 0, a = typeof t.annotations?.maximum == "number" ? t.annotations.maximum : void 0;
|
|
312
|
+
if (i !== void 0 && a !== void 0) {
|
|
313
|
+
const u = n * 37 % 100 / 100;
|
|
314
|
+
return Math.round((i + (a - i) * (u || 0.5)) * 1e3) / 1e3;
|
|
315
|
+
}
|
|
316
|
+
if (i !== void 0) return Math.max(i, s);
|
|
317
|
+
if (a !== void 0) return Math.min(a, s);
|
|
318
|
+
}
|
|
319
|
+
return s;
|
|
320
|
+
}
|
|
321
|
+
function Bt(t, n) {
|
|
322
|
+
const e = new Set(n.required ?? []), o = Object.entries(n.properties ?? {}).map(
|
|
323
|
+
([i, a]) => h(i, a, e.has(i))
|
|
324
|
+
), r = Object.entries(n.slots ?? {}).map(([i, a]) => ({
|
|
325
|
+
...h(i, a),
|
|
326
|
+
kind: "slot"
|
|
327
|
+
})), s = Array.isArray(n.emits) ? n.emits : [];
|
|
328
|
+
return { component: t, props: o, slots: r, emits: s };
|
|
329
|
+
}
|
|
330
|
+
function N(t, n = "") {
|
|
331
|
+
const e = [];
|
|
332
|
+
for (const o of t) {
|
|
333
|
+
const r = n ? `${n}.${o.name || "[]"}` : o.name || "[]";
|
|
334
|
+
o.kind === "json" && /^[A-Za-z_$][\w$]*(\[\])?$/.test(o.type) && o.type !== "unknown" && e.push({ path: r, type: o.type }), o.members && e.push(...N(o.members, r)), o.item && e.push(...N([o.item], r));
|
|
335
|
+
}
|
|
336
|
+
return e;
|
|
337
|
+
}
|
|
338
|
+
function h(t, n, e = !1, o = 0) {
|
|
339
|
+
const r = n.description, s = { format: n.format, mock: n.mock, bindable: n.bindable };
|
|
340
|
+
if (n.enum) {
|
|
341
|
+
const i = n.enum.map(String);
|
|
342
|
+
return {
|
|
343
|
+
name: t,
|
|
344
|
+
kind: "select",
|
|
345
|
+
type: n.enum.map((a) => JSON.stringify(a)).join(" | "),
|
|
346
|
+
options: i,
|
|
347
|
+
required: e,
|
|
348
|
+
description: r,
|
|
349
|
+
default: n.default,
|
|
350
|
+
...s
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
if (n.type === "boolean")
|
|
354
|
+
return { name: t, kind: "boolean", type: "boolean", required: e, description: r, default: n.default, ...s };
|
|
355
|
+
if (n.type === "number" || n.type === "integer") {
|
|
356
|
+
const i = {};
|
|
357
|
+
return typeof n.minimum == "number" && (i.minimum = n.minimum), typeof n.maximum == "number" && (i.maximum = n.maximum), {
|
|
358
|
+
name: t,
|
|
359
|
+
kind: "number",
|
|
360
|
+
type: "number",
|
|
361
|
+
required: e,
|
|
362
|
+
description: r,
|
|
363
|
+
default: n.default,
|
|
364
|
+
...Object.keys(i).length ? { annotations: i } : {},
|
|
365
|
+
...s
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (n.type === "string")
|
|
369
|
+
return { name: t, kind: "text", type: "string", required: e, description: r, default: n.default, ...s };
|
|
370
|
+
if (n.type === "array" && n.items && o < O) {
|
|
371
|
+
const i = h("", n.items, !1, o + 1), a = {};
|
|
372
|
+
return typeof n.minimum == "number" && (a.minimum = n.minimum), typeof n.maximum == "number" && (a.maximum = n.maximum), {
|
|
373
|
+
name: t,
|
|
374
|
+
kind: "array",
|
|
375
|
+
type: n.title ?? `${i.type}[]`,
|
|
376
|
+
item: i,
|
|
377
|
+
required: e,
|
|
378
|
+
description: r,
|
|
379
|
+
default: n.default,
|
|
380
|
+
shape: `${i.shape ?? i.type}[]`,
|
|
381
|
+
...Object.keys(a).length ? { annotations: a } : {},
|
|
382
|
+
...s
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
if (n.type === "object" && !n.properties && n.additionalProperties && o < O) {
|
|
386
|
+
const i = h("", n.additionalProperties, !1, o + 1);
|
|
387
|
+
return {
|
|
388
|
+
name: t,
|
|
389
|
+
kind: "record",
|
|
390
|
+
type: n.title ?? "object",
|
|
391
|
+
item: i,
|
|
392
|
+
required: e,
|
|
393
|
+
description: r,
|
|
394
|
+
default: n.default,
|
|
395
|
+
shape: `Record<string, ${i.shape ?? i.type}>`,
|
|
396
|
+
...s
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
if (n.type === "object" && n.properties && o < O) {
|
|
400
|
+
const i = n.required ?? [], a = Object.entries(n.properties).map(
|
|
401
|
+
([u, m]) => h(u, m, i.includes(u), o + 1)
|
|
402
|
+
);
|
|
403
|
+
return {
|
|
404
|
+
name: t,
|
|
405
|
+
kind: "object",
|
|
406
|
+
type: n.title ?? "object",
|
|
407
|
+
members: a,
|
|
408
|
+
required: e,
|
|
409
|
+
description: r,
|
|
410
|
+
default: n.default,
|
|
411
|
+
shape: D(a),
|
|
412
|
+
...s
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
return n.tsType?.includes("=>") ? { name: t, kind: "function", type: n.tsType, required: e, description: r, default: n.default, ...s } : { name: t, kind: "json", type: n.tsType ?? n.type ?? "unknown", required: e, description: r, default: n.default, ...s };
|
|
416
|
+
}
|
|
417
|
+
function S(t, n, e, o = "", r, s = 0, i = []) {
|
|
418
|
+
const u = F(n, o).replace(/\s+/g, " ").trim(), m = L(u);
|
|
419
|
+
if (m) return { name: t, kind: "select", type: u, options: m, required: !e, description: r };
|
|
420
|
+
const c = u.replace(/\s*\|\s*(undefined|null)\s*/g, "").trim();
|
|
421
|
+
if (c === "boolean") return { name: t, kind: "boolean", type: u, required: !e, description: r };
|
|
422
|
+
if (c === "number") return { name: t, kind: "number", type: u, required: !e, description: r };
|
|
423
|
+
if (c === "string") return { name: t, kind: "text", type: u, required: !e, description: r };
|
|
424
|
+
if (c.includes("|")) {
|
|
425
|
+
const l = q(c).flatMap((d) => q(F(d, o))), p = L(l.join(" | "));
|
|
426
|
+
if (p) return { name: t, kind: "select", type: u, options: p, required: !e, description: r };
|
|
427
|
+
if (l.includes("string")) return { name: t, kind: "text", type: u, required: !e, description: r };
|
|
428
|
+
if (l.includes("number")) return { name: t, kind: "number", type: u, required: !e, description: r };
|
|
429
|
+
if (l.includes("boolean")) return { name: t, kind: "boolean", type: u, required: !e, description: r };
|
|
430
|
+
}
|
|
431
|
+
if (/^\([^)]*\)\s*=>/.test(c))
|
|
432
|
+
return { name: t, kind: "function", type: u, required: !e, description: r };
|
|
433
|
+
if (s < 4) {
|
|
434
|
+
const l = c.match(/^Record<\s*string\s*,\s*(.+)>$/)?.[1] ?? c.match(/^\{\s*\[\s*\w+\s*:\s*string\s*\]\s*:\s*(.+?);?\s*\}$/)?.[1];
|
|
435
|
+
if (l) {
|
|
436
|
+
const y = S("", l, !1, o, void 0, s + 1, i);
|
|
437
|
+
return {
|
|
438
|
+
name: t,
|
|
439
|
+
kind: "record",
|
|
440
|
+
type: u,
|
|
441
|
+
item: y,
|
|
442
|
+
required: !e,
|
|
443
|
+
description: r,
|
|
444
|
+
shape: `Record<string, ${y.shape ?? y.type}>`
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
const p = c.match(/^(.*\S)\[\]$/)?.[1] ?? c.match(/^Array<(.+)>$/)?.[1];
|
|
448
|
+
if (p) {
|
|
449
|
+
const y = S("", p, !1, o, void 0, s + 1, i);
|
|
450
|
+
if (y.kind !== "json")
|
|
451
|
+
return {
|
|
452
|
+
name: t,
|
|
453
|
+
kind: "array",
|
|
454
|
+
type: u,
|
|
455
|
+
item: y,
|
|
456
|
+
required: !e,
|
|
457
|
+
description: r,
|
|
458
|
+
shape: `${y.shape ?? y.type}[]`
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
let d = null, j = "";
|
|
462
|
+
if (c.startsWith("{") && c.endsWith("}") ? d = c.slice(1, -1) : /^[A-Za-z_$][\w$]*$/.test(c) && !i.includes(c) && (j = c, d = Nt(o, c)), d !== null) {
|
|
463
|
+
const y = j ? [...i, j] : i, w = qt(d).map((b) => {
|
|
464
|
+
const x = S(b.name, b.type, b.optional, o, b.description, s + 1, y);
|
|
465
|
+
return b.mock && !x.mock && (x.mock = b.mock), x;
|
|
466
|
+
});
|
|
467
|
+
if (w.length)
|
|
468
|
+
return {
|
|
469
|
+
name: t,
|
|
470
|
+
kind: "object",
|
|
471
|
+
type: u,
|
|
472
|
+
members: w,
|
|
473
|
+
required: !e,
|
|
474
|
+
description: r,
|
|
475
|
+
shape: D(w)
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return { name: t, kind: "json", type: u, required: !e, description: r };
|
|
480
|
+
}
|
|
481
|
+
function Dt(t) {
|
|
482
|
+
const n = t.trim();
|
|
483
|
+
if (n === "true") return !0;
|
|
484
|
+
if (n === "false") return !1;
|
|
485
|
+
if (n === "null") return null;
|
|
486
|
+
if (/^-?\d+(\.\d+)?$/.test(n)) return Number(n);
|
|
487
|
+
const e = n.match(/^['"]([\s\S]*)['"]$/);
|
|
488
|
+
if (e) return e[1];
|
|
489
|
+
try {
|
|
490
|
+
return JSON.parse(n);
|
|
491
|
+
} catch {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function _t(t, n, e = "{", o = "}") {
|
|
496
|
+
let r = 1;
|
|
497
|
+
for (let s = n; s < t.length; s++) {
|
|
498
|
+
const i = t[s];
|
|
499
|
+
if (i === e) r++;
|
|
500
|
+
else if (i === o && (r--, r === 0))
|
|
501
|
+
return t.slice(n, s);
|
|
502
|
+
}
|
|
503
|
+
return t.slice(n);
|
|
504
|
+
}
|
|
505
|
+
function Nt(t, n) {
|
|
506
|
+
const e = [
|
|
507
|
+
new RegExp(`interface\\s+${n}\\s*(?:extends[^{]+)?\\{`),
|
|
508
|
+
new RegExp(`type\\s+${n}\\s*=\\s*\\{`)
|
|
509
|
+
];
|
|
510
|
+
for (const o of e) {
|
|
511
|
+
const r = o.exec(t);
|
|
512
|
+
if (r)
|
|
513
|
+
return _t(t, r.index + r[0].length);
|
|
514
|
+
}
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
export {
|
|
518
|
+
Ct as a,
|
|
519
|
+
Et as b,
|
|
520
|
+
qt as c,
|
|
521
|
+
Pt as d,
|
|
522
|
+
Nt as e,
|
|
523
|
+
A as f,
|
|
524
|
+
S as g,
|
|
525
|
+
Wt as h,
|
|
526
|
+
V as i,
|
|
527
|
+
Mt as j,
|
|
528
|
+
Bt as k,
|
|
529
|
+
Lt as l,
|
|
530
|
+
$ as m,
|
|
531
|
+
M as n,
|
|
532
|
+
N as o,
|
|
533
|
+
Dt as p,
|
|
534
|
+
J as q,
|
|
535
|
+
_t as r,
|
|
536
|
+
It as s,
|
|
537
|
+
v as t
|
|
538
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nimtech/nimpress",
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"description": "Svelte 5 docs framework that supports it all.",
|
|
5
|
+
"author": "nimling",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/nimling/nimpress.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/nimling/nimpress#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nimling/nimpress/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/nimpress.es.js",
|
|
17
|
+
"module": "./dist/nimpress.es.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"svelte": "./dist/nimpress.es.js",
|
|
20
|
+
"bin": {
|
|
21
|
+
"nimpress": "bin/nimpress.mjs"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"svelte": "./dist/nimpress.es.js",
|
|
27
|
+
"import": "./dist/nimpress.es.js"
|
|
28
|
+
},
|
|
29
|
+
"./plugin": {
|
|
30
|
+
"types": "./dist/plugin.d.ts",
|
|
31
|
+
"import": "./dist/plugin.es.js"
|
|
32
|
+
},
|
|
33
|
+
"./cli": {
|
|
34
|
+
"types": "./dist/cli.d.ts",
|
|
35
|
+
"import": "./dist/cli.es.js"
|
|
36
|
+
},
|
|
37
|
+
"./story": {
|
|
38
|
+
"types": "./dist/story/index.d.ts",
|
|
39
|
+
"import": "./dist/story.es.js"
|
|
40
|
+
},
|
|
41
|
+
"./tailwind": {
|
|
42
|
+
"types": "./dist/tailwind.preset.d.ts",
|
|
43
|
+
"import": "./dist/tailwind.preset.es.js"
|
|
44
|
+
},
|
|
45
|
+
"./harness/vue": "./src/harness/vue/index.ts",
|
|
46
|
+
"./harness/svelte": "./src/harness/svelte/index.ts",
|
|
47
|
+
"./mock": "./src/mock/index.ts",
|
|
48
|
+
"./app.css": "./src/styles/app.css",
|
|
49
|
+
"./style.css": "./dist/style.css"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"bin",
|
|
54
|
+
"src/styles",
|
|
55
|
+
"src/harness",
|
|
56
|
+
"src/mock",
|
|
57
|
+
".claude/rules",
|
|
58
|
+
"config.schema.json"
|
|
59
|
+
],
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"svelte": "^5.0.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@codemirror/commands": "^6.10.3",
|
|
65
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
66
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
67
|
+
"@codemirror/lang-python": "^6.2.1",
|
|
68
|
+
"@codemirror/language": "^6.12.3",
|
|
69
|
+
"@codemirror/legacy-modes": "^6.5.3",
|
|
70
|
+
"@codemirror/state": "^6.6.0",
|
|
71
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
72
|
+
"@codemirror/view": "^6.43.0",
|
|
73
|
+
"@dbml/core": "^10.1.0",
|
|
74
|
+
"@lezer/highlight": "^1.2.3",
|
|
75
|
+
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
|
76
|
+
"@tailwindcss/vite": "^4.1.17",
|
|
77
|
+
"@xyflow/svelte": "^1.6.3",
|
|
78
|
+
"codemirror": "^6.0.2",
|
|
79
|
+
"gray-matter": "^4.0.3",
|
|
80
|
+
"markdown-it": "^14.1.0",
|
|
81
|
+
"markdown-it-anchor": "^9.2.0",
|
|
82
|
+
"markdown-it-attrs": "^4.3.1",
|
|
83
|
+
"markdown-it-container": "^4.0.0",
|
|
84
|
+
"markdown-it-deflist": "^3.0.0",
|
|
85
|
+
"markdown-it-footnote": "^4.0.0",
|
|
86
|
+
"markdown-it-task-lists": "^2.1.1",
|
|
87
|
+
"mermaid": "^11.4.1",
|
|
88
|
+
"minisearch": "^7.1.2",
|
|
89
|
+
"path-to-regexp": "^8.0.0",
|
|
90
|
+
"shiki": "^1.24.0",
|
|
91
|
+
"sly-svelte-location-router": "^3.3.5",
|
|
92
|
+
"tailwindcss": "^4.1.17",
|
|
93
|
+
"vite": "^6.3.5",
|
|
94
|
+
"yaml": "^2.9.0",
|
|
95
|
+
"zod": "^3.23.8"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@tsconfig/svelte": "^5.0.4",
|
|
99
|
+
"@types/markdown-it": "^14.1.2",
|
|
100
|
+
"@types/markdown-it-container": "^2.0.10",
|
|
101
|
+
"@types/markdown-it-footnote": "^3.0.4",
|
|
102
|
+
"@types/node": "^22.10.0",
|
|
103
|
+
"autoprefixer": "^10.4.21",
|
|
104
|
+
"playwright": "^1.60.0",
|
|
105
|
+
"postcss": "^8.5.6",
|
|
106
|
+
"svelte": "^5.34.7",
|
|
107
|
+
"svelte-check": "^4.2.2",
|
|
108
|
+
"typescript": "~5.9.3",
|
|
109
|
+
"vite-plugin-dts": "^4.5.4",
|
|
110
|
+
"vitest": "^4.1.10"
|
|
111
|
+
},
|
|
112
|
+
"publishConfig": {
|
|
113
|
+
"access": "public"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"dev": "node scripts/dev.mjs",
|
|
117
|
+
"build:lib": "vite build --mode library",
|
|
118
|
+
"preview:lib": "vite preview --mode library",
|
|
119
|
+
"type-check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
|
|
120
|
+
"test": "vitest run",
|
|
121
|
+
"bump": "../sbump/sbump.sh patch --package-file=package.json --push-version",
|
|
122
|
+
"bump:minor": "../sbump/sbump.sh minor --package-file=package.json --push-version",
|
|
123
|
+
"bump:major": "../sbump/sbump.sh major --package-file=package.json --push-version"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
let { children }: { children?: Snippet } = $props()
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class="nimpress-harness">{@render children?.()}</div>
|
|
7
|
+
|
|
8
|
+
<style>
|
|
9
|
+
.nimpress-harness {
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
</style>
|