@uniweb/core 1.1.0 → 1.2.1

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/package.json +3 -3
  2. package/src/block.js +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,8 +49,8 @@
49
49
  "vitest": "^4.1.7"
50
50
  },
51
51
  "dependencies": {
52
- "@uniweb/theming": "~1.1.0",
53
- "@uniweb/semantic-parser": "~1.5.1"
52
+ "@uniweb/theming": "~1.2.0",
53
+ "@uniweb/semantic-parser": "~1.7.0"
54
54
  },
55
55
  "scripts": {
56
56
  "test": "vitest run"
package/src/block.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  parseContent as parseSemanticContent,
10
10
  resolveAssetUrl
11
11
  } from '@uniweb/semantic-parser'
12
- import { normalizeTokenValue } from '@uniweb/theming'
12
+ import { normalizeTokenValue, isCssName, isCssValue } from '@uniweb/theming'
13
13
  import { sectionDomId } from './section-id.js'
14
14
  import { liftInsets } from './insets.js'
15
15
 
@@ -744,12 +744,18 @@ export default class Block {
744
744
  if (typeof raw !== 'object' || Array.isArray(raw)) return { mode: String(raw), overrides: null, effectiveTokens: null }
745
745
 
746
746
  const { mode, colors, contexts, vars, ...tokens } = raw
747
+ // A token is written into the page — inline on the section and in its stylesheet — so
748
+ // it is a name and a value a stylesheet can hold, or nothing (@uniweb/theming's rule:
749
+ // a value cannot end its declaration, its rule or its element). ⛔ Until 2026-10-14 any
750
+ // value was applied inline as written.
747
751
  const tokenMap = (map) => {
748
752
  if (!map || typeof map !== 'object' || Array.isArray(map)) return null
749
753
  const out = {}
750
754
  for (const [name, value] of Object.entries(map)) {
751
755
  if (value === undefined || value === null || value === '') continue
752
- out[name] = normalizeTokenValue(value)
756
+ const normalized = normalizeTokenValue(value)
757
+ if (!isCssName(name) || !isCssValue(normalized)) continue
758
+ out[name] = normalized
753
759
  }
754
760
  return Object.keys(out).length > 0 ? out : null
755
761
  }