@plitzi/sdk-authoring 0.35.2 → 0.35.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @plitzi/sdk-authoring
2
2
 
3
+ ## 0.35.4
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.35.4
8
+
9
+ ## 0.35.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 0211dc4: A form speaks the site's language when it refuses a value.
14
+
15
+ - **Every rule of a `formControl` can say what it wants to say.** `requiredMessage`, `minLengthMessage`,
16
+ `maxLengthMessage` and `formatMessage` join `patternMessage` and `matchesMessage`; left empty, each falls back to
17
+ the English sentence it said before. `formatMessage` is said when the value does not have the shape the control's
18
+ type asks for — an address, for an `email` — one attribute for every type that has a shape. Offered in the builder under the rule they belong to.
19
+ - **A `form` can turn the browser's own checks off (`noValidate`, "Skip Browser Validation" in the builder).** Left on
20
+ — the default, as before — the browser answers first for a blank required field and a malformed address, in a
21
+ bubble no style reaches and in the browser's language, while every other rule answers under the control. Turned
22
+ on, the form's rules are the only ones, and all of them answer under the control.
23
+ - **An `email` control checks the address itself,** by the same definition the browser uses, so the format is still
24
+ asked for when the browser's checks are off.
25
+
3
26
  ## 0.35.2
4
27
 
5
28
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1743,6 +1743,7 @@ declare const elementDeclarations: {
1743
1743
  readonly method: "get";
1744
1744
  readonly actionUrl: "";
1745
1745
  readonly managedByInteractions: false;
1746
+ readonly noValidate: false;
1746
1747
  readonly errors: {};
1747
1748
  readonly values: {};
1748
1749
  };
