poveste 0.1.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.
Files changed (251) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +11 -0
  3. package/bin.mjs +4 -0
  4. package/client.d.ts +19 -0
  5. package/client.js +15 -0
  6. package/dist/controls.d.ts +2 -0
  7. package/dist/controls.d.ts.map +1 -0
  8. package/dist/controls.js +1 -0
  9. package/dist/node/alias.d.ts +3 -0
  10. package/dist/node/alias.d.ts.map +1 -0
  11. package/dist/node/alias.js +5 -0
  12. package/dist/node/bin.d.ts +2 -0
  13. package/dist/node/bin.d.ts.map +1 -0
  14. package/dist/node/bin.js +35 -0
  15. package/dist/node/build-serialize.d.ts +22 -0
  16. package/dist/node/build-serialize.d.ts.map +1 -0
  17. package/dist/node/build-serialize.js +36 -0
  18. package/dist/node/build.d.ts +3 -0
  19. package/dist/node/build.d.ts.map +1 -0
  20. package/dist/node/build.js +228 -0
  21. package/dist/node/builtin-plugins/pinceau-tokens.d.ts +7 -0
  22. package/dist/node/builtin-plugins/pinceau-tokens.d.ts.map +1 -0
  23. package/dist/node/builtin-plugins/pinceau-tokens.js +505 -0
  24. package/dist/node/builtin-plugins/tailwind-tokens.d.ts +6 -0
  25. package/dist/node/builtin-plugins/tailwind-tokens.d.ts.map +1 -0
  26. package/dist/node/builtin-plugins/tailwind-tokens.js +523 -0
  27. package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts +15 -0
  28. package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts.map +1 -0
  29. package/dist/node/builtin-plugins/vanilla-support/MountStory.js +39 -0
  30. package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts +39 -0
  31. package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts.map +1 -0
  32. package/dist/node/builtin-plugins/vanilla-support/RenderStory.js +129 -0
  33. package/dist/node/builtin-plugins/vanilla-support/client.d.ts +4 -0
  34. package/dist/node/builtin-plugins/vanilla-support/client.d.ts.map +1 -0
  35. package/dist/node/builtin-plugins/vanilla-support/client.js +5 -0
  36. package/dist/node/builtin-plugins/vanilla-support/collect.d.ts +3 -0
  37. package/dist/node/builtin-plugins/vanilla-support/collect.d.ts.map +1 -0
  38. package/dist/node/builtin-plugins/vanilla-support/collect.js +33 -0
  39. package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts +3 -0
  40. package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts.map +1 -0
  41. package/dist/node/builtin-plugins/vanilla-support/plugin.js +29 -0
  42. package/dist/node/builtin-plugins/vanilla-support/types.d.ts +36 -0
  43. package/dist/node/builtin-plugins/vanilla-support/types.d.ts.map +1 -0
  44. package/dist/node/builtin-plugins/vanilla-support/types.js +3 -0
  45. package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts +4 -0
  46. package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts.map +1 -0
  47. package/dist/node/builtin-plugins/vanilla-support/vanilla.story.js +55 -0
  48. package/dist/node/collect/index.d.ts +14 -0
  49. package/dist/node/collect/index.d.ts.map +1 -0
  50. package/dist/node/collect/index.js +129 -0
  51. package/dist/node/collect/run.d.ts +3 -0
  52. package/dist/node/collect/run.d.ts.map +1 -0
  53. package/dist/node/collect/run.js +7 -0
  54. package/dist/node/collect/worker.d.ts +14 -0
  55. package/dist/node/collect/worker.d.ts.map +1 -0
  56. package/dist/node/collect/worker.js +64 -0
  57. package/dist/node/colors.d.ts +287 -0
  58. package/dist/node/colors.d.ts.map +1 -0
  59. package/dist/node/colors.js +324 -0
  60. package/dist/node/commands/build.d.ts +5 -0
  61. package/dist/node/commands/build.d.ts.map +1 -0
  62. package/dist/node/commands/build.js +9 -0
  63. package/dist/node/commands/dev.d.ts +8 -0
  64. package/dist/node/commands/dev.d.ts.map +1 -0
  65. package/dist/node/commands/dev.js +52 -0
  66. package/dist/node/commands/preview.d.ts +5 -0
  67. package/dist/node/commands/preview.d.ts.map +1 -0
  68. package/dist/node/commands/preview.js +15 -0
  69. package/dist/node/config.d.ts +40 -0
  70. package/dist/node/config.d.ts.map +1 -0
  71. package/dist/node/config.js +330 -0
  72. package/dist/node/context.d.ts +18 -0
  73. package/dist/node/context.d.ts.map +1 -0
  74. package/dist/node/context.js +28 -0
  75. package/dist/node/dom/dom-keys.d.ts +5 -0
  76. package/dist/node/dom/dom-keys.d.ts.map +1 -0
  77. package/dist/node/dom/dom-keys.js +233 -0
  78. package/dist/node/dom/env.d.ts +5 -0
  79. package/dist/node/dom/env.d.ts.map +1 -0
  80. package/dist/node/dom/env.js +47 -0
  81. package/dist/node/dom/util.d.ts +11 -0
  82. package/dist/node/dom/util.d.ts.map +1 -0
  83. package/dist/node/dom/util.js +65 -0
  84. package/dist/node/index.d.ts +12 -0
  85. package/dist/node/index.d.ts.map +1 -0
  86. package/dist/node/index.js +4 -0
  87. package/dist/node/load.d.ts +9 -0
  88. package/dist/node/load.d.ts.map +1 -0
  89. package/dist/node/load.js +42 -0
  90. package/dist/node/markdown.d.ts +11 -0
  91. package/dist/node/markdown.d.ts.map +1 -0
  92. package/dist/node/markdown.js +228 -0
  93. package/dist/node/plugin.d.ts +42 -0
  94. package/dist/node/plugin.d.ts.map +1 -0
  95. package/dist/node/plugin.js +67 -0
  96. package/dist/node/preview.d.ts +8 -0
  97. package/dist/node/preview.d.ts.map +1 -0
  98. package/dist/node/preview.js +41 -0
  99. package/dist/node/search.d.ts +17 -0
  100. package/dist/node/search.d.ts.map +1 -0
  101. package/dist/node/search.js +72 -0
  102. package/dist/node/server.d.ts +12 -0
  103. package/dist/node/server.d.ts.map +1 -0
  104. package/dist/node/server.js +189 -0
  105. package/dist/node/stories.d.ts +22 -0
  106. package/dist/node/stories.d.ts.map +1 -0
  107. package/dist/node/stories.js +125 -0
  108. package/dist/node/tree.d.ts +4 -0
  109. package/dist/node/tree.d.ts.map +1 -0
  110. package/dist/node/tree.js +117 -0
  111. package/dist/node/util/find-up.d.ts +2 -0
  112. package/dist/node/util/find-up.d.ts.map +1 -0
  113. package/dist/node/util/find-up.js +20 -0
  114. package/dist/node/util/fs.d.ts +2 -0
  115. package/dist/node/util/fs.d.ts.map +1 -0
  116. package/dist/node/util/fs.js +1 -0
  117. package/dist/node/util/log.d.ts +2 -0
  118. package/dist/node/util/log.d.ts.map +1 -0
  119. package/dist/node/util/log.js +9 -0
  120. package/dist/node/util/slugify.d.ts +2 -0
  121. package/dist/node/util/slugify.d.ts.map +1 -0
  122. package/dist/node/util/slugify.js +22 -0
  123. package/dist/node/util/vendors.d.ts +3 -0
  124. package/dist/node/util/vendors.d.ts.map +1 -0
  125. package/dist/node/util/vendors.js +22 -0
  126. package/dist/node/vendors/controls.d.ts +2 -0
  127. package/dist/node/vendors/controls.d.ts.map +1 -0
  128. package/dist/node/vendors/controls.js +1 -0
  129. package/dist/node/vendors/vue.d.ts +2 -0
  130. package/dist/node/vendors/vue.d.ts.map +1 -0
  131. package/dist/node/vendors/vue.js +1 -0
  132. package/dist/node/virtual/index.d.ts +38 -0
  133. package/dist/node/virtual/index.d.ts.map +1 -0
  134. package/dist/node/virtual/index.js +49 -0
  135. package/dist/node/virtual/markdown.d.ts +3 -0
  136. package/dist/node/virtual/markdown.d.ts.map +1 -0
  137. package/dist/node/virtual/markdown.js +19 -0
  138. package/dist/node/virtual/noop.d.ts +2 -0
  139. package/dist/node/virtual/noop.d.ts.map +1 -0
  140. package/dist/node/virtual/noop.js +1 -0
  141. package/dist/node/virtual/resolved-commands.d.ts +3 -0
  142. package/dist/node/virtual/resolved-commands.d.ts.map +1 -0
  143. package/dist/node/virtual/resolved-commands.js +32 -0
  144. package/dist/node/virtual/resolved-config.d.ts +3 -0
  145. package/dist/node/virtual/resolved-config.d.ts.map +1 -0
  146. package/dist/node/virtual/resolved-config.js +10 -0
  147. package/dist/node/virtual/resolved-generated-global-setup.d.ts +3 -0
  148. package/dist/node/virtual/resolved-generated-global-setup.d.ts.map +1 -0
  149. package/dist/node/virtual/resolved-generated-global-setup.js +23 -0
  150. package/dist/node/virtual/resolved-generated-setup-code.d.ts +3 -0
  151. package/dist/node/virtual/resolved-generated-setup-code.d.ts.map +1 -0
  152. package/dist/node/virtual/resolved-generated-setup-code.js +5 -0
  153. package/dist/node/virtual/resolved-markdown-files.d.ts +3 -0
  154. package/dist/node/virtual/resolved-markdown-files.d.ts.map +1 -0
  155. package/dist/node/virtual/resolved-markdown-files.js +17 -0
  156. package/dist/node/virtual/resolved-stories.d.ts +3 -0
  157. package/dist/node/virtual/resolved-stories.d.ts.map +1 -0
  158. package/dist/node/virtual/resolved-stories.js +42 -0
  159. package/dist/node/virtual/resolved-support-plugins-client.d.ts +3 -0
  160. package/dist/node/virtual/resolved-support-plugins-client.d.ts.map +1 -0
  161. package/dist/node/virtual/resolved-support-plugins-client.js +11 -0
  162. package/dist/node/virtual/resolved-support-plugins-collect.d.ts +3 -0
  163. package/dist/node/virtual/resolved-support-plugins-collect.d.ts.map +1 -0
  164. package/dist/node/virtual/resolved-support-plugins-collect.js +11 -0
  165. package/dist/node/virtual/resolved-theme.d.ts +3 -0
  166. package/dist/node/virtual/resolved-theme.d.ts.map +1 -0
  167. package/dist/node/virtual/resolved-theme.js +12 -0
  168. package/dist/node/virtual/story-source.d.ts +3 -0
  169. package/dist/node/virtual/story-source.d.ts.map +1 -0
  170. package/dist/node/virtual/story-source.js +16 -0
  171. package/dist/node/virtual/story.d.ts +3 -0
  172. package/dist/node/virtual/story.d.ts.map +1 -0
  173. package/dist/node/virtual/story.js +7 -0
  174. package/dist/node/virtual/util.d.ts +3 -0
  175. package/dist/node/virtual/util.d.ts.map +1 -0
  176. package/dist/node/virtual/util.js +4 -0
  177. package/dist/node/virtual/vite-plugin.d.ts +4 -0
  178. package/dist/node/virtual/vite-plugin.d.ts.map +1 -0
  179. package/dist/node/virtual/vite-plugin.js +126 -0
  180. package/dist/node/vite.d.ts +9 -0
  181. package/dist/node/vite.d.ts.map +1 -0
  182. package/dist/node/vite.js +337 -0
  183. package/index.d.ts +1 -0
  184. package/package.json +89 -0
  185. package/plugin.d.ts +3 -0
  186. package/plugin.js +11 -0
  187. package/src/controls.ts +1 -0
  188. package/src/node/__tests__/markdown/test1.story.md +7 -0
  189. package/src/node/__tests__/markdown/test2.story.md +5 -0
  190. package/src/node/__tests__/markdown.spec.ts +61 -0
  191. package/src/node/__tests__/tree.spec.ts +109 -0
  192. package/src/node/alias.ts +8 -0
  193. package/src/node/bin.ts +43 -0
  194. package/src/node/build-serialize.ts +62 -0
  195. package/src/node/build.ts +283 -0
  196. package/src/node/builtin-plugins/pinceau-tokens.ts +521 -0
  197. package/src/node/builtin-plugins/tailwind-tokens.ts +536 -0
  198. package/src/node/builtin-plugins/vanilla-support/MountStory.ts +49 -0
  199. package/src/node/builtin-plugins/vanilla-support/RenderStory.ts +164 -0
  200. package/src/node/builtin-plugins/vanilla-support/client.ts +6 -0
  201. package/src/node/builtin-plugins/vanilla-support/collect.ts +43 -0
  202. package/src/node/builtin-plugins/vanilla-support/plugin.ts +35 -0
  203. package/src/node/builtin-plugins/vanilla-support/types.ts +40 -0
  204. package/src/node/builtin-plugins/vanilla-support/vanilla.story.ts +63 -0
  205. package/src/node/collect/index.ts +160 -0
  206. package/src/node/collect/run.ts +9 -0
  207. package/src/node/collect/worker.ts +97 -0
  208. package/src/node/colors.ts +340 -0
  209. package/src/node/commands/build.ts +14 -0
  210. package/src/node/commands/dev.ts +67 -0
  211. package/src/node/commands/preview.ts +22 -0
  212. package/src/node/config.ts +385 -0
  213. package/src/node/context.ts +60 -0
  214. package/src/node/dom/dom-keys.ts +238 -0
  215. package/src/node/dom/env.ts +60 -0
  216. package/src/node/dom/util.ts +83 -0
  217. package/src/node/index.ts +12 -0
  218. package/src/node/load.ts +59 -0
  219. package/src/node/markdown.ts +267 -0
  220. package/src/node/plugin.ts +95 -0
  221. package/src/node/preview.ts +57 -0
  222. package/src/node/search.ts +84 -0
  223. package/src/node/server.ts +235 -0
  224. package/src/node/stories.ts +154 -0
  225. package/src/node/tree.ts +158 -0
  226. package/src/node/util/find-up.ts +24 -0
  227. package/src/node/util/fs.ts +1 -0
  228. package/src/node/util/log.ts +10 -0
  229. package/src/node/util/slugify.ts +26 -0
  230. package/src/node/util/vendors.ts +27 -0
  231. package/src/node/vendors/controls.ts +1 -0
  232. package/src/node/vendors/vue.ts +1 -0
  233. package/src/node/virtual/index.ts +50 -0
  234. package/src/node/virtual/markdown.ts +21 -0
  235. package/src/node/virtual/noop.ts +1 -0
  236. package/src/node/virtual/resolved-commands.ts +42 -0
  237. package/src/node/virtual/resolved-config.ts +12 -0
  238. package/src/node/virtual/resolved-generated-global-setup.ts +25 -0
  239. package/src/node/virtual/resolved-generated-setup-code.ts +7 -0
  240. package/src/node/virtual/resolved-markdown-files.ts +19 -0
  241. package/src/node/virtual/resolved-stories.ts +44 -0
  242. package/src/node/virtual/resolved-support-plugins-client.ts +14 -0
  243. package/src/node/virtual/resolved-support-plugins-collect.ts +14 -0
  244. package/src/node/virtual/resolved-theme.ts +14 -0
  245. package/src/node/virtual/story-source.ts +18 -0
  246. package/src/node/virtual/story.ts +9 -0
  247. package/src/node/virtual/util.ts +5 -0
  248. package/src/node/virtual/vite-plugin.ts +146 -0
  249. package/src/node/vite.ts +379 -0
  250. package/tsconfig.json +44 -0
  251. package/vitest.config.ts +10 -0
