@styleflow.app/flowpress-astro-core 1.0.0-beta.30 → 1.0.0-beta.32

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 (112) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/astro/CompositionRenderer.astro +13 -2
  3. package/dist/astro/DefaultBlockAdapter.astro +3 -1
  4. package/dist/astro/FontStylesheets.astro +35 -0
  5. package/dist/astro/GutenbergRenderer.astro +59 -19
  6. package/dist/astro/Media.astro +24 -0
  7. package/dist/astro/StyleflowElement.astro +1 -0
  8. package/dist/astro/blocks/CarouselBlock.astro +3 -0
  9. package/dist/astro/blocks/CoverBlock.astro +2 -1
  10. package/dist/astro/blocks/HeroBlock.astro +2 -1
  11. package/dist/astro/blocks/ImageBlock.astro +2 -1
  12. package/dist/astro/blocks/ListItemFallback.astro +2 -1
  13. package/dist/astro/blocks/SiteLogoBlock.astro +3 -2
  14. package/dist/astro/blocks/helpers.d.ts +3 -1
  15. package/dist/astro/blocks/helpers.d.ts.map +1 -1
  16. package/dist/astro/blocks/helpers.js +5 -3
  17. package/dist/astro/blocks/helpers.js.map +1 -1
  18. package/dist/astro/blocks/helpers.ts +7 -4
  19. package/dist/astro/motion/AccordionRuntime.astro +9 -0
  20. package/dist/astro/motion/MotionBoot.astro +21 -0
  21. package/dist/astro/motion/MotionRuntime.astro +31 -0
  22. package/dist/astro/motion/accordion.css +163 -0
  23. package/dist/astro/motion/accordion.d.ts +3 -0
  24. package/dist/astro/motion/accordion.d.ts.map +1 -0
  25. package/dist/astro/motion/accordion.js +98 -0
  26. package/dist/astro/motion/accordion.js.map +1 -0
  27. package/dist/astro/motion/accordion.ts +109 -0
  28. package/dist/astro/motion/motion-controller.d.ts +12 -0
  29. package/dist/astro/motion/motion-controller.d.ts.map +1 -0
  30. package/dist/astro/motion/motion-controller.js +293 -0
  31. package/dist/astro/motion/motion-controller.js.map +1 -0
  32. package/dist/astro/motion/motion-controller.ts +377 -0
  33. package/dist/astro/motion/motion.css +546 -0
  34. package/dist/astro/motion/motion.d.ts +127 -0
  35. package/dist/astro/motion/motion.d.ts.map +1 -0
  36. package/dist/astro/motion/motion.js +255 -0
  37. package/dist/astro/motion/motion.js.map +1 -0
  38. package/dist/astro/motion/motion.ts +419 -0
  39. package/dist/astro/native/CustomFieldValue.astro +2 -1
  40. package/dist/astro/native/ReservedLogin.astro +107 -0
  41. package/dist/astro/native/ResolvedBlocks.astro +3 -1
  42. package/dist/astro/native/SyncedPatternContent.astro +3 -1
  43. package/dist/astro/native/TermFieldValue.astro +2 -1
  44. package/dist/astro/native/Timeline.astro +2 -1
  45. package/dist/astro/native/blob.css +1 -1
  46. package/dist/astro/native/button-template.d.ts +31 -0
  47. package/dist/astro/native/button-template.d.ts.map +1 -0
  48. package/dist/astro/native/button-template.js +54 -0
  49. package/dist/astro/native/button-template.js.map +1 -0
  50. package/dist/astro/native/button-template.ts +92 -0
  51. package/dist/astro/native/core-button-fallback.astro +43 -0
  52. package/dist/astro/native/core-button.astro +48 -26
  53. package/dist/astro/native/core-group.astro +3 -1
  54. package/dist/astro/native/core-image.astro +3 -2
  55. package/dist/astro/native/core-navigation.astro +9 -2
  56. package/dist/astro/native/core-post-featured-image.astro +3 -2
  57. package/dist/astro/native/core-post-template-fallback.astro +30 -0
  58. package/dist/astro/native/core-post-template.astro +17 -24
  59. package/dist/astro/native/grid-bleed.d.ts +2 -0
  60. package/dist/astro/native/grid-bleed.d.ts.map +1 -0
  61. package/dist/astro/native/grid-bleed.js +24 -7
  62. package/dist/astro/native/grid-bleed.js.map +1 -0
  63. package/dist/astro/native/group.css +36 -0
  64. package/dist/astro/native/group.d.ts +15 -0
  65. package/dist/astro/native/group.d.ts.map +1 -0
  66. package/dist/astro/native/group.js +66 -0
  67. package/dist/astro/native/group.js.map +1 -0
  68. package/dist/astro/native/group.ts +61 -0
  69. package/dist/astro/native/inline-text.css +15 -0
  70. package/dist/astro/native/query-carousel.d.ts +12 -0
  71. package/dist/astro/native/query-carousel.d.ts.map +1 -0
  72. package/dist/astro/native/query-carousel.js +36 -0
  73. package/dist/astro/native/query-carousel.js.map +1 -0
  74. package/dist/astro/native/query-carousel.ts +56 -0
  75. package/dist/astro/native/registry.d.ts.map +1 -1
  76. package/dist/astro/native/registry.js +3 -0
  77. package/dist/astro/native/registry.js.map +1 -1
  78. package/dist/astro/native/registry.ts +4 -0
  79. package/dist/astro/native/timeline.css +1 -1
  80. package/dist/astro/preferences/AccessibilityPanel.astro +73 -86
  81. package/dist/block-renderers.d.ts +3 -0
  82. package/dist/block-renderers.d.ts.map +1 -1
  83. package/dist/block-renderers.js.map +1 -1
  84. package/dist/composition.d.ts.map +1 -1
  85. package/dist/composition.js +2 -1
  86. package/dist/composition.js.map +1 -1
  87. package/dist/default-blocks.d.ts +1 -1
  88. package/dist/default-blocks.d.ts.map +1 -1
  89. package/dist/default-blocks.js +3 -1
  90. package/dist/default-blocks.js.map +1 -1
  91. package/dist/reserved-area.d.ts +10 -0
  92. package/dist/reserved-area.d.ts.map +1 -0
  93. package/dist/reserved-area.js +93 -0
  94. package/dist/reserved-area.js.map +1 -0
  95. package/dist/styleflow.d.ts +2 -0
  96. package/dist/styleflow.d.ts.map +1 -1
  97. package/dist/styleflow.js +6 -4
  98. package/dist/styleflow.js.map +1 -1
  99. package/dist/svg-media-runtime.d.ts +3 -0
  100. package/dist/svg-media-runtime.d.ts.map +1 -0
  101. package/dist/svg-media-runtime.js +33 -0
  102. package/dist/svg-media-runtime.js.map +1 -0
  103. package/dist/svg-media-types.d.ts +11 -0
  104. package/dist/svg-media-types.d.ts.map +1 -0
  105. package/dist/svg-media-types.js +2 -0
  106. package/dist/svg-media-types.js.map +1 -0
  107. package/dist/svg-media.d.ts +10 -0
  108. package/dist/svg-media.d.ts.map +1 -0
  109. package/dist/svg-media.js +34 -0
  110. package/dist/svg-media.js.map +1 -0
  111. package/dist/tsconfig.tsbuildinfo +1 -1
  112. package/package.json +30 -3
@@ -1,3 +1,4 @@
1
+ import { nativeFlexItemProps } from "./astro/native/group.js";
1
2
  export function flowpressBlockHtmlProps(attributes) {
2
3
  const id = typeof attributes.anchor === "string" ? attributes.anchor.trim() : "";
3
4
  const className = typeof attributes.className === "string"
@@ -31,7 +32,7 @@ export function flowpressBlockHtmlProps(attributes) {
31
32
  props[htmlName] = value;
32
33
  }
33
34
  }
34
- return props;
35
+ return nativeFlexItemProps(attributes, props);
35
36
  }