@@ -1790,6 +1791,7 @@ declare const elementDeclarations: {
1790
1791
  } & ElementAttributesBrand<Partial<{
1791
1792
  values: Record<string, unknown>;
1792
1793
  method: "get" | "post";
1794
+ noValidate: boolean;
1793
1795
  actionUrl: string;
1794
1796
  managedByInteractions: boolean;
1795
1797
  errors: Record<string, string>;
@@ -1807,8 +1809,12 @@ declare const elementDeclarations: {
1807
1809
  readonly disabled: false;
1808
1810
  readonly options: readonly [];
1809
1811
  readonly required: true;
1812
+ readonly requiredMessage: "";
1810
1813
  readonly minLength: 0;
1814
+ readonly minLengthMessage: "";
1811
1815
  readonly maxLength: 0;
1816
+ readonly maxLengthMessage: "";
1817
+ readonly formatMessage: "";
1812
1818
  readonly pattern: "";
1813
1819
  readonly patternMessage: "";
1814
1820
  readonly matches: "";
@@ -4347,6 +4353,7 @@ export declare const form: {
4347
4353
  (props?: ElementProps<Partial<{
4348
4354
  values: Record<string, unknown>;
4349
4355
  method: "get" | "post";
4356
+ noValidate: boolean;
4350
4357
  actionUrl: string;
4351
4358
  managedByInteractions: boolean;
4352
4359
  errors: Record<string, string>;
@@ -4354,6 +4361,7 @@ export declare const form: {
4354
4361
  (children: ElementSpec[], props?: ElementProps<Partial<{
4355
4362
  values: Record<string, unknown>;
4356
4363
  method: "get" | "post";
4364
+ noValidate: boolean;
4357
4365
  actionUrl: string;
4358
4366
  managedByInteractions: boolean;
4359
4367
  errors: Record<string, string>;
@@ -4387,9 +4395,17 @@ declare type FormControlProps = {
4387
4395
  /**
4388
4396
  * The rules a value has to meet before the form submits, checked by the form at submit time and by the control when
4389
4397
  * it loses focus. `0` and `''` mean no rule. See `validateField` for what each one says when it is broken.
4398
+ *
4399
+ * Each `…Message` is the sentence shown under the control when that rule is broken, in the site's language; empty
4400
+ * falls back to an English one. `formatMessage` speaks for the shape the control's own type asks of its value — an
4401
+ * address, for an `email` — so it is one attribute however many types come to have a shape.
4390
4402
  */
4403
+ requiredMessage: string;
4391
4404
  minLength: number;
4405
+ minLengthMessage: string;
4392
4406
  maxLength: number;
4407
+ maxLengthMessage: string;
4408
+ formatMessage: string;
4393
4409
  pattern: string;
4394
4410
  patternMessage: string;
4395
4411
  /** The `name` of another control in the same form this one has to repeat — a password confirmation, typically. */
@@ -5315,7 +5331,7 @@ export declare const richText: ElementFactory<Partial<{
5315
5331
 
5316
5332
  export declare const row: (gap: string, extra?: CssProps) => StyleRules;
5317
5333
 
5318
- declare type Rule = {
5334
+ export declare type Rule = {
5319
5335
  id?: string;
5320
5336
  field: string;
5321
5337
  operator: Operator;
@@ -5328,7 +5344,7 @@ declare type Rule = {
5328
5344
  value: RuleValue;
5329
5345
  });
5330
5346
 
5331
- declare type RuleGroup = {
5347
+ export declare type RuleGroup = {
5332
5348
  id?: string;
5333
5349
  combinator: Combinator;
5334
5350
  rules: (Rule | RuleGroup)[];
package/dist/index.js CHANGED
@@ -850,6 +850,7 @@ var t$31 = e()({
850
850
  method: "get",
851
851
  actionUrl: "",
852
852
  managedByInteractions: !1,
853
+ noValidate: !1,
853
854
  errors: {},
854
855
  values: {}
855
856
  },
@@ -950,8 +951,12 @@ var a$7 = e()({
950
951
  disabled: !1,
951
952
  options: [],
952
953
  required: !0,
954
+ requiredMessage: "",
953
955
  minLength: 0,
956
+ minLengthMessage: "",
954
957
  maxLength: 0,
958
+ maxLengthMessage: "",
959
+ formatMessage: "",
955
960
  pattern: "",
956
961
  patternMessage: "",
957
962
  matches: "",
@@ -6096,6 +6101,23 @@ var SpaceAuthor = class {
6096
6101
  details: { properties: skipped }
6097
6102
  });
6098
6103
  }
6104
+ /**
6105
+ * A provider dressed with a class it will never wear.
6106
+ *
6107
+ * An `apiContainer` whose `subType` is left empty — the builder's "Container Tag: None" — renders its children and
6108
+ * no element of its own, so its class and css style nothing and its id finds nothing on the page. Found three times
6109
+ * on real spaces: a counter card with no card, a sticky sidebar that did not stick, a map layer positioned nowhere.
6110
+ * A warning and not a refusal, because a provider with no tag is legal and often right; one with styles is not.
6111
+ */
6112
+ warnStyleWithoutTag(spec, where) {
6113
+ const subType = spec.attributes?.subType;
6114
+ if (spec.type !== "apiContainer" || typeof subType === "string" && subType !== "" || !spec.class && !spec.css) return;
6115
+ this.styleWarnings.push({
6116
+ code: "provider-style-without-tag",
6117
+ message: `${where} has ${spec.class ? "a class" : "css"} but no \`subType\`, so it renders no element of its own and the style applies to nothing. Give it a tag — \`subType: 'div'\`, or \`section\`, \`aside\`… — or move the style onto a child.`,
6118
+ details: { type: spec.type }
6119
+ });
6120
+ }
6099
6121
  writeSelector(name, responsive, where) {
6100
6122
  this.warnTabletOnly(responsive, where);
6101
6123
  for (const breakpoint of BREAKPOINTS) {
@@ -6270,6 +6292,7 @@ var SpaceAuthor = class {
6270
6292
  this.assertStepsKnown(spec.flows, where);
6271
6293
  const bindings = withVisibility(spec);
6272
6294
  const sourceIndex = this.options.sourceTypes ? this.sources : void 0;
6295
+ this.warnStyleWithoutTag(spec, where);
6273
6296
  const element = {
6274
6297
  id,
6275
6298
  attributes: spec.attributes ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.35.2",
3
+ "version": "0.35.4",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -44,11 +44,11 @@
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "^7.59.1",
46
46
  "@plitzi/plitzi-ui": "^1.6.21",
47
- "@plitzi/sdk-elements": "0.35.2",
48
- "@plitzi/sdk-interactions": "0.35.2",
49
- "@plitzi/sdk-schema": "0.35.2",
50
- "@plitzi/sdk-shared": "0.35.2",
51
- "@plitzi/sdk-style": "0.35.2",
47
+ "@plitzi/sdk-elements": "0.35.4",
48
+ "@plitzi/sdk-interactions": "0.35.4",
49
+ "@plitzi/sdk-schema": "0.35.4",
50
+ "@plitzi/sdk-shared": "0.35.4",
51
+ "@plitzi/sdk-style": "0.35.4",
52
52
  "@types/react": "^19.3.0",
53
53
  "eslint": "^9.39.5",
54
54
  "typescript": "^6.0.3",