@@ -0,0 +1,505 @@
1
+ import { join } from 'pathe';
2
+ import { getInjectedImport } from '../util/vendors.js';
3
+ export function pinceauTokens(_options = {}) {
4
+ const themePath = join(process.cwd(), 'node_modules/.vite/pinceau/index.js');
5
+ async function generate(api) {
6
+ try {
7
+ await api.fs.ensureDir(api.pluginTempDir);
8
+ await api.fs.emptyDir(api.pluginTempDir);
9
+ api.moduleLoader.clearCache();
10
+ await api.fs.writeFile(api.path.resolve(api.pluginTempDir, 'style.css'), css);
11
+ const theme = await api.moduleLoader.loadModule(themePath);
12
+ const storyFile = api.path.resolve(api.pluginTempDir, 'Pinceau.story.js');
13
+ await api.fs.writeFile(storyFile, storyTemplate(theme));
14
+ api.addStoryFile(storyFile);
15
+ }
16
+ catch (e) {
17
+ api.error(e.stack ?? e.message);
18
+ }
19
+ }
20
+ return {
21
+ name: 'builtin:pinceau-tokens',
22
+ config(config) {
23
+ // Add 'design-system' group
24
+ if (!config.tree) {
25
+ config.tree = {};
26
+ }
27
+ if (!config.tree.groups) {
28
+ config.tree.groups = [];
29
+ }
30
+ if (!config.tree.groups.some(g => g.id === 'design-system')) {
31
+ let index = 0;
32
+ // After 'top' group
33
+ const topIndex = config.tree.groups.findIndex(g => g.id === 'top');
34
+ if (topIndex > -1) {
35
+ index = topIndex + 1;
36
+ }
37
+ // Insert group
38
+ config.tree.groups.splice(index, 0, {
39
+ id: 'design-system',
40
+ title: 'Design System',
41
+ });
42
+ }
43
+ },
44
+ onDev(api, onCleanup) {
45
+ const watcher = api.watcher.watch(themePath)
46
+ .on('change', () => generate(api))
47
+ .on('add', () => generate(api));
48
+ onCleanup(() => {
49
+ watcher.close();
50
+ });
51
+ },
52
+ async onBuild(api) {
53
+ await generate(api);
54
+ },
55
+ };
56
+ }
57
+ function storyTemplate(pinceauConfig) {
58
+ pinceauConfig = pinceauConfig?.theme || pinceauConfig?.default?.theme || {};
59
+ return `import 'histoire-style'
60
+ import './style.css'
61
+ import { createApp, h, markRaw, ref } from ${getInjectedImport('@poveste/vendors/vue')}
62
+ import {
63
+ HstColorShades,
64
+ HstTokenList,
65
+ HstTokenGrid,
66
+ HstText,
67
+ HstTextarea,
68
+ HstNumber,
69
+ } from ${getInjectedImport('@poveste/controls')}
70
+
71
+ const config = markRaw(${JSON.stringify(pinceauConfig, null, 2)})
72
+ const search = ref('')
73
+ const sampleText = ref('Cat sit like bread eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap mrow cat cat moo moo lick ears lick paws')
74
+ const fontSize = ref(16)
75
+ const flattenTokens = (data, transformValue = (value) => (value?.value || value)) => {
76
+ const output = {}
77
+ function step(obj, prev) {
78
+ Object.keys(obj).forEach((key) => {
79
+ const value = obj[key]
80
+ const isarray = Array.isArray(value)
81
+ const type = Object.prototype.toString.call(value)
82
+ const isobject
83
+ = type === '[object Object]'
84
+ || type === '[object Array]'
85
+
86
+ const newKey = prev ? prev + '.' + key : key
87
+
88
+ if (value.value && !output[newKey]) {
89
+ output[newKey] = transformValue(value)
90
+ }
91
+
92
+ if (!isarray && isobject && Object.keys(value).length) { return step(value, newKey) }
93
+ })
94
+ }
95
+ step(data)
96
+ return output
97
+ }
98
+
99
+ function mountApp ({ el, state, onUnmount }, render) {
100
+ Object.assign(state, {
101
+ search,
102
+ sampleText,
103
+ fontSize,
104
+ })
105
+
106
+ const app = createApp({
107
+ render,
108
+ })
109
+ app.mount(el)
110
+
111
+ onUnmount(() => {
112
+ app.unmount()
113
+ })
114
+ }
115
+
116
+ /*
117
+ media?: PinceauTokens
118
+ colors?: ScaleTokens
119
+ fonts?: PinceauTokens
120
+ fontWeights?: FontWeightTokens
121
+ fontSizes?: BreakpointsTokens
122
+ size?: BreakpointsTokens
123
+ space?: BreakpointsTokens
124
+ radii?: BreakpointsTokens
125
+ borders?: BreakpointsTokens
126
+ borderWidths?: BreakpointsTokens
127
+ borderStyles?: BreakpointsTokens
128
+ shadows?: BreakpointsTokens
129
+ opacity?: BreakpointsTokens
130
+ leads?: BreakpointsTokens
131
+ letterSpacings?: BreakpointsTokens
132
+ transitions?: PinceauTokens
133
+ zIndices?: PinceauTokens
134
+ */
135
+
136
+ export default {
137
+ id: 'pinceau',
138
+ title: 'Pinceau',
139
+ group: 'design-system',
140
+ icon: 'noto:paintbrush',
141
+ responsiveDisabled: true,
142
+ layout: { type: 'single', iframe: false },
143
+ variants: [
144
+ {
145
+ id: 'media-queries',
146
+ title: 'Media Queries',
147
+ icon: 'carbon:screen',
148
+ onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
149
+ tokens: flattenTokens(config.media),
150
+ getName: key => '@mq.' + key,
151
+ colSize: 180,
152
+ }, ({ token }) => h('div', {
153
+ class: '__hst-drop-shadow',
154
+ }))),
155
+ },
156
+ {
157
+ id: 'colors',
158
+ title: 'Colors',
159
+ icon: 'carbon:color-palette',
160
+ onMount: (api) => mountApp(api, () => Object.entries(config.colors).map(([key, shades]) => h(HstColorShades, {
161
+ key,
162
+ shades: shades.value ? { DEFAULT: shades.value } : flattenTokens(shades),
163
+ getName: shade => '{colors.' + key + '.' + shade + '}',
164
+ search: search.value,
165
+ }, ({ color}) => h('div', {
166
+ class: '__hst-shade',
167
+ style: {
168
+ backgroundColor: color,
169
+ },
170
+ })))),
171
+ onMountControls: (api) => mountApp(api, () => [
172
+ h(HstText, {
173
+ title: 'Filter...',
174
+ modelValue: search.value,
175
+ 'onUpdate:modelValue': value => { search.value = value },
176
+ }),
177
+ ]),
178
+ },
179
+ // SPACES
180
+ {
181
+ id: 'Spaces',
182
+ title: 'Spaces',
183
+ icon: 'carbon:area',
184
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
185
+ tokens: flattenTokens(config.space),
186
+ getName: key => '{space.' + key + '}',
187
+ }, ({ token }) => h('div', {
188
+ class: '__hst-spaces',
189
+ style: {
190
+ padding: token.value,
191
+ },
192
+ }, [
193
+ h('div', {
194
+ class: '__hst-spaces-box',
195
+ }),
196
+ ]))),
197
+ },
198
+ // SIZES
199
+ {
200
+ id: 'sizes',
201
+ title: 'Sizes',
202
+ icon: 'carbon:pan-horizontal',
203
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
204
+ tokens: flattenTokens(config.size),
205
+ getName: key => '{size.' + key + '}',
206
+ }, ({ token }) => h('div', {
207
+ class: '__hst-width',
208
+ }, [
209
+ h('div', {
210
+ class: '__hst-width-box',
211
+ style: {
212
+ width: token.value,
213
+ },
214
+ }),
215
+ ]))),
216
+ },
217
+ // FONTSIZES
218
+ {
219
+ id: 'font-size',
220
+ title: 'Font Size',
221
+ icon: 'carbon:text-font',
222
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
223
+ tokens: flattenTokens(config.fontSizes),
224
+ getName: key => '{fontSizes.' + key + '}',
225
+ }, ({ token }) => h('div', {
226
+ class: '__hst-truncate',
227
+ style: {
228
+ fontSize: token.value,
229
+ },
230
+ }, sampleText.value))),
231
+ onMountControls: (api) => mountApp(api, () => [
232
+ h(HstTextarea, {
233
+ title: 'Sample text',
234
+ modelValue: sampleText.value,
235
+ 'onUpdate:modelValue': value => { sampleText.value = value },
236
+ rows: 5,
237
+ }),
238
+ ]),
239
+ },
240
+ // FONTWEIGHTS
241
+ {
242
+ id: 'font-weight',
243
+ title: 'Font Weight',
244
+ icon: 'carbon:text-font',
245
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
246
+ tokens: flattenTokens(config.fontWeights),
247
+ getName: key => '{fontWeights.' + key + '}',
248
+ }, ({ token }) => h('div', {
249
+ class: '__hst-truncate',
250
+ style: {
251
+ fontWeight: token.value,
252
+ fontSize: \`\${fontSize.value}px\`,
253
+ },
254
+ }, sampleText.value))),
255
+ onMountControls: (api) => mountApp(api, () => [
256
+ h(HstTextarea, {
257
+ title: 'Sample text',
258
+ modelValue: sampleText.value,
259
+ 'onUpdate:modelValue': value => { sampleText.value = value },
260
+ rows: 5,
261
+ }),
262
+ h(HstNumber, {
263
+ title: 'Font size',
264
+ modelValue: fontSize.value,
265
+ 'onUpdate:modelValue': value => { fontSize.value = value },
266
+ min: 1,
267
+ }),
268
+ ]),
269
+ },
270
+ // FONTS
271
+ {
272
+ id: 'fonts',
273
+ title: 'Fonts',
274
+ icon: 'carbon:text-font',
275
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
276
+ tokens: flattenTokens(config.fonts),
277
+ getName: key => '{fonts.' + key + '}',
278
+ }, ({ token }) => h('div', {
279
+ class: '__hst-truncate',
280
+ style: {
281
+ fontFamily: token.value,
282
+ fontSize: \`\${fontSize.value}px\`,
283
+ },
284
+ }, sampleText.value))),
285
+ onMountControls: (api) => mountApp(api, () => [
286
+ h(HstTextarea, {
287
+ title: 'Sample text',
288
+ modelValue: sampleText.value,
289
+ 'onUpdate:modelValue': value => { sampleText.value = value },
290
+ rows: 5,
291
+ }),
292
+ h(HstNumber, {
293
+ title: 'Font size',
294
+ modelValue: fontSize.value,
295
+ 'onUpdate:modelValue': value => { fontSize.value = value },
296
+ min: 1,
297
+ }),
298
+ ]),
299
+ },
300
+ // LETTERSPACINGS
301
+ {
302
+ id: 'letter-spacing',
303
+ title: 'Letter Spacing',
304
+ icon: 'carbon:text-font',
305
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
306
+ tokens: flattenTokens(config.letterSpacings),
307
+ getName: key => '{letterSpacings.' + key + '}',
308
+ }, ({ token }) => h('div', {
309
+ class: '__hst-truncate',
310
+ style: {
311
+ letterSpacing: token.value,
312
+ fontSize: \`\${fontSize.value}px\`,
313
+ },
314
+ }, sampleText.value))),
315
+ onMountControls: (api) => mountApp(api, () => [
316
+ h(HstTextarea, {
317
+ title: 'Sample text',
318
+ modelValue: sampleText.value,
319
+ 'onUpdate:modelValue': value => { sampleText.value = value },
320
+ rows: 5,
321
+ }),
322
+ h(HstNumber, {
323
+ title: 'Font size',
324
+ modelValue: fontSize.value,
325
+ 'onUpdate:modelValue': value => { fontSize.value = value },
326
+ min: 1,
327
+ }),
328
+ ]),
329
+ },
330
+ // LEADS
331
+ {
332
+ id: 'leads',
333
+ title: 'Leads',
334
+ icon: 'carbon:text-font',
335
+ onMount: (api) => mountApp(api, () => h(HstTokenList, {
336
+ tokens: flattenTokens(config.leads),
337
+ getName: key => '{leads.' + key + '}',
338
+ }, ({ token }) => h('div', {
339
+ style: {
340
+ lineHeight: token.value,
341
+ },
342
+ }, sampleText.value))),
343
+ onMountControls: (api) => mountApp(api, () => [
344
+ h(HstTextarea, {
345
+ title: 'Sample text',
346
+ modelValue: sampleText.value,
347
+ 'onUpdate:modelValue': value => { sampleText.value = value },
348
+ rows: 5,
349
+ }),
350
+ // @TODO select font size
351
+ ]),
352
+ },
353
+ // SHADOWS
354
+ {
355
+ id: 'shadows',
356
+ title: 'Shadows',
357
+ icon: 'carbon:shape-except',
358
+ onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
359
+ tokens: flattenTokens(config.shadows),
360
+ getName: key => '{shadows.' + key + '}',
361
+ colSize: 180,
362
+ }, ({ token }) => h('div', {
363
+ class: '__hst-drop-shadow',
364
+ style: 'box-shadow:' + token.value,
365
+ }))),
366
+ },
367
+ // OPACITIES
368
+ {
369
+ id: 'opacities',
370
+ title: 'Opacities',
371
+ icon: 'carbon:bring-forward',
372
+ onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
373
+ tokens: flattenTokens(config.opacity),
374
+ getName: key => '{opacity.' + key + '}',
375
+ colSize: 180,
376
+ }, ({ token }) => h('div', {
377
+ class: '__hst-drop-shadow',
378
+ style: 'opacity:' + token.value,
379
+ }))),
380
+ },
381
+ // RADII
382
+ {
383
+ id: 'border-radius',
384
+ title: 'Border Radius',
385
+ icon: 'carbon:condition-wait-point',
386
+ onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
387
+ tokens: flattenTokens(config.radii),
388
+ getName: key => '{radii.' + key + '}',
389
+ colSize: 180,
390
+ }, ({ token }) => h('div', {
391
+ class: '__hst-border-radius',
392
+ style: {
393
+ borderRadius: token.value,
394
+ },
395
+ }))),
396
+ },
397
+ // BORDERWIDTHS
398
+ {
399
+ id: 'border-width',
400
+ title: 'Border Width',
401
+ icon: 'carbon:checkbox',
402
+ onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
403
+ tokens: flattenTokens(config.borderWidths),
404
+ getName: key => '{borderWidths.' + key + '}',
405
+ colSize: 180,
406
+ }, ({ token }) => h('div', {
407
+ class: '__hst-border-width',
408
+ style: {
409
+ borderWidth: token.value,
410
+ },
411
+ }))),
412
+ },
413
+ // FULL CONFIG
414
+ {
415
+ id: 'full-config',
416
+ title: 'Full Config',
417
+ icon: 'carbon:code',
418
+ onMount: (api) => mountApp(api, () => h('pre', JSON.stringify(config, null, 2))),
419
+ },
420
+ ],
421
+ }`;
422
+ }
423
+ const css = `.__hst-shade {
424
+ height: 80px;
425
+ border-radius: 4px;
426
+ }
427
+
428
+ .__hst-text {
429
+ font-size: 4rem;
430
+ display: flex;
431
+ align-items: flex-end;
432
+ }
433
+
434
+ .__hst-border {
435
+ border-style: solid;
436
+ border-width: 2px;
437
+ }
438
+
439
+ .__hst-spaces {
440
+ background-color: rgb(113 113 122 / 0.1);
441
+ width: min-content;
442
+ }
443
+
444
+ .__hst-margin {
445
+ border: dashed 1px rgb(113 113 122 / 0.5);
446
+ width: min-content;
447
+ }
448
+
449
+ .__hst-spaces-box,
450
+ .__hst-margin-box {
451
+ width: 5rem;
452
+ height: 5rem;
453
+ background-color: rgb(113 113 122 / 0.5);
454
+ }
455
+
456
+ .__hst-spaces,
457
+ .__hst-spaces-box,
458
+ .__hst-margin,
459
+ .__hst-margin-box,
460
+ .__hst-drop-shadow {
461
+ border-radius: 4px;
462
+ }
463
+
464
+ .__hst-truncate {
465
+ overflow: hidden;
466
+ text-overflow: ellipsis;
467
+ white-space: nowrap;
468
+ }
469
+
470
+ .__hst-drop-shadow {
471
+ width: 8rem;
472
+ height: 8rem;
473
+ background: white;
474
+ margin-bottom: 0.5rem;
475
+ }
476
+
477
+ .__hst-drop-shadow {
478
+ background: #4e4e57;
479
+ }
480
+
481
+ .__hst-border-radius {
482
+ width: 8rem;
483
+ height: 8rem;
484
+ background-color: rgb(113 113 122 / 0.5);
485
+ }
486
+
487
+ .__hst-border-width {
488
+ width: 8rem;
489
+ height: 8rem;
490
+ border-color: rgb(113 113 122 / 0.5);
491
+ background-color: rgb(113 113 122 / 0.1);
492
+ }
493
+
494
+ .__hst-width {
495
+ background-color: rgb(113 113 122 / 0.1);
496
+ }
497
+
498
+ .__hst-width-box,
499
+ .__hst-height {
500
+ background-color: rgb(113 113 122 / 0.5);
501
+ }
502
+
503
+ .__hst-width-box {
504
+ height: 5rem;
505
+ }`;
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '@poveste/shared';
2
+ export interface TailwindTokensOptions {
3
+ configFile?: string;
4
+ }
5
+ export declare function tailwindTokens(options?: TailwindTokensOptions): Plugin;
6
+ //# sourceMappingURL=tailwind-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind-tokens.d.ts","sourceRoot":"","sources":["../../../src/node/builtin-plugins/tailwind-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iBAAiB,CAAA;AAI5D,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,CA2E1E"}