36
37
  function normalizeSupportedHtmlAttribute(name) {
37
38
  const normalized = name.trim().toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,uBAAuB,CACrC,UAA6C;IAE7C,MAAM,EAAE,GAAG,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,SAAS,KAAK,QAAQ;QACxD,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GAA4B;QACrC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC;IACF,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,CAAC;IAC3C,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAA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AC,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,+BAA+B,CAAC;QAChD,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,0DAA0D,SAAS,UAAU,OAAO,GAAG;YAChG,OAAO;SACR,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,0BAA0B,SAAS,mBAAmB,CAAC;QACvE,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC,SAAS,yCAAyC,OAAO,GAAG;YACrG,OAAO;SACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { FlowpressBlockAdapters } from \"./block-renderers.js\";\nimport type {\n FlowpressBlock,\n FlowpressBlockAuthoringAttributes,\n FlowpressBlockHtmlProps,\n FlowpressBlockTypeDescriptor,\n FlowpressCompositionV1\n} from \"./types.js\";\n\nexport function flowpressBlockHtmlProps(\n attributes: FlowpressBlockAuthoringAttributes\n): FlowpressBlockHtmlProps {\n const id = typeof attributes.anchor === \"string\" ? attributes.anchor.trim() : \"\";\n const className = typeof attributes.className === \"string\"\n ? attributes.className.trim().replace(/\\s+/g, \" \")\n : \"\";\n const props: FlowpressBlockHtmlProps = {\n ...(id ? { id } : {}),\n ...(className ? { class: className } : {})\n };\n const explicit = attributes.htmlAttributes;\n if (explicit && typeof explicit === \"object\" && !Array.isArray(explicit)) {\n for (const [name, value] of Object.entries(explicit)) {\n const normalized = normalizeSupportedHtmlAttribute(name);\n if (!normalized || normalized === \"id\" || normalized === \"class\") continue;\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[normalized] = value as string | number | boolean;\n }\n }\n }\n for (const [attribute, htmlName] of [\n [\"title\", \"title\"],\n [\"role\", \"role\"],\n [\"lang\", \"lang\"],\n [\"dir\", \"dir\"],\n [\"tabIndex\", \"tabindex\"],\n [\"ariaLabel\", \"aria-label\"]\n ] as const) {\n const value = attributes[attribute];\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[htmlName] = value as string | number | boolean;\n }\n }\n return props;\n}\n\nfunction normalizeSupportedHtmlAttribute(name: string): string {\n const normalized = name.trim().toLowerCase();\n if ([\"title\", \"role\", \"lang\", \"dir\", \"tabindex\", \"hidden\"].includes(normalized)) {\n return normalized;\n }\n if (/^aria-[a-z0-9-]+$/.test(normalized)) return normalized;\n if (\n /^data-[a-z0-9-]+$/.test(normalized)\n && !/^data-(?:color|surface|foreground|layout|text|interactive|styleflow|sf-)/.test(normalized)\n ) {\n return normalized;\n }\n return \"\";\n}\n\ntype LogoResolvedData = {\n themeMap?: Record<string, \"positive\" | \"negative\">;\n fallback?: \"positive\" | \"negative\";\n};\n\nfunction findLogoData(blocks: FlowpressBlock[]): LogoResolvedData | null {\n for (const block of blocks) {\n if (block.name === \"core/site-logo\" && block.resolvedData) {\n return block.resolvedData as LogoResolvedData;\n }\n const nested = findLogoData(block.innerBlocks ?? []);\n if (nested) return nested;\n }\n return null;\n}\n\n/** Structural logo visibility rules emitted once per composition. */\nexport function flowpressCompositionLogoStyles(\n composition: FlowpressCompositionV1\n): string {\n const data = findLogoData(composition.blocks);\n if (!data) return \"\";\n const fallback = data.fallback === \"negative\" ? \"negative\" : \"positive\";\n const other = fallback === \"positive\" ? \"negative\" : \"positive\";\n const lines = [\n `:root{--flowpress-logo-${fallback}-display:block;--flowpress-logo-${other}-display:none}`,\n \".flowpress-site-logo__image--positive{display:var(--flowpress-logo-positive-display,none)}\",\n \".flowpress-site-logo__image--negative{display:var(--flowpress-logo-negative-display,none)}\"\n ];\n for (const [theme, variant] of Object.entries(data.themeMap ?? {})) {\n if (!/^[a-z0-9_-]+$/.test(theme)) continue;\n const hidden = variant === \"positive\" ? \"negative\" : \"positive\";\n lines.push(\n `[data-styleflow-theme=\"${theme}\"]{--flowpress-logo-${variant}-display:block;--flowpress-logo-${hidden}-display:none}`\n );\n }\n lines.push(\n '.flowpress-site-logo[data-flowpress-logo-override=\"positive\"]{--flowpress-logo-positive-display:block;--flowpress-logo-negative-display:none}',\n '.flowpress-site-logo[data-flowpress-logo-override=\"negative\"]{--flowpress-logo-positive-display:none;--flowpress-logo-negative-display:block}'\n );\n return lines.join(\"\\n\");\n}\n\nexport type FlowpressAdapterCompatibilityCode =\n | \"missing-adapter\"\n | \"draft-adapter\"\n | \"missing-descriptor\"\n | \"stale-adapter\";\n\nexport interface FlowpressAdapterCompatibilityIssue {\n code: FlowpressAdapterCompatibilityCode;\n message: string;\n command: string;\n}\n\nexport function flowpressBlockTypeDescriptors(\n composition: FlowpressCompositionV1\n): ReadonlyMap<string, FlowpressBlockTypeDescriptor> {\n return new Map(composition.blockTypes.map((descriptor) => [\n descriptor.blockName,\n descriptor\n ]));\n}\n\nexport function flowpressAdapterCompatibilityIssue(\n blockName: string,\n descriptors: ReadonlyMap<string, FlowpressBlockTypeDescriptor>,\n adapters: FlowpressBlockAdapters\n): FlowpressAdapterCompatibilityIssue | null {\n const adapter = adapters[blockName];\n if (!adapter) {\n const command = `pnpm cms:block-adapter ${blockName}`;\n return {\n code: \"missing-adapter\",\n message: `Missing FlowPress block adapter for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (adapter.status !== \"ready\") {\n const command = `pnpm cms:block-adapter:approve ${blockName}`;\n return {\n code: \"draft-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" is draft. Run ${command}.`,\n command\n };\n }\n const descriptor = descriptors.get(blockName);\n if (!descriptor) {\n const command = \"pnpm cms:block-adapters:check\";\n return {\n code: \"missing-descriptor\",\n message: `WordPress did not provide a block type descriptor for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (descriptor.fingerprint !== adapter.fingerprint) {\n const command = `pnpm cms:block-adapter ${blockName} --refresh-schema`;\n return {\n code: \"stale-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" has a stale schema fingerprint.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U,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,0BAA0B,SAAS,mBAAmB,CAAC;QACvE,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC,SAAS,yCAAyC,OAAO,GAAG;YACrG,OAAO;SACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { nativeFlexItemProps } from \"./astro/native/group.js\";\nimport type { FlowpressBlockAdapters } from \"./block-renderers.js\";\nimport type {\n FlowpressBlock,\n FlowpressBlockAuthoringAttributes,\n FlowpressBlockHtmlProps,\n FlowpressBlockTypeDescriptor,\n FlowpressCompositionV1\n} from \"./types.js\";\n\nexport function flowpressBlockHtmlProps(\n attributes: FlowpressBlockAuthoringAttributes\n): FlowpressBlockHtmlProps {\n const id = typeof attributes.anchor === \"string\" ? attributes.anchor.trim() : \"\";\n const className = typeof attributes.className === \"string\"\n ? attributes.className.trim().replace(/\\s+/g, \" \")\n : \"\";\n const props: FlowpressBlockHtmlProps = {\n ...(id ? { id } : {}),\n ...(className ? { class: className } : {})\n };\n const explicit = attributes.htmlAttributes;\n if (explicit && typeof explicit === \"object\" && !Array.isArray(explicit)) {\n for (const [name, value] of Object.entries(explicit)) {\n const normalized = normalizeSupportedHtmlAttribute(name);\n if (!normalized || normalized === \"id\" || normalized === \"class\") continue;\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[normalized] = value as string | number | boolean;\n }\n }\n }\n for (const [attribute, htmlName] of [\n [\"title\", \"title\"],\n [\"role\", \"role\"],\n [\"lang\", \"lang\"],\n [\"dir\", \"dir\"],\n [\"tabIndex\", \"tabindex\"],\n [\"ariaLabel\", \"aria-label\"]\n ] as const) {\n const value = attributes[attribute];\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n props[htmlName] = value as string | number | boolean;\n }\n }\n return nativeFlexItemProps(attributes, props);\n}\n\nfunction normalizeSupportedHtmlAttribute(name: string): string {\n const normalized = name.trim().toLowerCase();\n if ([\"title\", \"role\", \"lang\", \"dir\", \"tabindex\", \"hidden\"].includes(normalized)) {\n return normalized;\n }\n if (/^aria-[a-z0-9-]+$/.test(normalized)) return normalized;\n if (\n /^data-[a-z0-9-]+$/.test(normalized)\n && !/^data-(?:color|surface|foreground|layout|text|interactive|styleflow|sf-)/.test(normalized)\n ) {\n return normalized;\n }\n return \"\";\n}\n\ntype LogoResolvedData = {\n themeMap?: Record<string, \"positive\" | \"negative\">;\n fallback?: \"positive\" | \"negative\";\n};\n\nfunction findLogoData(blocks: FlowpressBlock[]): LogoResolvedData | null {\n for (const block of blocks) {\n if (block.name === \"core/site-logo\" && block.resolvedData) {\n return block.resolvedData as LogoResolvedData;\n }\n const nested = findLogoData(block.innerBlocks ?? []);\n if (nested) return nested;\n }\n return null;\n}\n\n/** Structural logo visibility rules emitted once per composition. */\nexport function flowpressCompositionLogoStyles(\n composition: FlowpressCompositionV1\n): string {\n const data = findLogoData(composition.blocks);\n if (!data) return \"\";\n const fallback = data.fallback === \"negative\" ? \"negative\" : \"positive\";\n const other = fallback === \"positive\" ? \"negative\" : \"positive\";\n const lines = [\n `:root{--flowpress-logo-${fallback}-display:block;--flowpress-logo-${other}-display:none}`,\n \".flowpress-site-logo__image--positive{display:var(--flowpress-logo-positive-display,none)}\",\n \".flowpress-site-logo__image--negative{display:var(--flowpress-logo-negative-display,none)}\"\n ];\n for (const [theme, variant] of Object.entries(data.themeMap ?? {})) {\n if (!/^[a-z0-9_-]+$/.test(theme)) continue;\n const hidden = variant === \"positive\" ? \"negative\" : \"positive\";\n lines.push(\n `[data-styleflow-theme=\"${theme}\"]{--flowpress-logo-${variant}-display:block;--flowpress-logo-${hidden}-display:none}`\n );\n }\n lines.push(\n '.flowpress-site-logo[data-flowpress-logo-override=\"positive\"]{--flowpress-logo-positive-display:block;--flowpress-logo-negative-display:none}',\n '.flowpress-site-logo[data-flowpress-logo-override=\"negative\"]{--flowpress-logo-positive-display:none;--flowpress-logo-negative-display:block}'\n );\n return lines.join(\"\\n\");\n}\n\nexport type FlowpressAdapterCompatibilityCode =\n | \"missing-adapter\"\n | \"draft-adapter\"\n | \"missing-descriptor\"\n | \"stale-adapter\";\n\nexport interface FlowpressAdapterCompatibilityIssue {\n code: FlowpressAdapterCompatibilityCode;\n message: string;\n command: string;\n}\n\nexport function flowpressBlockTypeDescriptors(\n composition: FlowpressCompositionV1\n): ReadonlyMap<string, FlowpressBlockTypeDescriptor> {\n return new Map(composition.blockTypes.map((descriptor) => [\n descriptor.blockName,\n descriptor\n ]));\n}\n\nexport function flowpressAdapterCompatibilityIssue(\n blockName: string,\n descriptors: ReadonlyMap<string, FlowpressBlockTypeDescriptor>,\n adapters: FlowpressBlockAdapters\n): FlowpressAdapterCompatibilityIssue | null {\n const adapter = adapters[blockName];\n if (!adapter) {\n const command = `pnpm cms:block-adapter ${blockName}`;\n return {\n code: \"missing-adapter\",\n message: `Missing FlowPress block adapter for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (adapter.status !== \"ready\") {\n const command = `pnpm cms:block-adapter:approve ${blockName}`;\n return {\n code: \"draft-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" is draft. Run ${command}.`,\n command\n };\n }\n const descriptor = descriptors.get(blockName);\n if (!descriptor) {\n const command = \"pnpm cms:block-adapters:check\";\n return {\n code: \"missing-descriptor\",\n message: `WordPress did not provide a block type descriptor for \"${blockName}\". Run ${command}.`,\n command\n };\n }\n if (descriptor.fingerprint !== adapter.fingerprint) {\n const command = `pnpm cms:block-adapter ${blockName} --refresh-schema`;\n return {\n code: \"stale-adapter\",\n message: `FlowPress block adapter for \"${blockName}\" has a stale schema fingerprint. Run ${command}.`,\n command\n };\n }\n return null;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION: "5";
1
+ export declare const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION: "6";
2
2
  export interface FlowpressDefaultBlockCatalogEntry {
3
3
  blockName: string;
4
4
  template: "DefaultBlockAdapter.astro";
@@ -1 +1 @@
1
- {"version":3,"file":"default-blocks.d.ts","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uCAAuC,EAAG,GAAY,CAAC;AAEpE,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,2BAA2B,CAAC;CACvC;AAmFD,eAAO,MAAM,4BAA4B,EAAE,SAAS,iCAAiC,EACc,CAAC;AAIpG,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wBAAgB,wCAAwC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA+BlF"}
1
+ {"version":3,"file":"default-blocks.d.ts","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uCAAuC,EAAG,GAAY,CAAC;AAEpE,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,2BAA2B,CAAC;CACvC;AAqFD,eAAO,MAAM,4BAA4B,EAAE,SAAS,iCAAiC,EACc,CAAC;AAIpG,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wBAAgB,wCAAwC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA+BlF"}
@@ -1,4 +1,4 @@
1
- export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "5";
1
+ export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = "6";
2
2
  const blockNames = [
3
3
  "core/separator",
4
4
  "core/post-content",
@@ -14,6 +14,8 @@ const blockNames = [
14
14
  "core/term-name",
15
15
  "core/post-terms",
16
16
  "core/button",
17
+ "flowpress/login",
18
+ "flowpress/reserved-pagination",
17
19
  "core/post-date",
18
20
  "core/icon",
19
21
  "core/post-excerpt",
@@ -1 +1 @@
1
- {"version":3,"file":"default-blocks.js","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAY,CAAC;AAOpE,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,SAAS;IACT,UAAU;IACV,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,YAAY;IACZ,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,yBAAyB;IACzB,YAAY;IACZ,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,oBAAoB;IACpB,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,kBAAkB;IAClB,QAAQ;IACR,mBAAmB;IACnB,UAAU;IACV,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,UAAU;IACV,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;AAEpG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,UAAU,CAAC,CAAC;AAE9C,MAAM,UAAU,+BAA+B,CAAC,SAAiB;IAC/D,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,SAAiB;IACxE,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,iDAAiD,SAAS,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,OAAO;;;;;;;;;;;;;;;CAeV,CAAC;IACA,CAAC;IACD,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC","sourcesContent":["export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = \"5\" as const;\n\nexport interface FlowpressDefaultBlockCatalogEntry {\n blockName: string;\n template: \"DefaultBlockAdapter.astro\";\n}\n\nconst blockNames = [\n \"core/separator\",\n \"core/post-content\",\n \"core/site-logo\",\n \"core/template-part\",\n \"sf/accordion\",\n \"sf/collection\",\n \"sf/flex\",\n \"sf/group\",\n \"sf/marquee\",\n \"sf/media-text\",\n \"sf/theme-toggle\",\n\n \"core/term-name\",\n \"core/post-terms\",\n \"core/button\",\n \"core/post-date\",\n \"core/icon\",\n \"core/post-excerpt\",\n \"core/term-description\",\n \"core/post-template\",\n \"core/html\",\n \"core/block\",\n \"core/site-title\",\n \"core/post-featured-image\",\n \"core/page-list\",\n \"core/terms-query\",\n \"core/buttons\",\n \"core/image\",\n \"core/query-no-results\",\n \"core/term-template\",\n \"core/navigation\",\n \"core/navigation-submenu\",\n \"core/query\",\n \"core/home-link\",\n \"core/page-list-item\",\n \"core/navigation-link\",\n \"core/post-title\",\n \"sf/post-field\",\n \"project/post-field\",\n \"sf/block-binding\",\n \"project/block-binding\",\n \"sf/term-field\",\n \"project/term-field\",\n \"sf/timeline\",\n \"core/cover\",\n \"core/group\",\n \"core/heading\",\n \"core/list\",\n \"core/list-item\",\n \"core/paragraph\",\n \"core/quote\",\n \"sf/accordion-item\",\n \"sf/button\",\n \"sf/card\",\n \"sf/carousel\",\n \"sf/carousel-item\",\n \"sf/chip\",\n \"sf/code\",\n \"sf/column\",\n \"sf/content-list\",\n \"sf/form\",\n \"sf/gallery\",\n \"sf/grid\",\n \"sf/heading\",\n \"sf/hero\",\n \"sf/icon\",\n \"sf/image\",\n \"sf/blob\",\n \"sf/timeline-card\",\n \"sf/map\",\n \"sf/number-spinner\",\n \"sf/quote\",\n \"sf/rich-text\",\n \"sf/section\",\n \"sf/template\",\n \"sf/term-list\",\n \"sf/video\",\n \"sf/video-youtube\"\n] as const;\n\nexport const flowpressDefaultBlockCatalog: readonly FlowpressDefaultBlockCatalogEntry[] =\n [...blockNames].sort().map((blockName) => ({ blockName, template: \"DefaultBlockAdapter.astro\" }));\n\nconst supported = new Set<string>(blockNames);\n\nexport function hasFlowpressDefaultBlockAdapter(blockName: string): boolean {\n return supported.has(blockName);\n}\n\nexport function createFlowpressDefaultBlockAdapterSource(blockName: string): string {\n if (!hasFlowpressDefaultBlockAdapter(blockName)) {\n throw new Error(`FlowPress has no official default adapter for ${blockName}.`);\n }\n if (blockName === \"core/cover\") {\n return `---\nimport CoverBlock from \"@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;\n---\n\n<CoverBlock\n block={block}\n contract={contract}\n htmlProps={htmlProps}\n styleflowProps={styleflowProps}\n>\n <slot />\n</CoverBlock>\n`;\n }\n return `---\nimport DefaultBlockAdapter from \"@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst props = Astro.props as FlowpressBlockRendererProps;\n---\n\n<DefaultBlockAdapter {...props} />\n`;\n}\n"]}
1
+ {"version":3,"file":"default-blocks.js","sourceRoot":"","sources":["../src/default-blocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAY,CAAC;AAOpE,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,SAAS;IACT,UAAU;IACV,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,+BAA+B;IAC/B,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,YAAY;IACZ,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,yBAAyB;IACzB,YAAY;IACZ,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,oBAAoB;IACpB,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,kBAAkB;IAClB,QAAQ;IACR,mBAAmB;IACnB,UAAU;IACV,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,UAAU;IACV,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;AAEpG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,UAAU,CAAC,CAAC;AAE9C,MAAM,UAAU,+BAA+B,CAAC,SAAiB;IAC/D,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,SAAiB;IACxE,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,iDAAiD,SAAS,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,OAAO;;;;;;;;;;;;;;;CAeV,CAAC;IACA,CAAC;IACD,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC","sourcesContent":["export const FLOWPRESS_DEFAULT_BLOCK_CATALOG_VERSION = \"6\" as const;\n\nexport interface FlowpressDefaultBlockCatalogEntry {\n blockName: string;\n template: \"DefaultBlockAdapter.astro\";\n}\n\nconst blockNames = [\n \"core/separator\",\n \"core/post-content\",\n \"core/site-logo\",\n \"core/template-part\",\n \"sf/accordion\",\n \"sf/collection\",\n \"sf/flex\",\n \"sf/group\",\n \"sf/marquee\",\n \"sf/media-text\",\n \"sf/theme-toggle\",\n\n \"core/term-name\",\n \"core/post-terms\",\n \"core/button\",\n \"flowpress/login\",\n \"flowpress/reserved-pagination\",\n \"core/post-date\",\n \"core/icon\",\n \"core/post-excerpt\",\n \"core/term-description\",\n \"core/post-template\",\n \"core/html\",\n \"core/block\",\n \"core/site-title\",\n \"core/post-featured-image\",\n \"core/page-list\",\n \"core/terms-query\",\n \"core/buttons\",\n \"core/image\",\n \"core/query-no-results\",\n \"core/term-template\",\n \"core/navigation\",\n \"core/navigation-submenu\",\n \"core/query\",\n \"core/home-link\",\n \"core/page-list-item\",\n \"core/navigation-link\",\n \"core/post-title\",\n \"sf/post-field\",\n \"project/post-field\",\n \"sf/block-binding\",\n \"project/block-binding\",\n \"sf/term-field\",\n \"project/term-field\",\n \"sf/timeline\",\n \"core/cover\",\n \"core/group\",\n \"core/heading\",\n \"core/list\",\n \"core/list-item\",\n \"core/paragraph\",\n \"core/quote\",\n \"sf/accordion-item\",\n \"sf/button\",\n \"sf/card\",\n \"sf/carousel\",\n \"sf/carousel-item\",\n \"sf/chip\",\n \"sf/code\",\n \"sf/column\",\n \"sf/content-list\",\n \"sf/form\",\n \"sf/gallery\",\n \"sf/grid\",\n \"sf/heading\",\n \"sf/hero\",\n \"sf/icon\",\n \"sf/image\",\n \"sf/blob\",\n \"sf/timeline-card\",\n \"sf/map\",\n \"sf/number-spinner\",\n \"sf/quote\",\n \"sf/rich-text\",\n \"sf/section\",\n \"sf/template\",\n \"sf/term-list\",\n \"sf/video\",\n \"sf/video-youtube\"\n] as const;\n\nexport const flowpressDefaultBlockCatalog: readonly FlowpressDefaultBlockCatalogEntry[] =\n [...blockNames].sort().map((blockName) => ({ blockName, template: \"DefaultBlockAdapter.astro\" }));\n\nconst supported = new Set<string>(blockNames);\n\nexport function hasFlowpressDefaultBlockAdapter(blockName: string): boolean {\n return supported.has(blockName);\n}\n\nexport function createFlowpressDefaultBlockAdapterSource(blockName: string): string {\n if (!hasFlowpressDefaultBlockAdapter(blockName)) {\n throw new Error(`FlowPress has no official default adapter for ${blockName}.`);\n }\n if (blockName === \"core/cover\") {\n return `---\nimport CoverBlock from \"@styleflow.app/flowpress-astro-core/blocks/CoverBlock.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst { block, contract, htmlProps, styleflowProps } = Astro.props as FlowpressBlockRendererProps;\n---\n\n<CoverBlock\n block={block}\n contract={contract}\n htmlProps={htmlProps}\n styleflowProps={styleflowProps}\n>\n <slot />\n</CoverBlock>\n`;\n }\n return `---\nimport DefaultBlockAdapter from \"@styleflow.app/flowpress-astro-core/DefaultBlockAdapter.astro\";\nimport type { FlowpressBlockRendererProps } from \"@styleflow.app/flowpress-astro-core\";\n\nconst props = Astro.props as FlowpressBlockRendererProps;\n---\n\n<DefaultBlockAdapter {...props} />\n`;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ export declare function safeFlowpressReservedRedirect(value: unknown): string;
2
+ export declare function flowpressReservedSession(request: Request): string | undefined;
3
+ export declare function flowpressReservedEndpoint(graphqlUrl: string, action: string): URL;
4
+ export declare function flowpressReservedRedirect(path: string): Response;
5
+ export declare function handleFlowpressReservedRequest(request: Request, graphqlUrl: string, fetcher?: typeof fetch): Promise<Response | null>;
6
+ export declare function getFlowpressReservedComposition(graphqlUrl: string, uri: string, request?: Request, fetcher?: typeof fetch): Promise<{
7
+ status: number;
8
+ data?: any;
9
+ }>;
10
+ //# sourceMappingURL=reserved-area.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reserved-area.d.ts","sourceRoot":"","sources":["../src/reserved-area.ts"],"names":[],"mappings":"AASA,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMpE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAOjF;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKhE;AAcD,wBAAsB,8BAA8B,CAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,OAAO,GAAC,OAAO,KAAW,GAAE,OAAO,CAAC,QAAQ,GAAC,IAAI,CAAC,CAaxI;AACD,wBAAsB,+BAA+B,CAAC,UAAU,EAAC,MAAM,EAAC,GAAG,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,OAAO,EAAC,OAAO,GAAC,OAAO,KAAW,GAAE,OAAO,CAAC;IAAC,MAAM,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,GAAG,CAAA;CAAC,CAAC,CAKjK"}
@@ -0,0 +1,93 @@
1
+ const sessionCookie = "flowpress_session";
2
+ const privateHeaders = {
3
+ "cache-control": "private, no-store, max-age=0",
4
+ vary: "Cookie",
5
+ "x-content-type-options": "nosniff",
6
+ "x-robots-tag": "noindex, nofollow",
7
+ };
8
+ export function safeFlowpressReservedRedirect(value) {
9
+ if (typeof value !== "string" || !/^\/area-riservata\//.test(value) || /[\\\r\n]/.test(value))
10
+ return "/area-riservata/";
11
+ const base = new URL("https://flowpress.invalid");
12
+ const url = new URL(value, base);
13
+ return url.origin === base.origin && /^\/area-riservata\//.test(url.pathname)
14
+ ? `${url.pathname}${url.search}` : "/area-riservata/";
15
+ }
16
+ export function flowpressReservedSession(request) {
17
+ const value = request.headers.get("cookie")?.split(";").map(part => part.trim())
18
+ .find(part => part.startsWith(`${sessionCookie}=`))?.slice(sessionCookie.length + 1);
19
+ if (!value || value.length > 4096)
20
+ return undefined;
21
+ try {
22
+ const decoded = decodeURIComponent(value);
23
+ return /[\r\n]/.test(decoded) ? undefined : decoded;
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ }
29
+ export function flowpressReservedEndpoint(graphqlUrl, action) {
30
+ // Query-style REST routing also works when the CMS has no pretty permalinks.
31
+ const url = new URL(graphqlUrl);
32
+ url.search = "";
33
+ url.hash = "";
34
+ url.searchParams.set("rest_route", `/flowpress/v1/reserved-area/${action}`);
35
+ return url;
36
+ }
37
+ export function flowpressReservedRedirect(path) {
38
+ const base = new URL("https://flowpress.invalid");
39
+ const target = new URL(path, base);
40
+ if (target.origin !== base.origin || (!target.pathname.startsWith("/login/") && !target.pathname.startsWith("/area-riservata/")))
41
+ throw new Error("Invalid reserved redirect");
42
+ return new Response(null, { status: 303, headers: { ...privateHeaders, location: target.pathname + target.search } });
43
+ }
44
+ function redirect(path, cookie) {
45
+ const headers = new Headers({ ...privateHeaders, location: path });
46
+ if (cookie)
47
+ headers.set("set-cookie", cookie);
48
+ return new Response(null, { status: 303, headers });
49
+ }
50
+ function cookie(request, value, maxAge) {
51
+ return `${sessionCookie}=${encodeURIComponent(value)}; Path=/; HttpOnly; SameSite=Lax`
52
+ + (new URL(request.url).protocol === "https:" ? "; Secure" : "")
53
+ + (maxAge !== undefined ? `; Max-Age=${maxAge}` : "");
54
+ }
55
+ export async function handleFlowpressReservedRequest(request, graphqlUrl, fetcher = fetch) {
56
+ const url = new URL(request.url);
57
+ const api = url.pathname.match(/^\/api\/flowpress\/reserved-area\/(login|logout)\/?$/);
58
+ if (!api)
59
+ return null;
60
+ const headers = new Headers(privateHeaders);
61
+ headers.set('x-robots-tag', 'noindex, nofollow');
62
+ if (request.method !== 'POST')
63
+ return new Response(null, { status: 405, headers: { ...Object.fromEntries(headers), allow: 'POST' } });
64
+ if (request.headers.get('origin') !== url.origin)
65
+ return new Response(null, { status: 403, headers });
66
+ try {
67
+ const session = flowpressReservedSession(request);
68
+ const form = await request.formData();
69
+ const upstream = await fetcher(flowpressReservedEndpoint(graphqlUrl, api[1]), { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded', ...(session ? { authorization: `Flowpress ${session}`, 'x-flowpress-session': session } : {}) }, body: new URLSearchParams([...form].filter((entry) => typeof entry[1] === 'string')), redirect: 'manual', signal: AbortSignal.timeout(15000) });
70
+ const result = await upstream.json();
71
+ if (api[1] === 'logout')
72
+ return redirect('/login/', cookie(request, '', 0));
73
+ if (!upstream.ok || !result.session)
74
+ return redirect('/login/?errore=' + (result.code === 'accesso' ? 'accesso' : upstream.status >= 500 ? 'servizio' : 'credenziali'));
75
+ return redirect(safeFlowpressReservedRedirect(form.get('redirect_to')), cookie(request, result.session, result.maxAge));
76
+ }
77
+ catch {
78
+ return redirect('/login/?errore=servizio');
79
+ }
80
+ }
81
+ export async function getFlowpressReservedComposition(graphqlUrl, uri, request, fetcher = fetch) {
82
+ const endpoint = flowpressReservedEndpoint(graphqlUrl, 'composition');
83
+ endpoint.searchParams.set('uri', uri);
84
+ const token = request ? flowpressReservedSession(request) : undefined;
85
+ const response = await fetcher(endpoint, { headers: token ? { authorization: `Flowpress ${token}`, 'x-flowpress-session': token } : {}, redirect: 'manual', signal: AbortSignal.timeout(15000) });
86
+ if (!response.ok)
87
+ return { status: response.status === 401 ? 401 : response.status === 404 ? 404 : 503 };
88
+ const data = await response.json();
89
+ if (data.composition?.version !== '1' || !data.capabilities)
90
+ throw new Error('Invalid reserved composition');
91
+ return { status: 200, data };
92
+ }
93
+ //# sourceMappingURL=reserved-area.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reserved-area.js","sourceRoot":"","sources":["../src/reserved-area.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,cAAc,GAAG;IACrB,eAAe,EAAE,8BAA8B;IAC/C,IAAI,EAAE,QAAQ;IACd,wBAAwB,EAAE,SAAS;IACnC,cAAc,EAAE,mBAAmB;CACpC,CAAC;AAGF,MAAM,UAAU,6BAA6B,CAAC,KAAc;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACzH,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,qBAAqB,CAAC,I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C7H,MAAM,QAAQ,GAAC,yBAAyB,CAAC,UAAU,EAAC,aAAa,CAAC,CAAC;IAAA,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,CAAC,CAAC;IAAA,MAAM,KAAK,GAAC,OAAO,CAAA,CAAC,CAAA,wBAAwB,CAAC,OAAO,CAAC,CAAA,CAAC,CAAA,SAAS,CAAC;IACxK,MAAM,QAAQ,GAAC,MAAM,OAAO,CAAC,QAAQ,EAAC,EAAC,OAAO,EAAC,KAAK,CAAA,CAAC,CAAA,EAAC,aAAa,EAAC,aAAa,KAAK,EAAE,EAAC,qBAAqB,EAAC,KAAK,EAAC,CAAA,CAAC,CAAA,EAAE,EAAC,QAAQ,EAAC,QAAQ,EAAC,MAAM,EAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC;IAC/K,IAAG,CAAC,QAAQ,CAAC,EAAE;QAAC,OAAM,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM,KAAG,GAAG,CAAA,CAAC,CAAA,GAAG,CAAA,CAAC,CAAA,QAAQ,CAAC,MAAM,KAAG,GAAG,CAAA,CAAC,CAAA,GAAG,CAAA,CAAC,CAAA,GAAG,EAAC,CAAC;IACvF,MAAM,IAAI,GAAC,MAAM,QAAQ,CAAC,IAAI,EAAQ,CAAC;IAAA,IAAG,IAAI,CAAC,WAAW,EAAE,OAAO,KAAG,GAAG,IAAE,CAAC,IAAI,CAAC,YAAY;QAAC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAAA,OAAM,EAAC,MAAM,EAAC,GAAG,EAAC,IAAI,EAAC,CAAC;AACvK,CAAC","sourcesContent":["const sessionCookie = \"flowpress_session\";\nconst privateHeaders = {\n \"cache-control\": \"private, no-store, max-age=0\",\n vary: \"Cookie\",\n \"x-content-type-options\": \"nosniff\",\n \"x-robots-tag\": \"noindex, nofollow\",\n};\n\n\nexport function safeFlowpressReservedRedirect(value: unknown): string {\n if (typeof value !== \"string\" || !/^\\/area-riservata\\//.test(value) || /[\\\\\\r\\n]/.test(value)) return \"/area-riservata/\";\n const base = new URL(\"https://flowpress.invalid\");\n const url = new URL(value, base);\n return url.origin === base.origin && /^\\/area-riservata\\//.test(url.pathname)\n ? `${url.pathname}${url.search}` : \"/area-riservata/\";\n}\n\nexport function flowpressReservedSession(request: Request): string | undefined {\n const value = request.headers.get(\"cookie\")?.split(\";\").map(part => part.trim())\n .find(part => part.startsWith(`${sessionCookie}=`))?.slice(sessionCookie.length + 1);\n if (!value || value.length > 4096) return undefined;\n try {\n const decoded = decodeURIComponent(value);\n return /[\\r\\n]/.test(decoded) ? undefined : decoded;\n } catch { return undefined; }\n}\n\nexport function flowpressReservedEndpoint(graphqlUrl: string, action: string): URL {\n // Query-style REST routing also works when the CMS has no pretty permalinks.\n const url = new URL(graphqlUrl);\n url.search = \"\";\n url.hash = \"\";\n url.searchParams.set(\"rest_route\", `/flowpress/v1/reserved-area/${action}`);\n return url;\n}\n\nexport function flowpressReservedRedirect(path: string): Response {\n const base = new URL(\"https://flowpress.invalid\");\n const target = new URL(path, base);\n if (target.origin !== base.origin || (!target.pathname.startsWith(\"/login/\") && !target.pathname.startsWith(\"/area-riservata/\"))) throw new Error(\"Invalid reserved redirect\");\n return new Response(null, { status: 303, headers: { ...privateHeaders, location: target.pathname + target.search } });\n}\n\nfunction redirect(path: string, cookie?: string): Response {\n const headers = new Headers({ ...privateHeaders, location: path });\n if (cookie) headers.set(\"set-cookie\", cookie);\n return new Response(null, { status: 303, headers });\n}\n\nfunction cookie(request: Request, value: string, maxAge?: number): string {\n return `${sessionCookie}=${encodeURIComponent(value)}; Path=/; HttpOnly; SameSite=Lax`\n + (new URL(request.url).protocol === \"https:\" ? \"; Secure\" : \"\")\n + (maxAge !== undefined ? `; Max-Age=${maxAge}` : \"\");\n}\n\nexport async function handleFlowpressReservedRequest(request:Request,graphqlUrl:string,fetcher:typeof fetch=fetch):Promise<Response|null>{\n const url=new URL(request.url);const api=url.pathname.match(/^\\/api\\/flowpress\\/reserved-area\\/(login|logout)\\/?$/);if(!api)return null;\n const headers=new Headers(privateHeaders);headers.set('x-robots-tag','noindex, nofollow');\n if(request.method!=='POST')return new Response(null,{status:405,headers:{...Object.fromEntries(headers),allow:'POST'}});\n if(request.headers.get('origin')!==url.origin)return new Response(null,{status:403,headers});\n try{\n const session=flowpressReservedSession(request);const form=await request.formData();\n const upstream=await fetcher(flowpressReservedEndpoint(graphqlUrl,api[1]!),{method:'POST',headers:{'content-type':'application/x-www-form-urlencoded',...(session?{authorization:`Flowpress ${session}`,'x-flowpress-session':session}:{})},body:new URLSearchParams([...form].filter((entry):entry is [string,string]=>typeof entry[1]==='string')),redirect:'manual',signal:AbortSignal.timeout(15000)});\n const result=await upstream.json()as{session?:string;maxAge?:number;code?:string};\n if(api[1]==='logout')return redirect('/login/',cookie(request,'',0));\n if(!upstream.ok||!result.session)return redirect('/login/?errore='+(result.code==='accesso'?'accesso':upstream.status>=500?'servizio':'credenziali'));\n return redirect(safeFlowpressReservedRedirect(form.get('redirect_to')),cookie(request,result.session,result.maxAge));\n }catch{return redirect('/login/?errore=servizio');}\n}\nexport async function getFlowpressReservedComposition(graphqlUrl:string,uri:string,request?:Request,fetcher:typeof fetch=fetch):Promise<{status:number;data?:any}>{\n const endpoint=flowpressReservedEndpoint(graphqlUrl,'composition');endpoint.searchParams.set('uri',uri);const token=request?flowpressReservedSession(request):undefined;\n const response=await fetcher(endpoint,{headers:token?{authorization:`Flowpress ${token}`,'x-flowpress-session':token}:{},redirect:'manual',signal:AbortSignal.timeout(15000)});\n if(!response.ok)return{status:response.status===401?401:response.status===404?404:503};\n const data=await response.json()as any;if(data.composition?.version!=='1'||!data.capabilities)throw new Error('Invalid reserved composition');return{status:200,data};\n}\n"]}
@@ -58,6 +58,8 @@ export interface StyleflowDiagnostic {
58
58
  }
59
59
  export interface ResolveDynamicStyleflowOptions {
60
60
  strict?: boolean;
61
+ /** Concrete tone inherited from a rendered ancestor; never emitted as an attribute. */
62
+ effectiveTone?: string | undefined;
61
63
  onDiagnostic?: (diagnostic: StyleflowDiagnostic) => void;
62
64
  }
63
65
  /** Select and validate the semantic attributes authored on a Gutenberg block. */
@@ -1 +1 @@
1
- {"version":3,"file":"styleflow.d.ts","sourceRoot":"","sources":["../src/styleflow.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACnH,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IACvG,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACzC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACxC,WAAW,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC3F,CAAC;IACF,WAAW,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACzD;AACD,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAA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EAC5B,QAAQ,GAAE,qBAA0B,EACpC,OAAO,GAAE,8BAAmC,GAC3C,qBAAqB,CAWvB;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,qBAAqB,EAC5B,QAAQ,EAAE,qBAAqB,EAC/B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,8BAAmC,GAC3C,qBAAqB,CAiCvB"}
package/dist/styleflow.js CHANGED
@@ -70,7 +70,7 @@ export function resolveDynamicStyleflowProps(input, defaults, contract, options
70
70
  delete resolved[key];
71
71
  continue;
72
72
  }
73
- const allowed = allowedValues(key, input, defaults, contract);
73
+ const allowed = allowedValues(key, input, defaults, contract, options.effectiveTone);
74
74
  if (!allowed) {
75
75
  resolved[key] = value;
76
76
  continue;
@@ -96,7 +96,7 @@ export function resolveDynamicStyleflowProps(input, defaults, contract, options
96
96
  for (const key of ["theme", "tone", "intensity", "surface", "foreground", "layoutRole", "density", "ty", "v", "w", "interactivePriority"]) {
97
97
  if (resolved[key] === undefined)
98
98
  continue;
99
- const allowed = allowedValues(key, resolved, defaults, contract);
99
+ const allowed = allowedValues(key, resolved, defaults, contract, options.effectiveTone);
100
100
  if (allowed && !allowed.includes(String(resolved[key]))) {
101
101
  invalid(key, resolved[key], undefined, options);
102
102
  delete resolved[key];
@@ -104,14 +104,16 @@ export function resolveDynamicStyleflowProps(input, defaults, contract, options
104
104
  }
105
105
  return resolved;
106
106
  }
107
- function allowedValues(key, input, defaults, contract) {
107
+ function allowedValues(key, input, defaults, contract, effectiveTone) {
108
108
  const axes = contract.semantic.axes;
109
109
  if (key === "theme")
110
110
  return contract.semantic.themes;
111
111
  if (key === "tone")
112
112
  return axes.color.tones;
113
113
  if (key === "intensity") {
114
- const tone = String(input.tone ?? defaults.tone ?? "");
114
+ const authoredTone = input.tone === "inherit" ? undefined : input.tone;
115
+ const defaultTone = defaults.tone === "inherit" ? undefined : defaults.tone;
116
+ const tone = String(authoredTone ?? effectiveTone ?? defaultTone ?? "");
115
117
  return tone ? axes.color.intensitiesByTone[tone] ?? [] : [...new Set(Object.values(axes.color.intensitiesByTone).flat())];
116
118
  }
117
119
  if (key === "surface")
@@ -1 +1 @@
1
- {"version":3,"file":"styleflow.js","sourceRoot":"","sources":["../src/styleflow.ts"],"names":[],"mappings":"AAiCA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC9E,MAAM,qBAAqB,GAAG;IAC5B,OAAO;IACP,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;IACZ,SAAS;IACT,IAAI;IACJ,GAAG;IACH,GAAG;IACH,YAAY;IACZ,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,WAAW;IACX,OAAO;IACP,UAAU;IACV,cAAc;CACN,CAAC;AAEX,iFAAiF;AACjF,MAAM,UAAU,mCAAmC,CACjD,UAAmC,EACnC,QAA4B,EAC5B,WAAkC,EAAE,EACpC,UAA0C,EAAE;IAE5C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,qBAAqB;SAClB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;SAC9C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CACxC,CAAC;IACF,MAAM,aAAa,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACvD,UAAU,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CACpF,CAAC,EA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;AACnF,CAAC","sourcesContent":["export interface StyleflowContractAxes {\n color: { tones: string[]; intensitiesByTone: Record<string, string[]>; surfaces: string[]; foregrounds: string[] };\n layout: { roles: string[]; densities: string[]; breakpoints: Array<{ id: string; minWidth: number }> };\n typography: {\n types: string[];\n variantsByType: Record<string, string[]>;\n weightsByType: Record<string, string[]>;\n tagMappings: Array<{ tag: string; tyId?: string; variantId?: string; weightId?: string }>;\n };\n interaction: { priorities: string[]; states: string[] };\n}\nexport interface StyleflowContract {\n defaultTheme?: string;\n semantic: {\n themes: string[];\n axes: StyleflowContractAxes;\n agentPolicy: { defaults: { layoutRole: string; density: string; typography: { ty: string; v: string; w: string } } };\n };\n}\nexport type DynamicStyleflowProps = Record<string, unknown>;\nexport interface StyleflowDiagnostic {\n code: \"FP_STYLEFLOW_INVALID\" | \"FP_STYLEFLOW_FALLBACK\";\n prop: string;\n value: unknown;\n fallback?: unknown;\n blocking: boolean;\n message: string;\n}\nexport interface ResolveDynamicStyleflowOptions {\n strict?: boolean;\n onDiagnostic?: (diagnostic: StyleflowDiagnostic) => void;\n}\n\nconst INHERITED_PROPS = new Set([\"theme\", \"tone\", \"intensity\", \"foreground\"]);\nconst BLOCK_STYLEFLOW_PROPS = [\n \"theme\",\n \"tone\",\n \"intensity\",\n \"surface\",\n \"layoutRole\",\n \"density\",\n \"ty\",\n \"v\",\n \"w\",\n \"foreground\",\n \"interactivePriority\",\n \"noBackground\",\n \"noBorder\",\n \"noPadding\",\n \"noGap\",\n \"noRadius\",\n \"noForeground\"\n] as const;\n\n/** Select and validate the semantic attributes authored on a Gutenberg block. */\nexport function resolveFlowpressBlockStyleflowProps(\n attributes: Record<string, unknown>,\n contract?: StyleflowContract,\n defaults: DynamicStyleflowProps = {},\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const input = Object.fromEntries(\n BLOCK_STYLEFLOW_PROPS\n .filter((key) => attributes[key] !== undefined)\n .map((key) => [key, attributes[key]])\n );\n const blockDefaults = { ...defaults };\n if (![\"ty\", \"v\", \"w\", \"variant\", \"weight\"].some((key) => (\n attributes[key] !== undefined && attributes[key] !== null && attributes[key] !== \"\"\n ))) {\n for (const key of [\"ty\", \"v\", \"w\"]) delete blockDefaults[key];\n }\n if (contract) {\n return resolveDynamicStyleflowProps(input, blockDefaults, contract, options);\n }\n\n const resolved = { ...blockDefaults, ...input };\n for (const key of [\"ty\", \"v\", \"w\"]) {\n if (resolved[key] === \"\" || resolved[key] === null) delete resolved[key];\n }\n for (const key of INHERITED_PROPS) {\n if (input[key] === \"inherit\") delete resolved[key];\n }\n return resolved;\n}\n\n/**\n * Resolve a second, namespaced set of Styleflow coordinates stored on a block.\n *\n * A `scrimTone` attribute is therefore validated exactly like `tone`, without\n * leaking the prefixed authoring attribute into the rendered DOM.\n */\nexport function resolvePrefixedFlowpressBlockStyleflowProps(\n attributes: Record<string, unknown>,\n prefix: string,\n contract?: StyleflowContract,\n defaults: DynamicStyleflowProps = {},\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const prefixed = Object.fromEntries(BLOCK_STYLEFLOW_PROPS.flatMap((key) => {\n const name = `${prefix}${key.charAt(0).toUpperCase()}${key.slice(1)}`;\n return attributes[name] === undefined ? [] : [[key, attributes[name]]];\n }));\n return resolveFlowpressBlockStyleflowProps(\n prefixed,\n contract,\n defaults,\n options\n );\n}\n\n/** Validate CMS-authored props against the grouped vNext project contract. */\nexport function resolveDynamicStyleflowProps(\n input: DynamicStyleflowProps,\n defaults: DynamicStyleflowProps,\n contract: StyleflowContract,\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const resolved: DynamicStyleflowProps = { ...defaults };\n for (const [key, value] of Object.entries(input)) {\n if (value === undefined || value === null || value === \"\") continue;\n if (INHERITED_PROPS.has(key) && value === \"inherit\") { delete resolved[key]; continue; }\n if (key === \"interactionState\") {\n invalid(key, value, undefined, options); delete resolved[key]; continue;\n }\n const allowed = allowedValues(key, input, defaults, contract);\n if (!allowed) { resolved[key] = value; continue; }\n const candidate = typeof value === \"string\"\n ? value\n : typeof value === \"number\" && Number.isFinite(value)\n ? String(value)\n : undefined;\n if (candidate !== undefined && allowed.includes(candidate)) {\n resolved[key] = candidate;\n continue;\n }\n const fallback = explicitFallback(key, defaults, contract);\n invalid(key, value, fallback, options);\n if (fallback === undefined) delete resolved[key]; else resolved[key] = fallback;\n }\n // Validate dependent defaults too: a default is not permission to emit a\n // coordinate absent from the current project contract.\n for (const key of [\"theme\", \"tone\", \"intensity\", \"surface\", \"foreground\", \"layoutRole\", \"density\", \"ty\", \"v\", \"w\", \"interactivePriority\"]) {\n if (resolved[key] === undefined) continue;\n const allowed = allowedValues(key, resolved, defaults, contract);\n if (allowed && !allowed.includes(String(resolved[key]))) {\n invalid(key, resolved[key], undefined, options); delete resolved[key];\n }\n }\n return resolved;\n}\n\nfunction allowedValues(\n key: string, input: DynamicStyleflowProps, defaults: DynamicStyleflowProps,\n contract: StyleflowContract\n): string[] | undefined {\n const axes = contract.semantic.axes;\n if (key === \"theme\") return contract.semantic.themes;\n if (key === \"tone\") return axes.color.tones;\n if (key === \"intensity\") {\n const tone = String(input.tone ?? defaults.tone ?? \"\");\n return tone ? axes.color.intensitiesByTone[tone] ?? [] : [...new Set(Object.values(axes.color.intensitiesByTone).flat())];\n }\n if (key === \"surface\") return axes.color.surfaces;\n if (key === \"foreground\") return axes.color.foregrounds;\n if (key === \"layoutRole\") return axes.layout.roles;\n if (key === \"density\") return axes.layout.densities;\n if (key === \"ty\") return axes.typography.types;\n if (key === \"v\") {\n const authoredType = input.ty ?? defaults.ty;\n if (authoredType !== undefined && authoredType !== null && authoredType !== \"\") {\n return axes.typography.variantsByType[String(authoredType)] ?? [];\n }\n return [...new Set(Object.values(axes.typography.variantsByType).flat())];\n }\n if (key === \"w\") {\n const authoredType = input.ty ?? defaults.ty;\n if (authoredType !== undefined && authoredType !== null && authoredType !== \"\") {\n return axes.typography.weightsByType[String(authoredType)] ?? [];\n }\n return [...new Set(Object.values(axes.typography.weightsByType).flat())];\n }\n if (key === \"interactivePriority\") return axes.interaction.priorities;\n return undefined;\n}\n\nfunction explicitFallback(key: string, defaults: DynamicStyleflowProps, contract: StyleflowContract): unknown {\n if (defaults[key] !== undefined) return defaults[key];\n if (key === \"layoutRole\") return contract.semantic.agentPolicy.defaults.layoutRole;\n if (key === \"density\") return contract.semantic.agentPolicy.defaults.density;\n if (key === \"ty\" || key === \"v\" || key === \"w\") return contract.semantic.agentPolicy.defaults.typography[key];\n if (key === \"theme\") return contract.defaultTheme;\n return undefined;\n}\nfunction invalid(key: string, value: unknown, fallback: unknown, options: ResolveDynamicStyleflowOptions): void {\n const diagnostic: StyleflowDiagnostic = {\n code: fallback === undefined ? \"FP_STYLEFLOW_INVALID\" : \"FP_STYLEFLOW_FALLBACK\",\n prop: key, value, ...(fallback !== undefined ? { fallback } : {}),\n blocking: options.strict === true,\n message: fallback === undefined\n ? `Styleflow prop ${key}=${JSON.stringify(value)} is not in the grouped project contract.`\n : `Styleflow prop ${key}=${JSON.stringify(value)} fell back to ${JSON.stringify(fallback)}.`\n };\n (options.onDiagnostic ?? ((item) => console.warn(`[${item.code}] ${item.message}`)))(diagnostic);\n if (options.strict) throw new Error(`${diagnostic.code}: ${diagnostic.message}`);\n}\n"]}
1
+ {"version":3,"file":"styleflow.js","sourceRoot":"","sources":["../src/styleflow.ts"],"names":[],"mappings":"AAmCA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC9E,MAAM,qBAAqB,GAAG;IAC5B,OAAO;IACP,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;IACZ,SAAS;IACT,IAAI;IACJ,GAAG;IACH,GAAG;IACH,YAAY;IACZ,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,WAAW;IACX,OAAO;IACP,UAAU;IACV,cAAc;CACN,CAAC;AAEX,iFAAiF;AACjF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,CAAC;AACnB,CAAC;AACD,SAAS,OAAO,CAAC,GAAW,EAAE,KAAc,EAAE,QAAiB,EAAE,OAAuC;IACtG,MAAM,UAAU,GAAwB;QACtC,IAAI,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,uBAAuB;QAC/E,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,QAAQ,EAAE,OAAO,CAAC,MAAM,KAAK,IAAI;QACjC,OAAO,EAAE,QAAQ,KAAK,SAAS;YAC7B,CAAC,CAAC,kBAAkB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,0CAA0C;YAC1F,CAAC,CAAC,kBAAkB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG;KAC/F,CAAC;IACF,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACjG,IAAI,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC","sourcesContent":["export interface StyleflowContractAxes {\n color: { tones: string[]; intensitiesByTone: Record<string, string[]>; surfaces: string[]; foregrounds: string[] };\n layout: { roles: string[]; densities: string[]; breakpoints: Array<{ id: string; minWidth: number }> };\n typography: {\n types: string[];\n variantsByType: Record<string, string[]>;\n weightsByType: Record<string, string[]>;\n tagMappings: Array<{ tag: string; tyId?: string; variantId?: string; weightId?: string }>;\n };\n interaction: { priorities: string[]; states: string[] };\n}\nexport interface StyleflowContract {\n defaultTheme?: string;\n semantic: {\n themes: string[];\n axes: StyleflowContractAxes;\n agentPolicy: { defaults: { layoutRole: string; density: string; typography: { ty: string; v: string; w: string } } };\n };\n}\nexport type DynamicStyleflowProps = Record<string, unknown>;\nexport interface StyleflowDiagnostic {\n code: \"FP_STYLEFLOW_INVALID\" | \"FP_STYLEFLOW_FALLBACK\";\n prop: string;\n value: unknown;\n fallback?: unknown;\n blocking: boolean;\n message: string;\n}\nexport interface ResolveDynamicStyleflowOptions {\n strict?: boolean;\n /** Concrete tone inherited from a rendered ancestor; never emitted as an attribute. */\n effectiveTone?: string | undefined;\n onDiagnostic?: (diagnostic: StyleflowDiagnostic) => void;\n}\n\nconst INHERITED_PROPS = new Set([\"theme\", \"tone\", \"intensity\", \"foreground\"]);\nconst BLOCK_STYLEFLOW_PROPS = [\n \"theme\",\n \"tone\",\n \"intensity\",\n \"surface\",\n \"layoutRole\",\n \"density\",\n \"ty\",\n \"v\",\n \"w\",\n \"foreground\",\n \"interactivePriority\",\n \"noBackground\",\n \"noBorder\",\n \"noPadding\",\n \"noGap\",\n \"noRadius\",\n \"noForeground\"\n] as const;\n\n/** Select and validate the semantic attributes authored on a Gutenberg block. */\nexport function resolveFlowpressBlockStyleflowProps(\n attributes: Record<string, unknown>,\n contract?: StyleflowContract,\n defaults: DynamicStyleflowProps = {},\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const input = Object.fromEntries(\n BLOCK_STYLEFLOW_PROPS\n .filter((key) => attributes[key] !== undefined)\n .map((key) => [key, attributes[key]])\n );\n const blockDefaults = { ...defaults };\n if (![\"ty\", \"v\", \"w\", \"variant\", \"weight\"].some((key) => (\n attributes[key] !== undefined && attributes[key] !== null && attributes[key] !== \"\"\n ))) {\n for (const key of [\"ty\", \"v\", \"w\"]) delete blockDefaults[key];\n }\n if (contract) {\n return resolveDynamicStyleflowProps(input, blockDefaults, contract, options);\n }\n\n const resolved = { ...blockDefaults, ...input };\n for (const key of [\"ty\", \"v\", \"w\"]) {\n if (resolved[key] === \"\" || resolved[key] === null) delete resolved[key];\n }\n for (const key of INHERITED_PROPS) {\n if (input[key] === \"inherit\") delete resolved[key];\n }\n return resolved;\n}\n\n/**\n * Resolve a second, namespaced set of Styleflow coordinates stored on a block.\n *\n * A `scrimTone` attribute is therefore validated exactly like `tone`, without\n * leaking the prefixed authoring attribute into the rendered DOM.\n */\nexport function resolvePrefixedFlowpressBlockStyleflowProps(\n attributes: Record<string, unknown>,\n prefix: string,\n contract?: StyleflowContract,\n defaults: DynamicStyleflowProps = {},\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const prefixed = Object.fromEntries(BLOCK_STYLEFLOW_PROPS.flatMap((key) => {\n const name = `${prefix}${key.charAt(0).toUpperCase()}${key.slice(1)}`;\n return attributes[name] === undefined ? [] : [[key, attributes[name]]];\n }));\n return resolveFlowpressBlockStyleflowProps(\n prefixed,\n contract,\n defaults,\n options\n );\n}\n\n/** Validate CMS-authored props against the grouped vNext project contract. */\nexport function resolveDynamicStyleflowProps(\n input: DynamicStyleflowProps,\n defaults: DynamicStyleflowProps,\n contract: StyleflowContract,\n options: ResolveDynamicStyleflowOptions = {}\n): DynamicStyleflowProps {\n const resolved: DynamicStyleflowProps = { ...defaults };\n for (const [key, value] of Object.entries(input)) {\n if (value === undefined || value === null || value === \"\") continue;\n if (INHERITED_PROPS.has(key) && value === \"inherit\") { delete resolved[key]; continue; }\n if (key === \"interactionState\") {\n invalid(key, value, undefined, options); delete resolved[key]; continue;\n }\n const allowed = allowedValues(key, input, defaults, contract, options.effectiveTone);\n if (!allowed) { resolved[key] = value; continue; }\n const candidate = typeof value === \"string\"\n ? value\n : typeof value === \"number\" && Number.isFinite(value)\n ? String(value)\n : undefined;\n if (candidate !== undefined && allowed.includes(candidate)) {\n resolved[key] = candidate;\n continue;\n }\n const fallback = explicitFallback(key, defaults, contract);\n invalid(key, value, fallback, options);\n if (fallback === undefined) delete resolved[key]; else resolved[key] = fallback;\n }\n // Validate dependent defaults too: a default is not permission to emit a\n // coordinate absent from the current project contract.\n for (const key of [\"theme\", \"tone\", \"intensity\", \"surface\", \"foreground\", \"layoutRole\", \"density\", \"ty\", \"v\", \"w\", \"interactivePriority\"]) {\n if (resolved[key] === undefined) continue;\n const allowed = allowedValues(key, resolved, defaults, contract, options.effectiveTone);\n if (allowed && !allowed.includes(String(resolved[key]))) {\n invalid(key, resolved[key], undefined, options); delete resolved[key];\n }\n }\n return resolved;\n}\n\nfunction allowedValues(\n key: string, input: DynamicStyleflowProps, defaults: DynamicStyleflowProps,\n contract: StyleflowContract, effectiveTone?: string\n): string[] | undefined {\n const axes = contract.semantic.axes;\n if (key === \"theme\") return contract.semantic.themes;\n if (key === \"tone\") return axes.color.tones;\n if (key === \"intensity\") {\n const authoredTone = input.tone === \"inherit\" ? undefined : input.tone;\n const defaultTone = defaults.tone === \"inherit\" ? undefined : defaults.tone;\n const tone = String(authoredTone ?? effectiveTone ?? defaultTone ?? \"\");\n return tone ? axes.color.intensitiesByTone[tone] ?? [] : [...new Set(Object.values(axes.color.intensitiesByTone).flat())];\n }\n if (key === \"surface\") return axes.color.surfaces;\n if (key === \"foreground\") return axes.color.foregrounds;\n if (key === \"layoutRole\") return axes.layout.roles;\n if (key === \"density\") return axes.layout.densities;\n if (key === \"ty\") return axes.typography.types;\n if (key === \"v\") {\n const authoredType = input.ty ?? defaults.ty;\n if (authoredType !== undefined && authoredType !== null && authoredType !== \"\") {\n return axes.typography.variantsByType[String(authoredType)] ?? [];\n }\n return [...new Set(Object.values(axes.typography.variantsByType).flat())];\n }\n if (key === \"w\") {\n const authoredType = input.ty ?? defaults.ty;\n if (authoredType !== undefined && authoredType !== null && authoredType !== \"\") {\n return axes.typography.weightsByType[String(authoredType)] ?? [];\n }\n return [...new Set(Object.values(axes.typography.weightsByType).flat())];\n }\n if (key === \"interactivePriority\") return axes.interaction.priorities;\n return undefined;\n}\n\nfunction explicitFallback(key: string, defaults: DynamicStyleflowProps, contract: StyleflowContract): unknown {\n if (defaults[key] !== undefined) return defaults[key];\n if (key === \"layoutRole\") return contract.semantic.agentPolicy.defaults.layoutRole;\n if (key === \"density\") return contract.semantic.agentPolicy.defaults.density;\n if (key === \"ty\" || key === \"v\" || key === \"w\") return contract.semantic.agentPolicy.defaults.typography[key];\n if (key === \"theme\") return contract.defaultTheme;\n return undefined;\n}\nfunction invalid(key: string, value: unknown, fallback: unknown, options: ResolveDynamicStyleflowOptions): void {\n const diagnostic: StyleflowDiagnostic = {\n code: fallback === undefined ? \"FP_STYLEFLOW_INVALID\" : \"FP_STYLEFLOW_FALLBACK\",\n prop: key, value, ...(fallback !== undefined ? { fallback } : {}),\n blocking: options.strict === true,\n message: fallback === undefined\n ? `Styleflow prop ${key}=${JSON.stringify(value)} is not in the grouped project contract.`\n : `Styleflow prop ${key}=${JSON.stringify(value)} fell back to ${JSON.stringify(fallback)}.`\n };\n (options.onDiagnostic ?? ((item) => console.warn(`[${item.code}] ${item.message}`)))(diagnostic);\n if (options.strict) throw new Error(`${diagnostic.code}: ${diagnostic.message}`);\n}\n"]}
@@ -0,0 +1,3 @@
1
+ /** Preserve replaced-image fit/focal points without fetching or replacing SVGs. */
2
+ export function initializeFlowpressSvgMedia(root?: Document): void;
3
+ //# sourceMappingURL=svg-media-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media-runtime.d.ts","sourceRoot":"","sources":["../src/svg-media-runtime.js"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,mEAyBC"}
@@ -0,0 +1,33 @@
1
+ /** Preserve replaced-image fit/focal points without fetching or replacing SVGs. */
2
+ export function initializeFlowpressSvgMedia(root = document) {
3
+ const observer = new ResizeObserver((entries) => {
4
+ for (const { target: svg, contentRect } of entries) {
5
+ const box = svg.dataset.flowpressSvgViewbox?.split(/[ ,]+/).map(Number);
6
+ const width = contentRect.width, height = contentRect.height;
7
+ if (!box || box.length !== 4 || !box.every(Number.isFinite) || !box[2] || !box[3] || !width || !height)
8
+ continue;
9
+ const css = getComputedStyle(svg);
10
+ const naturalWidth = /^[\d.]+(?:px)?$/.test(svg.dataset.flowpressSvgWidth || "") ? parseFloat(svg.dataset.flowpressSvgWidth) : box[2];
11
+ const naturalHeight = /^[\d.]+(?:px)?$/.test(svg.dataset.flowpressSvgHeight || "") ? parseFloat(svg.dataset.flowpressSvgHeight) : box[3];
12
+ const fit = css.objectFit;
13
+ let scale = fit === "cover" ? Math.max(width / naturalWidth, height / naturalHeight) : Math.min(width / naturalWidth, height / naturalHeight);
14
+ if (fit === "none")
15
+ scale = 1;
16
+ if (fit === "scale-down")
17
+ scale = Math.min(1, scale);
18
+ const targetWidth = fit === "fill" ? width : naturalWidth * scale;
19
+ const targetHeight = fit === "fill" ? height : naturalHeight * scale;
20
+ const positions = css.objectPosition.split(/\s+/);
21
+ const offset = (value, free) => value?.endsWith("%") ? free * parseFloat(value) / 100 : parseFloat(value) || 0;
22
+ const x = offset(positions[0] || "50%", width - targetWidth);
23
+ const y = offset(positions[1] || "50%", height - targetHeight);
24
+ svg.setAttribute("viewBox", `${box[0] - x * box[2] / targetWidth} ${box[1] - y * box[3] / targetHeight} ${width * box[2] / targetWidth} ${height * box[3] / targetHeight}`);
25
+ svg.setAttribute("preserveAspectRatio", "none");
26
+ }
27
+ });
28
+ for (const svg of root.querySelectorAll("svg[data-flowpress-svg-viewbox]"))
29
+ observer.observe(svg);
30
+ document.addEventListener("astro:page-load", () => { observer.disconnect(); for (const svg of document.querySelectorAll("svg[data-flowpress-svg-viewbox]"))
31
+ observer.observe(svg); });
32
+ }
33
+ //# sourceMappingURL=svg-media-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media-runtime.js","sourceRoot":"","sources":["../src/svg-media-runtime.js"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,UAAU,2BAA2B,CAAC,IAAI,GAAG,QAAQ;IACzD,MA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CAAC,CAAC,GAAG,YAAY,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,YAAY,EAAE,CAAC,CAAC;YAC5K,GAAG,CAAC,YAAY,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,iCAAiC,CAAC;QAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClG,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,gBAAgB,CAAC,iCAAiC,CAAC;QAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxL,CAAC","sourcesContent":["/** Preserve replaced-image fit/focal points without fetching or replacing SVGs. */\nexport function initializeFlowpressSvgMedia(root = document) {\n const observer = new ResizeObserver((entries) => {\n for (const { target: svg, contentRect } of entries) {\n const box = svg.dataset.flowpressSvgViewbox?.split(/[ ,]+/).map(Number);\n const width = contentRect.width, height = contentRect.height;\n if (!box || box.length !== 4 || !box.every(Number.isFinite) || !box[2] || !box[3] || !width || !height) continue;\n const css = getComputedStyle(svg);\n const naturalWidth = /^[\\d.]+(?:px)?$/.test(svg.dataset.flowpressSvgWidth || \"\") ? parseFloat(svg.dataset.flowpressSvgWidth) : box[2];\n const naturalHeight = /^[\\d.]+(?:px)?$/.test(svg.dataset.flowpressSvgHeight || \"\") ? parseFloat(svg.dataset.flowpressSvgHeight) : box[3];\n const fit = css.objectFit;\n let scale = fit === \"cover\" ? Math.max(width / naturalWidth, height / naturalHeight) : Math.min(width / naturalWidth, height / naturalHeight);\n if (fit === \"none\") scale = 1;\n if (fit === \"scale-down\") scale = Math.min(1, scale);\n const targetWidth = fit === \"fill\" ? width : naturalWidth * scale;\n const targetHeight = fit === \"fill\" ? height : naturalHeight * scale;\n const positions = css.objectPosition.split(/\\s+/);\n const offset = (value, free) => value?.endsWith(\"%\") ? free * parseFloat(value) / 100 : parseFloat(value) || 0;\n const x = offset(positions[0] || \"50%\", width - targetWidth);\n const y = offset(positions[1] || \"50%\", height - targetHeight);\n svg.setAttribute(\"viewBox\", `${box[0] - x * box[2] / targetWidth} ${box[1] - y * box[3] / targetHeight} ${width * box[2] / targetWidth} ${height * box[3] / targetHeight}`);\n svg.setAttribute(\"preserveAspectRatio\", \"none\");\n }\n });\n for (const svg of root.querySelectorAll(\"svg[data-flowpress-svg-viewbox]\")) observer.observe(svg);\n document.addEventListener(\"astro:page-load\", () => { observer.disconnect(); for (const svg of document.querySelectorAll(\"svg[data-flowpress-svg-viewbox]\")) observer.observe(svg); });\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export interface FlowpressSvgMediaPayload {
2
+ version: "1";
3
+ attributes: Record<string, string>;
4
+ content: string;
5
+ digest: string;
6
+ }
7
+ export interface FlowpressSvgMediaLocals {
8
+ flowpressSvgMedia?: Map<string, FlowpressSvgMediaPayload>;
9
+ flowpressSvgMediaSequence?: number;
10
+ }
11
+ //# sourceMappingURL=svg-media-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media-types.d.ts","sourceRoot":"","sources":["../src/svg-media-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IAAE,OAAO,EAAC,GAAG,CAAC;IAAA,UAAU,EAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC;IAAA,OAAO,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAC;CAAC;AACtH,MAAM,WAAW,uBAAuB;IAAE,iBAAiB,CAAC,EAAC,GAAG,CAAC,MAAM,EAAC,wBAAwB,CAAC,CAAC;IAAA,yBAAyB,CAAC,EAAC,MAAM,CAAC;CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=svg-media-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media-types.js","sourceRoot":"","sources":["../src/svg-media-types.ts"],"names":[],"mappings":"","sourcesContent":["export interface FlowpressSvgMediaPayload {version:\"1\";attributes:Record<string,string>;content:string;digest:string;}\nexport interface FlowpressSvgMediaLocals {flowpressSvgMedia?:Map<string,FlowpressSvgMediaPayload>;flowpressSvgMediaSequence?:number;}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { FlowpressSvgMediaLocals } from "./svg-media-types.js";
2
+ export type { FlowpressSvgMediaPayload, FlowpressSvgMediaLocals } from "./svg-media-types.js";
3
+ export declare const SVG_INSTANCE_PLACEHOLDER = "__SF_SVG_INSTANCE__";
4
+ export declare function flowpressSvgMediaUrl(url: unknown): string;
5
+ export declare function registerFlowpressSvgMedia(value: unknown, locals: FlowpressSvgMediaLocals): void;
6
+ export declare function flowpressSvgMediaProps(src: unknown, props: Record<string, unknown>, locals: FlowpressSvgMediaLocals): {
7
+ attributes: Record<string, unknown>;
8
+ content: string;
9
+ } | null;
10
+ //# sourceMappingURL=svg-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media.d.ts","sourceRoot":"","sources":["../src/svg-media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAsE;AAChI,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAc/F;AACD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,uBAAuB,GAAG;IAAC,UAAU,EAAC,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;IAAA,OAAO,EAAC,MAAM,CAAA;CAAC,GAAC,IAAI,CAS7K"}
@@ -0,0 +1,34 @@
1
+ export const SVG_INSTANCE_PLACEHOLDER = "__SF_SVG_INSTANCE__";
2
+ export function flowpressSvgMediaUrl(url) { return typeof url === "string" ? url.replace(/[?#].*$/, "") : ""; }
3
+ export function registerFlowpressSvgMedia(value, locals) {
4
+ const registry = locals.flowpressSvgMedia ??= new Map();
5
+ const seen = new WeakSet();
6
+ function visit(node) {
7
+ if (!node || typeof node !== "object" || seen.has(node))
8
+ return;
9
+ seen.add(node);
10
+ const record = node;
11
+ if (record.svg?.version === "1" && record.svg.attributes && typeof record.svg.content === "string") {
12
+ const url = flowpressSvgMediaUrl(record.url || record.sourceUrl);
13
+ if (url)
14
+ registry.set(url, record.svg);
15
+ }
16
+ for (const [key, child] of Object.entries(record))
17
+ if (key !== "svg")
18
+ visit(child);
19
+ }
20
+ visit(value);
21
+ }
22
+ export function flowpressSvgMediaProps(src, props, locals) {
23
+ const payload = locals.flowpressSvgMedia?.get(flowpressSvgMediaUrl(src));
24
+ if (!payload)
25
+ return null;
26
+ const scope = `fp-svg-${locals.flowpressSvgMediaSequence = (locals.flowpressSvgMediaSequence || 0) + 1}`;
27
+ const replace = (v) => String(v).split(SVG_INSTANCE_PLACEHOLDER).join(scope);
28
+ const source = Object.fromEntries(Object.entries(payload.attributes).map(([n, v]) => [n, replace(v)]));
29
+ const { src: _src, srcset: _srcset, sizes: _sizes, loading: _loading, decoding: _decoding, fetchpriority: _priority, alt, ...html } = props;
30
+ const label = typeof html['aria-label'] === 'string' ? html['aria-label'] : String(alt ?? '');
31
+ const decorative = html['aria-hidden'] === 'true' || html['aria-hidden'] === true || !label;
32
+ return { attributes: { ...source, ...html, class: ['flowpress-svg-media', source.class, html.class].filter(Boolean).join(' '), style: [source.style, html.style].filter(Boolean).join(';') || undefined, role: decorative ? 'presentation' : 'img', 'aria-label': decorative ? undefined : label, 'aria-hidden': decorative ? 'true' : undefined, focusable: 'false', 'data-flowpress-svg-viewbox': source.viewBox, 'data-flowpress-svg-width': source.width, 'data-flowpress-svg-height': source.height }, content: replace(payload.content) };
33
+ }
34
+ //# sourceMappingURL=svg-media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-media.js","sourceRoot":"","sources":["../src/svg-media.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,UAAU,oBAAoB,CAAC,GAAY,IAAY,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChI,MAAM,UAAU,yBAAyB,CAAC,KAAc,EAAE,MAA+B;IACxF,MAAM,QAAQ,GAAG,MAAM,CAAC,iBAAiB,KAAK,IAAI,GAAG,EAAE,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,OAAO,EAAU,CAAC;IACnC,SAAS,KAAK,CAAC,IAAa;QAC3B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAChE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,MAAM,GAAG,IAA2B,CAAC;QAC3C,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACpG,MAAM,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,C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"./svg-media-types.js\";\nexport const SVG_INSTANCE_PLACEHOLDER = \"__SF_SVG_INSTANCE__\";\nexport function flowpressSvgMediaUrl(url: unknown): string { return typeof url === \"string\" ? url.replace(/[?#].*$/, \"\") : \"\"; }\nexport function registerFlowpressSvgMedia(value: unknown, locals: FlowpressSvgMediaLocals): void {\n const registry = locals.flowpressSvgMedia ??= new Map();\n const seen = new WeakSet<object>();\n function visit(node: unknown): void {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n const record = node as Record<string, any>;\n if (record.svg?.version === \"1\" && record.svg.attributes && typeof record.svg.content === \"string\") {\n const url = flowpressSvgMediaUrl(record.url || record.sourceUrl);\n if (url) registry.set(url, record.svg as FlowpressSvgMediaPayload);\n }\n for (const [key,child] of Object.entries(record)) if(key !== \"svg\") visit(child);\n }\n visit(value);\n}\nexport function flowpressSvgMediaProps(src: unknown, props: Record<string, unknown>, locals: FlowpressSvgMediaLocals): {attributes:Record<string,unknown>;content:string}|null {\n const payload=locals.flowpressSvgMedia?.get(flowpressSvgMediaUrl(src));if(!payload)return null;\n const scope=`fp-svg-${locals.flowpressSvgMediaSequence=(locals.flowpressSvgMediaSequence||0)+1}`;\n const replace=(v:unknown)=>String(v).split(SVG_INSTANCE_PLACEHOLDER).join(scope);\n const source=Object.fromEntries(Object.entries(payload.attributes).map(([n,v])=>[n,replace(v)]));\n const {src:_src,srcset:_srcset,sizes:_sizes,loading:_loading,decoding:_decoding,fetchpriority:_priority,alt,...html}=props;\n const label=typeof html['aria-label']==='string'?html['aria-label']:String(alt??'');\n const decorative=html['aria-hidden']==='true'||html['aria-hidden']===true||!label;\n return {attributes:{...source,...html,class:['flowpress-svg-media',source.class,html.class].filter(Boolean).join(' '),style:[source.style,html.style].filter(Boolean).join(';')||undefined,role:decorative?'presentation':'img','aria-label':decorative?undefined:label,'aria-hidden':decorative?'true':undefined,focusable:'false','data-flowpress-svg-viewbox':source.viewBox,'data-flowpress-svg-width':source.width,'data-flowpress-svg-height':source.height},content:replace(payload.content)};\n}\n"]}
@@ -1 +1 @@
1
- {"root":["../src/accessibility-panel.ts","../src/astro.d.ts","../src/block-renderers.ts","../src/carousel.ts","../src/client.ts","../src/composition.ts","../src/default-blocks.ts","../src/env.ts","../src/index.ts","../src/links.ts","../src/media.ts","../src/motion-preference.ts","../src/number-spinner.ts","../src/preferences-runtime.ts","../src/preferences-styleflow.ts","../src/preferences.ts","../src/style-classes.ts","../src/styleflow.ts","../src/template-hierarchy.ts","../src/templates.ts","../src/text.ts","../src/theme-runtime.ts","../src/types.ts","../src/vivid-colors-preference.ts","../src/astro/blocks/cover.ts","../src/astro/blocks/helpers.ts","../src/astro/native/button.ts","../src/astro/native/flowpress-navigation-controller.ts","../src/astro/native/grid.ts","../src/astro/native/html.ts","../src/astro/native/icon.ts","../src/astro/native/map.ts","../src/astro/native/motion-preference.ts","../src/astro/native/motion.ts","../src/astro/native/query-loop.ts","../src/astro/native/registry.ts","../src/astro/native/timeline.ts","../src/astro/native/blob/blob-shapes.generated.ts","../src/astro/native/blob/config.ts","../src/astro/native/blob/controller.ts","../src/astro/native/blob/geometry.ts","../src/astro/native/blob/ids.ts"],"version":"5.9.3"}
1
+ {"root":["../src/accessibility-panel.ts","../src/astro.d.ts","../src/block-renderers.ts","../src/carousel.ts","../src/client.ts","../src/composition.ts","../src/default-blocks.ts","../src/env.ts","../src/index.ts","../src/links.ts","../src/media.ts","../src/motion-preference.ts","../src/number-spinner.ts","../src/preferences-runtime.ts","../src/preferences-styleflow.ts","../src/preferences.ts","../src/reserved-area.ts","../src/style-classes.ts","../src/styleflow.ts","../src/svg-media-types.ts","../src/svg-media.ts","../src/template-hierarchy.ts","../src/templates.ts","../src/text.ts","../src/theme-runtime.ts","../src/types.ts","../src/vivid-colors-preference.ts","../src/astro/blocks/cover.ts","../src/astro/blocks/helpers.ts","../src/astro/motion/accordion.ts","../src/astro/motion/motion-controller.ts","../src/astro/motion/motion.ts","../src/astro/native/button-template.ts","../src/astro/native/button.ts","../src/astro/native/flowpress-navigation-controller.ts","../src/astro/native/grid.ts","../src/astro/native/group.ts","../src/astro/native/html.ts","../src/astro/native/icon.ts","../src/astro/native/map.ts","../src/astro/native/motion-preference.ts","../src/astro/native/motion.ts","../src/astro/native/query-carousel.ts","../src/astro/native/query-loop.ts","../src/astro/native/registry.ts","../src/astro/native/timeline.ts","../src/astro/native/blob/blob-shapes.generated.ts","../src/astro/native/blob/config.ts","../src/astro/native/blob/controller.ts","../src/astro/native/blob/geometry.ts","../src/astro/native/blob/ids.ts","../src/svg-media-runtime.js","../src/astro/native/grid-bleed.js"],"version":"5.9.3"}