@mgdis/core-ui-helpers 1.1.1 → 1.2.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 (37) hide show
  1. package/.turbo/turbo-build.log +16 -16
  2. package/CHANGELOG.md +18 -0
  3. package/dist/playwright/index.cjs +11 -5
  4. package/dist/playwright/index.cjs.map +1 -1
  5. package/dist/playwright/index.d.ts +7 -3
  6. package/dist/playwright/index.js +11 -5
  7. package/dist/playwright/index.js.map +1 -1
  8. package/dist/playwright/index.umd.js +11 -5
  9. package/dist/playwright/index.umd.js.map +1 -1
  10. package/dist/stencil/index.cjs +153 -1682
  11. package/dist/stencil/index.cjs.map +1 -1
  12. package/dist/stencil/index.d.ts +113 -2
  13. package/dist/stencil/index.js +152 -1683
  14. package/dist/stencil/index.js.map +1 -1
  15. package/dist/stencil/index.umd.js +352 -1881
  16. package/dist/stencil/index.umd.js.map +1 -1
  17. package/dist/storybook/index.cjs +168 -1705
  18. package/dist/storybook/index.cjs.map +1 -1
  19. package/dist/storybook/index.js +168 -1705
  20. package/dist/storybook/index.js.map +1 -1
  21. package/dist/storybook/index.umd.js +168 -1705
  22. package/dist/storybook/index.umd.js.map +1 -1
  23. package/json-doc.test.json +13 -2
  24. package/package.json +12 -12
  25. package/src/playwright/utils/__snapshots__/utils.spec.ts.snap +3 -3
  26. package/src/playwright/utils/utils.ts +10 -5
  27. package/src/stencil/ide/__snapshots__/cem.spec.ts.snap +248 -0
  28. package/src/stencil/ide/__snapshots__/ide.spec.ts.snap +11 -124
  29. package/src/stencil/ide/cem.spec.ts +35 -0
  30. package/src/stencil/ide/cem.ts +96 -0
  31. package/src/stencil/ide/ide.ts +33 -26
  32. package/src/stencil/ide/index.ts +1 -0
  33. package/src/stencil/index.ts +1 -0
  34. package/src/stencil/normalize-boolean-attributes/index.ts +1 -0
  35. package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.spec.ts +63 -0
  36. package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.ts +40 -0
  37. package/src/storybook/stencil/__snapshots__/stencil.spec.ts.snap +1 -1
@@ -75,7 +75,7 @@ declare const vsCodeGenerator: (jsonDocs: JsonDocs, storybookBaseUrl: string, so
75
75
  name: string;
76
76
  description: string;
77
77
  attributes: {
78
- name: string;
78
+ name: string | undefined;
79
79
  description: string;
80
80
  values: unknown[] | undefined;
81
81
  references: {
@@ -108,4 +108,115 @@ declare const vsCodeCssGenerator: (jsonDocs: JsonDocs) => {
108
108
  }[];
109
109
  };
110
110
 
111
- export { vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };
111
+ /**
112
+ * Generate a Custom Elements Manifest v2 from Stencil JSON docs.
113
+ * @param jsonDocs - Stencil JSON doc
114
+ * @returns CEM v2
115
+ * @example
116
+ * ```ts
117
+ * const cem = cemGenerator(jsonDocs);
118
+ * ```
119
+ */
120
+ declare const cemGenerator: (jsonDocs: JsonDocs) => {
121
+ schemaVersion: string;
122
+ readme: string;
123
+ modules: {
124
+ kind: "javascript-module";
125
+ path: string;
126
+ declarations: {
127
+ kind: "class";
128
+ name: string;
129
+ tagName: string;
130
+ customElement: boolean;
131
+ description: string;
132
+ attributes: {
133
+ fieldName: string;
134
+ default?: string | undefined;
135
+ name: string | undefined;
136
+ description: string;
137
+ type: {
138
+ text: string;
139
+ };
140
+ }[];
141
+ members: ({
142
+ attribute?: string | undefined;
143
+ default?: string | undefined;
144
+ kind: "field";
145
+ name: string;
146
+ description: string;
147
+ type: {
148
+ text: string;
149
+ };
150
+ } | {
151
+ kind: "method";
152
+ name: string;
153
+ description: string;
154
+ })[];
155
+ events: {
156
+ name: string;
157
+ description: string;
158
+ type: {
159
+ text: string;
160
+ };
161
+ }[];
162
+ slots: {
163
+ name: string;
164
+ description: string;
165
+ }[];
166
+ cssProperties: {
167
+ name: string;
168
+ description: string;
169
+ }[];
170
+ cssParts: {
171
+ name: string;
172
+ description: string;
173
+ }[];
174
+ }[];
175
+ exports: {
176
+ kind: "custom-element-definition";
177
+ name: string;
178
+ declaration: {
179
+ name: string;
180
+ module: string;
181
+ };
182
+ }[];
183
+ }[];
184
+ };
185
+
186
+ /**
187
+ * Per the HTML spec, a boolean attribute is `true` whenever it is present on the
188
+ * element, regardless of its value (including `="false"`). Stencil's default Prop
189
+ * parser converts the string `"false"` to the boolean `false`, which breaks this
190
+ * contract for consumers writing markup. Call this helper from `componentWillLoad`
191
+ * to re-normalize every present attribute that maps to a boolean-typed Prop.
192
+ *
193
+ * Iterates the host element's attributes and, for each one whose camelCase name
194
+ * matches a `typeof === 'boolean'` Prop on the instance, rewrites the attribute
195
+ * to `''` — Stencil's parser then turns that into `true` via the standard
196
+ * attribute → prop pipeline (no need for `mutable: true` on the Prop, since the
197
+ * write goes through Stencil's internal setter, not through user code).
198
+ *
199
+ * Non-boolean Props and non-Prop attributes (`class`, `id`, ...) are skipped
200
+ * naturally by the type check.
201
+ *
202
+ * @param target - the component instance (must expose `element` via `@Element()`)
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * @Component({ tag: 'my-input' })
207
+ * export class MyInput {
208
+ * @Element() element: HTMLMyInputElement;
209
+ * @Prop() readonly = false;
210
+ * @Prop() disabled = false;
211
+ *
212
+ * componentWillLoad() {
213
+ * normalizeBooleanAttributes(this);
214
+ * }
215
+ * }
216
+ * ```
217
+ */
218
+ declare const normalizeBooleanAttributes: (target: {
219
+ element: HTMLElement;
220
+ }) => void;
221
+
222
+ export { cemGenerator, normalizeBooleanAttributes, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };