@ng-prism/core 22.1.3 → 22.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"snippet-generator.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/snippet-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B;AAwBD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,EAAE,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,gBAAgB,CAAC,EAAE,uBAAuB,GACzC,MAAM,CAmER"}
1
+ {"version":3,"file":"snippet-generator.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/snippet-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B;AAwBD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,EAAE,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,gBAAgB,CAAC,EAAE,uBAAuB,GACzC,MAAM,CA0ER"}
@@ -6,7 +6,7 @@ function pushAttribute(attributes, name, value) {
6
6
  attributes.push(`${name}="${escapeAttrValue(value)}"`);
7
7
  }
8
8
  else if (typeof value === 'boolean') {
9
- attributes.push(`[${name}]="true"`);
9
+ attributes.push(`[${name}]="${value}"`);
10
10
  }
11
11
  else if (typeof value === 'number') {
12
12
  attributes.push(`[${name}]="${value}"`);
@@ -29,12 +29,16 @@ export function generateSnippet(selector, inputs, values, explicitKeys, content,
29
29
  const value = values[input.name];
30
30
  if (value === undefined)
31
31
  continue;
32
- if (typeof value === 'boolean' && !value)
33
- continue;
34
32
  if (input.defaultValue !== undefined &&
35
33
  value === input.defaultValue &&
36
34
  !explicitKeys?.has(input.name))
37
35
  continue;
36
+ // Only a guess, and only sound when no default is known: a boolean input
37
+ // that defaults to `true` has to show its explicit `false`.
38
+ if (input.defaultValue === undefined &&
39
+ typeof value === 'boolean' &&
40
+ !value)
41
+ continue;
38
42
  pushAttribute(attributes, input.name, value);
39
43
  }
40
44
  for (const [name, value] of Object.entries(values)) {
@@ -108,12 +112,16 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
108
112
  const value = values[input.name];
109
113
  if (value === undefined)
110
114
  continue;
111
- if (typeof value === 'boolean' && !value)
112
- continue;
113
115
  if (input.defaultValue !== undefined &&
114
116
  value === input.defaultValue &&
115
117
  !explicitKeys?.has(input.name))
116
118
  continue;
119
+ // Only a guess, and only sound when no default is known: a boolean input
120
+ // that defaults to `true` has to show its explicit `false`.
121
+ if (input.defaultValue === undefined &&
122
+ typeof value === 'boolean' &&
123
+ !value)
124
+ continue;
117
125
  pushAttribute(attributes, input.name, value);
118
126
  }
119
127
  for (const [name, value] of Object.entries(values)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "22.1.3",
3
+ "version": "22.1.4",
4
4
  "description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
5
5
  "keywords": [
6
6
  "ng-prism",