frameboard 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,8 +23,8 @@
23
23
  matchMedia('(prefers-color-scheme: dark)').matches),
24
24
  )
25
25
  </script>
26
- <script type="module" crossorigin src="/assets/index-BAjwLY8j.js"></script>
27
- <link rel="stylesheet" crossorigin href="/assets/index-BfJBy5ow.css">
26
+ <script type="module" crossorigin src="/assets/index-DPM4_A1Q.js"></script>
27
+ <link rel="stylesheet" crossorigin href="/assets/index-DOWds8pT.css">
28
28
  </head>
29
29
  <body>
30
30
  <div id="root"></div>
package/dist/hook.js CHANGED
@@ -11880,6 +11880,18 @@ const READ = /* @__PURE__ */ new Set([
11880
11880
  "font",
11881
11881
  "text-transform"
11882
11882
  ]);
11883
+ /** The longhands a shorthand competes for, so `font` sets the family too. */
11884
+ const SHORTHANDS = {
11885
+ font: ["font-family"],
11886
+ background: ["background-color"],
11887
+ border: ["border-color", "border-width"]
11888
+ };
11889
+ /** The properties an element takes from its parent when no rule sets them. */
11890
+ const INHERITED = /* @__PURE__ */ new Set([
11891
+ "color",
11892
+ "font-family",
11893
+ "text-transform"
11894
+ ]);
11883
11895
  /** At-rules whose blocks never style an element. */
