@markii/html 0.17.0-next.3 → 0.17.0-next.5

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 (2) hide show
  1. package/dist/render.js +6 -23
  2. package/package.json +4 -4
package/dist/render.js CHANGED
@@ -5,7 +5,7 @@ import { resolveLayoutAttributes } from './layout.js';
5
5
  import { escapeHtml } from './escape.js';
6
6
  import { resolveScopedPath } from './resolve.js';
7
7
  import { failureKindClass, failureTitle, EMPTY_INLINE_MARKER_CLASS, emptyInlineTitle, codeRendererFailedTitle, formMismatchTitle, INLINE_FALLBACK_SEPARATOR, invalidAttributeValueTitle, NO_ENGINE_VIEW_LABEL, noEngineViewTitle, } from './failure-presentation.js';
8
- import { createUnavailableComponentLookup, formatValue, getContract, reportDiagnostic, INTERACTIVE_ATTRIBUTE, } from '@markii/stdlib';
8
+ import { createUnavailableComponentLookup, formatValue, invalidEnumAttribute, reportDiagnostic, INTERACTIVE_ATTRIBUTE, } from '@markii/stdlib';
9
9
  import { resolveImageAttribute } from './image-resolve.js';
10
10
  import { resolveHrefAttribute } from './href-resolve.js';
11
11
  function isMarkRoot(node) {
@@ -359,28 +359,6 @@ function renderScriptMarker(node) {
359
359
  return undefined;
360
360
  }
361
361
  }
362
- /**
363
- * Whether one of `name`'s `@markii/stdlib` contract attributes with a
364
- * closed `enum` is present in `attributes` with a value outside that enum.
365
- * Returns the first offending attribute/value pair found, or `undefined`.
366
- * Mirrors `@markii/react`'s identical `invalidEnumAttribute`.
367
- */
368
- function invalidEnumAttribute(name, attributes) {
369
- const contract = getContract(name);
370
- if (!contract)
371
- return undefined;
372
- for (const [attribute, schema] of Object.entries(contract.attributes)) {
373
- const enumValues = schema.enum;
374
- if (!enumValues)
375
- continue;
376
- const value = attributes[attribute];
377
- if (value === undefined || value === null || value === '')
378
- continue;
379
- if (!enumValues.includes(value))
380
- return { attribute, value };
381
- }
382
- return undefined;
383
- }
384
362
  /** Resolves one directive (registry component, `:value[...]`, or the fallback) given its layout-stripped attributes. Never throws. */
385
363
  function renderDirectiveContent(name, kind, attributes, childrenHtml, plainLabel, registry, ctx, scope, layoutClassName, unavailable) {
386
364
  if (name === VALUE_DIRECTIVE_NAME) {
@@ -443,6 +421,11 @@ function renderDirectiveContent(name, kind, attributes, childrenHtml, plainLabel
443
421
  // in the same quiet marker/title, so the two engines produce identical
444
422
  // markup for this case.
445
423
  if (isRegisteredInline(entry) && childrenHtml.trim() === '') {
424
+ reportDiagnostic(ctx.onDiagnostic, {
425
+ kind: 'empty-inline',
426
+ directive: name,
427
+ message: emptyInlineTitle(name),
428
+ });
446
429
  const title = escapeHtml(emptyInlineTitle(name));
447
430
  return `<span class="${EMPTY_INLINE_MARKER_CLASS}" title="${title}">${rendered}</span>`;
448
431
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markii/html",
3
- "version": "0.17.0-next.3",
3
+ "version": "0.17.0-next.5",
4
4
  "description": "A framework-free static HTML renderer for Markii (.mk.md): a registry-driven hast-to-HTML string engine. Zero React; for stopped-changing documents (publish, CI, email, archive).",
5
5
  "keywords": [
6
6
  "markdown",
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "hast-util-to-html": "^9.0.0",
57
- "@markii/core": "^0.17.0-next.3",
58
- "@markii/runtime": "^0.17.0-next.3",
59
- "@markii/stdlib": "^0.17.0-next.3"
57
+ "@markii/core": "^0.17.0-next.5",
58
+ "@markii/runtime": "^0.17.0-next.5",
59
+ "@markii/stdlib": "^0.17.0-next.5"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/hast": "^3.0.4"