@luzmo/lucero 0.0.1 → 0.0.4

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 (203) hide show
  1. package/package.json +185 -92
  2. package/.storybook/dark-theme.ts +0 -18
  3. package/.storybook/light-theme.ts +0 -34
  4. package/.storybook/main.ts +0 -34
  5. package/.storybook/manager.ts +0 -11
  6. package/.storybook/preview-head.html +0 -7
  7. package/.storybook/preview.ts +0 -42
  8. package/README.md +0 -18
  9. package/custom-elements.json +0 -68111
  10. package/dist/LICENSE +0 -16
  11. package/dist/custom-elements.json +0 -34043
  12. package/dist/package.json +0 -191
  13. package/eslint.config.js +0 -314
  14. package/playwright.config.ts +0 -79
  15. package/vite-utils/cem-plugins/plugin-mixins-and-superclass.ts +0 -141
  16. package/vite-utils/cem-plugins/plugin-private-fields-filter.ts +0 -19
  17. package/vite-utils/get-components-entries.ts +0 -30
  18. package/vite-utils/get-license-content.ts +0 -31
  19. package/vite-utils/get-package-json-content.ts +0 -49
  20. package/vite-utils/plugin-generate-custom-elements-manifest.ts +0 -156
  21. package/vite-utils/plugin-generate-file.ts +0 -130
  22. package/vite-utils/plugin-prepend-css-variables-code.ts +0 -55
  23. package/vite.config.component.ts +0 -69
  24. package/vite.config.storybook.ts +0 -6
  25. package/web-test-runner.config.js +0 -23
  26. /package/{dist/lib → lib}/accordion/index.cjs +0 -0
  27. /package/{dist/lib → lib}/accordion/index.js +0 -0
  28. /package/{dist/lib → lib}/action-bar/index.cjs +0 -0
  29. /package/{dist/lib → lib}/action-bar/index.js +0 -0
  30. /package/{dist/lib → lib}/action-button/index.cjs +0 -0
  31. /package/{dist/lib → lib}/action-button/index.js +0 -0
  32. /package/{dist/lib → lib}/action-group/index.cjs +0 -0
  33. /package/{dist/lib → lib}/action-group/index.js +0 -0
  34. /package/{dist/lib → lib}/action-group-BoIH8s8R.js +0 -0
  35. /package/{dist/lib → lib}/action-group-D4MxBrq8.cjs +0 -0
  36. /package/{dist/lib → lib}/action-menu/index.cjs +0 -0
  37. /package/{dist/lib → lib}/action-menu/index.js +0 -0
  38. /package/{dist/lib → lib}/async-directive-CV2MII86.cjs +0 -0
  39. /package/{dist/lib → lib}/async-directive-FGzMycjH.js +0 -0
  40. /package/{dist/lib → lib}/avatar/index.cjs +0 -0
  41. /package/{dist/lib → lib}/avatar/index.js +0 -0
  42. /package/{dist/lib → lib}/base-BCmA9Wxv.cjs +0 -0
  43. /package/{dist/lib → lib}/base-BjTwmyRF.cjs +0 -0
  44. /package/{dist/lib → lib}/base-D76d76ww.js +0 -0
  45. /package/{dist/lib → lib}/base-nYalvNMy.js +0 -0
  46. /package/{dist/lib → lib}/button/index.cjs +0 -0
  47. /package/{dist/lib → lib}/button/index.js +0 -0
  48. /package/{dist/lib → lib}/button-base-B0iB_JTv.cjs +0 -0
  49. /package/{dist/lib → lib}/button-base-DgtT6sU5.js +0 -0
  50. /package/{dist/lib → lib}/button-group/index.cjs +0 -0
  51. /package/{dist/lib → lib}/button-group/index.js +0 -0
  52. /package/{dist/lib → lib}/checkbox/index.cjs +0 -0
  53. /package/{dist/lib → lib}/checkbox/index.js +0 -0
  54. /package/{dist/lib → lib}/checkbox-mixin-DegQlk5C.js +0 -0
  55. /package/{dist/lib → lib}/checkbox-mixin-H0Hm-VLk.cjs +0 -0
  56. /package/{dist/lib → lib}/clear-button-Ap5H3UyH.js +0 -0
  57. /package/{dist/lib → lib}/clear-button-D0djuaLb.cjs +0 -0
  58. /package/{dist/lib → lib}/close-button-BrfeZvjk.cjs +0 -0
  59. /package/{dist/lib → lib}/close-button-CGISEF33.js +0 -0
  60. /package/{dist/lib → lib}/color-Bg3tYsAQ.js +0 -0
  61. /package/{dist/lib → lib}/color-DphK4hwx.cjs +0 -0
  62. /package/{dist/lib → lib}/color-area/index.cjs +0 -0
  63. /package/{dist/lib → lib}/color-area/index.js +0 -0
  64. /package/{dist/lib → lib}/color-field/index.cjs +0 -0
  65. /package/{dist/lib → lib}/color-field/index.js +0 -0
  66. /package/{dist/lib → lib}/color-handle/index.cjs +0 -0
  67. /package/{dist/lib → lib}/color-handle/index.js +0 -0
  68. /package/{dist/lib → lib}/color-loupe/index.cjs +0 -0
  69. /package/{dist/lib → lib}/color-loupe/index.js +0 -0
  70. /package/{dist/lib → lib}/color-loupe-BICpNqFs.cjs +0 -0
  71. /package/{dist/lib → lib}/color-loupe-DBEApMDT.js +0 -0
  72. /package/{dist/lib → lib}/color-menu/index.cjs +0 -0
  73. /package/{dist/lib → lib}/color-menu/index.js +0 -0
  74. /package/{dist/lib → lib}/color-picker/index.cjs +0 -0
  75. /package/{dist/lib → lib}/color-picker/index.js +0 -0
  76. /package/{dist/lib → lib}/color-slider/index.cjs +0 -0
  77. /package/{dist/lib → lib}/color-slider/index.js +0 -0
  78. /package/{dist/lib → lib}/condition-attribute-with-id-DrQYZzFS.cjs +0 -0
  79. /package/{dist/lib → lib}/condition-attribute-with-id-Dv4lSRbe.js +0 -0
  80. /package/{dist/lib → lib}/dependency-manger-C5HCkMMB.cjs +0 -0
  81. /package/{dist/lib → lib}/dependency-manger-CEXvGQUV.js +0 -0
  82. /package/{dist/lib → lib}/directive-C7oCP5Bh.cjs +0 -0
  83. /package/{dist/lib → lib}/directive-helpers-BLDZnGQv.js +0 -0
  84. /package/{dist/lib → lib}/directive-helpers-C2vOfhFx.cjs +0 -0
  85. /package/{dist/lib → lib}/directive-oAbCiebi.js +0 -0
  86. /package/{dist/lib → lib}/divider/index.cjs +0 -0
  87. /package/{dist/lib → lib}/divider/index.js +0 -0
  88. /package/{dist/lib → lib}/divider.module-CXMNveQc.cjs +0 -0
  89. /package/{dist/lib → lib}/divider.module-DwOuLGU3.js +0 -0
  90. /package/{dist/lib → lib}/element-resolution-BvRLGqIU.cjs +0 -0
  91. /package/{dist/lib → lib}/element-resolution-FCUT-wql.js +0 -0
  92. /package/{dist/lib → lib}/field-group/index.cjs +0 -0
  93. /package/{dist/lib → lib}/field-group/index.js +0 -0
  94. /package/{dist/lib → lib}/field-group-CBWafIUV.js +0 -0
  95. /package/{dist/lib → lib}/field-group-TUFvhJkk.cjs +0 -0
  96. /package/{dist/lib → lib}/field-label/index.cjs +0 -0
  97. /package/{dist/lib → lib}/field-label/index.js +0 -0
  98. /package/{dist/lib → lib}/field-label-BK_tk8vP.js +0 -0
  99. /package/{dist/lib → lib}/field-label-BrJaeORz.cjs +0 -0
  100. /package/{dist/lib → lib}/focus-group-DHeTq18L.js +0 -0
  101. /package/{dist/lib → lib}/focus-group-DnxZUBhQ.cjs +0 -0
  102. /package/{dist/lib → lib}/focus-visible-B0P9aY_G.cjs +0 -0
  103. /package/{dist/lib → lib}/focus-visible-DBlJGoEW.js +0 -0
  104. /package/{dist/lib → lib}/focusable-DbUg-3Vp.js +0 -0
  105. /package/{dist/lib → lib}/focusable-Dv_6CFaY.cjs +0 -0
  106. /package/{dist/lib → lib}/focusable-selectors-B4YgbghQ.js +0 -0
  107. /package/{dist/lib → lib}/focusable-selectors-BgFlyFcY.cjs +0 -0
  108. /package/{dist/lib → lib}/icon/index.cjs +0 -0
  109. /package/{dist/lib → lib}/icon/index.js +0 -0
  110. /package/{dist/lib → lib}/if-defined-CYpcjGCb.js +0 -0
  111. /package/{dist/lib → lib}/if-defined-Cv6xanXh.cjs +0 -0
  112. /package/{dist/lib → lib}/index-C1chwzNp.js +0 -0
  113. /package/{dist/lib → lib}/index-DCKCHDTt.cjs +0 -0
  114. /package/{dist/lib → lib}/index-ovT-qVzf.js +0 -0
  115. /package/{dist/lib → lib}/index-yNcLzjhM.cjs +0 -0
  116. /package/{dist/lib → lib}/index.cjs +0 -0
  117. /package/{dist/lib → lib}/index.js +0 -0
  118. /package/{dist/lib → lib}/infield-button/index.cjs +0 -0
  119. /package/{dist/lib → lib}/infield-button/index.js +0 -0
  120. /package/{dist/lib → lib}/label/index.cjs +0 -0
  121. /package/{dist/lib → lib}/label/index.js +0 -0
  122. /package/{dist/lib → lib}/legend-position/index.cjs +0 -0
  123. /package/{dist/lib → lib}/legend-position/index.js +0 -0
  124. /package/{dist/lib → lib}/like-anchor-K8W0QYwC.cjs +0 -0
  125. /package/{dist/lib → lib}/like-anchor-cDeGGeHh.js +0 -0
  126. /package/{dist/lib → lib}/lit-html-B3ugcwD9.js +0 -0
  127. /package/{dist/lib → lib}/lit-html-p4Oxv2-5.cjs +0 -0
  128. /package/{dist/lib → lib}/manage-help-text-2mSEy-AD.js +0 -0
  129. /package/{dist/lib → lib}/manage-help-text-iOk-zmy8.cjs +0 -0
  130. /package/{dist/lib → lib}/menu/index.cjs +0 -0
  131. /package/{dist/lib → lib}/menu/index.js +0 -0
  132. /package/{dist/lib → lib}/multi-language-field/index.cjs +0 -0
  133. /package/{dist/lib → lib}/multi-language-field/index.js +0 -0
  134. /package/{dist/lib → lib}/mutation-controller-DH7YOCyj.js +0 -0
  135. /package/{dist/lib → lib}/mutation-controller-DkOMCW-c.cjs +0 -0
  136. /package/{dist/lib → lib}/number-field/index.cjs +0 -0
  137. /package/{dist/lib → lib}/number-field/index.js +0 -0
  138. /package/{dist/lib → lib}/observe-slot-text-BmsCNJig.cjs +0 -0
  139. /package/{dist/lib → lib}/observe-slot-text-BoFRF-VI.js +0 -0
  140. /package/{dist/lib → lib}/overlay/index.cjs +0 -0
  141. /package/{dist/lib → lib}/overlay/index.js +0 -0
  142. /package/{dist/lib → lib}/overlay-C7QKFqRc.js +0 -0
  143. /package/{dist/lib → lib}/overlay-DScraBAi.cjs +0 -0
  144. /package/{dist/lib → lib}/pending-state-D5KTK4_1.js +0 -0
  145. /package/{dist/lib → lib}/pending-state-Dbc2HIM2.cjs +0 -0
  146. /package/{dist/lib → lib}/picker/index.cjs +0 -0
  147. /package/{dist/lib → lib}/picker/index.js +0 -0
  148. /package/{dist/lib → lib}/picker--2OCYWnV.js +0 -0
  149. /package/{dist/lib → lib}/picker-B9W7Haf4.cjs +0 -0
  150. /package/{dist/lib → lib}/platform-CQzYNWKq.cjs +0 -0
  151. /package/{dist/lib → lib}/platform-DQYMG7JI.js +0 -0
  152. /package/{dist/lib → lib}/popover/index.cjs +0 -0
  153. /package/{dist/lib → lib}/popover/index.js +0 -0
  154. /package/{dist/lib → lib}/popover-CVbjhSnx.cjs +0 -0
  155. /package/{dist/lib → lib}/popover-ZRVxogyp.js +0 -0
  156. /package/{dist/lib → lib}/progress-circle/index.cjs +0 -0
  157. /package/{dist/lib → lib}/progress-circle/index.js +0 -0
  158. /package/{dist/lib → lib}/progress-circle-CiJoS8J7.cjs +0 -0
  159. /package/{dist/lib → lib}/progress-circle-DpXiqW6a.js +0 -0
  160. /package/{dist/lib → lib}/query-BL-TJj7K.cjs +0 -0
  161. /package/{dist/lib → lib}/query-D_KR_GUc.js +0 -0
  162. /package/{dist/lib → lib}/query-assigned-elements-DjfhL1cl.js +0 -0
  163. /package/{dist/lib → lib}/query-assigned-elements-DsKsfk7G.cjs +0 -0
  164. /package/{dist/lib → lib}/query-assigned-nodes-BcKWmGzy.cjs +0 -0
  165. /package/{dist/lib → lib}/query-assigned-nodes-C76XVPWY.js +0 -0
  166. /package/{dist/lib → lib}/radio/index.cjs +0 -0
  167. /package/{dist/lib → lib}/radio/index.js +0 -0
  168. /package/{dist/lib → lib}/random-id-ByCz1xaq.js +0 -0
  169. /package/{dist/lib → lib}/random-id-CqvckpWe.cjs +0 -0
  170. /package/{dist/lib → lib}/roving-tabindex-By_fCy_e.cjs +0 -0
  171. /package/{dist/lib → lib}/roving-tabindex-DOg4z6ZU.js +0 -0
  172. /package/{dist/lib → lib}/search/index.cjs +0 -0
  173. /package/{dist/lib → lib}/search/index.js +0 -0
  174. /package/{dist/lib → lib}/sized-mixin-BSYHt8nT.cjs +0 -0
  175. /package/{dist/lib → lib}/sized-mixin-Dl0KoEcV.js +0 -0
  176. /package/{dist/lib → lib}/slider/index.cjs +0 -0
  177. /package/{dist/lib → lib}/slider/index.js +0 -0
  178. /package/{dist/lib → lib}/slottable-request-event-BfUUt1Mh.cjs +0 -0
  179. /package/{dist/lib → lib}/slottable-request-event-DggLA4Rx.js +0 -0
  180. /package/{dist/lib → lib}/state-BAO-13Bs.js +0 -0
  181. /package/{dist/lib → lib}/state-DReJ3hB6.cjs +0 -0
  182. /package/{dist/lib → lib}/streaming-listener-Bw4jE33f.cjs +0 -0
  183. /package/{dist/lib → lib}/streaming-listener-DLo0wkMc.js +0 -0
  184. /package/{dist/lib → lib}/style-map-BjBGQ_u3.cjs +0 -0
  185. /package/{dist/lib → lib}/style-map-BqvQDFJt.js +0 -0
  186. /package/{dist/lib → lib}/swatch/index.cjs +0 -0
  187. /package/{dist/lib → lib}/swatch/index.js +0 -0
  188. /package/{dist/lib → lib}/switch/index.cjs +0 -0
  189. /package/{dist/lib → lib}/switch/index.js +0 -0
  190. /package/{dist/lib → lib}/tags/index.cjs +0 -0
  191. /package/{dist/lib → lib}/tags/index.js +0 -0
  192. /package/{dist/lib → lib}/text-field/index.cjs +0 -0
  193. /package/{dist/lib → lib}/text-field/index.js +0 -0
  194. /package/{dist/lib → lib}/text-field-C6Aa7XOb.cjs +0 -0
  195. /package/{dist/lib → lib}/text-field-DPk332j9.js +0 -0
  196. /package/{dist/lib → lib}/toast/index.cjs +0 -0
  197. /package/{dist/lib → lib}/toast/index.js +0 -0
  198. /package/{dist/lib → lib}/tooltip/index.cjs +0 -0
  199. /package/{dist/lib → lib}/tooltip/index.js +0 -0
  200. /package/{dist/lib → lib}/unit-input/index.cjs +0 -0
  201. /package/{dist/lib → lib}/unit-input/index.js +0 -0
  202. /package/{dist/lib → lib}/when-CDK1Tt5Y.js +0 -0
  203. /package/{dist/lib → lib}/when-CDZyJPvd.cjs +0 -0
