@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.
Files changed (223) hide show
  1. package/.claude/rules/changelog-entries.md +229 -0
  2. package/.claude/rules/chunk-cycles.md +23 -0
  3. package/.claude/rules/component-modules.md +152 -0
  4. package/.claude/rules/dbml-pages.md +118 -0
  5. package/.claude/rules/deploy.md +47 -0
  6. package/.claude/rules/doc-pages.md +93 -0
  7. package/.claude/rules/docs-authoring.md +90 -0
  8. package/.claude/rules/docs-sync.md +59 -0
  9. package/.claude/rules/file-layout.md +49 -0
  10. package/.claude/rules/frontmatter.md +91 -0
  11. package/.claude/rules/page-types.md +108 -0
  12. package/.claude/rules/paths.md +27 -0
  13. package/.claude/rules/roadmap-entries.md +154 -0
  14. package/.claude/rules/style.md +61 -0
  15. package/LICENSE +201 -0
  16. package/README.md +137 -0
  17. package/bin/nimpress.mjs +7 -0
  18. package/config.schema.json +555 -0
  19. package/dist/DbmlNote-CTwTd5vM.js +21 -0
  20. package/dist/DbmlTable-BXIyJnLV.js +209 -0
  21. package/dist/cli.es.js +1265 -0
  22. package/dist/nimpress.es.js +8896 -0
  23. package/dist/plugin-DQtunTIv.js +8268 -0
  24. package/dist/plugin.es.js +23 -0
  25. package/dist/src/api/CodeExamples.svelte.d.ts +1 -0
  26. package/dist/src/api/MethodBadge.svelte.d.ts +1 -0
  27. package/dist/src/api/OpenApiRoot.svelte.d.ts +1 -0
  28. package/dist/src/api/Operation.svelte.d.ts +1 -0
  29. package/dist/src/api/ParamRow.svelte.d.ts +1 -0
  30. package/dist/src/api/Schema.svelte.d.ts +1 -0
  31. package/dist/src/api/TryDialog.svelte.d.ts +1 -0
  32. package/dist/src/api/TryPanel.svelte.d.ts +1 -0
  33. package/dist/src/api/refs.d.ts +12 -0
  34. package/dist/src/api/refs.d.ts.map +1 -0
  35. package/dist/src/api/tryState.d.ts +21 -0
  36. package/dist/src/api/tryState.d.ts.map +1 -0
  37. package/dist/src/api/types.d.ts +63 -0
  38. package/dist/src/api/types.d.ts.map +1 -0
  39. package/dist/src/auth/AccountMenu.svelte.d.ts +1 -0
  40. package/dist/src/auth/guard.d.ts +5 -0
  41. package/dist/src/auth/guard.d.ts.map +1 -0
  42. package/dist/src/auth/session.d.ts +8 -0
  43. package/dist/src/auth/session.d.ts.map +1 -0
  44. package/dist/src/banner.d.ts +23 -0
  45. package/dist/src/banner.d.ts.map +1 -0
  46. package/dist/src/cli/export.d.ts +4 -0
  47. package/dist/src/cli/export.d.ts.map +1 -0
  48. package/dist/src/cli/guard.d.ts +3 -0
  49. package/dist/src/cli/guard.d.ts.map +1 -0
  50. package/dist/src/cli/init.d.ts +2 -0
  51. package/dist/src/cli/init.d.ts.map +1 -0
  52. package/dist/src/cli/lint.d.ts +11 -0
  53. package/dist/src/cli/lint.d.ts.map +1 -0
  54. package/dist/src/cli/modules.d.ts +3 -0
  55. package/dist/src/cli/modules.d.ts.map +1 -0
  56. package/dist/src/cli/shared.d.ts +6 -0
  57. package/dist/src/cli/shared.d.ts.map +1 -0
  58. package/dist/src/cli/site.d.ts +7 -0
  59. package/dist/src/cli/site.d.ts.map +1 -0
  60. package/dist/src/cli.d.ts +5 -0
  61. package/dist/src/cli.d.ts.map +1 -0
  62. package/dist/src/config/base.d.ts +4 -0
  63. package/dist/src/config/base.d.ts.map +1 -0
  64. package/dist/src/config/chunkCycles.d.ts +10 -0
  65. package/dist/src/config/chunkCycles.d.ts.map +1 -0
  66. package/dist/src/config/defaults.d.ts +4 -0
  67. package/dist/src/config/defaults.d.ts.map +1 -0
  68. package/dist/src/config/html.d.ts +3 -0
  69. package/dist/src/config/html.d.ts.map +1 -0
  70. package/dist/src/config/load.d.ts +20 -0
  71. package/dist/src/config/load.d.ts.map +1 -0
  72. package/dist/src/config/paths.d.ts +8 -0
  73. package/dist/src/config/paths.d.ts.map +1 -0
  74. package/dist/src/config/schema.d.ts +1238 -0
  75. package/dist/src/config/schema.d.ts.map +1 -0
  76. package/dist/src/config/viteConfig.d.ts +11 -0
  77. package/dist/src/config/viteConfig.d.ts.map +1 -0
  78. package/dist/src/dbml/erd.d.ts +59 -0
  79. package/dist/src/dbml/erd.d.ts.map +1 -0
  80. package/dist/src/framework/configStore.d.ts +7 -0
  81. package/dist/src/framework/configStore.d.ts.map +1 -0
  82. package/dist/src/framework/createNimpressApp.d.ts +10 -0
  83. package/dist/src/framework/createNimpressApp.d.ts.map +1 -0
  84. package/dist/src/framework/gated.d.ts +5 -0
  85. package/dist/src/framework/gated.d.ts.map +1 -0
  86. package/dist/src/framework/hashSpy.d.ts +7 -0
  87. package/dist/src/framework/hashSpy.d.ts.map +1 -0
  88. package/dist/src/framework/pageMeta.d.ts +4 -0
  89. package/dist/src/framework/pageMeta.d.ts.map +1 -0
  90. package/dist/src/framework/pageStyles.d.ts +2 -0
  91. package/dist/src/framework/pageStyles.d.ts.map +1 -0
  92. package/dist/src/framework/router.d.ts +5 -0
  93. package/dist/src/framework/router.d.ts.map +1 -0
  94. package/dist/src/framework/stores/feed.d.ts +8 -0
  95. package/dist/src/framework/stores/feed.d.ts.map +1 -0
  96. package/dist/src/framework/stores/sidebar.d.ts +4 -0
  97. package/dist/src/framework/stores/sidebar.d.ts.map +1 -0
  98. package/dist/src/framework/stores/theme.d.ts +6 -0
  99. package/dist/src/framework/stores/theme.d.ts.map +1 -0
  100. package/dist/src/framework/stores/viewer.d.ts +6 -0
  101. package/dist/src/framework/stores/viewer.d.ts.map +1 -0
  102. package/dist/src/icons/FullscreenIcon.svelte.d.ts +1 -0
  103. package/dist/src/icons/IconAdd.svelte.d.ts +1 -0
  104. package/dist/src/icons/IconChevron.svelte.d.ts +1 -0
  105. package/dist/src/icons/IconClear.svelte.d.ts +1 -0
  106. package/dist/src/icons/IconConsole.svelte.d.ts +1 -0
  107. package/dist/src/icons/IconDock.svelte.d.ts +1 -0
  108. package/dist/src/icons/IconDownload.svelte.d.ts +1 -0
  109. package/dist/src/icons/IconJson.svelte.d.ts +1 -0
  110. package/dist/src/icons/IconMinus.svelte.d.ts +1 -0
  111. package/dist/src/icons/IconMock.svelte.d.ts +1 -0
  112. package/dist/src/icons/IconMoon.svelte.d.ts +1 -0
  113. package/dist/src/icons/IconOpen.svelte.d.ts +1 -0
  114. package/dist/src/icons/IconReload.svelte.d.ts +1 -0
  115. package/dist/src/icons/IconRemove.svelte.d.ts +1 -0
  116. package/dist/src/icons/IconShadow.svelte.d.ts +1 -0
  117. package/dist/src/icons/IconSun.svelte.d.ts +1 -0
  118. package/dist/src/index.d.ts +44 -0
  119. package/dist/src/index.d.ts.map +1 -0
  120. package/dist/src/layout/App.svelte.d.ts +1 -0
  121. package/dist/src/layout/AppRoot.svelte.d.ts +1 -0
  122. package/dist/src/layout/BackToTop.svelte.d.ts +1 -0
  123. package/dist/src/layout/Breadcrumbs.svelte.d.ts +1 -0
  124. package/dist/src/layout/GatedPage.svelte.d.ts +1 -0
  125. package/dist/src/layout/Header.svelte.d.ts +1 -0
  126. package/dist/src/layout/HomePage.svelte.d.ts +1 -0
  127. package/dist/src/layout/RightToc.svelte.d.ts +1 -0
  128. package/dist/src/layout/Sidebar.svelte.d.ts +1 -0
  129. package/dist/src/layout/SidebarNode.svelte.d.ts +1 -0
  130. package/dist/src/markdown/Actions.svelte.d.ts +1 -0
  131. package/dist/src/markdown/CalloutCheck.svelte.d.ts +1 -0
  132. package/dist/src/markdown/CalloutInfo.svelte.d.ts +1 -0
  133. package/dist/src/markdown/CalloutNote.svelte.d.ts +1 -0
  134. package/dist/src/markdown/CalloutTip.svelte.d.ts +1 -0
  135. package/dist/src/markdown/CalloutWarning.svelte.d.ts +1 -0
  136. package/dist/src/markdown/Card.svelte.d.ts +1 -0
  137. package/dist/src/markdown/CardGroup.svelte.d.ts +1 -0
  138. package/dist/src/markdown/ChangelogPage.svelte.d.ts +1 -0
  139. package/dist/src/markdown/CodeBlock.svelte.d.ts +1 -0
  140. package/dist/src/markdown/CodeEditor.svelte.d.ts +1 -0
  141. package/dist/src/markdown/CodeGroup.svelte.d.ts +1 -0
  142. package/dist/src/markdown/ComponentEmbed.svelte.d.ts +1 -0
  143. package/dist/src/markdown/ComponentPage.svelte.d.ts +1 -0
  144. package/dist/src/markdown/ControlNode.svelte.d.ts +1 -0
  145. package/dist/src/markdown/DBMLBlock.svelte.d.ts +1 -0
  146. package/dist/src/markdown/DbmlNote.svelte.d.ts +1 -0
  147. package/dist/src/markdown/DbmlPage.svelte.d.ts +1 -0
  148. package/dist/src/markdown/DbmlTable.svelte.d.ts +1 -0
  149. package/dist/src/markdown/DragDivider.svelte.d.ts +1 -0
  150. package/dist/src/markdown/Feature.svelte.d.ts +1 -0
  151. package/dist/src/markdown/FeatureGrid.svelte.d.ts +1 -0
  152. package/dist/src/markdown/HeroPage.svelte.d.ts +1 -0
  153. package/dist/src/markdown/MermaidBlock.svelte.d.ts +1 -0
  154. package/dist/src/markdown/Page.svelte.d.ts +1 -0
  155. package/dist/src/markdown/PlanetFooter.svelte.d.ts +1 -0
  156. package/dist/src/markdown/RoadmapBlob.svelte.d.ts +1 -0
  157. package/dist/src/markdown/RoadmapNode.svelte.d.ts +1 -0
  158. package/dist/src/markdown/RoadmapPage.svelte.d.ts +1 -0
  159. package/dist/src/markdown/SubscribeDialog.svelte.d.ts +1 -0
  160. package/dist/src/mock/index.d.ts +42 -0
  161. package/dist/src/mock/index.d.ts.map +1 -0
  162. package/dist/src/modules/autoStory.d.ts +5 -0
  163. package/dist/src/modules/autoStory.d.ts.map +1 -0
  164. package/dist/src/modules/componentData.d.ts +14 -0
  165. package/dist/src/modules/componentData.d.ts.map +1 -0
  166. package/dist/src/modules/harness.d.ts +25 -0
  167. package/dist/src/modules/harness.d.ts.map +1 -0
  168. package/dist/src/modules/importStorybook.d.ts +12 -0
  169. package/dist/src/modules/importStorybook.d.ts.map +1 -0
  170. package/dist/src/modules/lint.d.ts +3 -0
  171. package/dist/src/modules/lint.d.ts.map +1 -0
  172. package/dist/src/modules/pages.d.ts +10 -0
  173. package/dist/src/modules/pages.d.ts.map +1 -0
  174. package/dist/src/modules/parse/dts.d.ts +4 -0
  175. package/dist/src/modules/parse/dts.d.ts.map +1 -0
  176. package/dist/src/modules/parse/svelte.d.ts +3 -0
  177. package/dist/src/modules/parse/svelte.d.ts.map +1 -0
  178. package/dist/src/modules/parse/typeMembers.d.ts +64 -0
  179. package/dist/src/modules/parse/typeMembers.d.ts.map +1 -0
  180. package/dist/src/modules/parse/vue.d.ts +3 -0
  181. package/dist/src/modules/parse/vue.d.ts.map +1 -0
  182. package/dist/src/modules/resolve.d.ts +9 -0
  183. package/dist/src/modules/resolve.d.ts.map +1 -0
  184. package/dist/src/modules/schema.d.ts +53 -0
  185. package/dist/src/modules/schema.d.ts.map +1 -0
  186. package/dist/src/modules/stories.d.ts +4 -0
  187. package/dist/src/modules/stories.d.ts.map +1 -0
  188. package/dist/src/search/SearchModal.svelte.d.ts +1 -0
  189. package/dist/src/search/indexer.d.ts +5 -0
  190. package/dist/src/search/indexer.d.ts.map +1 -0
  191. package/dist/src/story/index.d.ts +17 -0
  192. package/dist/src/story/index.d.ts.map +1 -0
  193. package/dist/src/subscribe/subscribe.d.ts +5 -0
  194. package/dist/src/subscribe/subscribe.d.ts.map +1 -0
  195. package/dist/src/types.d.ts +531 -0
  196. package/dist/src/types.d.ts.map +1 -0
  197. package/dist/story.es.js +10 -0
  198. package/dist/style.css +1 -0
  199. package/dist/tailwind.preset.d.ts +4 -0
  200. package/dist/tailwind.preset.d.ts.map +1 -0
  201. package/dist/tailwind.preset.es.js +67 -0
  202. package/dist/typeMembers-CNvE92EX.js +538 -0
  203. package/package.json +125 -0
  204. package/src/harness/svelte/ComponentHarness.svelte +12 -0
  205. package/src/harness/svelte/ComponentHarnessEffects.svelte +24 -0
  206. package/src/harness/svelte/ComponentHarnessOverlay.svelte +9 -0
  207. package/src/harness/svelte/ComponentStory.svelte +9 -0
  208. package/src/harness/svelte/DefaultHarness.svelte +15 -0
  209. package/src/harness/svelte/HarnessRoot.svelte +22 -0
  210. package/src/harness/svelte/context.svelte.ts +33 -0
  211. package/src/harness/svelte/index.ts +12 -0
  212. package/src/harness/vue/ComponentHarness.vue +16 -0
  213. package/src/harness/vue/ComponentHarnessEffects.vue +27 -0
  214. package/src/harness/vue/ComponentHarnessOverlay.vue +12 -0
  215. package/src/harness/vue/ComponentStory.vue +16 -0
  216. package/src/harness/vue/DefaultHarness.vue +14 -0
  217. package/src/harness/vue/context.ts +37 -0
  218. package/src/harness/vue/index.ts +11 -0
  219. package/src/mock/index.ts +88 -0
  220. package/src/styles/app.css +3 -0
  221. package/src/styles/preflight.css +540 -0
  222. package/src/styles/theme.css +81 -0
  223. package/src/styles/tokens.css +150 -0
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+ import { useHarness } from './context.svelte'
4
+ const ctx = useHarness()
5
+ let { children }: { children?: Snippet } = $props()
6
+ </script>
7
+
8
+ <div class="nimpress-harness-effects" class:nimpress-harness-shadow={ctx.shadow}>
9
+ {@render children?.()}
10
+ </div>
11
+
12
+ <style>
13
+ .nimpress-harness-effects {
14
+ display: contents;
15
+ }
16
+
17
+ .nimpress-harness-shadow > :global(*) {
18
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
19
+ }
20
+
21
+ :global([data-theme='dark']) .nimpress-harness-shadow > :global(*) {
22
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.09);
23
+ }
24
+ </style>
@@ -0,0 +1,9 @@
1
+ <script lang="ts">
2
+ import { useHarness } from './context.svelte'
3
+ const ctx = useHarness()
4
+ </script>
5
+
6
+ {#if ctx.overlay}
7
+ {@const Overlay = ctx.overlay}
8
+ <Overlay />
9
+ {/if}
@@ -0,0 +1,9 @@
1
+ <script lang="ts">
2
+ import { useHarness } from './context.svelte'
3
+ const ctx = useHarness()
4
+ </script>
5
+
6
+ {#if ctx.component}
7
+ {@const Story = ctx.component}
8
+ <Story {...ctx.props} />
9
+ {/if}
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+ import ComponentHarness from './ComponentHarness.svelte'
4
+ import ComponentHarnessEffects from './ComponentHarnessEffects.svelte'
5
+ import ComponentHarnessOverlay from './ComponentHarnessOverlay.svelte'
6
+
7
+ let { children }: { children?: Snippet } = $props()
8
+ </script>
9
+
10
+ <ComponentHarness>
11
+ <ComponentHarnessEffects>
12
+ {@render children?.()}
13
+ </ComponentHarnessEffects>
14
+ <ComponentHarnessOverlay />
15
+ </ComponentHarness>
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import type { Component } from 'svelte'
3
+ import { setHarness, type HarnessContext } from './context.svelte'
4
+ import ComponentStory from './ComponentStory.svelte'
5
+
6
+ let {
7
+ ctx,
8
+ harness: Harness,
9
+ storyHarness: StoryHarness
10
+ }: { ctx: HarnessContext; harness: Component; storyHarness?: Component } = $props()
11
+ setHarness(ctx)
12
+ </script>
13
+
14
+ <Harness>
15
+ {#if StoryHarness}
16
+ <StoryHarness>
17
+ <ComponentStory />
18
+ </StoryHarness>
19
+ {:else}
20
+ <ComponentStory />
21
+ {/if}
22
+ </Harness>
@@ -0,0 +1,33 @@
1
+ import { getContext, setContext } from 'svelte'
2
+ import type { Component } from 'svelte'
3
+
4
+ export interface HarnessContext {
5
+ component: Component | null
6
+ props: Record<string, unknown>
7
+ overlay: Component | null
8
+ shadow: boolean
9
+ zoom: number
10
+ }
11
+
12
+ const HARNESS_KEY = Symbol('nimpressHarness')
13
+
14
+ export function createHarnessContext(): HarnessContext {
15
+ const ctx: HarnessContext = $state({
16
+ component: null,
17
+ props: {},
18
+ overlay: null,
19
+ shadow: false,
20
+ zoom: 1
21
+ })
22
+ return ctx
23
+ }
24
+
25
+ export function setHarness(ctx: HarnessContext): void {
26
+ setContext(HARNESS_KEY, ctx)
27
+ }
28
+
29
+ export function useHarness(): HarnessContext {
30
+ const ctx = getContext<HarnessContext>(HARNESS_KEY)
31
+ if (!ctx) throw new Error('nimpress harness primitive used outside a ComponentHarness tree')
32
+ return ctx
33
+ }
@@ -0,0 +1,12 @@
1
+ export { default as ComponentHarness } from './ComponentHarness.svelte'
2
+ export { default as ComponentHarnessEffects } from './ComponentHarnessEffects.svelte'
3
+ export { default as ComponentHarnessOverlay } from './ComponentHarnessOverlay.svelte'
4
+ export { default as ComponentStory } from './ComponentStory.svelte'
5
+ export { default as DefaultHarness } from './DefaultHarness.svelte'
6
+ export { default as HarnessRoot } from './HarnessRoot.svelte'
7
+ export {
8
+ createHarnessContext,
9
+ setHarness,
10
+ useHarness,
11
+ type HarnessContext,
12
+ } from './context.svelte'
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { defineComponent, h } from 'vue'
3
+
4
+ export default defineComponent({
5
+ name: 'ComponentHarness',
6
+ setup(_, { slots }) {
7
+ return () => h('div', { class: 'nimpress-harness' }, slots.default?.())
8
+ },
9
+ })
10
+ </script>
11
+
12
+ <style>
13
+ .nimpress-harness {
14
+ display: contents;
15
+ }
16
+ </style>
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { computed, defineComponent, h } from 'vue'
3
+ import { useHarness } from './context'
4
+
5
+ export default defineComponent({
6
+ name: 'ComponentHarnessEffects',
7
+ setup(_, { slots }) {
8
+ const ctx = useHarness()
9
+ const cls = computed(() => ['nimpress-harness-effects', { 'nimpress-harness-shadow': ctx.shadow.value }])
10
+ return () => h('div', { class: cls.value }, slots.default?.())
11
+ },
12
+ })
13
+ </script>
14
+
15
+ <style>
16
+ .nimpress-harness-effects {
17
+ display: contents;
18
+ }
19
+
20
+ .nimpress-harness-shadow > * {
21
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
22
+ }
23
+
24
+ [data-theme='dark'] .nimpress-harness-shadow > * {
25
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.09);
26
+ }
27
+ </style>
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import { defineComponent, h } from 'vue'
3
+ import { useHarness } from './context'
4
+
5
+ export default defineComponent({
6
+ name: 'ComponentHarnessOverlay',
7
+ setup() {
8
+ const ctx = useHarness()
9
+ return () => (ctx.overlay.value ? h(ctx.overlay.value) : null)
10
+ },
11
+ })
12
+ </script>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { defineComponent, h } from 'vue'
3
+ import { useHarness } from './context'
4
+
5
+ export default defineComponent({
6
+ name: 'ComponentStory',
7
+ setup() {
8
+ const ctx = useHarness()
9
+ return () => {
10
+ const target = ctx.component.value
11
+ if (!target) return null
12
+ return h(target, ctx.props.value, ctx.slots.value)
13
+ }
14
+ },
15
+ })
16
+ </script>
@@ -0,0 +1,14 @@
1
+ <script setup lang="ts">
2
+ import ComponentHarness from './ComponentHarness.vue'
3
+ import ComponentHarnessEffects from './ComponentHarnessEffects.vue'
4
+ import ComponentHarnessOverlay from './ComponentHarnessOverlay.vue'
5
+ </script>
6
+
7
+ <template>
8
+ <ComponentHarness>
9
+ <ComponentHarnessEffects>
10
+ <slot />
11
+ </ComponentHarnessEffects>
12
+ <ComponentHarnessOverlay />
13
+ </ComponentHarness>
14
+ </template>
@@ -0,0 +1,37 @@
1
+ import {
2
+ inject,
3
+ ref,
4
+ shallowRef,
5
+ type Component,
6
+ type InjectionKey,
7
+ type Ref,
8
+ type ShallowRef,
9
+ } from 'vue'
10
+
11
+ export interface HarnessContext {
12
+ component: ShallowRef<Component | null>
13
+ props: ShallowRef<Record<string, unknown>>
14
+ slots: ShallowRef<Record<string, () => unknown>>
15
+ overlay: ShallowRef<Component | null>
16
+ shadow: Ref<boolean>
17
+ zoom: Ref<number>
18
+ }
19
+
20
+ export const HARNESS_KEY: InjectionKey<HarnessContext> = Symbol('nimpressHarness')
21
+
22
+ export function createHarnessContext(): HarnessContext {
23
+ return {
24
+ component: shallowRef(null),
25
+ props: shallowRef({}),
26
+ slots: shallowRef({}),
27
+ overlay: shallowRef(null),
28
+ shadow: ref(false),
29
+ zoom: ref(1),
30
+ }
31
+ }
32
+
33
+ export function useHarness(): HarnessContext {
34
+ const ctx = inject(HARNESS_KEY, null)
35
+ if (!ctx) throw new Error('nimpress harness primitive used outside a ComponentHarness tree')
36
+ return ctx
37
+ }
@@ -0,0 +1,11 @@
1
+ export { default as ComponentHarness } from './ComponentHarness.vue'
2
+ export { default as ComponentHarnessEffects } from './ComponentHarnessEffects.vue'
3
+ export { default as ComponentHarnessOverlay } from './ComponentHarnessOverlay.vue'
4
+ export { default as ComponentStory } from './ComponentStory.vue'
5
+ export { default as DefaultHarness } from './DefaultHarness.vue'
6
+ export {
7
+ HARNESS_KEY,
8
+ createHarnessContext,
9
+ useHarness,
10
+ type HarnessContext,
11
+ } from './context'
@@ -0,0 +1,88 @@
1
+ const swCharacters = ['Luke Skywalker', 'Leia Organa', 'Han Solo', 'Obi-Wan Kenobi', 'Ahsoka Tano', 'Lando Calrissian', 'Din Djarin', 'Padmé Amidala']
2
+ const swFirst = ['Luke', 'Leia', 'Han', 'Ahsoka', 'Din', 'Padmé', 'Lando', 'Obi-Wan']
3
+ const swFamily = ['Skywalker', 'Organa', 'Solo', 'Kenobi', 'Tano', 'Calrissian', 'Amidala', 'Djarin']
4
+ const swPlaces = ['Tatooine', 'Coruscant', 'Endor', 'Hoth', 'Naboo', 'Dagobah', 'Mos Eisley', 'Bespin']
5
+ const swThings = ['Millennium Falcon', 'X-Wing', 'Razor Crest', 'Lightsaber', 'Holocron', 'Beskar Ingot', 'Astromech Droid', 'Sarlacc Pit']
6
+ const swSentences = [
7
+ 'Bantha fodder drifts across the dune sea beyond Mos Eisley.',
8
+ 'A hyperdrive hums softly as the freighter clears the asteroid field.',
9
+ 'Womp rats scatter when the landspeeder skims Beggar’s Canyon.',
10
+ 'The council convened on Coruscant to debate the blockade of Naboo.',
11
+ 'Moisture vaporators line the ridge above the homestead on Tatooine.',
12
+ 'A protocol droid recites etiquette while the astromech beeps in protest.',
13
+ 'Snow swirls over the shield generator on the plains of Hoth.',
14
+ 'The cantina band strikes up as smugglers haggle over spice.'
15
+ ]
16
+ const swWords = ['bantha', 'kyber', 'hyperdrive', 'womp-rat', 'sabacc', 'holocron', 'beskar', 'porg']
17
+ const swEmails = ['leia.organa@rebellion.org', 'luke.skywalker@jedi.temple', 'han.solo@falcon.crew', 'ahsoka.tano@fulcrum.net']
18
+ const swColors = ['#ffe81f', '#2e67f8', '#e5484d', '#30a46c', '#8a63d2']
19
+
20
+ function hintHash(text: string): number {
21
+ let h = 0
22
+ for (let i = 0; i < text.length; i++) h = (h * 31 + text.charCodeAt(i)) >>> 0
23
+ return h
24
+ }
25
+ function pick<T>(list: T[], seed = 0): T {
26
+ return list[(hintHash(String(seed)) + seed) % list.length] as T
27
+ }
28
+
29
+ export interface MockFnValue {
30
+ __nimpressFn: string
31
+ }
32
+
33
+ export function isFnValue(value: unknown): value is MockFnValue {
34
+ return !!value && typeof value === 'object' && typeof (value as MockFnValue).__nimpressFn === 'string'
35
+ }
36
+
37
+ export function fnSource(name: string): string {
38
+ return `(...args) => {
39
+ console.log(${JSON.stringify(name || 'handler')}, ...args)
40
+ }`
41
+ }
42
+
43
+ export const mockFullName = (seed = 0): string => pick(swCharacters, seed)
44
+ export const mockFirstName = (seed = 0): string => pick(swFirst, seed)
45
+ export const mockFamilyName = (seed = 0): string => pick(swFamily, seed)
46
+ export const mockUsername = (seed = 0): string => `${pick(swFirst, seed).toLowerCase()}_${pick(swWords, seed + 1)}`
47
+ export const mockEmail = (seed = 0): string => pick(swEmails, seed)
48
+ export const mockPassword = (seed = 0): string => `${pick(swWords, seed)}-${pick(swThings, seed + 1).replace(/\s+/g, '')}`
49
+ export const mockWord = (seed = 0): string => pick(swWords, seed)
50
+ export const mockTitle = (seed = 0): string => pick(swThings, seed)
51
+ export const mockSentence = (seed = 0): string => pick(swSentences, seed)
52
+ export const mockParagraph = (seed = 0): string => `${pick(swSentences, seed)} ${pick(swSentences, seed + 1)} ${pick(swSentences, seed + 2)}`
53
+ export const mockPlace = (seed = 0): string => pick(swPlaces, seed)
54
+ export const mockUrl = (seed = 0): string => `https://holonet.example/${pick(swWords, seed)}`
55
+ export const mockImageUrl = (seed = 0): string => `https://holonet.example/${pick(swWords, seed)}.png`
56
+ export const mockColor = (seed = 0): string => pick(swColors, seed)
57
+ export const mockIcon = (): string => 'pi pi-star'
58
+ export const mockDate = (): string => '1977-05-25'
59
+ export const mockTime = (): string => '09:41'
60
+ export const mockPhone = (): string => '+47 555 01138'
61
+ export const mockId = (seed = 0): string => `${pick(swWords, seed)}-1138`
62
+ export const mockSlug = (seed = 0): string => pick(swWords, seed)
63
+ export const mockObject = (seed = 0): Record<string, unknown> => ({
64
+ [pick(swWords, seed)]: pick(swSentences, seed),
65
+ [pick(swWords, seed + 3)]: pick(swSentences, seed + 3)
66
+ })
67
+ export const mockArray = (seed = 0): unknown[] => [pick(swWords, seed), pick(swWords, seed + 3)]
68
+
69
+ export const mockBoolean = (): boolean => true
70
+ export const mockInt = (): number => 42
71
+ export const mockIndex = (): number => 0
72
+ export const mockFloat = (): number => 1.618
73
+ export const mockCount = (): number => 7
74
+ export const mockPercent = (): number => 66
75
+ export const mockWidth = (): number => 320
76
+ export const mockHeight = (): number => 240
77
+ export const mockPrice = (): number => 199
78
+ export const mockYear = (): number => 1977
79
+ export const mockAge = (): number => 29
80
+ export const mockOption = (options: string[] = [], seed = 0, exclude: unknown[] = []): string | undefined => {
81
+ const pool = options.filter((option) => !exclude.includes(option))
82
+ return pool.length ? pool[(hintHash(String(seed)) + seed) % pool.length] : undefined
83
+ }
84
+
85
+ export const mockFunction = (name = 'handler'): MockFnValue => ({
86
+ __nimpressFn: fnSource(name)
87
+ })
88
+ export const mockEvent = (name = 'event'): MockFnValue => mockFunction(name)
@@ -0,0 +1,3 @@
1
+ @import 'tailwindcss';
2
+ @source '../../dist';
3
+ @import '@nimtech/nimpress/style.css';