11884
11896
  const NOT_STYLING = /* @__PURE__ */ new Set([
11885
11897
  "keyframes",
@@ -11924,7 +11936,8 @@ const CSS_WIDE = /* @__PURE__ */ new Set([
11924
11936
  * through `@bramus/specificity`, and takes every rule inside a media query
11925
11937
  * as applying, since a frame renders at one viewport the check cannot see.
11926
11938
  */
11927
- function buildCascade(source, tokens) {
11939
+ function buildCascade(source, tokens, { properties = READ } = {}) {
11940
+ const reads = (property) => property.startsWith("--") || properties.has(property.toLowerCase());
11928
11941
  const rules = [];
11929
11942
  let order = 0;
11930
11943
  for (const sheet of [...tokens, ...source.sheets]) {
@@ -11962,12 +11975,13 @@ function buildCascade(source, tokens) {
11962
11975
  if (cached) return cached;
11963
11976
  const won = /* @__PURE__ */ new Map();
11964
11977
  const consider = (declaration) => {
11965
- const property = declaration.property === "font" ? "font-family" : declaration.property;
11966
- const current = won.get(property);
11967
- if (!current || beats(declaration, current)) won.set(property, declaration);
11978
+ for (const property of SHORTHANDS[declaration.property] ?? [declaration.property]) {
11979
+ const current = won.get(property);
11980
+ if (!current || beats(declaration, current)) won.set(property, declaration);
11981
+ }
11968
11982
  };
11969
11983
  for (const rule of rules) if (rule.matches(element)) rule.declarations.forEach(consider);
11970
- inlineDeclarations(element).forEach(consider);
11984
+ inlineDeclarations(element, reads).forEach(consider);
11971
11985
  winners.set(element, won);
11972
11986
  return won;
11973
11987
  };
@@ -11983,7 +11997,7 @@ function buildCascade(source, tokens) {
11983
11997
  value: declaration.value,
11984
11998
  element: current,
11985
11999
  userAgent: false,
11986
- shorthand: declaration.property === "font"
12000
+ shorthand: declaration.property !== property
11987
12001
  };
11988
12002
  }
11989
12003
  if (property === "font-family" && current.name in USER_AGENT_FAMILIES) {
@@ -12032,12 +12046,21 @@ function buildCascade(source, tokens) {
12032
12046
  const found = inherited(element, "text-transform");
12033
12047
  if (!found) return "none";
12034
12048
  return (resolveVars(found.value, found.element) ?? "none").trim().toLowerCase();
12049
+ },
12050
+ specified: (element, property) => {
12051
+ if (INHERITED.has(property)) return inherited(element, property);
12052
+ const declaration = declaredOn(element).get(property);
12053
+ if (!declaration) return null;
12054
+ if (CSS_WIDE.has(declaration.value.trim().toLowerCase())) return null;
12055
+ return {
12056
+ value: declaration.value,
12057
+ element,
12058
+ userAgent: false,
12059
+ shorthand: declaration.property !== property
12060
+ };
12035
12061
  }
12036
12062
  };
12037
12063
  }
12038
- function reads(property) {
12039
- return property.startsWith("--") || READ.has(property.toLowerCase());
12040
- }
12041
12064
  /** A rule styles elements unless it sits in a non-styling at-rule or inside another rule. */
12042
12065
  function styles(rule) {
12043
12066
  for (let parent = rule.parent; parent; parent = parent.parent) {
@@ -12079,7 +12102,7 @@ function beats(a, b) {
12079
12102
  }
12080
12103
  return a.order > b.order;
12081
12104
  }
12082
- function inlineDeclarations(element) {
12105
+ function inlineDeclarations(element, reads) {
12083
12106
  const style = element.attribs.style;
12084
12107
  if (!style) return [];
12085
12108
  let root;
@@ -18825,11 +18848,11 @@ function sheetBase(sheet) {
18825
18848
  }
18826
18849
  //#endregion
18827
18850
  //#region src/server/checks/rule.ts
18828
- /** A finding at `error`, the severity every rule in this tier reports. */
18851
+ /** A finding at `error` unless the rule asks for `warning`. */
18829
18852
  function finding(rule, fields) {
18830
18853
  return {
18831
18854
  rule,
18832
- severity: "error",
18855
+ severity: fields.severity ?? "error",
18833
18856
  frame: fields.frame,
18834
18857
  path: fields.path,
18835
18858
  message: fields.message,
@@ -19296,7 +19319,8 @@ function readProjectContext(root, project, boardSheet) {
19296
19319
  /**
19297
19320
  * The project's `checks` config, read by hand rather than through the
19298
19321
  * project record's schema, which the hook cannot afford to load. A file that
19299
- * does not read, or a key of the wrong type, leaves that rule off.
19322
+ * does not read, or a key of the wrong type, leaves that rule off. The
19323
+ * server's browser checker reads it too, for `minFontSize`.
19300
19324
  */
19301
19325
  function readConfig(root, project) {
19302
19326
  let parsed;
@@ -19310,6 +19334,7 @@ function readConfig(root, project) {
19310
19334
  const config = {};
19311
19335
  if (Array.isArray(checks.allowedFonts) && checks.allowedFonts.every((font) => typeof font === "string")) config.allowedFonts = checks.allowedFonts;
19312
19336
  if (typeof checks.noUppercase === "boolean") config.noUppercase = checks.noUppercase;
19337
+ if (typeof checks.minFontSize === "number" && checks.minFontSize > 0) config.minFontSize = checks.minFontSize;
19313
19338
  return config;
19314
19339
  }
19315
19340
  function isRecord(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frameboard",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "A local design board that coding agents draw on as plain HTML files",
5
5
  "keywords": [
6
6
  "design",
@@ -58,6 +58,8 @@
58
58
  "readme-screenshot": "PREVIEW_PORT=$(bash scripts/worktree-port.sh 4173) && export PREVIEW_PORT && bash scripts/readme-screenshot.sh"
59
59
  },
60
60
  "devDependencies": {
61
+ "@atlaskit/pragmatic-drag-and-drop": "4.0.0",
62
+ "@atlaskit/pragmatic-drag-and-drop-hitbox": "3.0.0",
61
63
  "@base-ui/react": "^1.9.0",
62
64
  "@bramus/specificity": "^2.4.3",
63
65
  "@commitlint/cli": "^21.2.3",
@@ -85,6 +87,7 @@
85
87
  "@vitest/ui": "^5",
86
88
  "chokidar": "^5.0.0",
87
89
  "class-variance-authority": "^0.7.1",
90
+ "cmdk": "^1.1.1",
88
91
  "cn": "^0.4.0",
89
92
  "commander": "^15.0.0",
90
93
  "css-select": "^7.0.0",