@@ -1,141 +0,0 @@
1
- // TO DO check if we cannot autogenerated through following the mixins & superclass in custome elements manifest in storybook
2
-
3
- const treatSizedMixin = (classDocument) => {
4
- classDocument.attributes.push({
5
- name: 'size',
6
- type: {
7
- text: "'s' | 'm' | 'l' | 'xl'",
8
- },
9
- default: 'm',
10
- description: 'The size of the element',
11
- fieldName: 'size',
12
- });
13
- classDocument.mixins = classDocument.mixins.filter(
14
- (mixin) =>
15
- !(mixin.name === 'SizedMixin' || mixin.package === '@utils/sized-mixin')
16
- );
17
- if (classDocument.mixins.length === 0) {
18
- delete classDocument.mixins;
19
- }
20
- };
21
-
22
- const treatLikeAnchor = (classDocument) => {
23
- const attributes = [
24
- [
25
- 'download',
26
- 'string',
27
- 'Causes the browser to treat the linked URL as a download',
28
- ],
29
- [
30
- 'label',
31
- 'string',
32
- 'An accessible label that describes the component. It will be applied to aria-label, but not visually rendered.',
33
- ],
34
- ['href', 'text', 'The URL that the hyperlink points to.'],
35
- [
36
- 'target',
37
- '"_blank" | "_parent" | "_self" | "_top"',
38
- 'Where to display the linked URL, as the name for a browsing context (a tab, window, or iframe).',
39
- ],
40
- [
41
- 'referrerpolicy',
42
- '"no-referrer" |"no-referrer-when-downgrade" |"origin" |"origin-when-cross-origin" |"same-origin" |"strict-origin" |"strict-origin-when-cross-origin" |"unsafe-url" |',
43
- 'How much of the referrer to send when following the link.',
44
- ],
45
- [
46
- 'rel',
47
- 'string',
48
- 'The relationship of the linked URL as space-separated link types.',
49
- ],
50
- ];
51
- attributes.forEach(([name, type, description]) => {
52
- const attribute = {
53
- name,
54
- type: {
55
- text: type,
56
- },
57
- description,
58
- fieldName: name,
59
- };
60
- classDocument.attributes.push(attribute);
61
- });
62
- classDocument.mixins = classDocument.mixins.filter(
63
- (mixin) =>
64
- !(mixin.name === 'LikeAnchor' || mixin.package === '@utils/like-anchor')
65
- );
66
- if (classDocument.mixins.length === 0) {
67
- delete classDocument.mixins;
68
- }
69
- };
70
-
71
- const treatFocusable = (classDocument) => {
72
- classDocument.attributes.push({
73
- name: 'disabled',
74
- type: {
75
- text: 'boolean',
76
- },
77
- default: 'false',
78
- description: 'Disable this control. It will not receive focus or events',
79
- fieldName: 'disabled',
80
- });
81
- classDocument.attributes.push({
82
- name: 'autofocus',
83
- type: {
84
- text: 'boolean',
85
- },
86
- default: 'false',
87
- description: 'When this control is rendered, focus it automatically',
88
- fieldName: 'autofocus',
89
- });
90
- classDocument.attributes.push({
91
- name: 'tabIndex',
92
- type: {
93
- text: 'number',
94
- },
95
- description:
96
- 'The tab index to apply to this control. See general documentation about the tabindex HTML property',
97
- fieldName: 'tabIndex',
98
- });
99
- if (classDocument.superclass) {
100
- delete classDocument.superclass;
101
- }
102
- };
103
-
104
- export const cemPluginMixinsAndSuperclass = {
105
- name: 'web-components-mixins-and-superclass',
106
- analyzePhase({ ts, node, moduleDoc }) {
107
- switch (node.kind) {
108
- case ts.SyntaxKind.ClassDeclaration: {
109
- const className = node.name.getText();
110
- const classDocument = moduleDoc?.declarations?.find(
111
- (declaration) => declaration.name === className
112
- );
113
-
114
- if (classDocument?.mixins) {
115
- const hasSizedMixin = classDocument.mixins?.some(
116
- (mixin) =>
117
- mixin.name === 'SizedMixin' ||
118
- mixin.package === '@utils/sized-mixin'
119
- );
120
- if (hasSizedMixin && classDocument.attributes) {
121
- treatSizedMixin(classDocument);
122
- }
123
- const hasLikeAnchorMixin = classDocument.mixins?.some(
124
- (mixin) =>
125
- mixin.name === 'LikeAnchorMixin' ||
126
- mixin.package === '@utils/like-anchor'
127
- );
128
- if (hasLikeAnchorMixin && classDocument.attributes) {
129
- treatLikeAnchor(classDocument);
130
- }
131
- const hasFocusableMixin =
132
- classDocument.superclass?.name === 'Focusable' ||
133
- classDocument.superclass?.package === '@utils/focusable';
134
- if (hasFocusableMixin && classDocument.attributes) {
135
- treatFocusable(classDocument);
136
- }
137
- }
138
- }
139
- }
140
- },
141
- };
@@ -1,19 +0,0 @@
1
- export const cemPluginPrivateFieldsFilter = {
2
- name: 'web-components-private-fields-filter',
3
- analyzePhase({ ts, node, moduleDoc }) {
4
- switch (node.kind) {
5
- case ts.SyntaxKind.ClassDeclaration: {
6
- const className = node.name.getText();
7
- const classDocument = moduleDoc?.declarations?.find(
8
- (declaration) => declaration.name === className
9
- );
10
-
11
- if (classDocument?.members) {
12
- classDocument.members = classDocument.members.filter(
13
- (member) => !member.privacy
14
- );
15
- }
16
- }
17
- }
18
- },
19
- };
@@ -1,30 +0,0 @@
1
- import glob from 'fast-glob';
2
- export const getWebComponentEntries = () => {
3
- // Always include the index entry
4
- const webComponentEntries: Record<string, string> = {
5
- index: './src/index.ts'
6
- };
7
-
8
- const componentFiles = glob.sync('./src/components/**/index.ts', {
9
- ignore: ['./src/components/**/test/**', './src/components/**/stories/**']
10
- }); // ** = also include/ignore nested folders
11
-
12
- for (const file of componentFiles) {
13
- // Extract the component path relative to components directory
14
- const relativePath = file
15
- .replace('./src/components/', '')
16
- .replace('.ts', '');
17
-
18
- // Check if this is a nested component or root component
19
- const isNestedComponent = relativePath.replace('/index', '').includes('/');
20
-
21
- const componentName = isNestedComponent
22
- ? relativePath.split('/')[1]
23
- : relativePath.replace('/index', '');
24
-
25
- const entryKey = `${componentName}/index`;
26
- webComponentEntries[entryKey] = file;
27
- }
28
-
29
- return webComponentEntries;
30
- };
@@ -1,31 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
-
3
- const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
4
- export const getLicenseContent = (commentFormat: boolean) => {
5
- try {
6
- const licenseFile = readFileSync('LICENSE', 'utf8');
7
-
8
- if (!commentFormat) {
9
- return licenseFile;
10
- }
11
-
12
- return licenseFile
13
- .split('\n')
14
- .map((line) => ` * ${line}`)
15
- .join('\n')
16
- .trim();
17
- } catch {
18
- const license = [
19
- `Copyright (c) ${new Date().getFullYear()}`,
20
- `name: ${packageJson.name}`,
21
- `version: v${packageJson.version}`,
22
- `description: ${packageJson.description}`,
23
- `author: ${packageJson.author}`,
24
- `homepage: ${packageJson.homepage}`
25
- ];
26
- if (!commentFormat) {
27
- return license.join('\n');
28
- }
29
- return `/**\n ${license.join('\n * ')} */`;
30
- }
31
- };
@@ -1,49 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
-
3
- const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
4
- export function getPackageJsonContent(
5
- webComponentEntries: Record<string, string>
6
- ) {
7
- return {
8
- name: packageJson.name,
9
- version: packageJson.version,
10
- homepage: 'https://luzmo.com',
11
- description: 'Lucero - The design system for Luzmo',
12
- type: 'module',
13
- files: ['dist'],
14
- main: './lib/index.js',
15
- module: './lib/index.js',
16
- types: './lib/index.d.ts',
17
- exports: {
18
- '.': {
19
- // types: './lib/index.d.ts',
20
- import: './lib/index.js',
21
- require: './lib/index.cjs'
22
- },
23
- ...Object.fromEntries(
24
- Object.keys(webComponentEntries)
25
- .filter((entry) => entry !== 'index')
26
- .map((entry) => [
27
- `./${entry.replace('/index', '')}`,
28
- {
29
- // types: `./lib/${entry.replace('/index', '')}/index.d.ts`,
30
- import: `./lib/${entry.replace('/index', '')}/index.js`,
31
- require: `./lib/${entry.replace('/index', '')}/index.cjs`
32
- }
33
- ])
34
- )
35
- },
36
- keywords: [
37
- 'Luzmo',
38
- 'design system',
39
- 'components',
40
- 'web components',
41
- 'lucero',
42
- 'analytics'
43
- ],
44
- author: 'Luzmo',
45
- publishConfig: {
46
- access: 'restricted'
47
- }
48
- };
49
- }
@@ -1,156 +0,0 @@
1
- import { Plugin as CemPlugin } from '@custom-elements-manifest/analyzer';
2
- import {
3
- create,
4
- litPlugin,
5
- ts
6
- } from '@custom-elements-manifest/analyzer/src/browser-entrypoint.js';
7
- import glob from 'fast-glob';
8
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
9
- import { join } from 'node:path';
10
- import type { SourceFile } from 'typescript';
11
- import { Plugin } from 'vite';
12
- import { cemPluginMixinsAndSuperclass } from './cem-plugins/plugin-mixins-and-superclass';
13
- import { cemPluginPrivateFieldsFilter } from './cem-plugins/plugin-private-fields-filter';
14
-
15
- export interface VitePluginCustomElementsManifestOptions {
16
- endpoint?: string; // '/custom-elements.json'
17
- output?: string; // 'custom-elements.json'
18
- files?: string[];
19
- componentEntries?: string[];
20
- config?: string; // 'custom-elements-manifest.config.mjs'
21
- dev?: boolean;
22
- plugins?: CemPlugin[];
23
- }
24
-
25
- export interface ConfigFileOptions {
26
- globs: string[];
27
- exclude: string[];
28
- dev: boolean;
29
- plugins: CemPlugin[];
30
- }
31
-
32
- export async function loadOptions({
33
- endpoint = '/custom-elements.json',
34
- output = 'custom-elements.json',
35
- componentEntries = [],
36
- config,
37
- ...createManifestOptions
38
- }: VitePluginCustomElementsManifestOptions): Promise<VitePluginCustomElementsManifestOptions> {
39
- const files = Object.entries(componentEntries)
40
- .filter(([key, _]) => key !== 'index')
41
- // only use component entries
42
- .map(([_, value]) => `${value.replace('/index.ts', '')}/**/*.ts`);
43
-
44
- return {
45
- endpoint,
46
- output,
47
- dev: createManifestOptions.dev,
48
- plugins: createManifestOptions.plugins,
49
- files
50
- };
51
- }
52
-
53
- function createModule(path: string) {
54
- const source = readFileSync(path).toString();
55
-
56
- return ts.createSourceFile(
57
- path,
58
- source,
59
- ts.ScriptTarget.ES2015,
60
- true
61
- ) as SourceFile;
62
- }
63
-
64
- function createManifest(
65
- paths: string[],
66
- { dev = false }: { dev?: boolean } = {}
67
- ) {
68
- let files = paths.flatMap((p) => glob.sync(p, { absolute: false }));
69
-
70
- // filter out files in the tests & stories folders & index.ts files
71
- files = files.filter(
72
- (path) =>
73
- !path.includes('/tests/') &&
74
- !path.includes('/stories/') &&
75
- !path.endsWith('index.ts')
76
- );
77
-
78
- const modules = files.map(createModule);
79
-
80
- const plugins: CemPlugin[] = [
81
- ...litPlugin(),
82
- cemPluginPrivateFieldsFilter,
83
- cemPluginMixinsAndSuperclass
84
- ];
85
-
86
- return create({
87
- modules,
88
- plugins,
89
- dev
90
- });
91
- }
92
-
93
- async function PluginCustomElementsManifest(
94
- options: VitePluginCustomElementsManifestOptions = {}
95
- ): Promise<Plugin> {
96
- const virtualModuleId = 'virtual:vite-plugin-cem/custom-elements-manifest';
97
- const resolvedVirtualModuleId = `\0${virtualModuleId}`;
98
-
99
- const {
100
- endpoint = '/custom-elements.json',
101
- output,
102
- files = [],
103
- ...createManifestOptions
104
- } = await loadOptions(options);
105
-
106
- return {
107
- name: 'vite-plugin-custom-elements-manifest',
108
-
109
- configureServer(server) {
110
- server.middlewares.use(endpoint, async (req, res) => {
111
- const manifest = createManifest(files, createManifestOptions);
112
-
113
- res.end(JSON.stringify(manifest, null, 2));
114
- });
115
- },
116
-
117
- generateBundle(this, { dir }) {
118
- const path = join(dir, output);
119
- const manifest = createManifest(files, createManifestOptions);
120
-
121
- mkdirSync(dir, { recursive: true });
122
- writeFileSync(path, JSON.stringify(manifest, null, 2));
123
- },
124
-
125
- resolveId(id) {
126
- if (id !== virtualModuleId) {
127
- return;
128
- }
129
-
130
- return resolvedVirtualModuleId;
131
- },
132
-
133
- load(id) {
134
- if (id !== resolvedVirtualModuleId) {
135
- return;
136
- }
137
-
138
- const manifest = createManifest(files, createManifestOptions);
139
- return `export default ${JSON.stringify(manifest, null, 2)}`;
140
- },
141
-
142
- async handleHotUpdate({ server }) {
143
- const mod = await server.moduleGraph.getModuleByUrl(
144
- resolvedVirtualModuleId
145
- );
146
-
147
- if (!mod) {
148
- return;
149
- }
150
-
151
- server.reloadModule(mod);
152
- }
153
- };
154
- }
155
-
156
- export default PluginCustomElementsManifest;
@@ -1,130 +0,0 @@
1
- // adapated from https://github.com/sumy7/vite-plugin-generate-file
2
-
3
- import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
4
- import { dirname, relative, resolve } from 'node:path';
5
- import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite';
6
-
7
- interface GenerateFile {
8
- output?: string;
9
- type?: 'json' | 'text';
10
- data?: Record<string, any> | string;
11
- }
12
-
13
- interface NormalizeGenerateFile extends GenerateFile {
14
- contentType?: 'application/json' | 'text/plain';
15
- fullPath: string;
16
- relativePath: string;
17
- }
18
-
19
- type Options = GenerateFile | GenerateFile[];
20
- let config: ResolvedConfig;
21
- let distPath: string;
22
- const generateFileMap = new Map<string, NormalizeGenerateFile>();
23
-
24
- function ensureDirectoryExistence(filePath: string): void {
25
- const _dirname = dirname(filePath);
26
- if (existsSync(_dirname)) {
27
- return;
28
- }
29
- ensureDirectoryExistence(_dirname);
30
- mkdirSync(_dirname);
31
- }
32
-
33
- function normalizeOption(option: GenerateFile): NormalizeGenerateFile {
34
- const generateFileOption: GenerateFile = {
35
- output: './output.txt',
36
- type: 'json',
37
- ...option
38
- };
39
- const fullPath = resolve(distPath, generateFileOption.output!);
40
- const relativePath = `/${relative(distPath, fullPath)}`;
41
- const contentType =
42
- generateFileOption.output === 'json' ? 'application/json' : 'text/plain';
43
- return {
44
- ...generateFileOption,
45
- contentType,
46
- fullPath,
47
- relativePath
48
- };
49
- }
50
-
51
- function generateFile(option: NormalizeGenerateFile): void {
52
- const filePath = option.fullPath;
53
- const fileContent =
54
- typeof option.data === 'string'
55
- ? option.data
56
- : JSON.stringify(option.data, null, 2);
57
- ensureDirectoryExistence(filePath);
58
- writeFileSync(filePath, fileContent, { flag: 'w' });
59
- }
60
-
61
- function configureServer(server: ViteDevServer): void {
62
- server.middlewares.use((req, res, next) => {
63
- const uri = new URL(req.originalUrl!, `http://${req.headers.host}`);
64
- const pathname = uri.pathname;
65
-
66
- if (generateFileMap.has(pathname)) {
67
- const option = generateFileMap.get(pathname)!;
68
- const content =
69
- typeof option.data === 'string'
70
- ? option.data
71
- : JSON.stringify(option.data, null, 2);
72
- res.writeHead(200, {
73
- 'Content-Type': option.contentType
74
- });
75
- res.write(content);
76
- res.end();
77
- } else {
78
- next();
79
- }
80
- });
81
-
82
- const _print = server.printUrls;
83
- server.printUrls = () => {
84
- let host = `${config.server.https ? 'https' : 'http'}://localhost:${
85
- config.server.port || '80'
86
- }`;
87
-
88
- const url = server.resolvedUrls?.local[0];
89
-
90
- if (url) {
91
- try {
92
- const u = new URL(url);
93
- host = `${u.protocol}//${u.host}`;
94
- } catch (error) {
95
- console.warn('Parse resolved url failed:', error);
96
- }
97
- }
98
-
99
- _print();
100
- };
101
- }
102
-
103
- export function PluginGenerateFile(options: Options): Plugin {
104
- return {
105
- name: 'vite-generate-file',
106
- configResolved(resolvedConfig) {
107
- config = resolvedConfig;
108
- distPath = resolve(config.root, config.build.outDir);
109
-
110
- if (Array.isArray(options)) {
111
- options.forEach((option) => {
112
- const simpleOption = normalizeOption(option);
113
- generateFileMap.set(simpleOption.relativePath, simpleOption);
114
- });
115
- } else {
116
- const simpleOption = normalizeOption(options);
117
- generateFileMap.set(simpleOption.relativePath, simpleOption);
118
- }
119
- },
120
- closeBundle() {
121
- if (config.command === 'serve') {
122
- return;
123
- }
124
- for (const option of generateFileMap.values()) {
125
- generateFile(option);
126
- }
127
- },
128
- configureServer
129
- };
130
- }
@@ -1,55 +0,0 @@
1
- import MagicString from 'magic-string';
2
- import fs from 'node:fs';
3
- import { resolve } from 'node:path';
4
- import * as sass from 'sass';
5
- import { Plugin } from 'vite';
6
-
7
- // Create the CSS variables initialization code
8
- let globalCSSVariables;
9
- const getGlobalStyles = () => {
10
- if (globalCSSVariables) return globalCSSVariables;
11
-
12
- const globalScssPath = resolve(
13
- import.meta.dirname,
14
- './../src/styles/global-variables.css'
15
- );
16
- const scssContent = fs.readFileSync(globalScssPath, 'utf8');
17
- globalCSSVariables = sass.compileString(scssContent, {
18
- style: 'compressed',
19
- loadPaths: [resolve(import.meta.dirname, './../src/styles')]
20
- }).css;
21
-
22
- return globalCSSVariables;
23
- };
24
-
25
- const cssVariablesTemplate = () => `
26
- // Auto-generated initialization code
27
- const initializeGlobalLuzmoCSSVariables = () => {
28
- if (typeof document !== 'undefined' && !document.querySelector('style[data-luzmo-vars]')) {
29
- const styleElement = document.createElement('style');
30
- styleElement.setAttribute('data-luzmo-vars', '');
31
- styleElement.textContent = \`${getGlobalStyles().replaceAll('`', '\\`')}\`;
32
- document.head.appendChild(styleElement);
33
- }
34
- };
35
- initializeGlobalLuzmoCSSVariables();
36
- `;
37
-
38
- export function prependCssVariablesCode(): Plugin {
39
- return {
40
- name: 'prepend-css-variables-code',
41
- renderChunk(code, chunk) {
42
- // Only prepend the initialization code to the index entry of web component files
43
- if (!chunk.fileName.endsWith('index.js')) {
44
- return null;
45
- }
46
- const s = new MagicString(code);
47
- s.prepend(cssVariablesTemplate());
48
- return {
49
- code: s.toString(),
50
- map: s.generateMap({ hires: true })
51
- };
52
- },
53
- apply: 'build'
54
- };
55
- }
@@ -1,69 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import banner from 'vite-plugin-banner';
3
- import tsconfigPaths from 'vite-tsconfig-paths';
4
- import { getWebComponentEntries } from './vite-utils/get-components-entries';
5
- import { getLicenseContent } from './vite-utils/get-license-content';
6
- import { getPackageJsonContent } from './vite-utils/get-package-json-content';
7
- import PluginCustomElementsManifest from './vite-utils/plugin-generate-custom-elements-manifest';
8
- import { PluginGenerateFile } from './vite-utils/plugin-generate-file';
9
- import { prependCssVariablesCode } from './vite-utils/plugin-prepend-css-variables-code';
10
-
11
- export default defineConfig(({ mode }) => {
12
- const webComponentEntries = getWebComponentEntries();
13
- const bannerContent = getLicenseContent(true);
14
- const packageJsonContent = getPackageJsonContent(webComponentEntries);
15
- return {
16
- define: {
17
- 'process.env.NODE_ENV': JSON.stringify(mode)
18
- },
19
- plugins: [
20
- tsconfigPaths(),
21
- PluginCustomElementsManifest({
22
- output: './../custom-elements.json',
23
- dev: mode === 'development',
24
- componentEntries: Object.values(webComponentEntries),
25
- files: ['src/components/**/*(!stories).ts']
26
- }),
27
- prependCssVariablesCode(),
28
- banner(bannerContent),
29
- PluginGenerateFile([
30
- {
31
- type: 'json',
32
- output: './../package.json',
33
- data: packageJsonContent
34
- }
35
- ]),
36
- PluginGenerateFile([
37
- {
38
- type: 'text',
39
- output: './../LICENSE',
40
- data: getLicenseContent(false)
41
- }
42
- ])
43
- ],
44
- css: {
45
- modules: {
46
- // set to [local] so that the css class names are not changed
47
- generateScopedName: '[local]'
48
- }
49
- },
50
- build: {
51
- // make sure the dist folder is set otherwise will overwrite the package.json in the root folder
52
- outDir: './dist/lib',
53
- // set to false in development mode so the storybook doesn't watch a suddenly empty dist folder
54
- emptyOutDir: mode === 'production' ? true : false,
55
- lib: {
56
- entry: webComponentEntries,
57
- name: 'Luzmo Design System - Lucero'
58
- },
59
- rollupOptions: {
60
- external: ['lit', '@luzmo/icons'],
61
- output: {
62
- globals: {
63
- lit: 'lit'
64
- }
65
- }
66
- }
67
- }
68
- };
69
- });
@@ -1,6 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import tsconfigPaths from 'vite-tsconfig-paths';
3
-
4
- export default defineConfig({
5
- plugins: [tsconfigPaths()]
6
- });